Learn R Programming

hyperSpec (version 0.98-20140523)

spc.fit.poly: Polynomial Baseline Fitting These functions fit polynomal baselines.

Description

Both functions fit polynomials to be used as baselines. If apply.to is NULL, a hyperSpec object with the polynomial coefficients is returned, otherwise the polynomials are evaluated on the spectral range of apply.to.

spc.fit.poly.below tries to fit the baseline on appropriate spectral ranges of the spectra in fit.to. For details, see the vignette ("baseline").

Usage

spc.fit.poly(fit.to, apply.to = NULL, poly.order = 1,
    short = "spc.fit.poly", user = NULL, date = NULL)

spc.fit.poly.below(fit.to, apply.to = fit.to, poly.order = 1, npts.min = NULL, noise = 0, short = "spc.fit.poly.below", user = NULL, date = NULL)

Arguments

fit.to
hyperSpec object on which the baselines are fitted
apply.to
hyperSpec object on which the baselines are evaluted If NULL, a hyperSpec object containing the polynomial coefficients rather than evaluted baselines is returned.
poly.order
order of the polynomial to be used
short,user,date
handed to logentry
npts.min
minmal number of points used for fitting the polynomial
noise
noise level to be considered during the fit. It may be given as one value for all the spectra, or for each spectrum separately.

Value

  • hyperspec object containing the baselines in the spectra matrix, either as polynomial coefficients or as polynomials evaluted on the spectral range of apply.to

concept

baseline

Details

spc.fit.poly calculates the least squares fit of order poly.order to the complete spectra given in fit.to. Thus fit.to needs to be cut appropriately.

See Also

vignette ("baseline", package = "hyperSpec")

Examples

Run this code
vignette ("baseline", package = "hyperSpec")

baselines <- spc.fit.poly(chondro[,, c (625 ~ 640, 1785 ~ 1800)], chondro)
plot(chondro - baselines, "spcprctl5")
baselines <- spc.fit.poly.below(chondro)
plot(chondro - baselines, "spcprctl5")

Run the code above in your browser using DataLab