get_source

sherpa.astro.ui.get_source(id=None)

Return the source model expression for a data set.

This returns the model expression created by set_model or set_source. It does not include any instrument response.

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:model – This can contain multiple model components. Changing attributes of this model changes the model used by the data set.
Return type:a sherpa.models.Model object

See also

delete_model()
Delete the model expression from a data set.
get_model()
Return the model expression for a data set.
get_model_pars()
Return the names of the parameters of a model.
get_model_type()
Describe a model expression.
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 source expression for the default data set:

>>> src = get_source()
>>> len(src.pars)
5

Set the source expression for data set ‘obs2’ to be equal to the model of data set ‘obs1’ multiplied by a scalar value:

>>> set_source('obs2', const1d.norm * get_source('obs1'))