Calibrate the energy scale of a gamma spectrum.

calibrate(object, lines, ...)

# S4 method for GammaSpectra,list
calibrate(object, lines, ...)

# S4 method for GammaSpectrum,list
calibrate(object, lines, ...)

# S4 method for PeakModel,numeric
calibrate(object, lines, ...)

Arguments

object

An object of class GammaSpectrum, GammaSpectra or PeakModel.

lines

A list of or a numeric vector. If a list is provided, each element must be a named length-two numeric vector giving the observed peak position (chanel) and the corresponding expected energy value (in keV). If lines is a numeric vector, each element must be an expected energy value.

...

Currently not used.

Value

An object of class GammaSpectrum.

Details

TODO

Examples

# Import a CNF file for calibration tka_file <- system.file("extdata/test_TKA.tka", package = "gamma") (tka_spc <- read(tka_file, skip = TRUE))
#> Gamma spectrum: #> Reference: test_TKA #> Instrument: unknown #> Date: 2019-06-06 20:06:40 #> Number of chanels: 989 #> Energy range (keV): not calibrated #> Dose rate: not known
## 1. Use observed peak positions ### Set peak positions (chanel) and expected energy values calib_lines <- list( Pb = c(chanel = 86, energy = 238), K = c(chanel = 496, energy = 1461), Cs = c(chanel = 876, energy = 2614.5) ) ### Correct the energy scale (spc1 <- calibrate(tka_spc, lines = calib_lines))
#> Gamma spectrum: #> Reference: test_TKA #> Instrument: unknown #> Date: 2019-06-06 20:06:40 #> Number of chanels: 989 #> Energy range (keV): 90.39 - 3068.96 #> Dose rate: not known
### Inspect results plot(spc1, xaxis = "energy", yaxis = "rate") + ggplot2::geom_vline(xintercept = c(238, 1461, 2614.5), linetype = 3) + ggplot2::labs(x = "Energy [keV]", y = "Count rate [1/s]")
## 2. Use estimated peak parameters peaks <- fitPeaks(tka_spc, peaks = c(84, 496, 876)) ### Inspect results plot(peaks)
### Correct the energy scale (spc2 <- calibrate(peaks, lines = c(238, 1461, 2614.5)))
#> Gamma spectrum: #> Reference: test_TKA #> Instrument: unknown #> Date: 2019-06-06 20:06:41 #> Number of chanels: 989 #> Energy range (keV): 89.34 - 3061.28 #> Dose rate: not known
### Inspect results plot(spc2, xaxis = "energy", yaxis = "rate") + ggplot2::geom_vline(xintercept = c(238, 1461, 2614.5), linetype = 3) + ggplot2::labs(x = "Energy [keV]", y = "Count rate [1/s]")