Skip to the navigation links
Last modified: 1 Jul 2010
Where are the PDFs?

Remove the acis_detect_afterglow Correction

CIAO 4.2 Science Threads


Last Update: 1 Jul 2010 - the chandra_repro reprocessing script automates data processing for ACIS imaging data


[New] A reprocessing script for ACIS and HRC imaging data: the chandra_repro script runs the data processing steps in this thread for ACIS imaging data. To use the reprocessing script, install the contrib tarfile. Refer to "ahelp chandra_repro" for more information.

An afterglow is the residual charge from the interaction of a cosmic ray in a CCD. Some of the excess charge is captured by charge traps and released in a few to a few dozen subsequent frames. If afterglow events are not removed from the data, they can result in the spurious "detection" of faint sources.

A new method for identifying afterglow events, namely the ACIS hot pixel tools, was introduced to SDP at version DS 7.4.0 to try to avoid discarding a significant fraction of real x-ray events. Before using the hot pixel tools, the afterglow status bits in data that were processed with acis_detect_afterglow must be reset so that they may be recomputed. After running this thread, users should complete the New ACIS Bad Pixel File: Identify ACIS Hot Pixels and Cosmic Ray Afterglows thread.

Be sure to read the Cosmic-Ray Afterglows why topic and the caveats section of this thread.


To reset the status bits 16 through 19, removing the effects of the acis_detect_afterglow processing. How to examine the events marked as afterglows is also shown.

Read this thread if:

If your data have gone through Reprocessing III, you do not have to run this thread. Get Started shows how to check the software version used in processing your data.

Related Links:


Get Started

Sample ObsID used: 459 (HETG/ACIS-S, 3C 273)

File types needed: evt1

To see which processing version was used on the data:

unix% dmkeypar acisf00459_000N002_evt1.fits ASCDSVER echo+

Since the ASCDSVER is lower than DS 7.4.0, it is necessary to run this thread. Note that the version numbering changed after version R4CU5UPD14 to the "DS" system, starting with DS 6.0.0.


At present, the tool acis_run_hotpix is being used in the pipeline to identify cosmic-ray afterglows. The results obtained using this tool should be sufficient unless a user is interested in searching for or studying sources that have a small number of counts (i.e. less than about 10). In these situations, it may be advantageous to use the tool acis_detect_afterglow (in addition to acis_run_hotpix) to try to eliminate afterglows that have only a few events. Some care is required to ensure that acis_detect_afterglow does not eliminate a significant number of real x-ray events.

For more information, read the Cosmic-Ray Afterglows why topic.

Examine the Afterglow Events (Optional)

It is possible to display the spatial distribution of events flagged by acis_detect_afterglow. Here we have defined a filter that excludes cases in which none of the afterglow status bits (16-19, counting from the right, starting at zero) are marked as bad (1). The other bits are filtered on the wildcard "x", which lets either a good or bad value pass. This filter retains the events in which any of the afterglow flags have been set to 1:

unix% dmcopy \
      "acisf00459_000N002_evt1.fits[exclude status=xxxxxxxxxxxx0000xxxxxxxxxxxxxxxx]" \

In this case, displaying the file in ds9 (Figure 1) shows that the source is clearly visible, meaning that many source photons have been marked as afterglows.

[Thumbnail image: The afterglow events and the original event file are displayed side-by-side in ds9.]

[Version: full-size]

[Print media version: The afterglow events and the original event file are displayed side-by-side in ds9.]

Figure 1: Image of the afterglow events

The afterglow events are in the left frame and the event file is in the right frame. A number of source events clearly have been tagged as afterglows.

Reset the Status Bits

The tool dmtcalc is used to reset the status bits.

The expression selects the afterglow bits (status=X15F,status=X14F,status=X13F,status=X12F) and sets them to "0" (False), while retaining the original value of all other status bits (status=status). The tool counts the bits in the opposite direction (left-to-right vs. right-to-left), so the numbers 15-12 in the expression correspond to bits 16-19.

unix% punlearn dmtcalc
unix% pset dmtcalc infile=acisf00459_000N002_evt1.fits 
unix% pset dmtcalc outfile=acis_459_reset_evt1.fits 
unix% pset dmtcalc expression="status=status,status=X15F,status=X14F,status=X13F,status=X12F"
unix% dmtcalc
Input file (acisf00459_000N002_evt1.fits): 
Output file (acis_459_reset_evt1.fits): 
expression(s) to evaluate (status=status,status=X15F,status=X14F,status=X13F,status=X12F): 

Since the file is processed line-by-line, this step can take several minutes to run.

The new output file, acis_459_reset_evt1.fits, is a level=1 file with status bits 16-19 set to "0". The content of the parameter file may be checked using plist dmtcalc.


At this point, users should procede to the Create a New ACIS Bad Pixel File: Identify ACIS Hot Pixels and Cosmic Ray Afterglows thread to create a new bad pixel file for their data which contains more accurate afterglow information. After that, the data is reprocessed with acis_process_events and a new level=2 file must be created. For an overview of the full reprocessing thread, see the ACIS Data Preparation Analysis Guide.

Parameters for /home/username/cxcds_param/dmtcalc.par

        infile = acisf00459_000N002_evt1.fits   Input file
       outfile = acis_459_reset_evt1.fits Output file
    expression = status=status,status=X15F,status=X14F,status=X13F,status=X12F expression(s) to evaluate
      (clobber = no)              Clobber output file if it exists?
      (verbose = 0)               Debug level
         (mode = ql)              


13 Jan 2005 updated for CIAO 3.2: the thread now shows how to reset the afterglow status bits before applying a new bad pixel file
12 Dec 2005 reviewed for CIAO 3.3: no changes
01 Dec 2006 reviewed for CIAO 3.4: no changes
14 Dec 2007 updated for CIAO 4.0: kernel parameter removed from dmtcalc; linked to afterglow why topic
23 Jun 2008 updated image display to place figures inline with text
12 Jan 2009 reviewed for CIAO 4.1: no changes
08 Feb 2010 reviewed for CIAO 4.2: no changes
01 Jul 2010 the chandra_repro reprocessing script automates data processing for ACIS imaging data

Return to Threads Page: Top | All | Data Prep

Where are the PDFs?
Last modified: 1 Jul 2010