Learn R Programming

photobiology (version 0.9.6)

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

Description

Trimming of head and tail 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_spct(spct, range = NULL, low.limit = NULL, high.limit = NULL,
  use.hinges = TRUE, fill = NULL, byref = FALSE,
  verbose = getOption("photobiology.verbose", default = TRUE))

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

Arguments

spct
an object of class "generic_spct"
range
a numeric vector of length two, or any other object for which function range() will return 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, if TRUE (the default) wavelengths in nm.
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"

Value

  • a spectrum of same class as input with its tails trimmed or expanded

See Also

Other trim functions: clip_wl, trim_tails, 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