get_bkg_plot
- sherpa.astro.ui.get_bkg_plot(id: IdType | None = None, bkg_id: IdType | None = None, recalc=True)
Return the data used by plot_bkg.
- Parameters:
id (int, str, or None, optional) – The data set that provides the data. If not given then the default identifier is used, as returned by
get_default_id.bkg_id (int, str, or None, optional) – Identify the background component to use, if there are multiple ones associated with the data set.
recalc (bool, optional) – If
Falsethen the results from the last call toplot_bkg(orget_bkg_plot) are returned, otherwise the data is re-generated.
- Returns:
data – An object representing the data used to create the plot by
plot_data. The relationship between the returned values and the values in the data set depend on the analysis, filtering, and grouping settings of the data set.- Return type:
a
sherpa.astro.plot.BkgDataPlotinstance- Raises:
sherpa.utils.err.ArgumentErr – If the data set does not contain PHA data.
sherpa.utils.err.IdentifierErr – If the
bkg_idparameter is invalid.
See also
get_default_idReturn the default data set identifier.
plot_bkgPlot the background values for a PHA data set.
Examples
Create the data needed to create the “data plot” for the background of the default data set and display it:
>>> bplot = get_bkg_plot() >>> print(bplot)
Return the plot data for data set 2, and then use it to create a plot:
>>> b2 = get_bkg_plot(2) >>> b2.plot()
Return the plot data for the second background component to the “jet” data set:
>>> bplot = get_bkg_plot('jet', bkg_id=2)