get_resid_plot

sherpa.astro.ui.get_resid_plot(id: IdType | None = None, recalc: bool = True, copy: bool = True)

Return the data used by plot_resid.

Changed in version 4.19.0: The plot object is now copied by default. To get the previous behaviour set the copy attribute to False.

Parameters:
idint, str, or None, optional

The data set. If not given then the default identifier is used, as returned by get_default_id.

recalcbool, optional

If False then the results from the last call to plot_resid (or get_resid_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.

Returns:
resid_dataa sherpa.plot.ResidPlot instance
Raises:
sherpa.utils.err.IdentifierErr

If the data set does not exist or a source expression has not been set.

See also

get_chisqr_plot

Return the data used by plot_chisqr.

get_delchi_plot

Return the data used by plot_delchi.

get_ratio_plot

Return the data used by plot_ratio.

plot_resid

Plot the residuals (data - model) for a data set.

Examples

Return the residual data for the default data set:

>>> rplot = get_resid_plot()
>>> np.min(rplot.y)
-2.9102595936209896
>>> np.max(rplot.y)
4.0897404063790104

Display the contents of the residuals plot for data set 2:

>>> print(get_resid_plot(2))

Overplot the residuals plot from the ‘core’ data set on the ‘jet’ data set:

>>> r1 = get_resid_plot('jet')
>>> r2 = get_resid_plot('core')
>>> r1.plot()
>>> r2.overplot()