spectrochempy.analysis.constraints.ModelProfile

class ModelProfile(profile, components=None, model=None)[source]

Profile generator constraint.

States that a profile must lie in the family of profiles generated by a user-supplied model. The model is a callable fitted at each ALS iteration on the current least-squares profile and used to regenerate the constrained profile. This generalises the historical getConc and getSpec mechanisms of MCRALS.

Parameters:
  • profile (str) – Must be "C" (concentrations) or "St" (spectra).

  • components (list[int], optional) – Component indices to which the model applies. None (default) means “all components”.

  • model (callable) – A callable that, given the current ALS profile for the selected side ("C" or "St"), returns the model-constrained profile. Validation is limited to checking that it is callable; signature enforcement is deferred to the enforcement engine.

Examples

>>> from spectrochempy import ProfileModel
>>> def my_model(C):
...     return C
>>> ModelProfile("C", components=[0, 1], model=my_model)
ModelProfile(profile='C', components=[0, 1], model=<function my_model at ...>)
>>> ModelProfile("St", components=[0], model=my_model)
ModelProfile(profile='St', components=[0], model=<function my_model at ...>)

Attributes Summary

components

Component selection (None means "all").

model

Model callable used to regenerate the constrained profile.

name

Short human-readable name of the constraint family.

profile

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

Attributes Documentation

components

Component selection (None means “all”).

Type:

list[int] or None

model

Model callable used to regenerate the constrained profile.

Type:

callable

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.ModelProfile