photobiology (version 0.9.26)

normalize: Normalize spectral data

Description

These functions return a spectral object of the same class as the one supplied as argument but with the spectral data normalized to 1.o a certain wavelength.

Usage

normalize(x, ...)

# S3 method for default normalize(x, ...)

# S3 method for source_spct normalize(x, ..., range = NULL, norm = "max", unit.out = getOption("photobiology.radiation.unit", default = "energy"), na.rm = FALSE)

# S3 method for response_spct normalize(x, ..., range = NULL, norm = "max", unit.out = getOption("photobiology.radiation.unit", default = "energy"), na.rm = FALSE)

# S3 method for filter_spct normalize(x, ..., range = NULL, norm = "max", qty.out = getOption("photobiology.filter.qty", default = "transmittance"), na.rm = FALSE)

# S3 method for reflector_spct normalize(x, ..., range = NULL, norm = "max", qty.out = NULL, na.rm = FALSE)

# S3 method for raw_spct normalize(x, ..., range = NULL, norm = "max", na.rm = FALSE)

# S3 method for cps_spct normalize(x, ..., range = NULL, norm = "max", na.rm = FALSE)

# S3 method for generic_spct normalize(x, ..., range = NULL, norm = "max", col.names, na.rm = FALSE)

# S3 method for source_mspct normalize(x, ..., range = NULL, norm = "max", unit.out = getOption("photobiology.radiation.unit", default = "energy"), na.rm = FALSE, .parallel = FALSE, .paropts = NULL)

# S3 method for response_mspct normalize(x, ..., range = NULL, norm = "max", unit.out = getOption("photobiology.radiation.unit", default = "energy"), na.rm = FALSE, .parallel = FALSE, .paropts = NULL)

# S3 method for filter_mspct normalize(x, ..., range = NULL, norm = "max", qty.out = getOption("photobiology.filter.qty", default = "transmittance"), na.rm = FALSE, .parallel = FALSE, .paropts = NULL)

# S3 method for reflector_mspct normalize(x, ..., range = x, norm = "max", qty.out = NULL, na.rm = FALSE, .parallel = FALSE, .paropts = NULL)

# S3 method for raw_mspct normalize(x, ..., range = x, norm = "max", na.rm = FALSE, .parallel = FALSE, .paropts = NULL)

# S3 method for cps_mspct normalize(x, ..., range = x, norm = "max", na.rm = FALSE, .parallel = FALSE, .paropts = NULL)

Arguments

x

An R object

...

not used in current version

range

An R object on which range() returns a numeric vector of length 2 with the limits of a range of wavelengths in nm, with min and max wavelengths (nm) used to set boundaries for search for normalization.

norm

numeric Normalization wavelength (nm) or character string "max", or "min" for normalization at the corresponding wavelength.

unit.out

character Allowed values "energy", and "photon", or its alias "quantum"

na.rm

logical indicating whether NA values should be stripped before calculating the summary (e.g. "max") used for normalization.

qty.out

character string Allowed values are "transmittance", and "absorbance" indicating on which quantity to apply the normalization.

col.names

character vector containing the names of columns or variables to which to apply the normalization.

.parallel

if TRUE, apply function in parallel, using parallel backend provided by foreach

.paropts

a list of additional options passed into the foreach function when parallel computation is enabled. This is important if (for example) your code relies on external data or packages: use the .export and .packages arguments to supply them so that all cluster nodes have the correct environment set up for computing.

Value

A copy of x, with spectral data values normalized to one for the criterion specified by the argument passed to norm.

A copy of x with the values of the spectral quantity rescaled to 1 at the normalization wavelength. If the normalization wavelength is not already present in x, it is added by interpolation---i.e. the returned value may be one row longer than x.

Methods (by class)

  • default: Default for generic function

  • source_spct: Normalize a source_spct object.

  • response_spct: Normalize a response spectrum.

  • filter_spct: Normalize a filter spectrum.

  • reflector_spct: Normalize a reflector spectrum.

  • raw_spct: Normalize a raw spectrum.

  • cps_spct: Normalize a cps spectrum.

  • generic_spct: Normalize a raw spectrum.

  • source_mspct: Normalize the members of a source_mspct object.

  • response_mspct: Normalize the members of a response_mspct object.

  • filter_mspct: Normalize the members of a filter_mspct object.

  • reflector_mspct: Normalize the members of a reflector_mspct object.

  • raw_mspct: Normalize the members of a raw_mspct object.

  • cps_mspct: Normalize the members of a cps_mspct object.

See Also

Other rescaling functions: fscale, fshift, getNormalized, is_normalized, is_scaled, setNormalized, setScaled

Examples

Run this code
# NOT RUN {
normalize(sun.spct)
normalize(sun.spct, norm = "max")
normalize(sun.spct, norm = 400)

# }

Run the code above in your browser using DataCamp Workspace