Learn R Programming

photobiologyInOut (version 0.4.29)

colorSpec2mspct: Convert 'colorSpec::colorSpec' objects

Description

Convert 'colorSpec::colorSpec' objects into spectral objects (xxxx_spct, xxxx_mspct) as defined in package 'photobiology' and vice versa preserving as much information as possible.

Usage

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

# S3 method for colorSpec as.source_spct(x, multiplier = 1, ...)

# S3 method for colorSpec as.source_mspct(x, multiplier = 1, ...)

# S3 method for colorSpec as.response_spct(x, multiplier = 1, ...)

# S3 method for colorSpec as.response_mspct(x, multiplier = 1, ...)

# S3 method for colorSpec as.filter_spct(x, multiplier = 1, ...)

# S3 method for colorSpec as.filter_mspct(x, multiplier = 1, ...)

# S3 method for colorSpec as.reflector_spct(x, multiplier = 1, ...)

# S3 method for colorSpec as.reflector_mspct(x, multiplier = 1, ...)

# S3 method for colorSpec as.chroma_mspct(x, multiplier = 1, ...)

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

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

# S3 method for colorSpec as.chroma_spct(x, multiplier = 1, ...)

# S3 method for colorSpec as.chroma_mspct(x, multiplier = 1, ...)

# S3 method for colorSpec as.generic_spct(x, multiplier = 1, ...)

# S3 method for colorSpec as.generic_mspct(x, multiplier = 1, ...)

Arguments

x

colorSpec object

multiplier

numeric A multiplier to be applied to the 'spc' data to do unit or scale conversion.

...

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 without help from the user through optional function arguments.

Details

Objects of class colorSpec::colorSpec do not contain metadata or class data from which the units of expression could be obtained. When using function colorSpec2mspct the user needs to use parameter multiplier to convert the data to what is expected by the object constructors defined in package 'photobiology' but should only rarely need to use parameter spct.data.var to select the quantity.

colorSpec::colorSpec objects may use memory more efficiently than spectral objects of the classes for collections of spectra defined in package 'photobiology' as wavelengths are assumed to be the same for all member spectra, and stored only once while this assumption is not made for collections of spectra, allowing different wavelengths and lengths for the component spectra. When using as.colorSpec methods to convert collections of spectra into colorSpec objects, if the wavelengths of the individual spectra differe, only the shared range of wavelengths is retained and within the this range, wavelngth values are made consistent by interpolation.

Examples

Run this code
# example run only if 'colorSpec' is available
if (requireNamespace("colorSpec", quietly = TRUE)) {
  library(colorSpec)
  colorSpec2mspct(Fs.5nm)
  colorSpec2spct(Fs.5nm)
  colorSpec2mspct(C.5nm)
  colorSpec2spct(C.5nm)
} 

Run the code above in your browser using DataLab