energy | R Documentation |
Calibrates the energy scale of a gamma spectrum.
energy_calibrate(object, lines, ...)
has_energy(object)
has_calibration(object)
## S4 method for signature 'GammaSpectrum,list'
energy_calibrate(object, lines, ...)
## S4 method for signature 'GammaSpectrum,PeakPosition'
energy_calibrate(object, lines, ...)
## S4 method for signature 'GammaSpectra,list'
energy_calibrate(object, lines, ...)
## S4 method for signature 'GammaSpectra,PeakPosition'
energy_calibrate(object, lines, ...)
## S4 method for signature 'GammaSpectrum'
has_energy(object)
## S4 method for signature 'GammaSpectra'
has_energy(object)
## S4 method for signature 'GammaSpectrum'
has_calibration(object)
## S4 method for signature 'GammaSpectra'
has_calibration(object)
object |
A GammaSpectrum or GammaSpectra object. |
lines |
A PeakPosition object or a |
... |
Currently not used. |
The energy calibration of a spectrum is the most tricky part. To do this, the user must specify the position of at least three observed peaks and the corresponding energy value (in keV). A second order polynomial model is fitted on these energy vs channel values, then used to predict the new energy scale of the spectrum.
The package allows to provide the channel-energy pairs to be use. However, the spectrum can be noisy so it is difficult to properly determine the peak channel. In this case, a better approach may be to pre-process the spectrum (variance-stabilization, smoothing and baseline correction) and perform a peak detection. Once the identified peaks are satisfactory, you can set the corresponding energy values (in keV) and use these lines to calibrate the energy scale of the spectrum.
Regardless of the approach you choose, it is strongly recommended to check the result before proceeding.
energy_calibrate()
returns either a GammaSpectrum or a GammaSpectra
object depending on the input#
has_energy()
and has_calibration()
return a logical
vector.
N. Frerebeau
## Import a CNF file
spc_file <- system.file("extdata/LaBr.TKA", package = "gamma")
(spc <- read(spc_file))
## Set peak positions (channel) and expected energy values
calib_lines <- list(
channel = c(86, 495, 879),
energy = c(238, 1461, 2615)
)
## Adjust the energy scale
(spc1 <- energy_calibrate(spc, lines = calib_lines))
## Inspect results
plot(spc1, xaxis = "energy", yaxis = "count") +
ggplot2::geom_vline(xintercept = c(238, 1461, 2615), linetype = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.