|AHELP for CIAO 4.3 Sherpa v1||
Plot the fit, fit plus delta chi, or fit plus residuals
plot_fit([id], [replot=False, overplot=False]) plot_fit_delchi([id], [replot=False, clearwindow=True]) plot_fit_resid([id], [replot=False, clearwindow=True])
The plot_fit command plots the fit. The plot_fit_delchi and plot_fit_resid commands plot the fit along with the delta chi (residuals divided by uncertainties) and residuals (measured counts minus predicted counts), respectively.
|id||1 (can be changed, see "ahelp get_default_id")||the id of the dataset to plot|
|replot||False||should previously-calculated arrays be used to create the plot?|
|overplot||False||If True then add the data to the current plot, otherwise erase the frame and create a new plot.|
|clearwindow||True||If True then do not delete any existing frames in the current ChIPS window. Note that the plots will be created in a new ChIPS frame even when this argument is set.|
The plot is displayed in a ChIPS plotting window. If there is no plotting window open, one is created. If a plotting window exists, the "overplot" parameter value determines whether the new plot is overlaid on the existing plot in the window or if the window is cleared before the plot is drawn. The "clearwindow" value determines whether a new ChIPS frame should be created for the plots; setting the value to False allows for multiple plot_fit_delchi or plot_fit_resid output to be displayed side-by-side, as shown in the examples.
ChIPS commands may be used within Sherpa to modify plot characteristics and create hardcopies; refer to the ChIPS website for information.
The default values for the plots can be read - and changed - using the get_data_plot_prefs() and get_model_plot_prefs() commands. See
unix% ahelp get_data_plot
unix% ahelp get_model_plot
and the examples below for more information.
To plot multiple Sherpa objects - e.g. data, model, fit, residuals - in a single window, use the plot command.
sherpa> plot_fit() sherpa> log_scale(XY_AXIS)
Plot the fit for the default dataset and then change both axes to use logarithmic scaling.
sherpa> get_data_plot_prefs()["xlog"] = True sherpa> get_data_plot_prefs()["ylog"] = True sherpa> plot_fit()
Here the plot preferences for data plots are chanegd to use logarithmic scaling for both axes. Any new plot showing data - such as plot_fit() - will therefore use logged axes by default.
sherpa> plot_fit("src", overplot=True)
Plot the fit for the "src" dataset, overlaying on any existing plots.
sherpa> set_preference("frame.transparency", "true") sherpa> plot_fit_delchi(1) sherpa> reposition_frame(0.0,0.5,1.0,1.0) sherpa> plot_fit_delchi(2, clearwindow=False) sherpa> reposition_frame(0.0,0.0,1.0,0.5) sherpa> save_state("fits.state")
Normally, Sherpa plots clear the contents of the current ChIPS window before creating the new plot. For commands that create only a single plot - such as plot_fit() - the overplot option can be used to overlay data onto an existing plot. There is no overplot support for commands like plot_fit_delchi() and plot_fit_resid(), which create two separate plots; instead it is possible to create the plots in separate ChIPS frames and then re-size the frames so as to show multiple datasets in the same window.
In this example we create two plots for dataset 1, then re-size the frame they are in so that they occupy the top-half of the window. The second plot_fit_delchi call creates a new frame, which by default fills the whole window, but does not delete the existing frame because the clearwindow argument has been set to False. The second frame is then re-sized so that it fills the bottom-half of the window.
The save_state() call creates a binary file (i.e. not human readable) that can be loaded into a new ChIPS session - using load_state() - so as to re-create the window. This can be useful to allow further editing of the plot for publication without having to re-create the fit in Sherpa.
The set_preference call is used to allow overlapping ChIPS frames - as used in this example - to show contents below them. If it had not been made then the second plot_fit_delchi() call would have appeared to delete the first frame as the new frame completely covered the old frame.
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.
- get_data_prof, get_data_prof_prefs, get_delchi_prof, get_delchi_prof_prefs, get_fit_prof, get_model_prof, get_model_prof_prefs, get_resid_prof, get_resid_prof_prefs, get_source_prof, get_source_prof_prefs, plot_chart_spectrum, prof_data, prof_delchi, prof_fit, prof_fit_delchi, prof_fit_resid, prof_model, prof_resid, prof_source
- get_arf_plot, get_bkg_plot
- get_iter_method_name, get_iter_method_opt, list_iter_methods, set_iter_method, set_iter_method_opt
- get_energy_flux_hist, get_photon_flux_hist, get_split_plot, plot, plot_arf, plot_bkg, plot_chisqr, plot_data, plot_delchi, plot_energy_flux, plot_model, plot_model_component, plot_order, plot_photon_flux, plot_ratio, plot_resid, plot_source, plot_source_component, set_xlinear, set_xlog, set_ylinear, set_ylog
- get_chisqr_plot, get_delchi_plot, get_stat
- calc_chisqr, calc_stat
- contour_resid, image_fit