ibllib.dsp.smooth

Functions

lp

Smooth the data in frequency domain (assumes a uniform sampling rate), using edge padding

rolling_window

Smooth the data using a window with requested size.

smooth_demo

lp(ts, fac, pad=0.2)[source]

Smooth the data in frequency domain (assumes a uniform sampling rate), using edge padding

ibllib.dsp.smooth.lp(ts, [.1, .15]) :param ts: input signal to be smoothed :param fac: 2 element vector of the frequency edges relative to Nyquist: [0.15, 0.2] keeps everything up to 15% of the full band tapering down to 20% :param pad: padding on the edges of the time serie, between 0 and 1 (0.2 means 20% of the size) :return: smoothed time series

rolling_window(x, window_len=11, window='blackman')[source]

Smooth the data using a window with requested size.

This method is based on the convolution of a scaled window with the signal. The signal is prepared by introducing reflected copies of the signal (with the window size) in both ends so that transient parts are minimized in the beginning and end part of the output signal.

Parameters
  • x (list or numpy.array) – The input signal

  • window_len (int, optional) – The dimension of the smoothing window, should be an odd integer, defaults to 11

  • window (str, optional) – The type of window from [‘flat’, ‘hanning’, ‘hamming’, ‘bartlett’, ‘blackman’] flat window will produce a moving average smoothing, defaults to ‘blackman’

Raises
  • ValueError – Smooth only accepts 1 dimension arrays.

  • ValueError – Input vector needs to be bigger than window size.

  • ValueError – Window is not one of ‘flat’, ‘hanning’, ‘hamming’, ‘bartlett’, ‘blackman’

Returns

Smoothed array

Return type

numpy.array

smooth_demo()[source]