Pileup Correction in ISIS, Sherpa, and XSPEC:

A Comparison for Low Pileup Fractions

Updated June. 11, 2003 - Original Version Can Be Found HERE
(Better S-lang Scripts for both ISIS and Sherpa Now Provided)


The ISIS and Sherpa spectral analysis packages are found to agree when applying pileup correction models to both real and simulated Chandra data.  As of the release of Ciao 3.0, it will be relatively straightforward to apply the model in either system.  (Greater care, however, was still required in Sherpa in order to ensure that the true minimum chi^2 was indeed found.)  The XSPEC analysis package is now found to basically agree with the ISIS and Sherpa, however, there still may be very slight differences at large values of the "grade migration" parameter, alpha~1.0.  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 any of the software fitting packages.

Fitting Packages:

All fits discussed here were performed with one of three available spectral fitting packages:  ISIS v1.0 (a version is included with the CIAO 3.0 software package; the very latest version is available separately), Sherpa* (as it will be implemented in the CIAO 3.0 software package), or XSPEC v11.2.0** (part of the  XANADU software package). Consult the linked web pages for further details concerning  these software packages.

(*Note: Most of the problems fitting pileup with earlier versions of Sherpa, e.g., 2.2.1 and 2.3, will be resolved with the Ciao 3.0 release of Sherpa.)

(**Note: Earlier versions of  XSPEC had several bugs when implementing the pileup model.  Consult the original version of this document, as well as the XSPEC bug report page.)

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, or at the very least the dependence of the spectral fit results on the alpha parameter are assessed.

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 v11.2.0 now also essentially reproduce the above results and error bars on the parameters.  To further explore the consistency between the two fitting packages, we compare fits for two separate spectra as a function of the grade migration parameter, alpha.  To automatically tabulate these fits, the following:

     ISIS S-Lang script

was written for ISIS. However, being a slightly better S-lang programmer than when I first wrote this document long ago, I like the following

     ISIS S-Lang script (June 11, 2003)

much better. 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. These real spectra, taken with the ACIS-I chips,  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).

As can be seen from the figures, the ISIS and XSPEC results agree reasonably well.  There is still some slight discrepancy at the largest values of alpha; however, the resulting fit parameters from each package lie within each others 90% error bars.  For all intents and purposes, the two fitting routines now seem to agree.  Note also that both sets of fits prefer a value of ~0.5-0.6.

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 (as to be implemented in Ciao 3.0) are now found to be identical to within error bars, with the following caveat. Pile-up fits are inherently fraught with local minima. For example, a given spectrum can often either be fit with a high flux/high pile-up fraction model (wherein most of the piled photons are modelled as being ignored by the spacecraft), or a low flux/low pile-up fraction model (with the low count rate being due to, not a loss of piled photons, but simply the inherently low flux [this is where the astrophysicists knowledge of the source, and looking at the wings of the point spread function, can come in handy]). Likewise, in the fits above, notice that one can model high energy tails as power laws or as piled photons (if alpha is large). It was previously found that at large alpha/low power-law normalization, Sherpa would miss extremely low power law normalizations that yielded lower chi^2. This is still true to an extent. To avoid this problem, a small step size was chosen for varying the power law normalization in the fit. However, as alpha was decreased and the power law normalization was increased, Sherpa then missed lower chi^2 with a very moderate power law tail.

It was found that the best minima could be attained, for the particular spectra presented above, by choosing small step sizes when alpha was large, and then choosing larger step sizes when alpha was small. (In fact, at each 0.05 step in alpha, from 1 to 0, the value of the step size was increased by a factor of 3.) The good news is that by doing this, the Sherpa results were found to be virtually identical to the ISIS results. The better news is that, with the upcoming release of Ciao 3.0, one will be able to implement S-lang scripts in Sherpa. The following

     Sherpa S-Lang script (June 11, 2003)

when run under Ciao 3.0 will behave in much the same manner as the above ISIS script.

Michael Nowak; mnowak@space.mit.edu; March 28, 2002
Updated: July 2, 2002
Updated: Sept. 5, 2002
Updated: Sept. 10, 2002
Updated: Sept. 12, 2002
Updated: June 11, 2003