ir_correct_atmosphere: Corrects artifacts in a spectrum based on reference spectra...

View source: R/ir_correct_atmosphere.R

ir_correct_atmosphereR Documentation

Corrects artifacts in a spectrum based on reference spectra of the artifact compound

Description

ir_correct_atmosphere takes two objects of class ir with the same number of spectra in each and corrects the spectra of the first object with the spectra of the second object according to the procedure presented by \insertCitePerez-Guaita.2013ir.

Usage

ir_correct_atmosphere(
  x,
  ref,
  wn1,
  wn2,
  return_contribution = FALSE,
  do_interpolate = FALSE,
  start = NULL,
  dw = 1,
  warn = TRUE,
  return_ir_flat = FALSE
)

Arguments

x

An object of class ir containing the spectra to correct (with intensities representing absorbances).

ref

An object of class ir containing the reference spectra to use for correction (with intensities representing absorbances). ref must have the same number of rows as x, the contained spectra must cover the wavenumber range of all spectra in x, and if do_interpolate = FALSE, all spectra must have identical wavenumber values.

wn1

A numeric value representing the first wavenumber value to use as reference point \insertCitePerez-Guaita.2013ir. Examples used by \insertCitePerez-Guaita.2013;textualir are:

H_2O

3902 cm^{-1}.

CO_2

2361 cm^{-1}.

wn2

A numeric value representing the second wavenumber value to use as reference point \insertCitePerez-Guaita.2013ir. Examples used by \insertCitePerez-Guaita.2013;textualir are:

H_2O

3912 cm^{-1}.

CO_2

2349 cm^{-1}.

return_contribution

A logical value indicating whether in addition to the corrected spectra, the computed relative contribution of ref to each spectrum in x should be added to the returned object as new column contribution (TRUE) or not (FALSE).

do_interpolate

A logical value indicating if x and ref should be interpolated prior correction (TRUE) or not (FALSE).

start

See ir_interpolate().

dw

See ir_interpolate().

warn

A logical value indicating whether warnings about mismatching wavenumber values should be displayed (TRUE) or not (FALSE). If set to TRUE and wn1 or wn2 do not exactly match the wavenumber values in x and ref, a warning will be printed to inform about the wavenumber difference between the selected and targeted wavenumber value.

return_ir_flat

Logical value. If TRUE, the spectra are returned as ir_flat object.

Value

x corrected with the reference spectra in ref.

Source

\insertAllCited

Examples

x1 <-
  ir_correct_atmosphere(
    ir_sample_data[1:5, ], ir_sample_data[1:5, ], wn1 = 2361, wn2 = 2349
  )

x2 <-
  ir_correct_atmosphere(
    ir_sample_data[1:5, ], ir_sample_data[1:5, ], wn1 = 2361, wn2 = 2349,
    return_contribution = TRUE
  )

x2$contribution


henningte/ir documentation built on July 4, 2025, 5:12 p.m.