smooth_signal¶
- HSTB.kluster.modules.wobble.smooth_signal(x, window_len=20, window='hanning', maintain_input_shape=True)¶
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. | | ex: | t=linspace(-2,2,0.1) | x=sin(t)+randn(len(t))*0.1 | y=smooth_signal(x)
- Parameters
x (
array) – signal to smoothwindow_len (
int) – the dimension of the smoothing window; should be an odd integerwindow (
str) – the type of window from ‘flat’, ‘hanning’, ‘hamming’, ‘bartlett’, ‘blackman’. flat window will produce a moving average smoothing.maintain_input_shape (
bool) – if True, will modify return to match input shape
- Returns
smoothed signal
- Return type
np.array