Skip to the navigation links
Last modified: October 2010

AHELP for CIAO 4.2


Context: ciao_contrib


Reprocess a Chandra dataset


chandra_repro  indir outdir [root] [badpixel] [process_events]
[destreak] [set_ardlib] [check_vf_pha] [pix_adj] [cleanup] [clobber]


The chandra_repro reprocessing script automates the recommended data processing steps presented in the CIAO analysis threads. The script reads data from the standard data distribution (e.g. primary and secondary directories) and creates a new bad pixel file and a new level=2 event file.

The script may be used to reprocess ACIS and HRC imaging data. Grating data is not currently supported.

There are parameters to control certain reprocessing steps, such as creating the new bad pixel file or destreaking the data. Users who wish to have finer-grained control over the reprocessing parameters should instead follow the step-by-step instructions in the CIAO Data Preparation Threads.

Example 1

unix% chandra_repro

Reprocess the dataset in the current working directory with the default script settings. The default verbosity of 1 means that status messages will be printed to the screen.

Example 2

unix% chandra_repro verbose=0

Reprocess the dataset in the current working directory with the default settings. Nothing will be printed to the screen, unless the script detects an error.

Example 3

unix% chandra_repro indir=/data/1838 outdir=/data/1838/new cleanup=no

Reprocess the dataset in directory /data/1838, writing the new files to /data/1838/new . Save all of the intermediate files (cleanup=no).

Example 4

unix% chandra_repro set_ardlib=no

The data will be reprocessed, but the bad pixel filename will not be set in ardlib.par.


name type def min max reqd
indir file ./     yes
outdir file ./repro     yes
root string       no
badpixel boolean yes     no
process_events boolean yes     no
destreak boolean yes     no
set_ardlib boolean yes     no
check_vf_pha boolean yes     no
pix_adj string default     no
cleanup boolean yes     no
clobber boolean yes     no
verbose integer 1 0 5 no

Detailed Parameter Descriptions

Parameter=indir (file required default=./)

Input directory

The directory which contains the data files or which contains the primary/ and secondary/ data directories from a standard Chandra Data Archive download tarfile.

Special Input Cases

In order to run chandra_repro on observations that were done in ACIS interleaved (alternating exposure) mode or that have multiple observation intervals (OBIs), the input data has to be separated into different input directories. Interleaved data is easily divided by the "e1" and "e2" in the filenames. For multi-obi data, refer to the Multi-OBI Observations why topic for information on how to separate the files. If the data are not sorted, the script will exit with an input error.

Parameter=outdir (file required default=./repro)

Output directory

The output directory for the reprocessed data files. This directory will also contain copies of the files which are required for data analysis, e.g. the aspect solution and the mask file.

Parameter=root (string not required)

Root for output filenames

If not specified, the script removes "_evt1.fits" from the level=1 event file to define the root, e.g. "acisf01838_000N002" is the root of "acisf01838_000N002_evt1.fits".

Parameter=badpixel (boolean not required default=yes)

Create a new bad pixel file?

If "badpixel=yes" (the default), a new bad pixel file is created for the dataset.

ACIS Data:
  • status bits 16 through 19 in the event file are reset to remove the effects of the acis_detect_afterglow processing, if necessary, and
  • acis_run_hotpix is run to create a new bad pixel file which flags hot pixel and afterglow events in the event file.

HRC Data:
  • hrc_run_hotpix is run to define the valid coordinate regions in the detectors and to identify hot pixels in the event file.

The new bad pixel that is created is used in reprocessing the data, assuming "process_events=yes".

ACIS continuous-clocking mode

This parameter setting does not apply when the input data were taken in ACIS continuous-clocking mode, as the acis_run_hotpixel tool cannot be used with this data mode.

Related webpages:

o) Remove the acis_detect_afterglow Correction thread

o) New ACIS Bad Pixel File: Identify ACIS Hot Pixels and Cosmic Ray Afterglows thread

o) New Observation-Specific HRC Bad Pixel File thread

Parameter=process_events (boolean not required default=yes)

Create a new level=2 event file?

If "process_events=yes" (the default), the acis_process_events or hrc_process_events tool is run to create a new level=1 event file with the latest calibration applied. The standard grade, status, and good time filters are applied by the tool dmcopy to create a new level=2 event file.

ACIS Reprocessing Steps
  • the latest charge transfer inefficiency (CTI) correction
  • the latest time-dependent gain adjustment
  • the latest gain map
  • a new bad pixel file
  • PHA randomization
  • pixel randomization (see "pix_adj" parameter)
  • clean the VFAINT background (see "check_vf_pha" parameter)
  • continuous clocking mode times of arrival

HRC Reprocessing Steps
  • the latest time-dependent gain adjustment
  • the AMP_SF correction
  • the degap correction
  • recomputing average HRC dead time corrections
  • pixel randomization (see "pix_adj" parameter)

Related webpages:

o) Reprocessing Data to Create a New Level=2 Event File thread

o) acis_process_events help file

o) hrc_process_events help file

Parameter=destreak (boolean not required default=yes)

Destreak the ACIS-8 chip?

There is a flaw in the serial readout of the ACIS chips, causing a significant amount of charge to be randomly deposited along pixel rows as they are read out. If "destreak=yes" (the default), the destreak tool is run on the ACIS-S4 chip to detect probable streak events. The flagged events are then filtered out of the event file.

Related webpages:

o) Destreaking ACIS Data why topic

o) destreak help file

Parameter=set_ardlib (boolean not required default=yes)

Set ardlib.par with the bad pixel file?

If "set_ardlib=yes" (the default), the observation-specific bad pixel file is set in the ardlib.par file so that it is available to the CIAO tools during data analysis.

Setting "set_ardlib=no" may be useful if you are analysing another dataset while chandra_repro is running. In this case, you would not want ardlib.par to be modified until the other analysis tasks are finished.

Remember to "punlearn" your ardlib.par file after completing analysis of this dataset to ensure that the proper bad pixel maps are used the next time that ardlib.par is referenced by a tool.

Related webpages:

o) Setting the Observation-specific Bad Pixel Files

Parameter=check_vf_pha (boolean not required default=yes)

Clean ACIS background in VFAINT data?

In ACIS very faint mode, acis_process_events can use the pulse heights in the outer 16 pixels of the 5x5 event island to help distinguish between good X-ray events and bad events that are most likely associated with cosmic rays.

If "check_vf_pha=yes" (the default), the ACIS particle background for very faint mode observations is cleaned. The potential background event - events where one or more of those outer pixels is greater than the default split threshold - is flagged and filtered out of the event file.

The value of this parameter is passed to the "check_vf_pha" parameter of acis_process_events when "process_events=yes".

Related webpages:

o) ACIS VFAINT Background Cleaning why topic

Parameter=pix_adj (string not required default=default)

Pixel randomization: default|none|randomize

If "pix_adj=default" (the default), the default value of the tool's pixel randomization parameter is used. For ACIS data, randomization is applied (acis_process_events rand_pix_size=0.5). For HRC data, randomization is not applied (hrc_process_events rand_pix_size=0.0).

If "pix_adj=randomize", the event coordinates are randomized over the pixel size by [-0.5,+0.5] pixel. The parameter value is passed as "rand_pix_size=0.5" to acis_process_events or hrc_process_events when "process_events=yes".

If "pix_adj=none", the coordinate positions are not randomized in the reprocessed event file. The parameter value is passed as "rand_pix_size=0.0" to acis_process_events or hrc_process_events when "process_events=yes".

Related webpages:

o) ACIS Pixel Randomization why topic

Parameter=cleanup (boolean not required default=yes)

Cleanup intermediate files on exit

If "cleanup=yes" (the default), intermediate data files are deleted when the script ends. When the parameter is set to "no", these files remain in the "outdir" directory.

Parameter=clobber (boolean not required default=yes)

Clobber existing files?

Overwrite existing files with the same filename?

Parameter=verbose (integer not required default=1 min=0 max=5)

The amount of information printed to the screen

The default verbosity setting (1) prints status messages as the script runs. Higher verbosity settings print the commands that are being run. Setting verbose=0 turns off all screen output except errors.


  • Support for HRC imaging data has been added.
  • The default value of the pix_adj parameter is set to "default" to accommodate ACIS and HRC default parameter settings; see the parameter description (above) for details.
  • A HISTORY entry for chandra_repro is added to the header of the level=1 and level=2 event files. Use the dmhistory tool to view the entry.
  • The PHAS column is retained in the ACIS level=2 event file.
  • The script copies the field of view file (fov1.fits) to the output directory.


This script is not an official part of the CIAO release but is made available as "contributed" software via the CIAO scripts page. Please see the installation instructions page for help on installing the package.


See the bugs page for this script on the CIAO website for an up-to-date listing of known bugs.

Last modified: October 2010