list_model_components
- sherpa.ui.list_model_components()
List the names of all the model components.
Models are created either directly - by using the form
mname.mid
, wheremname
is the name of the model, such asgauss1d
, andmid
is the name of the component - or with thecreate_model_component
function, which acceptsmname
andmid
as separate arguments. This function returns all themid
values that have been created.- Returns
ids – The identifiers for all the model components that have been created. They do not need to be associated with a source expression (i.e. they do not need to have been included in a call to
set_model
).- Return type
list of str
See also
create_model_component
Create a model component.
delete_model_component
Delete a model component.
list_models
List the available model types.
list_model_ids
List of all the data sets with a source expression.
set_model
Set the source model expression for a data set.
Examples
The
gal
andpl
model components are created - as versions of thexsphabs
andpowlaw1d
model types - which means that the list of model components returned asmids
will contain both strings.>>> set_model(xsphabs.gal * powlaw1d.pl) >>> mids = list_model_components() >>> 'gal' in mids True >>> 'pl' in mids True
The model component does not need to be included as part of a source expression for it to be included in the output of this function:
>>> create_model_component('gauss2d', 'gsrc') >>> 'gsrc' in list_model_components() True