Learn R Programming

photobiologyInOut (version 0.4.29)

hyperSpec2mspct: Convert 'hyperSpec::hyperSpec' objects

Description

Convert hyperSpec::hyperSpec objects containing VIS and UV radiation data into spectral objects (xxxx_spct, xxxx_mspct) as defined in package 'photobiology' and vice versa, preserving as much information as possible. As hyperSpec can contain other kinds of spectral data, it does make sense to use these functions only with objects containing data that can be handled by both packages.

Usage

hyperSpec2mspct(x, member.class, spct.data.var, multiplier = 1, ...)

hyperSpec2spct(x, multiplier = 1, ...)

mspct2hyperSpec(x, spct.data.var, multiplier = 1, ...)

spct2hyperSpec(x, spct.data.var = NULL, multiplier = 1, ...)

Arguments

x

hyperSpec object

member.class

character One of the spectrum classes defined in package 'photobiology'.

spct.data.var

character The name to be used for the 'spc' data when constructing the spectral objects.

multiplier

numeric A multiplier to be applied to the 'spc' data to do unit or scale conversion. For example "a.u." units in some examples in package 'hyperSpec' seem to have scale factors applied.

...

currently ignored.

Warning!

Always check the sanity of the imported or exported data values, as guessing is needed when matching the different classes, and the functions defined here are NOT guaranteed to return valid data wihtout help from the user through optional function arguments.

Examples

Run this code
# example run only if 'hyperSpec' is available
if (requireNamespace("hyperSpec", quietly = TRUE)) {
  library(hyperSpec)
  data(laser)
  wl(laser) <- 
    list(wl = 1e7 / (1/405e-7 - wl (laser)),
         label = expression (lambda / nm))
  laser.mspct <- hyperSpec2mspct(laser, "source_spct", "s.e.irrad")
  class(laser.mspct)
}

Run the code above in your browser using DataLab