Complex evaluation of Raman spectra using morphological filters: algorithms, software implementation and experimental verification of background subtraction, cosmic ray removal and peak recognition in SERS spectra of designer drugs Vít Pavelka Abstract: We discuss the use of morphological operations, such as dilation, erosion, opening as well as a compound operator P-function to provide baseline correction, cosmic ray removal and peak recognition in Raman spectra. The algorithms are implemented as Python scripts, permitting automated evaluation or individual Raman spectra as well as Raman maps or time-resolved series which is demonstrated by processed SERS spectra of designer drugs, such as mephedrone and buphedrone.