normalize: Normalize spectral data

Description Usage Arguments Value Methods (by class) Note See Also Examples

View source: R/spct.normalize.r

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
normalize(x, ...)

## Default S3 method:
normalize(x, ...)

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

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

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

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

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

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

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

## S3 method for class '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 class '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 class '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 class 'reflector_mspct'
normalize(x, ..., range = x, norm = "max",
  qty.out = NULL, na.rm = FALSE, .parallel = FALSE,
  .paropts = NULL)

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

## S3 method for class '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)

Note

1) By default if x contains one or more NA values and the normalization is based on a summary quantity, the returned spectrum will contain only NA values. If na.rm == TRUE then the summary quantity will be calculated after striping NA values, and only the values that were NA in x will be NA values in the returned spectrum.

See Also

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

Examples

1
2
3

photobiology documentation built on Aug. 30, 2018, 9:04 a.m.