View source: R/wavelength_calibration.R
| apply_calibration | R Documentation |
Relabels the wavelengths of spectra with the correction fitted by
wavelength_calibration(). The intensities are not changed.
apply_calibration(spectra, calibration)
spectra |
Spectra with the wavelength axis of the calibration: a numeric vector named by wavelength, or a matrix or data frame with the wavelengths as column names (other columns are kept unchanged). |
calibration |
The result of |
The spectra must have the wavelength axis of the calibration (the same channels, in the same order), so that each channel gets the correction of its detector segment. The corrected wavelengths are rounded to 4 decimals (0.1 pm) for the column names.
spectra, with the corrected wavelengths as names.
wavelength_calibration()
data(forageLIBS)
spectra <- forageLIBS[-(1:14)]
wl <- as.numeric(names(spectra))
first_detector <- spectra[seq_len(which(diff(wl) < 0)[1])]
reference <- c(`Mg I` = 285.213, `Ca II` = 317.933, `Ca II` = 393.366, `K I` = 404.414,
`Ca I` = 422.673, `Mg I` = 518.360, `Na I` = 588.995, `Ca I` = 643.907)
cal <- wavelength_calibration(first_detector, reference)
corrected <- apply_calibration(first_detector, cal)
head(names(corrected))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.