This function removes cosmic peaks from spectral data by computing a specified order derivative to detect spikes. It masks channels around detected peaks that exceed a set threshold and restores them through interpolation, resulting in a clean spectrum.
Reference
Gomez-Sanchez, A.; Rocha de Oliveira, R. (2024). CosmicPeakCorrection function. GitHub repository. https://github.com/LovelaceSquare/cosmic-peak-correction Version 1.0.