Open Lab/Preprocessing · Method

Extended Multiplicative Signal Correction

EMSC

A model based spectral preprocessing framework that extends MSC by explicitly modeling multiplicative scaling, baseline variation and optional known spectral contributions.

SpectroscopyNIRRamanScatter CorrectionBaseline CorrectionPythonMATLAB
Wavelength (nm)Intensity
Wavelength (nm)EMSC
01

What is EMSC?

Extended Multiplicative Signal Correction is a model-based spectral preprocessing framework introduced as an extension of multiplicative signal correction.

Traditional EMSC represents each measured spectrum using a reference spectrum together with terms that describe unwanted variation, commonly polynomial baseline components. The model coefficients are estimated by least squares. The modeled baseline contribution can then be removed and the spectrum scaled relative to the reference.

The same framework can be extended with additional known spectral profiles representing constituents or interferents. This page focuses on traditional single-reference EMSC with polynomial baseline terms.

02

Why use EMSC?

MSC models an individual spectrum mainly through an additive offset and a multiplicative scaling relative to a reference. EMSC extends that idea by allowing additional known sources of variation to be included explicitly in the model.

Polynomial basis functions can represent wavelength-dependent baseline variation. Known interferent or constituent spectra can also be included when scientifically justified. This formulation allows different modeled sources of variation to be estimated separately.

The method can help separate modeled baseline and scaling effects from residual spectral structure. It does not guarantee perfect physical separation, and it should not be assumed to improve every predictive model.

03

How does it work?

For each spectrum the measured vector is fitted as a linear combination of a reference and of chosen basis vectors.

  1. Select a reference spectrum.
  2. Create basis vectors for the effects that should be modeled.
  3. For basic EMSC, use the reference together with polynomial baseline vectors.
  4. Fit the measured spectrum as a linear combination of those vectors by least squares.
  5. Estimate the reference scaling coefficient.
  6. Estimate the polynomial baseline coefficients.
  7. Subtract the modeled baseline contribution.
  8. Divide by the reference scaling coefficient.
  9. Return the corrected spectrum.

If only a constant baseline term and the reference are included, the correction is MSC-like. Additional linear or quadratic terms allow more structured baseline variation to be represented.

04

Mathematics & algorithm

Let be one measured spectrum and let be a chosen reference. Let be polynomial baseline basis vectors, commonly constructed from a normalized coordinate with , and . Higher degrees may be included when justified. Degree 2 is a common demonstration choice, not a universally optimal setting.

Mathematical foundation

(1)
(2)
(3)
(4)
(5)
measured spectrum
reference spectrum
multiplicative scaling coefficient for the reference
polynomial degree
coefficient of polynomial baseline term k
polynomial baseline basis vector of degree k
residual spectrum after the fit
basis matrix with the reference as the first column
coefficient vector

Interpretation

Equation 2 removes the fitted polynomial contribution and scales by the estimated reference coefficient. Equation 3 is the equivalent statement that the corrected spectrum equals the reference plus the scaled residual. The residual is what remains after the chosen basis has been fitted. It should not be read as exclusively useful chemical information. If no reference is supplied, the mean spectrum of the calibration matrix is a common choice.

The method is called extended because known spectral profiles can be added as further columns of . In that case , where may represent a known interferent or constituent spectrum. The algorithm and code below use only the reference and polynomial baseline terms.

Algorithm 1

Extended Multiplicative Signal Correction

InputSpectral matrix X ∈ ℝⁿˣᵖ, optional reference r, polynomial degree d

OutputEMSC-corrected matrix

  1. 01if no reference spectrum is provided then
  2. 02
  3. 03end if
  4. 04construct normalized coordinate
  5. 05construct polynomial basis
  6. 06
  7. 07for to do
  8. 08 ← spectrum
  9. 09
  10. 10 ← coefficient associated with
  11. 11 ← polynomial coefficients
  12. 12
  13. 13if then
  14. 14error("scale near zero")
  15. 15end if
  16. 16
  17. 17end for
  18. 18return

This pseudocode is a SPARKS representation of Equations 1 to 5. It is not a verbatim extract from the cited papers. If no reference is supplied, the mean spectrum of X is used.

05

Visual example

The same rows include multiplicative scale, offset, and a quadratic baseline. MSC removes only intercept and slope relative to the mean reference (dashed). Degree-2 EMSC also models that polynomial term.

Wavelength (nm)IntensityRaw
Wavelength (nm)MSCMSC
Wavelength (nm)EMSCEMSC
Identical spectra. Left: raw. Center: MSC. Right: degree-2 EMSC. MSC leaves residual curvature that EMSC reduces.
06

Code

The functions below are SPARKS implementations of Equations 1 to 5. They are not copied from the cited papers. Both operate on a matrix with rows as samples and columns as spectral variables. The first column of the basis is the reference. The remaining columns are polynomial terms in a coordinate running from to . A reference scaling coefficient near zero is rejected. If no reference is supplied, the mean spectrum of the supplied matrix is used.

import numpy as np def emsc(X, reference=None, degree=2):    X = np.asarray(X, dtype=float)     if X.ndim != 2:        raise ValueError("X must be a 2D array of samples by spectral variables.")     n_samples, n_variables = X.shape     # reference=None uses mean(X) of the supplied matrix. Pass the    # calibration mean explicitly when transforming new spectra.    if reference is None:        reference = X.mean(axis=0)     reference = np.asarray(reference, dtype=float)     if reference.shape != (n_variables,):        raise ValueError(            "reference must contain one value per spectral variable."        )     t = np.linspace(-1.0, 1.0, n_variables)    polynomial_terms = [t ** k for k in range(degree + 1)]    B = np.column_stack([reference] + polynomial_terms)     X_emsc = np.empty_like(X)     for i, spectrum in enumerate(X):        coefficients, *_ = np.linalg.lstsq(B, spectrum, rcond=None)        scale = coefficients[0]        baseline_coefficients = coefficients[1:]         if np.isclose(scale, 0.0):            raise ValueError(                "EMSC reference scaling coefficient is too close to zero."            )         baseline = sum(            c * v            for c, v in zip(baseline_coefficients, polynomial_terms)        )         X_emsc[i] = (spectrum - baseline) / scale     return X_emsc 
07

Practical notes

  • EMSC is model based. The selected basis determines which spectral variations are treated as modeled contributions.
  • The choice of reference spectrum matters. The mean spectrum of the calibration set is a common practical choice. Estimate that reference from the calibration set only, then apply the same reference to validation or test spectra. Do not recompute it independently on the test set in a predictive workflow.
  • Polynomial terms can represent smoothly varying baseline effects. Increasing the polynomial degree increases flexibility and is not automatically better preprocessing.
  • Traditional EMSC with only a constant term and a reference is MSC-like. Additional polynomial terms generalize that correction.
  • Known constituent or interferent spectra can be added when scientifically justified. Arbitrary extra spectra should not be introduced casually, because confounding among basis vectors can complicate interpretation of the fitted coefficients.
08

References

  1. 1.

    Martens, H., & Stark, E. (1991). Extended multiplicative signal correction and spectral interference subtraction: new preprocessing methods for near infrared spectroscopy. Journal of Pharmaceutical and Biomedical Analysis, 9(8), 625-635.

    doi:10.1016/0731-7085(91)80188-F
  2. 2.

    Afseth, N. K., & Kohler, A. (2012). Extended multiplicative signal correction in vibrational spectroscopy, a tutorial. Chemometrics and Intelligent Laboratory Systems, 117, 92-99.

    doi:10.1016/j.chemolab.2012.03.004
  3. 3.

    Solheim, J. H., Zimmermann, B., Tafintseva, V., Dzurendová, S., Shapaval, V., & Kohler, A. (2022). The Use of Constituent Spectra and Weighting in Extended Multiplicative Signal Correction in Infrared Spectroscopy. Molecules, 27(6), 1900.

    doi:10.3390/molecules27061900