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

Skip the navigation links
Last modified: 21 September 2006
Hardcopy (PDF): A4 | Letter

How is error handling done in Sherpa as opposed to XSPEC?


PHA files have a column called STAT_ERR. In CIAO this is calculated using the chi gehrels statistic:

STAT_ERR = 1.0 + sqrt(n_i + 0.75)

That is, if COUNTS=0:

STAT_ERR = 1.0 + sqrt(COUNTS + 0.75) = 1.86603

In Sherpa: the STAT_ERR column is not used by default. If Sherpa detects that it exists, it returns a message like:

WARNING: statistical errors specified in the PHA file.
         These are currently IGNORED. To use them, type:
         READ ERRORS "<filename>[cols CHANNEL,STAT_ERR]" fitsbin

If the data are grouped, Sherpa calculates the GRP_STAT_ERR based on

  1. the counts in the group (i.e. GRP_DATA)
  2. the chosen statistic

In XSPEC: the STAT_ERR column is used by default.

If the data are grouped then XSPEC calculates the GRP_STAT_ERR = sqrt(SUM STAT_ERR**2) over the group. This gives an error which is much larger than the correct one calculated from the counts in the group.

In order to ignore the STAT_ERR column in XSPEC, the following workaround needs to be applied. From the "Points to Note & Conventions" in the documentation on the OGIP standard format for spectral files:

	In the case of Data in units of Counts per channel (only), 
	if appropriate the Stat_err column can be deleted from the 
	data table, and POISSERR=T specified as a keyword within the 
	extension header. XSPEC will then assume Poissonian errors 
	are appropriate to the data stored in Data.

Goodness of Fit

Note also that Sherpa has chi gehrels as the default statistic, while XSPEC has chi dvar as the default. When comparing chi square results from both packages, the same statistic should be applied, e.g.

sherpa> statistic chi dvar 


Hardcopy (PDF): A4 | Letter
Last modified: 21 September 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.