Chemometrics: A chemometrics package for Python

chemometrics is a Python module providing chemometric functionality in the Python ecosystem for scientific computing and machine learning (numpy, scipy, matplotlib, scikit-learn).


plot_colored_series(Y[, x, reference])

Plot lines colored by position or reference

plot_svd(D[, n_comp, n_eigenvalues])

Plot SVD-matrices in three subplots.


Emsc([p_order, background, normalize, ...])

Perform extended multiplicative scatter correction (EMSC)

AsymWhittaker(penalty[, constraint_order, ...])

Background correction X with an asymmetric Whittaker filter

Whittaker([penalty, constraint_order, deriv])

Smooth with a Whittaker filter


PCA([n_components, copy, whiten, ...])

Principal component analysis with added chemometric functionality

fit_pca(X[, pipeline, cv_object, max_lv])

Auto-calibrate PCA model and generate analytical plots


PLSRegression([n_components, max_iter, tol, ...])

PLS regression with added chemometric functionality

fit_pls(X, Y[, pipeline, cv_object, max_lv])

Auto-calibrate PLS model and generate analytical plots

IHM(features, peak_parameters[, bl_order, ...])

Indirect Hard Modeling (IHM) without linear regression

IHMRegression(features, peak_parameters[, ...])

Indirect Hard Modeling (IHM) of spectra with OLS prediction

Multivariate curve resolution

The chemometrics.mcr module provides Multivariate Curve Resolution - Alternating Least Squares (MCR-ALS) functionality

mcr.McrAR([c_regr, st_regr, fit_kwargs, ...])

Multivariate Curve Resolution - Alternating Regression


McrAR constraints


Built-in least squares / regression methods.


Metrics used in chemometrics.mcr

Artificial data generation

generate_background(n_wl[, rel_lengthscale, ...])

Generate dummy background.

generate_data([n_wl, n_samples, n_conc, noise])

Generate artificial spectroscopic XY data without background

generate_spectra(n_wl, n_band, bandwidth)

Generate a dummy spectra with n_band

pseudo_voigt_spectra(x, parameter)

Generates vector based on pseudo-Voigt profiles