mask: Mask spectra

View source: R/speclib_mask.R

maskR Documentation

Mask spectra

Description

Returning and setting mask of spectra in Speclib. interpolate.mask linearly interpolates masked parts in spectra.

Usage

## S4 method for signature 'Speclib'
mask(object)
## S4 replacement method for signature 'Speclib,data.frame'
mask(object) <- value
## S4 replacement method for signature 'Speclib,list'
mask(object) <- value
## S4 replacement method for signature 'Speclib,numeric'
mask(object) <- value

## Linear interpolation of masked parts
interpolate.mask(object)

Arguments

object

Object of class Speclib.

value

Numeric vector, data frame or list giving the mask boundaries in wavelength units. See details section.

Details

Value may be an object of class vector, data frame or list. Data frames must contain 2 columns with the first column giving the lower (lb) and the second the upper boundary (ub) of the wavelength ranges to be masked. List must have two items consisting of vectors of length = 2. The first entry is used as lower and the second as upper boundary value. Vectors must contain corresponding lower and upper boundary values consecutively. The masked wavelength range(s) as defined by the lower and upper boundaries are excluded from the object of class Speclib.

Interpolation of masked parts is mainly intended for internal use. Interpolation is only possible if mask does not exceed spectral range of Speclib.

Value

For mask<-, the updated object. Otherwise a data frame giving the mask boundaries.

interpolate.mask returns a new object of class Speclib.

Author(s)

Lukas Lehnert and Hanna Meyer

See Also

Speclib

Examples

data(spectral_data)

mask(spectral_data) ## NULL


## Mask from vector
spectral_data_ve <- spectral_data
mask(spectral_data_ve) <- c(1040,1060,1300,1450)
mask(spectral_data_ve)


## Mask from data frame
spectral_data_df <- spectral_data
mask(spectral_data_df) <- data.frame(lb=c(1040,1300),ub=c(1060,1450))
mask(spectral_data_df)


## Mask from list
spectral_data_li <- spectral_data
mask(spectral_data_li) <- list(lb=c(1040,1300),ub=c(1060,1450))
mask(spectral_data_li)

## Linear interpolation
plot(spectral_data)
plot(interpolate.mask(spectral_data_li), new=FALSE)

hsdar documentation built on March 18, 2022, 6:35 p.m.