getNormalized: Query the "normalized" and "normalization" attributes

View source: R/spct.normalize.r

getNormalizedR Documentation

Query the "normalized" and "normalization" attributes

Description

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.

Details

In some computations spectral data that have been normalized need to be handled differently than data expressed in original units. Method getNormalized() makes it possible to query if a generic_spct or generic_mspct object or objects of derived classes contain data expressed in true physical units or normalized.

Method getNormalization() retrieves from objects storing spectral data, metadata that trace previously applied normalizations, making it possible to revert the effect of earlier normalizations. The metadata are also used when printing and plotting the spectra.

Value

For objects containing a single spectrum, getNormalized() returns a logical value, and exceptionally for objects created with 'photobiology' (< 0.10.8), a numeric value (normalization wavelength expressed in nanometres). A character value for objects created with 'photobiology' (< 0.x.x). For collections of spectra and multiple spectra in long form, a named list, with one logical member for each spectrum is returned. If x is not a generic_spct object, NA is returned with a warning.

For objects containing a single spectrum, 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 is returned. Objects created with versions of package 'photobiology' (< 0.10.8) are lacking the detailed normalization metadata, in which case getNormalized() must be used to detect normalization. See setNormalized() for the values stored in the fields. If x is not a generic_spct object, a named list with all fields set to NA is returned with a warning.

Note

While method getNormalized() returns in some cases numeric values or possibly even character values if stored in attribute normalized, is_normalized() always returns a logical value and can be safely used in conditional code clauses.

getNormalised() is another name for getNormalized().

getNormalisation() is another name for getNormalization().

See Also

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

Examples


getNormalized(sun.spct)
str(getNormalization(sun.spct))

norm_sun.spct <- normalize(sun.spct)

is_normalized(norm_sun.spct)
getNormalized(norm_sun.spct)
str(getNormalization(norm_sun.spct))

str(getNormalization(e2q(norm_sun.spct)))

norm_gel.spct <- normalize(yellow_gel.spct)

is_normalized(norm_gel.spct)
getNormalized(norm_gel.spct)
str(getNormalization(norm_gel.spct))

getNormalization(T2Afr(norm_gel.spct))
getNormalization(any2A(norm_gel.spct))

norm_sun_evening.mspct <- normalize(sun_evening.mspct[1:3])
str(is_normalized(norm_sun_evening.mspct))
str(getNormalized(norm_sun_evening.mspct))
str(getNormalization(norm_sun_evening.mspct))


photobiology documentation built on March 15, 2026, 9:06 a.m.