Skip to contents

Estimates the baseline of every sample in nmr_dataset with the PSALSA algorithm (see psalsa()) and stores it in the data_1r_baseline element, leaving data_1r itself untouched. Several other functions (nmr_baseline_threshold(), nmr_detect_peaks(), nmr_integrate_regions(), nmr_normalize()) pick up data_1r_baseline automatically when it is present.

Usage

nmr_baseline_estimation(
  nmr_dataset,
  lambda = "auto",
  p = "auto",
  k = "auto",
  maxit = "auto"
)

Arguments

nmr_dataset

An nmr_dataset_1D.

lambda

Smoothing parameter, or "auto" to pick it with tune_psalsa(). See psalsa().

p

Asymmetry parameter, or "auto" to pick it with tune_psalsa(). See psalsa().

k

Peak height parameter, or "auto" to pick it with tune_psalsa(). See psalsa().

maxit

Maximum number of iterations, or "auto" to use psalsa()'s own default.

Value

The same nmr_dataset_1D object with the data_1r_baseline element.

Details

lambda, p and k each default to "auto". Whenever any of them is "auto", tune_psalsa() is run once on every sample in nmr_dataset (pooled together, as it would be for a single call to tune_psalsa() with a list of spectra) to pick values for every "auto" parameter; a parameter given as an explicit number instead bypasses tuning for that parameter and is passed to psalsa() as-is. The same lambda/p/k are then used for every sample. maxit also defaults to "auto", meaning psalsa()'s own default is used, since maxit is not tuned by tune_psalsa().

See also

psalsa(), tune_psalsa()

Other baseline removal functions: nmr_baseline_removal()

Examples

dataset_1D <- nmr_dataset_load(system.file("extdata", "nmr_dataset.rds", package = "AlpsNMR"))
dataset_1D <- nmr_baseline_estimation(dataset_1D)