sablib
Loading...
Searching...
No Matches
backcor.h File Reference

Baseline estimation using iterative polynomial fitting with a non-quadratic cost function(Backcor algorithm). More...

#include <stdexcept>
#include <vector>

Go to the source code of this file.

Enumerations

enum class  sablib::BackcorFunc {
  Huber , AHuber , TQuad , ATQuad ,
  Indec , AIndec
}
 Cost function types for the Backcor algorithm. More...

Functions

const std::vector< double > sablib::BaselineBackcor (const std::vector< double > &y, const unsigned int polyorder, const BackcorFunc func=BackcorFunc::ATQuad, const double s=1, const double alpha=0.99 *0.5, const unsigned int loop=50, const double eps=1.0e-3)
 Performs baseline estimation using iterative polynomial fitting with a non-quadratic cost function (Backcor).

Detailed Description

Baseline estimation using iterative polynomial fitting with a non-quadratic cost function(Backcor algorithm).

Author
Izadori

References:

  • Mazet, V.; Carteret, C.; Brie, D.; Idier, J.; Humbert, B. "Background removal from spectra by designing and minimising a non-quadratic cost function" Chemometrics and Intelligent Laboratory Systems, 2005, 76(2), 121-133.
  • Liu, J.; Sun, J.; Huang, X.; Li, G.; Liu, B. "Goldindec: A Novel Algorithm for Raman Spectrum Baseline Correction" Appl. Spectrosc., 2015, 69(7), 834-842.

Definition in file backcor.h.

Enumeration Type Documentation

◆ BackcorFunc

enum class sablib::BackcorFunc
strong

Cost function types for the Backcor algorithm.

These functions define how the fitting error is penalized during the iterative polynomial fitting process. Asymmetric versions are typically used for signals with positive peaks to ensure the baseline stays below the signal.

Enumerator
Huber 

Huber function.

AHuber 

Asymmetric Huber function.

TQuad 

Truncated quadratic function.

ATQuad 

Asymmetric truncated quadratic function.

Indec 

Indec function.

AIndec 

Asymmetric Indec function.

Definition at line 25 of file backcor.h.

Function Documentation

◆ BaselineBackcor()

const std::vector< double > sablib::BaselineBackcor ( const std::vector< double > & y,
const unsigned int polyorder,
const BackcorFunc func = BackcorFunc::ATQuad,
const double s = 1,
const double alpha = 0.99 *0.5,
const unsigned int loop = 50,
const double eps = 1.0e-3 )

Performs baseline estimation using iterative polynomial fitting with a non-quadratic cost function (Backcor).

This algorithm fits a polynomial of order polyorder to the signal y. In each iteration, the signal is modified based on the chosen cost function func to progressively estimate the background.

Parameters
yThe input data vector (signal to be processed).
polyorderThe order of the polynomial to be fitted.
funcThe type of cost function to use (default: ATQuad).
sThreshold parameter for the cost function (default: 1.0).
alphaControl parameter for the iterative update (default: 0.99 * 0.5). Should be in range [0, 1].
loopThe maximum number of iterations (default: 50).
epsConvergence threshold for the relative change in the estimated baseline (default: 1.0e-3).
Returns
A vector of the same size as y containing the estimated baseline.
Exceptions
std::invalid_argumentOne or more parameters are wrong.

Definition at line 20 of file backcor.cpp.