Skip to contents

Function to set by reference the "filter.properties" attribute of an existing filter_spct object.

Usage

setFilterProperties(
  x,
  filter.properties = NULL,
  pass.null = FALSE,
  Rfr.constant = NA_real_,
  thickness = NA_real_,
  attenuation.mode = NA_character_
)

filter_properties(x) <- value

Arguments

x

a filter_spct object

filter.properties, value

a list with fields named "Rfr.constant", "thickness" and "attenuation.mode".

pass.null

logical If TRUE, the parameters to the next three parameters will be always ignored, otherwise they will be used to build an object of class "filter.properties" when the argument passed to parameter filter.properties is NULL.

Rfr.constant

numeric The value of the reflection factor [/1].

thickness

numeric The thickness of the material [\(m\)].

attenuation.mode

character One of "reflection", "absorption", "absorption.layer", "mixed" or "stack".

Value

x

Details

Storing filter properties allows inter-conversion between internal and total transmittance, as well as computation of transmittance for arbitrary thickness of the material. Whether computations are valid depend on the homogeneity of the material. The parameter pass.null makes it possible to remove the attribute.

Note

This function alters x itself by reference and in addition returns x invisibly. If x is not a filter_spct object, x is not modified.

The values of attenuation.mode "reflection" and "absorption" should be used when one of these processes is clearly the main one; "mixed" is for cases when they both play a role, i.e., when a simple correction using a single value of Rfr across wavelengths is not possible; "absorption.layer" is for cases when a thin absorbing layer is deposited on the surface of a transparent support or enclosed between two sheets of glass or other transparent material. If in doubt, set this to NA to ensure that computation of spectra for a different thickness remains disabled.

Examples


my.spct <- polyester.spct
filter_properties(my.spct)
#> Rfr (/1): 0.074, thickness (mm): 0.125, attenuation mode: absorption.
filter_properties(my.spct) <- NULL
filter_properties(my.spct)
#> Rfr (/1): NA, thickness (mm): NA, attenuation mode: NA.
filter_properties(my.spct, return.null = TRUE)
#> NULL
filter_properties(my.spct) <- list(Rfr.constant = 0.01,
                                   thickness = 125e-6,
                                   attenuation.mode = "absorption")
filter_properties(my.spct)
#> Rfr (/1): 0.010, thickness (mm): 0.125, attenuation mode: absorption.