get_source_component_plot

sherpa.astro.ui.get_source_component_plot(id, model=None, recalc=True)

Return the data used by plot_source_component.

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.

  • model (str or sherpa.models.model.Model instance) – The component to use (the name, if a string).

  • recalc (bool, optional) – If False then the results from the last call to plot_source_component (or get_source_component_plot) are returned, otherwise the data is re-generated.

Returns

An object representing the data used to create the plot by plot_source_component. The return value depends on the data set (e.g. 1D binned or un-binned).

Return type

instance

See also

get_source_plot

Return the data used to create the source plot.

plot_source

Plot the source expression for a data set.

plot_source_component

Plot a component of the source expression for a data set.

Notes

The function does not follow the normal Python standards for parameter use, since it is designed for easy interactive use. When called with a single un-named argument, it is taken to be the model parameter. If given two un-named arguments, then they are interpreted as the id and model parameters, respectively.

Examples

Return the plot data for the pl component used in the default data set:

>>> cplot = get_source_component_plot(pl)

Return the full source model (fplot) and then for the components gal * pl and gal * gline, for the data set ‘jet’:

>>> fmodel = xsphabs.gal * (powlaw1d.pl + gauss1d.gline)
>>> set_source('jet', fmodel)
>>> fit('jet')
>>> fplot = get_source('jet')
>>> plot1 = get_source_component_plot('jet', pl*gal)
>>> plot2 = get_source_component_plot('jet', gline*gal)