Trim (or expand) head and/or tail

Share:

Description

Trimming of 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

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

Arguments

x

numeric array

y

numeric array

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 largets x-value in input)

use.hinges

logical, if TRUE (the default)

fill

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

Value

a data.frame with variables x and y

Note

When expanding an spectrum, if fill==NULL, then expansion is not performed with a warning.

See Also

Other trim functions: clip_wl, trim_spct, trim_waveband, trim_wl

Examples

1
2
3
4
5
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)))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.