prep_transform: Reflectance/absorbance conversion constructor for spectral preprocessing
Description
Creates a preprocessing constructor for converting spectral data between
reflectance and absorbance. The constructor is intended to be passed to
preprocess_recipe and executed via process.
An object of class preprocessing to be used in
preprocess_recipe and executed by process.
Arguments
to
A character string specifying the target unit. Either
"absorbance" (default) or "reflectance".
Author
Leonardo Ramirez-Lopez
Details
Conversion follows Beer's Law:
A = -_10(R)A = -log10(R)
where AA is absorbance and RR is reflectance.
When converting to absorbance, all values in X must be strictly
positive. A warning is issued if the resulting absorbance contains small
negative values, which may indicate precision or scaling issues in the
input.
Note that no check is performed on whether the input is actually in the
expected unit (the transformation is applied as specified).