get_bkg_source

sherpa.astro.ui.get_bkg_source(id=None, bkg_id=None)

Return the model expression for the background of a PHA data set.

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

Parameters:
  • id (int or str, optional) – The data set to use. If not given then the default identifier is used, as returned by get_default_id.

  • bkg_id (int or str, optional) – Identify the background component to use, if there are multiple ones associated with the data set.

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_bkg_model

Delete the background model expression for a data set.

get_bkg_model

Return the model expression for the background of a PHA data set.

list_model_ids

List of all the data sets with a source expression.

set_bkg_model

Set the background model expression for a PHA data set.

show_bkg_model

Display the background model expression for a data set.

Examples

Return the background model expression for the default data set:

>>> bkg = get_bkg_source()
>>> len(bkg.pars)
2