get_model_component¶
-
sherpa.ui.
get_model_component
(name)¶ Returns a model component given its name.
Parameters: name (str) – The name of the model component. Returns: component – The model component object. Return type: a sherpa.models.model.Model instance Raises: sherpa.utils.err.IdentifierErr
– If there is no model component with the givenname
.See also
create_model_component()
- Create a model component.
get_model()
- Return the model expression for a data set.
get_source()
- Return the source model expression for a data set.
list_model_components()
- List the names of all the model components.
set_model()
- Set the source model expression for a data set.
Notes
The model instances are named as modeltype.username, and it is the
username
component that is used here to access the instance.Examples
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, as shown here:
>>> create_model_component('gauss1d', 'gline') >>> gmodel = get_model_component('gline') >>> gmodel.name 'gauss1d.gline' >>> gmodel.pars (<Parameter 'fwhm' of model 'gline'>, <Parameter 'pos' of model 'gline'>, <Parameter 'ampl' of model 'gline'>)