spectrochempy.analysis.constraints.Constraint

class Constraint(profile)[source]

Abstract base class for MCRALS constraints.

A constraint represents a single piece of scientific prior knowledge about the concentration ("C") or spectral ("St") profiles estimated by spectrochempy.MCRALS.

Every public constraint subclasses this base and accepts profile as its first positional argument. The base class validates the profile identifier and provides a uniform repr and equality protocol so that constraints can be compared and inspected consistently.

This base is not itself instantiable as a usable constraint: it carries no scientific meaning. Subclass it to define a new constraint family; do not subclass Constraint directly when defining a new scientific concept β€” pick or introduce a dedicated subclass instead.

Parameters:

profile (str) – Canonical profile identifier. Must be "C" (concentrations) or "St" (spectra).

Raises:
  • TypeError – If profile is not a string.

  • ValueError – If profile is not one of the canonical identifiers.

Notes

Constraint objects are declarative. They store the user intent and validate it; they do not perform any numerical computation. The actual enforcement (projection, regularised least squares, profile generation, …) is the responsibility of the internal ALS engine and is added in subsequent PRs.

See also

NonNegative

Non-negativity constraint.

Closure

Closure (constant sum) constraint.

Unimodal

Unimodality constraint.

Monotonic

Monotonicity constraint.

Attributes Summary

name

Short human-readable name of the constraint family.

profile

Canonical profile identifier ("C" or "St").

Attributes Documentation

name

Short human-readable name of the constraint family.

Type:

str

profile

Canonical profile identifier ("C" or "St").

Type:

str

Examples using spectrochempy.analysis.constraints.Constraint