get_source_plot¶
-
sherpa.astro.ui.
get_source_plot
(id=None, lo=None, hi=None)¶ Return the data used by plot_source.
Parameters: - 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 (only used for PHA data sets).
- hi (number, optional) – The high value to plot (only use for PHA data sets).
Returns: An object representing the data used to create the plot by plot_source. The return value depends on the data set (e.g. PHA, 1D binned, 1D un-binned). If
lo
orhi
were set then themask
attribute of the object can be used to apply the filter to thexlo
,xhi
, andy
attributes.Return type: instance
See also
get_model_plot()
- Return the data used by plot_model.
plot_model()
- Plot the model for a data set.
plot_source()
- Plot the source expression for a data set.
Examples
Retrieve the source plot information for the default data set and then display it:
>>> splot = get_source_plot() >>> print(splot)
Return the plot data for data set 2, and then use it to create a plot:
>>> s2 = get_source_plot(2) >>> s2.plot()
Retrive the 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_source_plot(id='jet', lo=0.5, hi=7) >>> splot2 = get_source_plot(id='core', lo=0.5, hi=7) >>> splot1.plot() >>> splot2.overplot()
Access the plot data (for a PHA data set) and select only the bins corresponding to the 2-7 keV range defined in the call:
>>> splot = get_source_plot(lo=2, hi=7) >>> xlo = splot.xlo[splot.mask] >>> xhi = splot.xhi[splot.mask] >>> y = splot.y[splot.mask]
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 photon/s/cm^2/keV x Energy and the X axis in keV:
>>> set_analysis('energy', factor=1) >>> splot = get_source_plot() >>> print(splot)