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

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

#include <cmath>
#include <functional>
#include "../misc/polyfit.h"
#include "backcor.h"

Go to the source code of this file.

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)(implementation).

Author
Izadori

Definition in file backcor.cpp.

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.