pyeeg.utils.moving_average

pyeeg.utils.moving_average(data, winsize=2)

Compute the moving average of the data using overlapping windows.

The data is chunked into windows of size winsize with an overlap of winsize - 1 samples (i.e. a step of 1 sample), and the mean over each window is returned.

Parameters:
  • data (ndarray (nsamples, nchannels) or (nsamples,)) – Data to average.

  • winsize (int) – Number of samples in one window (default 2).

Returns:

avg – Moving average of the data, one value per window.

Return type:

ndarray (num_windows, nchannels) or (num_windows,)