spectrochempy.analysis.constraints.Constraint
- class Constraint(profile, blocks=None)[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 byspectrochempy.MCRALS.Every public constraint subclasses this base and accepts
profileas its first positional argument. The base class validates the profile identifier and provides a uniformreprand 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
Constraintdirectly 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
profileis not a string.ValueError – If
profileis 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
NonNegativeNon-negativity constraint.
ClosureClosure (constant sum) constraint.
UnimodalUnimodality constraint.
MonotonicMonotonicity constraint.
Attributes Summary
Block indices for augmented data (
Nonemeans all blocks).Short human-readable name of the constraint family.
Canonical profile identifier (
"C"or"St").Attributes Documentation
Examples using spectrochempy.analysis.constraints.Constraint