The following units can be converted into each other: nm, \(cm^{-1}\), eV, THz and Raman shift.

wl_convert_units(x, from, to, ref_wl = NULL)

# S3 method for default
wl_convert_units(x, from, to, ref_wl = NULL)

# S3 method for hyperSpec
wl_convert_units(x, from, to, ref_wl = NULL)

Arguments

x

Data to be converted. Either a hyperSpec object or a numeric or integer vector.

from

(character): Source units. E.g. "nm", "1/cm", "eV", "tHz", "Raman shift".

to

(character): Destination units.

ref_wl

(numeric): Laser/Reference wavelength (required for work with Raman shift).

Value

Object of the same class as input x.

Details

For hyperSpec objects, values of @wavelength and label of wavelengths (@label$.wavelength) are changed.

Author

R. Kiselev, V. Gegzna

Examples

wl_convert_units(3200, "Raman shift", "nm", ref_wl = 785.04)
#> [1] 1048.415
wl_convert_units(785, "nm", "invcm")
#> [1] 12738.85