Skip to contents

Functions to read the "normalized" and "normalization" attributes of an existing generic_spct object.

Usage

getNormalized(x, .force.numeric = FALSE)

getNormalised(x, .force.numeric = FALSE)

getNormalization(x)

getNormalisation(x)

Arguments

x

a generic_spct object.

.force.numeric

logical If TRUE always silently return a numeric value, with FALSE encoded as zero, and character values as NA.

Value

getNormalized() returns numeric or logical (possibly character for objects created with earlier versions); for collections of spectra, a named list, with one member for each spectrum. If x is not a generic_spct object, NA or a list with fields set to NAs is returned. Objects created with versions of package 'photobiology' earlier than 0.10.8 are lacking the detailed normalization metadata.

getNormalization() returns a list with five fields: norm.type, norm.wl, norm.factors, norm.cols, norm.range. For collections of spectra, a named list of lists, with one member list for each member of the collection of spectra. See setNormalized() for the values stored in the fields.

Details

Spectral data that has been normalized needs to be used diffferently in computations than data expresed in original units. These two functions make it possible to query if data stored in an object of class generic_spct or of a derived class contains data expressed in physical units or normalized. In the later case, it is possible to also query how the normalization was done.

Note

getNormalised() is a synonym for this getNormalized() method.

See also

Other rescaling functions: fscale(), fshift(), getScaled(), is_normalized(), is_scaled(), normalize(), setNormalized(), setScaled()

Examples


getNormalized(sun.spct)
#> [1] FALSE
getNormalization(sun.spct)
#> $norm.type
#> [1] NA
#> 
#> $norm.wl
#> [1] NA
#> 
#> $norm.factors
#> [1] NA
#> 
#> $norm.cols
#> [1] NA
#> 
#> $norm.range
#> [1] NA NA
#> 

sun_norm.spct <- normalize(sun.spct)

getNormalized(sun_norm.spct)
#> [1] 451
getNormalization(sun_norm.spct)
#> $norm.type
#> [1] "max"
#> 
#> $norm.wl
#> [1] 451
#> 
#> $norm.factors
#> [1] 1.218823
#> 
#> $norm.cols
#> [1] "s.e.irrad"
#> 
#> $norm.range
#> [1] 280 800
#> 

getNormalization(e2q(sun_norm.spct))
#> $norm.type
#> [1] "max"
#> 
#> $norm.wl
#> [1] 531
#> 
#> $norm.factors
#> [1] NA
#> 
#> $norm.cols
#> [1] "s.q.irrad"
#> 
#> $norm.range
#> [1] 280 800
#> 

gel_norm.spct <- normalize(yellow_gel.spct)

getNormalized(gel_norm.spct)
#> [1] 768
getNormalization(gel_norm.spct)
#> $norm.type
#> [1] "max"
#> 
#> $norm.wl
#> [1] 768
#> 
#> $norm.factors
#> [1] 1.108911
#> 
#> $norm.cols
#> [1] "Tfr"
#> 
#> $norm.range
#> [1] 190 800
#> 

getNormalization(T2Afr(gel_norm.spct))
#> Warning: Conversion from internal Tfr to Afr possible only if Rfr or Rfr.constant are known.
#> $norm.type
#> [1] NA
#> 
#> $norm.wl
#> [1] NA
#> 
#> $norm.factors
#> [1] NA
#> 
#> $norm.cols
#> [1] NA
#> 
#> $norm.range
#> [1] NA NA
#> 
getNormalization(any2A(gel_norm.spct))
#> $norm.type
#> [1] NA
#> 
#> $norm.wl
#> [1] NA
#> 
#> $norm.factors
#> [1] NA
#> 
#> $norm.cols
#> [1] NA
#> 
#> $norm.range
#> [1] NA NA
#>