grapa.shared.maths.smooth
- grapa.shared.maths.smooth(x, window_len=11, window='hanning')
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 begining and end part of the output signal.
- Parameters:
x – the input signal
window_len – the dimension of the smoothing window; should be an odd integer
window – the type of window from ‘flat’, ‘hanning’, ‘hamming’, ‘bartlett’, ‘blackman’. flat window will produce a moving average smoothing.
- Returns:
the smoothed signal as np.array
Example:
t = linspace(-2, 2, 0.1) x = sin(t) + randn(len(t)) * 0.1 y = smooth(x)
See also: numpy.hanning, numpy.hamming, numpy.bartlett, numpy.blackman, numpy.convolve, scipy.signal.lfilter
TODO: check the following was done: length(output) != length(input) return y[(window_len/2-1):-(window_len/2)] instead of just y.