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)

Arguments

x

data.frame (required): a two column data.frame

interval

numeric: a vector of length two specifying the range of x-values where peaks are searched

th

numeric: an integer specifying the number of neighbouring values to compare each x-value to

Value

A data.frame containing the x- and y-values of each peak is returned.

Details

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.

Examples

# Import Bruker ELEXSYS500 spectrum (ASCII) file <- system.file("extdata", "dpph.ASC", package = "ESR") spec <- read_Spectrum(file)
#> #> Job done!
# 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