get_model

sherpa.ui.get_model(id=None)

Return the model expression for a data set.

This returns the model expression for a data set, including any instrument response (e.g. PSF or ARF and RMF) whether created automatically or explicitly, with set_full_model.

Parameters:id (int or str, optional) – The data set containing the source expression. If not given then the default identifier is used, as returned by get_default_id.
Returns:This can contain multiple model components and any instrument response. Changing attributes of this model changes the model used by the data set.
Return type:instance

See also

delete_model()
Delete the model expression from a data set.
get_model_pars()
Return the names of the parameters of a model.
get_model_type()
Describe a model expression.
get_source()
Return the source model expression for a data set.
list_model_ids()
List of all the data sets with a source expression.
sherpa.astro.ui.set_bkg_model()
Set the background model expression for a data set.
set_model()
Set the source model expression for a data set.
set_full_model()
Define the convolved model expression for a data set.
show_model()
Display the source model expression for a data set.

Examples

Return the model fitted to the default data set:

>>> mdl = get_model()
>>> len(mdl.pars)
5