1D Baseline Correction
- class pybaselines.Baseline(x_data=None, check_finite=True, assume_sorted=False, output_dtype=None)[source]
A class for all baseline correction algorithms.
Contains all available baseline correction algorithms in pybaselines as methods to allow a single interface for easier usage.
- Parameters:
- x_dataarray_like, shape (N,), optional
The x-values of the measured data. Default is None, which will create an array from -1 to 1 during the first function call with length equal to the input data length.
- check_finitebool, optional
If True (default), will raise an error if any values in input data are not finite. Setting to False will skip the check. Note that errors may occur if check_finite is False and the input data contains non-finite values.
- assume_sortedbool, optional
If False (default), will sort the input x_data values. Otherwise, the input is assumed to be sorted, although it will still be checked to be in ascending order. Note that some methods will raise an error if x_data values are not unique.
- output_dtype
type
ornumpy.dtype
, optional The dtype to cast the output array. Default is None, which uses the typing of the input data.
- Attributes:
- x
numpy.ndarray
orNone
The x-values for the object. If initialized with None, then x is initialized the first function call to have the same length as the input data and has min and max values of -1 and 1, respectively.
- x_domain
numpy.ndarray
The minimum and maximum values of x. If x_data is None during initialization, then set to numpy.ndarray([-1, 1]).
- x
- property banded_solver
Designates the solver to prefer using for solving banded linear systems.
Added in version 1.2.0.
An integer between 1 and 4 designating the solver to prefer for solving banded linear systems. Setting to 1 or 2 will use the
PTRANS-I
andPTRANS-II
solvers, respectively, frompentapy.solve()
ifpentapy
is installed and the linear system is pentadiagonal. Otherwise, it will usescipy.linalg.solveh_banded()
if the system is symmetric, elsescipy.linalg.solve_banded()
. Settingbanded_solver
to 3 will only use the SciPy solvers following the same logic, and 4 will force usage ofscipy.linalg.solve_banded()
. Default is 2.This typically does not need to be modified since all solvers have relatively the same numerical stability and is mostly for internal testing.
- property pentapy_solver
The solver if using
pentapy
to solve banded equations.Deprecated since version 1.2: The pentapy_solver property is deprecated and will be removed in version 1.4. Use
banded_solver
instead.
Polynomial Algorithms
Computes a polynomial that fits the baseline of the data. |
|
The modified polynomial (ModPoly) baseline algorithm. |
|
The improved modofied polynomial (IModPoly) baseline algorithm. |
|
Fits a polynomial baseline using a non-quadratic cost function. |
|
Locally estimated scatterplot smoothing (LOESS). |
|
Approximates the baseline of the data using quantile regression. |
|
Fits a polynomial baseline using a non-quadratic cost function. |
Whittaker Smoothing Algorithms
Fits the baseline using asymmetric least squares (AsLS) fitting. |
|
Fits the baseline using the improved asymmetric least squares (IAsLS) algorithm. |
|
Adaptive iteratively reweighted penalized least squares (airPLS) baseline. |
|
Asymmetrically reweighted penalized least squares smoothing (arPLS). |
|
Doubly reweighted penalized least squares (drPLS) baseline. |
|
Improved asymmetrically reweighted penalized least squares smoothing (IarPLS). |
|
Adaptive smoothness penalized least squares smoothing (asPLS). |
|
Peaked Signal's Asymmetric Least Squares Algorithm (psalsa). |
|
Derivative Peak-Screening Asymmetric Least Squares Algorithm (derpsalsa). |
|
Bayesian Reweighted Penalized Least Squares (BrPLS) baseline. |
|
Locally Symmetric Reweighted Penalized Least Squares (LSRPLS). |
Morphological Algorithms
The Morphological penalized least squares (MPLS) baseline algorithm. |
|
A Morphological based (Mor) baseline algorithm. |
|
An Improved Morphological based (IMor) baseline algorithm. |
|
Iterative morphological and mollified (MorMol) baseline. |
|
Iteratively averaging morphological and mollified (aMorMol) baseline. |
|
The rolling ball baseline algorithm. |
|
Moving window minimum value (MWMV) baseline. |
|
Estimates the baseline using a top-hat transformation (morphological opening). |
|
Morphology-based penalized spline baseline. |
|
Joint Baseline Correction and Denoising (jbcd) Algorithm. |
Spline Algorithms
Considers the data as a mixture model composed of noise and peaks. |
|
Iterative Reweighted Spline Quantile Regression (IRSQR). |
|
Iteratively removes corner points and creates a Bezier spline from the remaining points. |
|
A penalized spline version of the asymmetric least squares (AsLS) algorithm. |
|
A penalized spline version of the IAsLS algorithm. |
|
A penalized spline version of the airPLS algorithm. |
|
A penalized spline version of the arPLS algorithm. |
|
A penalized spline version of the drPLS algorithm. |
|
A penalized spline version of the IarPLS algorithm. |
|
A penalized spline version of the asPLS algorithm. |
|
A penalized spline version of the psalsa algorithm. |
|
A penalized spline version of the derpsalsa algorithm. |
|
A penalized spline version of the morphological penalized least squares (MPLS) algorithm. |
|
A penalized spline version of the BrPLS algorithm. |
|
A penalized spline version of the LSRPLS algorithm. |
Smoothing Algorithms
The noise-median method for baseline identification. |
|
Statistics-sensitive Non-linear Iterative Peak-clipping (SNIP). |
|
Small-window moving average (SWiMA) baseline. |
|
Iterative Polynomial Smoothing Algorithm (IPSA). |
|
Range Independent Algorithm (RIA). |
|
The 4S (Smooth, Subsample, Suppress, Stretch) Peak Filling algorithm. |
Baseline/Peak Classification Algorithms
Dietrich's method for identifying baseline regions. |
|
Golotvin's method for identifying baseline regions. |
|
Identifies baseline segments by analyzing the rolling standard deviation distribution. |
|
Identifies baseline segments by thresholding the rolling standard deviation distribution. |
|
Continuous wavelet transform baseline recognition (CWT-BR) algorithm. |
|
Fully automatic baseline correction (fabc). |
|
Identifies baseline points by fitting a convex hull to the bottom of the data. |
Optimizing Algorithms
Collaborative Penalized Least Squares (collab-PLS). |
|
Extends data and finds the best parameter value for the given baseline method. |
|
Fits polynomials of different orders and uses the maximum values as the baseline. |
|
Customized baseline correction for fine tuned stiffness of the baseline at specific regions. |
Miscellaneous Algorithms
Creates a baseline by interpolating through input points. |
|
Baseline estimation and denoising with sparsity (BEADS). |