sherpa.astro.ui.get_bkg_source_plot(id=None, lo=None, hi=None, bkg_id=None)

Return the data used by plot_bkg_source.

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

  • lo (number, optional) – The low value to plot.

  • hi (number, optional) – The high value to plot.

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


source – An object representing the data used to create the plot by plot_bkg_source.

Return type

a sherpa.astro.plot.BkgSourcePlot instance


See also


Return the data used by plot_bkg_model.


Plot the model for the background of a PHA data set.


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


Retrieve the source plot information for the background of the default data set and display it:

>>> splot = get_bkg_source_plot()
>>> print(splot)

Return the background plot data for data set 2, and then use it to create a plot:

>>> s2 = get_bkg_source_plot(2)
>>> s2.plot()

Create a plot of the first two background components of the ‘histate’ data set, overplotting the second on the first:

>>> b1 = get_bkg_source_plot('histate', bkg_id=1)
>>> b2 = get_bkg_source_plot('histate', bkg_id=2)
>>> b1.plot()
>>> b2.overplot()

Retrive the background source plots for the 0.5 to 7 range of the ‘jet’ and ‘core’ data sets and display them on the same plot:

>>> splot1 = get_bkg_source_plot(id='jet', lo=0.5, hi=7)
>>> splot2 = get_bkg_source_plot(id='core', lo=0.5, hi=7)
>>> splot1.plot()
>>> splot2.overplot()

For a PHA data set, the units on both the X and Y axes of the plot are controlled by the set_analysis command. In this case the Y axis will be in units of photons/s/cm^2 and the X axis in keV:

>>> set_analysis('energy', factor=1)
>>> splot = get_bkg_source_plot()
>>> print(splot)