About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/sherpa_plotfns.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 sherpa_plotfns Context: sherpa

Synopsis

Plot-related functions for Sherpa.

Syntax

plot_rprofr();
plot_rprofd();

plot_eprofr();
plot_eprofd();

lpfd();
lpfr();

and the variables:

_sherpa_plotfns_version_string
_sherpa_plotfns_version

Description

The sherpa_plotfns.sl package contains S-Lang routines that may be useful to the Sherpa user. The package also sets the plot configuration (e.g. "ahelp sherpa.plot" and related pages) to change the appearance of residual plots.

See the Plotting section of the Sherpa threads for more information on plotting in Sherpa.

The available routines are:

Routine Information
plot_rprofr() Display a radial profile of 2D data, fit, and residuals (units of counts). See "ahelp plot_rprof".
plot_rprofd() Display a radial profile of 2D data, fit, and residuals (units of counts/error). See "ahelp plot_rprof".
plot_eprofr() Display an elliptical profile of 2D data, fit, and residuals (units of counts). See "ahelp plot_eprof".
plot_eprofd() Display a elliptical profile of 2D data, fit, and residuals (units of counts/error). See "ahelp plot_eprof".
lpfd() A short form for 'lplot 2 fit delchi'.
lpfr() A short form for 'lplot 2 fit resid'.

The available variables are:

Variable Information
_sherpa_plotfns_version_string Contains the version of the script as a string.
_sherpa_plotfns_version Contains the version of the script as an integer.

The plot_rprofr() and plot_rprofd() functions are described in "ahelp plot_rprof". The plot_eprofr() and plot_eprofd() functions are described in "ahelp plot_eprof". The remaining functions are described below:

lpfd([dnum])

This is a short form for

  sherpa> lplot 2 fit delchi

If an argument is given then it is taken to be the dataset to be plotted - e.g.

  sherpa> lplot 2 fit dnum delchi dnum

lpfr([dnum])

This is a short form for

  sherpa> lplot 2 fit resid

If an argument is given then it is taken to be the dataset to be plotted - e.g.

  sherpa> lplot 2 fit dnum resid dnum

The variables are:

_sherpa_utils_version_string

Contains the version number of the script as a string in the format "a.b".

_sherpa_utils_version

Contains the version number of the script as an integer equal to a*100 + b (when _sherpa_utils_version_string is "a.b").

Example 1

sherpa> lpfd

This will display two plots: the first plot will be the source data together with the best-fit model, and the second plot will be the residuls of the fit in units of "sigma" (i.e. the residual divided by the error).

The appearance of the first plot is taken from the sherpa.fitplot configuration variable (see 'ahelp sherpa.fitplot'), and the second plot from the sherpa.resplot configuration variable (see 'ahelp sherpa.resplot').

Example 2

sherpa> lpfr

This is similar to the previous example, except that the second plot shows the residuals in the data units.

Example 3

sherpa> lpfd(2)

This is the same as calling lpfd but shows the results for the fit to the second dataset.

CUSTOMISING THE RESIDUAL PLOTS

The sherpa_plotfns.sl script makes the following changes to the Sherpa plot-configuration variables when it is loaded:

Variable Value
sherpa.resplot.x_errorbars 0
sherpa.resplot.symbolstyle "bigpoint"
sherpa.resplot.symbolsize 1
sherpa.resplot.prefunc &_sherpa_resid_prefunc
sherpa.resplot.postfunc &_sherpa_resid_postfunc

The first three changes turn off the drawing of errorbars along the X-axis, change the symbol to the "bigpoint" style, and set the symbol size to 1.0 when drawing residual plots. The last two changes tell Sherpa to call the _sherpa_resid_prefunc() and _sherpa_resid_postfunc() functions - which are local (or "private") to the sherpa_plotfns.sl script - before and after a residual plot is created. It is within these two functions that the remaining customisations, which are not possible using the configuration variables, are made. Please see the Advanced customization of Sherpa plots thread for further information.

CHANGES

Version 1.29 (CIAO 3.2)

Version 1.29 of sherpa_plotfns.sl was released with CIAO 3.2. The script can now be loaded by saying

require("sherpa_plotfns");

rather than having to use

() = evalfile("sherpa_plotfns.sl");

The old method will still work.

Version 1.27 (CIAO 3.1)

Version 1.27 of sherpa_utils.sl was released at the same time as CIAO 3.1. The major changes to the previous version are:

  • The plot_rprofr() and plot_rprofd() functions have been added to plot the residuals in units of counts or sigma (analogous to the "resid" and "delchi" options of the lplot command). The plot_rprof() command is kept for backwards compatability, and is the same as plot_rprofr().
  • The plot_eprofr() and plot_eprofd() functions have been added to calculate the profiles within elliptical annuli.
  • The residuals are no longer noramlized by the area of each annulus.
  • Error bars are now displayed (where the errors are estimated using the approximations given in Gehrels, N., 1986, Ap.J., 303, 336).
  • You can give just the model name, rather than the names of the "xpos" and "ypos" parameters, to distinguish which model to use to calculate the center of the profile.
  • The residual plots now contain a line at "y=0".
  • The residual plots are now smaller than the main plot; previously they were the same size.

Version 1.19 (CIAO 3.0.2)

Version 1.19 of sherpa_plotfns.sl was released for use with CIAO 3.0.2. The major changes to the previous version are:

New functions

The plot_rprof() function has been added to sherpa_plotfns.sl. See 'ahelp plot_rprof' for further information.

New variables

The _sherpa_plotfns_version and _sherpa_plotfns_version_string variables have been added to the script.

Internal changes

The sherpa_utils.sl script is now required by sherpa_plotfns.sl and will be automatically loaded when sherpa_plotfns.sl is.

NOTES

This script is not an official part of the CIAO release but is made available as "contributed" software via the CIAO scripts page. Please see the installation instructions page for help on installing the package.

Bugs

The residual-plot customisations are designed to work when residual plots are displayed individually - e.g.

  sherpa> lplot resid

- or along with the best-fit plot, such as

  sherpa> lplot 2 fit 2 delchi 2

The customisations do not look as good if more complicated plots - such as "lplot 3 fit resid arf" - are created.

Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.