Functional Interface (Legacy)

1D Baseline Correction

The Baseline class was introduced in pybaselines version 1.0 and is the recommened way to use all of the different baseline correction algorithms provided by pybaselines due to not having to import multiple functions from different modules and the benefit that comes from reusing the same Baseline object for multiples fits, as shown in this example.

With that said, pybaselines will retain its functional interface to maintain compatibility for older code before the class-based interface was introduced, as well as to provide an easier to use interface for users who are new to object-oriented programming or programming in general. Use of this legacy functional interface is discouraged but will not be deprecated in the foreseeable future.

For users who want to migrate from the legacy functional interface to the recommened class-based interface of pybaselines, simply follow the example below.

# replace this...
from pybaselines.polynomial import modpoly
from pybaselines.whittaker import asls
fit_1, params_1 = modpoly(data, x_data=x_data)
fit_2, params_2 = asls(data)

# ...with this
from pybaselines import Baseline
baseline_fitter = Baseline(x_data=x_data)
fit_1, params_1 = baseline_fitter.modpoly(data)
fit_2, params_2 = baseline_fitter.asls(data)

Modules

pybaselines.polynomial

Polynomial techniques for fitting baselines to experimental data.

pybaselines.whittaker

Whittaker-smoothing-based techniques for fitting baselines to experimental data.

pybaselines.morphological

Morphological techniques for fitting baselines to experimental data.

pybaselines.spline

Functions for fitting baselines using splines.

pybaselines.smooth

Smoothing-based techniques for fitting baselines to experimental data.

pybaselines.classification

Techniques that rely on classifying peak and/or baseline segments for fitting baselines.

pybaselines.optimizers

High level functions for making better use of baseline algorithms.

pybaselines.misc

Miscellaneous functions for creating baselines.

2D Baseline Correction

No functional interface is provided for 2D baseline correction since the Baseline2D class was implemented after the creation on the Baseline class when the 1D functional interface was already considered legacy. There are no current plans to implement a functional interface for 2D algorithms.