Skip to contents

Function to set the "Tfr.type" attribute and simultaneously convert the spectral data to correspond to the new type.

Usage

convertTfrType(x, Tfr.type = NULL)

Arguments

x

a filter_spct, object_spct, filter_mspct or object_mspct object.

Tfr.type

character One of "internal" or "total".

Value

x if possible, with the value of the "Tfr.type" attribute modified and the values stored in the Tfr variable converted to the new quantity.

Details

Internal transmittance, \(\tau\), uses as reference the light entering the object while total transmittance, \(T\), takes the incident light as reference. The conversion is possible only if total reflectance, \(\rho\), is known. Either as spectral data in an object_spct object, a filter_spct object that is "under-the-hood" an object_spct, or if a fixed reflectance factor applicable to all wavelengths is stored in the filter.properties attribute of the filter_spct object.

Conversions are computed as:

$$\tau = \frac{T - \rho}{1 - \rho}$$

and

$$T = \tau * (1 - \rho) + \rho$$

For the conversion to take place the object passed as argument to x, must contain a column with transmittance data, named Tfr. Any necessary conversion from absorbance A or from Afr into transmittance, must be done before calling convertTfrType().

Note

if x is not a filter_spct object, x is returned unchanged. If x does not have the "filter.properties" attribute set if it is missing data, x is returned with Tfr set to NA values.

Examples

getTfrType(polyester.spct)
#> [1] "total"
filter_properties(polyester.spct)
#> Rfr (/1): 0.074, thickness (mm): 0.125, attenuation mode: absorption.
convertTfrType(polyester.spct, Tfr.type = "internal")
#> Object: filter_spct [454 x 2]
#> Wavelength range 240-800 nm, step 1-4 nm 
#> Label: Polyester, clear film, 0.000125 m thick, Autostat CT5 from McDermit Autotype; new 
#> Rfr (/1): 0.074, thickness (mm): 0.125, attenuation mode: absorption.
#> Variables:
#>  w.length: Wavelength [nm]
#>  Tfr: Internal spectral transmittance [/1] 
#> --
#> # A tibble: 454 × 2
#>    w.length     Tfr
#>       <int>   <dbl>
#>  1      240 0.00521
#>  2      241 0.00501
#>  3      242 0.00482
#>  4      244 0.00447
#>  5      246 0.00432
#>  6      248 0.00432
#>  7      252 0.00417
#>  8      256 0.00355
#>  9      258 0.00324
#> 10      259 0.00324
#> # ℹ 444 more rows