This is a simple algorithm to determine local minima and maxima of ESR spectra, but can also be used for various other kind of data.
find_Peaks(x, interval, th = 10)
x |
|
---|---|
interval |
|
th |
|
A data.frame containing the x- and y-values of each peak is returned.
The algorithm characterises a peak by comparing the y-value at each x-value to its neighbouring y-values.
The threshold value specified by th
determines to how many neighbours the value
is compared to, so that lower values of th
yield more peaks than higher
threshold values.
# Import Bruker ELEXSYS500 spectrum (ASCII) file <- system.file("extdata", "dpph.ASC", package = "ESR") spec <- read_Spectrum(file)#> #># Use the function peaks1 <- find_Peaks(spec) # Since spec is an object of class ESR.Spectrum, you can also use # its get-method peaks2 <- spec$get_peaks() identical(peaks1, peaks2)#> [1] TRUE