Learn R Programming

photobiology (version 0.11.4)

trim_tails: Trim (or expand) head and/or tail

Description

Trim tails of a spectrum based on wavelength limits, interpolating the values at the boundaries.Trimming is needed for example to remove short wavelength noise when the measured spectrum extends beyond the known emission spectrum of the measured light source. Occasionally one may want also to expand the wavelength range.

Usage

trim_tails(
  x,
  y,
  low.limit = min(x),
  high.limit = max(x),
  use.hinges = TRUE,
  fill = NULL,
  verbose = TRUE
)

Value

A data.frame with variables x and y.

Arguments

x

numeric vector of wavelengths.

y

numeric vector of values for a spectral quantity.

low.limit

smallest x-value to be kept (defaults to smallest x-value in input).

high.limit

largest x-value to be kept (defaults to largest x-value in input).

use.hinges

logical Flag indicating whether to insert "hinges" into the spectral data before integration so as to reduce interpolation errors at the boundaries of the wavebands.

fill

if fill == NULL then tails are deleted, otherwise tails of y are filled with the value of fill.

verbose

logical Use to suppress warnings.

See Also

Other low-level functions operating on numeric vectors.: as_energy(), as_quantum_mol(), calc_multipliers(), div_spectra(), 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(), v_insert_hinges(), v_replace_hinges()

Examples

Run this code
head(sun.data)
head(with(sun.data,
     trim_tails(w.length, s.e.irrad, low.limit=300)))
head(with(sun.data,
     trim_tails(w.length, s.e.irrad, low.limit=300, fill=NULL)))

Run the code above in your browser using DataLab