spectrochempy.despike¶
- despike(dataset, size=9, delta=2)[source]¶
Remove convex spike from the data using the katsumoto-ozaki procedure.
The method can be used to remove cosmic ray peaks from a spectrum.
The present implementation is based on the method is described in Katsumoto and Ozaki [2003]:
In the first step, the moving-average method is employed to detect the spike noise. The moving-average window should contain several data points along the abscissa that are larger than those of the spikes in the spectrum. If a window contains a spike, the value on the ordinate for the spike will show an anomalous deviation from the average for this window.
In the second step, each data point value identified as noise is replaced by the moving-averaged value.
In the third step, the moving-average process is applied to the new data set made by the second step.
In the fourth step, the spikes are identified by comparing the differences between the original spectra and the moving-averaged spectra calculated in the third step.
As a result, the proposed method realizes the reduction of convex spikes.
- Parameters
dataset (
NDDataset
or a ndarray-like object) – Input object.size (int, optional, default: 9) – Size of the moving average window.
delta (float, optional, default: 2) – Set the threshold for the detection of spikes. A spike is detected if its value is greater than
delta
times the standard deviation of the difference between the original and the smoothed data.
- Returns
NDdataset
– The despike dataset
Examples using spectrochempy.despike
¶
Removing cosmic ray spikes from a Raman spectrum