div_spectra: Divide two spectra, even if the wavelengths values differ

Description Usage Arguments Details Value See Also Examples

View source: R/div.spectra.r

Description

The wavelength vectors of the two spectra are merged, and the missing spectral values are calculated by interpolation. After this, the two spectral values at each wavelength are operated upon.

Usage

1
2
div_spectra(w.length1, w.length2 = NULL, s.irrad1, s.irrad2,
  trim = "union", na.rm = FALSE)

Arguments

w.length1

numeric vector of wavelength (nm) of denominator.

w.length2

numeric vector of wavelength (nm) of divisor.

s.irrad1

a numeric vector of spectral values of denominator.

s.irrad2

a numeric vector of spectral values of divisor.

trim

a character string with value "union" or "intersection".

na.rm

a logical value, if TRUE, not the default, NAs in the input are replaced with zeros.

Details

If trim=="union" spectral values are calculated for the whole range of wavelengths covered by at least one of the input spectra, and missing values are set in each input spectrum to zero before addition. If trim=="intersection" then the range of wavelengths covered by both input spectra is returned, and the non-overlapping regions discarded. If w.length2==NULL, it is assumed that both spectra are measured at the same wavelengths, and a simple addition is used, ensuring fast calculation.

Value

a dataframe with two numeric variables.

See Also

Other low-level functions operating on numeric vectors.: as_energy, as_quantum_mol, calc_multipliers, energy_irradiance, energy_ratio, insert_hinges, integrate_xy, interpolate_spectrum, irradiance, l_insert_hinges, oper_spectra, photon_irradiance, photon_ratio, photons_energy_ratio, prod_spectra, s_e_irrad2rgb, split_energy_irradiance, split_photon_irradiance, subt_spectra, sum_spectra, trim_tails, v_insert_hinges

Examples

1
2
3
4
head(sun.data)
one.data <- with(sun.data, div_spectra(w.length, w.length, s.e.irrad, s.e.irrad))
head(one.data)
tail(one.data)

photobiology documentation built on Sept. 24, 2018, 1:03 a.m.