View source: R/lighting_values.R
interpolate_spectra | R Documentation |
This function provides the all recommended interpolation method for spectra. This includes linear, spline and sprague interpolation.
interpolate_spectra(
spectra,
wl_out = seq(380, 780, 5),
method = "linear",
str_wavelength = NULL,
tolerance = 1e-14
)
spectra |
is a dataframe of spectra in wide table format including a wavelength column in nm. |
wl_out |
defines the output wavelength range and interval in nm for
interpolation.
Default: |
method |
specifies the interpolation method of the functions
approx and spline. Default:
|
str_wavelength |
Define name of wavelength column in |
tolerance |
used for sprague interpolation wrapper to correct numerical differentiation errors. Important to calculate the interpolation factor f. Default: 1e-14. |
In Details - Not tested for wavelength interval < 1 nm. Linear interpolating: extrapolation results into 0 values.
returns a dataframe of interpolated spectra in wide table format
specified by wl_out
.
Dr. William Truong
# Create spectrum planckian radiator using black body temperature in K
wavelength <- seq(380, 780, 5)
planck2700 <- planck_law(seq(380, 780, 5), 2700)
planck5000 <- planck_law(seq(380, 780, 5), 5000)
spectra <- tibble::tibble(wavelength, planck2700, planck5000)
interpolate_spectra(spectra, seq(380, 780, 1), method = "linear")
interpolate_spectra(spectra, seq(380, 780, 1), method = "fmm")
interpolate_spectra(spectra, seq(400, 700, 1), method = "sprague")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.