Estimate the baseline on an nmr_dataset_1D object, using psalsa()
Source: R/nmr_baseline_estimation.R
nmr_baseline_estimation.RdEstimates 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 withtune_psalsa(). Seepsalsa().- p
Asymmetry parameter, or
"auto"to pick it withtune_psalsa(). Seepsalsa().- k
Peak height parameter, or
"auto"to pick it withtune_psalsa(). Seepsalsa().- maxit
Maximum number of iterations, or
"auto"to usepsalsa()'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
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)