downsample#

pypillometry.signal.downsample(y, R)[source]#

Simple downsampling scheme using mean within the downsampling window.

The signal is split into consecutive windows of R samples and each window is replaced by its mean (ignoring NaN). If the length of y is not a multiple of R, the last window is shorter.

Parameters:
  • y (np.ndarray) – signal to downsample

  • R (int) – decimate-factor (number of samples per window)

Returns:

y2 (np.ndarray) – downsampled data of length ceil(len(y)/R)