get_source
- sherpa.ui.get_source(id: IdType | None = None) Model
Return the source model expression for a data set.
This returns the model expression created by
set_modelorset_source. It does not include any instrument response.- Parameters:
id (int, str, or None, 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_modelDelete the model expression from a data set.
get_modelReturn the model expression for a data set.
get_model_parsReturn the names of the parameters of a model.
get_model_typeDescribe a model expression.
list_model_idsList of all the data sets with a source expression.
sherpa.astro.ui.set_bkg_modelSet the background model expression for a data set.
set_modelSet the source model expression for a data set.
set_full_modelDefine the convolved model expression for a data set.
show_modelDisplay the source model expression for a data set.
Examples
Return the source expression for the default data set, display it, and then find the number of parameters in it:
>>> src = get_source() >>> print(src) >>> 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'))