Search the maxima in sequential data around a given value.
Usage
peaks_search(object, index, ...)
# S4 method for class 'GammaSpectrum,integer'
peaks_search(object, index, span = 10, tolerance = 0.025)
# S4 method for class 'GammaSpectrum,numeric'
peaks_search(object, index, span = 10, tolerance = 0.025)Arguments
- object
A GammaSpectrum object.
- index
A vector giving the expected peak position. If
indexis anumericvector, peaks are searched by energy (indexis assumed to be expressed in keV). Ifindexis anintegervector, peaks are searched by channel.- ...
Currently not used.
- span
A
numericvalue giving the half window size for searching. Ifindexis anumericvector,spanis expressed in keV. Ifindexis anintegervector,spanis expressed in channel.- tolerance
A
numericvalue giving the threshold above which a warning/error is raised.
Value
A PeakPosition object.
See also
Other signal processing:
baseline,
peaks_find(),
signal_integrate(),
signal_slice(),
signal_split(),
signal_stabilize(),
smooth()
Examples
## Import a LaBr spectrum
LaBr_file <- system.file("extdata/LaBr.TKA", package = "gamma")
LaBr_spc <- read(LaBr_file)
## Find peaks by channel
(LaBr_pks <- peaks_find(LaBr_spc)) # Ugly
#> 2 peaks were detected.
plot(LaBr_spc, LaBr_pks)
## Search peaks by channel
(LaBr_pks <- peaks_search(LaBr_spc, index = c(86L, 207L, 496L), span = 7))
#> 3 peaks were detected.
plot(LaBr_spc, LaBr_pks, split = TRUE)
## Import a BEGe spectrum
BEGe_file <- system.file("extdata/BEGe.CNF", package = "gamma")
BEGe_spc <- read(BEGe_file)
## Search peaks by energy
(BEGe_pks <- peaks_search(BEGe_spc, index = c(47, 63, 911, 1460)))
#> 4 peaks were detected.
plot(BEGe_spc, BEGe_pks, split = TRUE)
