timeseries.Signal.iter_windows_by_index

Signal.iter_windows_by_index(window, step=1, start=None, stop=None)[source]

Produce equal-length Signals using a sliding-window on self. This slides by index, not by abstract time. window = length of window (number of indices) time_step = step size in index. (default = 1) time_start = start index (default = None, min index) time_stop = stop index (default = None, max index) normalize = renormalize by N(0,1) on window? (default = False) norm = norm function to use for comparison (default = np.linalg.norm)

return: iterator of np arrays, whose columns are timestamp, value. To access the tracks as a list,use list(Signal.iter_windows_index())

Examples

>>> S = Signal([2.0,3.0,0.0,5.0,2.5,2.9])
>>> for s in S.iter_windows_by_index(4, step=2):
...     print(s[:,1])
[ 2.  3.  0.  5.]
[ 0.   5.   2.5  2.9]