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
getConcandgetSpecmechanisms ofMCRALS.- 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
Component selection (
Nonemeans "all").Model callable used to regenerate the constrained profile.
Short human-readable name of the constraint family.
Canonical profile identifier (
"C"or"St").Attributes Documentation
- model
Model callable used to regenerate the constrained profile.
- Type:
callable
Examples using spectrochempy.analysis.constraints.ModelProfile