insert_hinges: Insert wavelength values into spectral data.

Description Usage Arguments Value Note See Also Examples

View source: R/insert.hinges.r

Description

Inserting wavelengths values immediately before and after a discontinuity in the SWF, greatly reduces the errors caused by interpolating the weighted irradiance during integration of the effective spectral irradiance. This is specially true when data have a large wavelength step size.

Usage

1
insert_hinges(x, y, h)

Arguments

x

numeric vector (sorted in increasing order)

y

numeric vector

h

a numeric vector giving the wavelengths at which the y values should be inserted by interpolation, no interpolation is indicated by an empty vector (numeric(0))

Value

a data.frame with variables x and y. Unless the hinge values were already present in y, each inserted hinge, expands the vectors returned in the data frame by one value.

Note

Insertion is a costly operation but I have tried to optimize this function as much as possible by avoiding loops. Earlier this function was implemented in C++, but a bug was discovered and I have now rewritten it using R.

See Also

Other low-level functions operating on numeric vectors.: as_energy, as_quantum_mol, calc_multipliers, div_spectra, energy_irradiance, energy_ratio, 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
with(sun.data,
    insert_hinges(w.length, s.e.irrad,
       c(399.99, 400.00, 699.99, 700.00)))

photobiology documentation built on April 3, 2018, 1:06 a.m.