spectrochempy.smooth¶
- smooth(dataset, window_length=5, window='flat', **kwargs)[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 data.
- Parameters
dataset (|NDDataset| or a ndarray-like object) – Input object.
window_length (int, optional, default=5) – The dimension of the smoothing window; must be an odd integer.
window (str, optional, default=’flat’) – The type of window from ‘flat’, ‘hanning’, ‘hamming’, ‘bartlett’, ‘blackman’. flat window will produce a moving average smoothing.
**kwargs – Optional keyword parameters (see Other Parameters).
- Returns
smoothed – Same type as input dataset.
- Other Parameters
dim (str or int, optional, default=’x’.) – Specify on which dimension to apply this method. If
dim
is specified as an integer it is equivalent to the usualaxis
numpy parameter.inplace (bool, optional, default=False.) – True if we make the transform inplace. If False, the function return a new object
See also
savgol_filter
Apply a Savitzky-Golay filter.
Examples
>>> ds = scp.read("irdata/nh4y-activation.spg") >>> ds.smooth(window_length=11) NDDataset: [float64] a.u. (shape: (y:55, x:5549))