Learn R Programming

photobiology (version 0.11.4)

trim_spct: Trim (or expand) head and/or tail of a spectrum

Description

Trim head and tail of a spectrum based on wavelength limits, interpolating the values at the boundaries of the range. 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_spct(
  spct,
  range = NULL,
  low.limit = NULL,
  high.limit = NULL,
  use.hinges = TRUE,
  fill = NULL,
  byref = FALSE,
  verbose = getOption("photobiology.verbose")
)

trim_mspct( mspct, range = NULL, low.limit = NULL, high.limit = NULL, use.hinges = TRUE, fill = NULL, byref = FALSE, verbose = getOption("photobiology.verbose"), .parallel = FALSE, .paropts = NULL )

trim2overlap( mspct, use.hinges = TRUE, verbose = getOption("photobiology.verbose"), .parallel = FALSE, .paropts = NULL )

extend2extremes( mspct, use.hinges = TRUE, fill = NA, verbose = getOption("photobiology.verbose"), .parallel = FALSE, .paropts = NULL )

Value

a spectrum object or a collection of spectral objects of the same class as x with wavelength heads and tails clipped or extended.

Arguments

spct

an object of class "generic_spct".

range

a numeric vector of length two, or any other object for which method range() will return a numeric vector of length two.

low.limit

shortest wavelength to be kept (defaults to shortest w.length value).

high.limit

longest wavelength to be kept (defaults to longest w.length value).

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 or s.irrad are filled with the value of fill.

byref

logical indicating if new object will be created by reference or by copy of spct.

verbose

logical.

mspct

an object of class "generic_mspct"

.parallel

if TRUE, apply function in parallel, using parallel backend provided by foreach

.paropts

a list of additional options passed into the foreach function when parallel computation is enabled. This is important if (for example) your code relies on external data or packages: use the .export and .packages arguments to supply them so that all cluster nodes have the correct environment set up for computing.

See Also

Other trim functions: clip_wl(), trim_waveband(), trim_wl()

Examples

Run this code
trim_spct(sun.spct, low.limit=300)
trim_spct(sun.spct, low.limit=300, fill=NULL)
trim_spct(sun.spct, low.limit=300, fill=NA)
trim_spct(sun.spct, low.limit=300, fill=0.0)
trim_spct(sun.spct, range = c(300, 400))
trim_spct(sun.spct, range = c(300, NA))
trim_spct(sun.spct, range = c(NA, 400))

Run the code above in your browser using DataLab