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
- the counts in the group (i.e. GRP_DATA)
- 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