subtr_bg: Automated background subtraction for spectral data

View source: R/subtr_bg.R

subtr_bgR Documentation

Automated background subtraction for spectral data

Description

This baseline correction routine iteratively finds the baseline of a spectrum using a polynomial fitting.

Usage

subtr_bg(x, ...)

## S3 method for class 'formula'
subtr_bg(formula, data = NULL, ...)

## S3 method for class 'data.frame'
subtr_bg(x, ...)

## Default S3 method:
subtr_bg(x, y, degree = 8, raw = FALSE, make_rel = TRUE, ...)

Arguments

x

a numeric vector containing the spectral wavenumbers; alternatively a data frame containing spectral data as "wavenumber" and "intensity" can be supplied.

formula

an object of class 'formula' of the form intensity ~ wavenumber.

data

a data frame containing the variables in formula.

y

a numeric vector containing the spectral intensities.

degree

the degree of the polynomial. Must be less than the number of unique points when raw is FALSE. Typically a good fit can be found with a 8th order polynomial.

raw

if TRUE, use raw and not orthogonal polynomials.

make_rel

logical; if TRUE spectra are automatically normalized with make_rel().

...

further arguments passed to poly().

Details

This is a translation of Michael Stephen Chen's MATLAB code written for the imodpolyfit routine from Zhao et al. 2007.

Value

subtr_bg() returns a data frame containing two columns named "wavenumber" and "intensity".

Author(s)

Win Cowger, Zacharias Steinmetz

References

Chen MS (2020). Michaelstchen/ModPolyFit. MATLAB. Retrieved from https://github.com/michaelstchen/modPolyFit (Original work published July 28, 2015)

Zhao J, Lui H, McLean DI, Zeng H (2007). “Automated Autofluorescence Background Subtraction Algorithm for Biomedical Raman Spectroscopy.” Applied Spectroscopy, 61(11), 1225–1232. doi: 10.1366/000370207782597003.

See Also

poly(); smooth_intens()

Examples

data("raman_hdpe")

subtr_bg(raman_hdpe)


OpenSpecy documentation built on July 6, 2022, 5:07 p.m.