get_model_component_plot
- sherpa.ui.get_model_component_plot(id, model=None, recalc: bool = True, copy: bool = True)
Return the data used to create the model-component plot.
Changed in version 4.19.0: The plot object is now copied by default. To get the previous behaviour set the
copyattribute toFalse.- Parameters:
- id
intorstr,optional The data set that provides the data. If not given then the default identifier is used, as returned by
get_default_id.- model
strorsherpa.models.model.Modelinstance The component to use (the name, if a string).
- recalcbool,
optional If
Falsethen the results from the last call toplot_model_component(orget_model_component_plot) are returned, otherwise the data is re-generated.- copybool,
optional Is the plot object copied before being returned? If so then the plot attributes will not be changed by multiple calls to this routine.
- id
- Returns:
instanceAn object representing the data used to create the plot by
plot_model_component. The return value depends on the data set (e.g. 1D binned or un-binned).
See also
get_model_plotReturn the data used to create the model plot.
plot_modelPlot the model for a data set.
plot_model_componentPlot a component of the model 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
modelparameter. If given two un-named arguments, then they are interpreted as theidandmodelparameters, respectively.Examples
Return the plot data for the
plcomponent used in the default data set:>>> cplot = get_model_component_plot(pl)
Return the full source model (
fplot) and then for the componentsgal * plandgal * gline, for the data set ‘jet’:>>> fmodel = xsphabs.gal * (powlaw1d.pl + gauss1d.gline) >>> set_source('jet', fmodel) >>> fit('jet') >>> fplot = get_model_plot('jet') >>> plot1 = get_model_component_plot('jet', pl*gal) >>> plot2 = get_model_component_plot('jet', gline*gal)