base_line: Baseline correction using the baseline package#'

base_lineR Documentation

Baseline correction using the baseline package#'

Description

Estimates baselines for the spectra in the obj object, using the algorithm named in 'method'.

Usage

## S4 method for signature 'Spectra'
base_line(object, ...)

Arguments

object

an object inheriting from class Spectra

...

additional arguments to be passed to the baseline function in the baseline package. The main option would be 'method', to switch between the several baseline methods presented in teh details section.

Details

The baseline package implements various algorithms for the baseline correction. The following methods are available:

  • 'als': Baseline correction by 2nd derivative constrained weighted regression

  • 'fillPeaks': An iterative algorithm using suppression of baseline by means in local windows

  • 'irls' (default): An algorithm with primary smoothing and repeated baseline suppressions and regressions with 2nd derivative constraint

  • 'lowpass': An algorithm for removing baselines based on Fast Fourier Transform filtering

  • 'medianWindow': An implementation and extention of Mark S. Friedrichs' model-free algorithm

  • 'modpolyfit': An implementation of Chad A. Lieber and Anita Mahadevan-Jansen's algorithm for polynomial fiting

  • 'peakDetection': A translation from Kevin R. Coombes et al.'s MATLAB code for detecting peaks and removing baselines

  • 'rfbaseline': Wrapper for Andreas F. Ruckstuhl, Matthew P. Jacobson, Robert W. Field, James A. Dodd's algorithm based on LOWESS and weighted regression

  • 'rollingBall': Ideas from Rolling Ball algorithm for X-ray spectra by M.A.Kneen and H.J. Annegarn. Variable window width has been left out

See baseline package documentation for more information and references.

Additionally, the baseline package provides a nice GUI that helps choosing the good baseline method and the good parametrisation. This GUI can be used with the inspectr package. This is demonstrate in the Examples section.

Value

An object of the same class as obj with the continuum removed from its spectra.

Author(s)

Interface to the baseline package by Pierre Roudier pierre.roudier@gmail.com, baseline package authored by Kristian Hovde Liland and Bjorn-Helge Mevik

References

Kristian Hovde Liland and Bjorn-Helge Mevik (2011). baseline: Baseline Correction of Spectra. R package version 1.0-1. http://CRAN.R-project.org/package=baseline

See Also

continuum_removal, snv, rnv

Examples


# Loading example data
data(australia)
spectra(australia) <- sr_no ~ ... ~ 350:2500

# Subsample for demo purposes
australia <- australia[1:10,]

# Correction using the default method (irls)
bl <- base_line(australia)
plot(bl)

# Specifying another method for baseline calculation
bl2 <- base_line(australia, method = "modpolyfit")
plot(bl2)

# Using the baseline package independently
# (useful to plot the corrections)
## Not run: 
library(baseline)
bl3 <- baseline(spectra(australia), method = 'irls')
class(bl3) # this is a baseline object
plot(bl3)
# Affecting the baseline-corrected spectra back
# to the SpectraDataFrame object
spectra(australia) <- getCorrected(bl3)
plot(australia)

# Using the baselineGUI with inspectr
baselineGUI(spectra(australia))
## When happy with a configuration, clik "Apply to all" and 
## save the results under a name, e.g. "corrected.spectra"
spectra(australia) <- getCorrected(corrected.spectra)
plot(australia)

## End(Not run)


spectacles documentation built on July 10, 2023, 1:59 a.m.