2D Baseline Correction
- class pybaselines.Baseline2D(x_data=None, z_data=None, check_finite=True, assume_sorted=False, output_dtype=None)[source]
A class for all 2D baseline correction algorithms.
Contains all available 2D baseline correction algorithms in pybaselines as methods to allow a single interface for easier usage.
- Parameters:
- x_dataarray_like, shape (M,), optional
The x-values of the measured data (independant variable for the rows). 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.
- z_dataarray_like, shape (N,), optional
The z-values of the measured data (independant variable for the columns). 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 and z_data values. Otherwise, the input is assumed to be sorted, although they will still be checked to be in ascending order. Note that some methods will raise an error if x_data or z_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 size as the input data.shape[-2] 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]).
- z
numpy.ndarray
orNone
The z-values for the object. If initialized with None, then z is initialized the first function call to have the same size as the input data.shape[-1] and has min and max values of -1 and 1, respectively.
- z_domain
numpy.ndarray
The minimum and maximum values of z. If z_data is None during initialization, then set to numpy.ndarray([-1, 1]).
- x
- property banded_solver
Designates the solver to prefer using for solving 1D banded linear systems.
Added in version 1.2.0.
Only used to pass to a new
Baseline
object when usingBaseline2D.individual_axes()
. An integer between 1 and 4 designating the solver to prefer for solving banded linear systems in 1D. Seebanded_solver
for more information. 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. |
|
Approximates the baseline of the data using quantile regression. |
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). |
|
Bayesian Reweighted Penalized Least Squares (BrPLS) baseline. |
|
Locally Symmetric Reweighted Penalized Least Squares (LSRPLS). |
Morphological Algorithms
A Morphological based (Mor) baseline algorithm. |
|
An Improved Morphological based (IMor) baseline algorithm. |
|
The rolling ball baseline algorithm. |
|
Estimates the baseline using a top-hat transformation (morphological opening). |
Spline Algorithms
Considers the data as a mixture model composed of noise and peaks. |
|
Iterative Reweighted Spline Quantile Regression (IRSQR). |
|
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 IarPLS algorithm. |
|
A penalized spline version of the psalsa 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. |
Optimizing Algorithms
Collaborative Penalized Least Squares (collab-PLS). |
|
Fits polynomials of different orders and uses the maximum values as the baseline. |
|
Applies a one dimensional baseline correction method along each row and/or column. |