(sig, window, step=1)
return numpy.lib.stride_tricks.as_strided(
      sig, shape=shape, strides=strides)[::step]
Apply rolling window.
Apply rolling window.
Apply rolling window .
def rolling_window(sig, window, step=1):
  ''' Apply rolling window. '''
  # http://ellisvalentiner.com/post/2017-03-21-np-strides-trick
  shape = sig.shape[:-1] + (sig.shape[-1] - window + 1, window)
  strides = sig.strides + (sig.strides[-1],)
  return numpy.lib.stride_tricks.as_strided(
      sig, shape=shape, strides=strides)[::step]
def rolling_window ( sig , window , step = 1 ) : # http://ellisvalentiner.com/post/2017-03-21-np-strides-trick shape = sig . shape [ : - 1 ] + ( sig . shape [ - 1 ] - window + 1 , window ) strides = sig . strides + ( sig . strides [ - 1 ] , ) return numpy . lib . stride_tricks . as_strided ( sig , shape = shape , strides = strides ) [ : : step ]