yasa.sliding_window

yasa.sliding_window(data, sf, window, step=None, axis=-1)[source]

Calculate a sliding window of a 1D or 2D EEG signal.

New in version 0.1.7.

Parameters
datanumpy array

The 1D or 2D EEG data.

sffloat

The sampling frequency of data.

windowint

The sliding window length, in seconds.

stepint

The sliding window step length, in seconds. If None (default), step is set to window, which results in no overlap between the sliding windows.

axisint

The axis to slide over. Defaults to the last axis.

Returns
timesnumpy array

Time vector, in seconds, corresponding to the START of each sliding epoch in strided.

stridednumpy array

A matrix where row in last dimension consists of one instance of the sliding window.

Notes

This is a wrapper around the numpy.lib.stride_tricks.as_strided() function.