Finds local maxima in one-dimensional spectra according to peak properties such as height, threshold, distance, prominence, width and plateau size.
raman_find_peaks(
x,
height = NULL,
threshold = NULL,
distance = NULL,
prominence = NULL,
width = NULL,
plateau_size = NULL,
wlen = NULL,
rel_height = 0.5
)A list with two elements:
peaksInteger vector of one-based indices of peaks in
x satisfying the requested conditions.
propertiesData frame containing properties of the
returned peaks, including peak_index and peak_height.
Additional columns are included when the respective properties are
calculated.
Numeric vector containing the signal intensity values.
Numeric value or length-two numeric vector specifying the
required height of peaks. A single value is interpreted as a minimum height.
A vector c(min, max) defines a closed interval.
Numeric value or length-two numeric vector specifying the required vertical distance to neighbouring samples.
Positive integer specifying the minimum horizontal distance, in samples, between neighbouring peaks.
Numeric value or length-two numeric vector specifying the required prominence of peaks.
Numeric value or length-two numeric vector specifying the required width of peaks, in samples.
Numeric value or length-two numeric vector specifying the required size of the flat top of peaks, in samples.
Optional positive integer. It defines the maximum number of samples inspected on each side of a peak when calculating prominence.
Numeric value between zero and one used for peak-width calculations.
The interface and peak-property terminology are inspired by
scipy.signal.find_peaks(). Prominence and width calculations use an
R implementation tailored to Raman/SERS spectra and are not intended to
reproduce SciPy results exactly.
x = c(0, 1, 0, 2, 1, 0, 3, 2, 0, 4, 1)
res = raman_find_peaks(
x,
height = 1,
distance = 2
)
res$peaks
res$properties
Run the code above in your browser using DataLab