Returns a model component given its name.
name (str) – The name of the model component.
component – The model component object.
- Return type
a sherpa.models.model.Model instance
sherpa.utils.err.IdentifierErr – If there is no model component with the given
The model instances are named as modeltype.username, and it is the
usernamecomponent that is used here to access the instance.
When a model component is created, a variable is created that contains the model instance. The instance can also be returned with
get_model_component, which can then be queried or used to change the model settings:
>>> create_model_component('gauss1d', 'gline') >>> gmodel = get_model_component('gline') >>> gmodel.name 'gauss1d.gline' >>> print([p.name for p in gmodel.pars]) ['fwhm', 'pos', 'ampl'] >>> gmodel.fwhm.val = 12.2 >>> gmodel.fwhm.freeze()