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 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
Short human-readable name of the constraint family.
Canonical profile identifier (
"C"or"St").Attributes Documentation
Examples using spectrochempy.analysis.constraints.Constraint