Pileup Correction in ISIS, Sherpa, and XSPEC:

** Original Version (3/28/2002) ** - Updated Version Can Be Found HERE

A Comparison for Low Pileup Fractions


The ISIS and Sherpa spectral analysis packages are found to agree when applying pileup correction models to both real and simulated Chandra data.  It is not as straightforward, however, to apply the model in Sherpa.  The XSPEC analysis package is found to disagree with the other packages in that it requires a larger value of the "grade migration" parameter, alpha~1.0, in order to reproduce the spectra.  (The "best fit" XSPEC model applied in ISIS produces a high energy excess.) For the data presented (low flux, soft spectra peaking at ~1 keV, measured on the ACIS-I chips), alpha~0.5 provides the best description of the data when analyzed with either ISIS or Sherpa.

Fitting Packages:

All fits discussed here were performed with one of three available spectral fitting packages:  ISIS v1.0 (an earlier version is included with the CIAO 2.2.1 software package; v1.0 is available separately), Sherpa (part of the CIAO 2.2.1 software package), or XSPEC v11.1.0o* (part of the  XANADU software package). Consult the linked web pages for further details concerning  these software packages.

(*Note: XSPEC v11.1.0o has one known bug when implementing its pileup model.  The syntax: pileup*model1*(model2+...) will result in the pileup model parameters not varying during fits; however, the syntax pileup*(model1*(model2+...)) will implement correctly, and it is this syntax that we have used throughout. Later versions of XSPEC have corrected this syntax bug.)

Note Added April 11, 2002:  A new version of XSPEC, v11.1.0ad, is now available that purports to correct the problems discussed below.  I have yet to test this version, but will report the results here once I do.

Pileup Models:

All three of the above fitting packages implement versions of the pileup correction model of  Davis (2001, ApJ, 562, p. 575). The software implementation in Sherpa follows very closely  the software implementation in ISIS, with much of the underlying code taken from ISIS.  The  software implementation in XSPEC is independent of those in ISIS and Sherpa.


We present here real observational data taken with Chandra in imaging mode on the frontsideside illuminated ACIS-I chips, as well as data (found here) simulated for the ACIS-S S3 chip, utilizing the MARX v4.0 software  package.  MARX is designed to realistically simulate the response of the Chandra detectors,  and includes utilities for simulating pileup (a script is presented on the MARX web pages).   The MARX pileup simulation uses the simple parametrization for grade migration as given by Davis (2001), but it represents a software implementation independent from the above fitting packages.

All data presented here represent low temperature (~0.2 keV), low flux (~0.1 counts per second) blackbodies absorbed by a neutral column (~1021 cm-2).  For these particular spectra, the pileup fraction is low: most piled up events represent the sum of two, occasionally three, photons, and the total fraction of events that represent piled events is typically < 10%.

Discussions of heavily piled up spectra can be found in Davis (2001).

Purpose of Document:

The purpose of these simulations is three-fold:
  1. Cross check the results of the three fitting packages with one another, to ensure that they are implementing the pileup correction model of Davis (2001) in a consistent manner.
  2. Cross check the output results with known (simulated) input results, in order to determine how successfully the input spectrum can be recovered.
  3. Provide a calibration for the "grade migration" alpha parameter of the Davis (2001) model (although see the caveats below regarding `calibration' of alpha).
As regards the final point, alpha parameterizes "grade migration" in the detector, and  represents the probability, per photon count greater than one, that the piled event is not rejected by the spacecraft software as a "bad event". Specifically, if n photons are piled together in a single frame, the probability of them being retained (as a single photon event with their summed energy) is given by alpha(n-1).

In reality, the alpha parameter should be a photon energy-dependent and detector chip-dependent matrix.  For simplicity, the model of Davis (2001) assumes a constant value.  The real data presented here are for the ACIS-I chips, and furthermore, the spectrum is such that most of the piled events represent two or three approximately 1 keV photons being piled into either a bad event, or an event detected as a 2-3 keV photon.  Thus, the fitted values of alpha cannot be interpretted as necessarily being applicable to other chips, or to spectra with very different spectral energy distributions.  In general, it is strongly recommended that, lacking specific calibration information, alpha be left as a free parameter in any fits.

Comparisons between ISIS and XSPEC:

We first present the results for data simulated with the MARX software package. The model was an absorbed blackbody implementable in XSPEC as phabs*(bbody), with the following parameters: nH = 0.2 X 1022 cm-2, kT = 0.206 keV, norm = 3.67 X 10-6. The Chandra frame time was set at 3.2 sec, and the pileup alpha parameter was set to 0.5.  A 500,000 sec observation with the ACIS-S S3 chip in imaging mode was simulated.

If we first assume no pileup correction, fits with ISIS and XSPEC produce essentially identical results.  Specifically, the chi2 is 197 for 113 degrees of freedom.  The fitted neutral columns are slightly too low (nH = 0.17 X 1022 cm-2), and the fitted temperatures are slightly too high (kT = 0.225 keV). As shown in the figure for the XSPEC fit, an excess is clearly seen at photon energies of > 2 keV.  This excess is due to piled events.

Letting the alpha parameter be freely fit, ISIS successfully recovers the input parameters.  Specifically, the ISIS fits find:  nH = 0.216 +/- 0.019 X 1022 cm-2, kT = 0.205 +/- 0.005 keV, norm=3.7 +/- 0.3 X 10-6, alpha = 0.42 +/- 0.9  (90% confidence levels). chi2 is 131 for 112 degrees of freedom. The best fit is shown below.

Fits with XSPEC, on the other hand, while reproducing the neutral column and blackbody parameters, produce an alpha greater than both the ISIS fits and the input value.  Specifically,  nH = 0.241 +/- 0.010 X 1022 cm-2, kT = 0.193 +/- 0.004 keV, norm=4.2 +/- 0.3 X 10-6, alpha = 0.95 + 0.05 /- 0.23 (90% confidence levels). chi2 is 124 for 112 degrees of freedom. As shown in the figure on the left below, XSPEC does produce a good fit to the data and removes the excess at > 2 keV; however,  XSPEC required an alpha significantly larger than the input value and the best fit ISIS value in order to achieve these results. Applying the best fit XSPEC parameters to the ISIS model produces a statistically significant excess above the data, as shown in the figure on the right.

This discrepancy between ISIS and XSPEC fits can be further explored by performing fits for fixed alpha, and then varying alpha between 0 and 1.  (To automatically tabulate these fits, the following S-Lang script was written for ISIS, while a TCL script was written for XSPEC.) The results are presented in the figure below, which shows chi2 relative to the (overall, i.e. ISIS and XSPEC) minimum value, vs. the pileup alpha parameter.  Triangles are for ISIS fits, while diamonds are for XSPEC fits.  Lines represent delta chi2 = 2.71 (i.e., the 90% confidence interval) from the minima of the ISIS and XSPEC chi2 values.  As expected, the chi2 of the fits agree for no-pileup correction, but the results become increasingly discrepant for larger values of alpha.  For the ISIS fits, the minimum in chi2 near the input value is clearly seen, and the trend for XSPEC to fit larger values of alpha is also clearly seen.

The same trends also appear in real data taken with the ACIS-I chips in imaging mode.  Below we show the chi2 relative to the minimum values vs. alpha for two separate spectra.  These spectra represent two observed sources, believed to be well described by absorbed blackbody models. (Here, however, we have also allowed for the possiblity of a power law tail with a photon index fixed to a value of Gamma = 2).  Again, ISIS and XSPEC yield the same fit results and agree that the data are poorly fit if no pileup correction is applied.  Applying pileup correction and letting alpha be freely fit, the ISIS fits strongly prefer a value of alpha ~ 0.5, while the XSPEC fits prefer alpha ~ 1.0. Comparing the best fit ISIS and XSPEC models for each data set, it is found that the ISIS and XSPEC fitted values of temperature disagree by ~10%, the (low, < 1021 cm-2) fitted values of the neutral column disagree by a factor of two, and ISIS places more stringent upper limits than XSPEC on the flux in any power law component.

Updates to XSPEC are frequently posted on the XSPEC webpages, and any changes to the implementation of the XSPEC pileup model will be posted there first.  If new implementations (i.e., beyond the v11.1.0o model discussed above) of the XSPEC pileup model become avaialble, further comparisons will be posted here.

Note Added April 11, 2002:  A new version of XSPEC, v11.1.0ad, is now available that purports to correct the problems discussed below.  I have yet to test this version, but will report the results here once I do.

Fixed Alpha Example:

Another  example of a real data spectrum is shown below on the left. This spectrum represents a faint, absorbed blackbody with a power law tail.  The dotted line is an analytic estimate of the maximum (i.e., alpha=1) contribution of piled events to the spectrum.  As can be seen, there is essentially no effect of pileup at energies < 0.5 keV or  > 8 keV.   This particular spectrum illustrates a case of where one might prefer to freeze the value of alpha.  Due to the presence of the power law tail, fits cannot distinguish a "best" value of alpha --- values of alpha ranging from 0 - 1 yield different best fit values of the power law slope (larger alpha yields harder spectral fits), with the chi2 being nearly indistinguishable as a function of alpha.  As this observation was taken in imaging mode (albeit with the ACIS-S S3 backside illuminated chip), and the source has a similar spectrum and flux to the above data sets, freezing alpha to a value of ~0.5 is a reasonable approach.   The best ISIS fit (with alpha=0.5) is shown on the right.

Comparisions between ISIS and Sherpa:

Results obtained with ISIS and Sherpa are found to be identical, with the following important caveat.  When applying the pileup model, ISIS allows users to ignore energy channels (for purposes of fitting the counts, although the response properties of those channels are still used in calculating the pileup fraction for a specific spectral model).  Sherpa pileup correction does not allow any energy channels to be ignored: all energy channels must be included in the fit.  In the above fits, energy channels < 0.5 keV and > 3 - 8 keV were ignored.  The former has a poorly known response, and the latter often has very few counts, so it is often very desirable to ignore those channels.  (The example immediately above illustrates a case where those ignored spectral bins in fact do not themselves contribute strongly to the pileup.)

 In practice, one can effectively ignore** energy channels in  Sherpa by assigning extremely large error bars (i.e., very low statistical weight) to the undesired channels.  However, this does have the unfortunate side effect that one then must use a fit statistic that is based directly upon the data error bars (e.g.,  the Cash statistic could not be used).  One could instead  effectively ignore the channels via the Sherpa  "read weights" function.  To do this, specify  an ascii file of the same length as the unfiltered input PHA data  as:

1       0       # effectively ignore channel
2       0
3       1       # include channel
1024    0

then read this file in:

sherpa> read weights <filename>

(** In general, when not applying pileup correction, one can ignore energy channels in Sherpa; however, as currently implemented, the Sherpa pileup correction module does not allow energy channels to be ignored.)

Within ISIS, however, any data bin can be ignored for pileup fits in the usual manner (e.g., "xnotice(1,1.,10.)").

When fit in similar manners (i.e., noticing all channels), ISIS and Sherpa, however, do give identical results.

Michael Nowak; mnowak@space.mit.edu; March 28, 2002
Updated: April 11, 2002