spectrochempy.despike
- despike(dataset, size=9, delta=2, method='katsumoto')[source]
- Remove spikes from the data. - The - despikemethods can be used to remove cosmic ray peaks from a spectrum.- The ‘katsumoto’ implementation (default) 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. - The ‘whitaker’ implementation is based on the method is described in Whitaker and Hayes [2018]: - The spikes are detected when the zscore of the difference between consecutive intensities is larger than the delta parameter. 
- The spike intensities are replaced by the average of the intensities in a window around the spike, excluding the points that are spikes. 
 - Parameters:
- dataset ( - NDDatasetor a ndarray-like object) – Input object.
- size (int, optional, default: 9) – Size of the moving average window (‘katsumoto’ method) or the size of the window around the spike to estimate the intensities (‘whitaker’ method). 
- delta (float, optional, default: 2) – Set the threshold for the detection of spikes. 
- method (str, optional, default: ‘katsumoto’) – The method to use. Can be ‘katsumoto’ or ‘whitaker’ 
 
- Returns:
- NDdataset– The despike dataset
 
