View source: R/spectra_to_spectrace.R
spectra_to_spectrace | R Documentation |
This function converts a spectrum to the normalized spectrum as Spectrace would "see" it. For this, the original spectrum is convolved with the Spectrace response curves of each channel and then normalized. By default the resulting spectrum is interpolated back to the original spectrum's resolution, but a custom resolution or no interpolation can be selected as well.
spectra_to_spectrace(
spectralData,
output_resolution = c("original", "spectrace", "1nm", "5nm"),
interp_method = c("pchip", "linear"),
normalize = TRUE
)
spectralData |
Data frame containing the spectral data in reach row with wavelength as column names (e.g. "380nm", "385nm", ..., "780nm"). The wavelengths must be between 380-780nm in either 1nm or 5nm resolution. Additional variables are allowed. |
output_resolution |
String specifying the resolution of the output spectrum. Can be one of ("original", "spectrace", "1nm", "5mm")). Default is the resolution of the original spectrum. If "spectrace" is specified, no interpolation will be performed. |
interp_method |
The interpolation method. Can be either "pchip" (default)
or "linear". Pchip (piecewise cubic hermetic interpolation) results in a
smooth spectrum while preserving the source values as local minima/maxima.
Will be ignored if |
normalize |
Logical. Normalize the resulting spectrum to peak = 1? Default is TRUE. |
The original data frame with the spectral data replaced by the new spectral data (normalized).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.