Chandra X-Ray Observatory
Skip to the navigation links
Last modified: 12 April 2017


Scripts Package:
Version History

Package Version Name Changes
12 Apr 2017

Typo fixed in screen output and script modified to add file history using the Python ciao_contrib.runtool.add_tool_history instead of relying on dmhistory.


Script modified to run fluximage with background=none, to avoid double counting the background, since srcflux also determines the background independently. This change only affects HRC-I observations.


The output simulated events file now includes a [x=:,y=:] to trim the TLMIN/TLMAX keyword range of the output event file to make visuzlizing results in DS9 easier.

mktgresp Support of Type I PHA file as input added.
tgsplit The REGION block is appended to the produced Type I PHA files
combine_spectra If input files contain a STAT_ERR column, the values will be recomputed using the Gehrels' variance function; which is needed by combine_grating_spectra.
install_marx, ecf_calc Updated for Python 3.5 compatibility.

Bug fixed that was triggered by multi-asol observations causing runtime failure with Python 3.5.

download_obsid_caldb Bug fixed where the script fails when the output directory parameter contains a trailing "/".
  • New random parameter added to pass to reproject_events, in order to create re-producible results.
  • The DY_AVG, DZ_AVG, and DTH_AVG header keywords are added to the tailored blanksky background file that match the reference events file, which fixes incomplete transformations to sky and chips coordinates when the background file is reprojected.
  • Bug fixed which caused the script to fail when co-adding *3* sets of spectra and responses when bkgresp=no. The individual sets of data products are otherwise correct.
  • Focal plane temperature testing is skipped for HRC observations, since the event file does not have the FP_TEMP header keyword, which would cause the script the error out.
sherpa_contrib.xspec.xsconvolve The XSPEC convolution interface is updated so it works with Sherpa in CIAO 4.8 or greater. A bug was also fixed that will allow use of the XSpec partial covering model (load_xspartcov).
13 Dec 2016
multiple scripts

The scripts package has been updated for the CIAO 4.9 release and to run under Python version 3.5 as well as Python 2.7. These changes are purely internal and do not change how the scripts behave.


The behavior has been changed when bkgresp=yes so that the calculated background ARF will always be weighted. The background RMF type is determined by the unweight_rmf" parameter.

03 Oct 2016
[New] blanksky

Script to create an unscaled blanksky background file compatible with a given observation events file. The background scaling factors for each chip are calculated and stored in the file header.

[New] blanksky_image

Script to create scaled background and background-subtracted images given an observation-specific blanksky background file and a reference image.

[New] correct_periscope_drift

Script to correct small (~0.1 arcsec) intra-observation alignment drifts that can be seen in recent, long (>50 ks) observations. Requires a bright, on-axis (<2 arcmin) point source with minimal pileup.

  • binarfcorr parameter added to explicitly specify detector pixel size used by arfcorr PSF correction.

  • Additional checks and warning messages added for warm observations with focal plane temperatures >-110C.

  • If weight=no and P2_resp calibration files are available, mkacisrmf runs with infile=CALDB(CCD_ID=x)—where 'x' is the CCD that the extraction region is centered on— instead of just infile=CALDB to avoid inadvertent tool failure.

  • Users with MARX installed can now use psfmethod=marx to simulate a mono-chromatic PSF that is used for aperture correction.
  • Users can input multiple event files, but the results are not merged. The same regions, if specified, are used for each event file so the regions need to be in celestial coordinates or the events files must be reprojected to the same tangent plane.
  • The default model and absmodel have been updated to separate the absorption model.
  • A new ${root}_summary.txt file is created with a copy of the final summary information.
  • Bug fixed affecting psfmethod=arfcorr PSF file names.
chandra_repro Using pix_adj=default for ACIS data in CC-mode will now run acis_process_events with pix_adj=NONE.
mktgresp Can now create responses for ACIS-I observations with gratings inserted.

Error fixed when using tgextract2 pha2 files which were created with error=gehrels.

monitor_photom Script cleaned up to avoid warnings thrown by newer versions of NumPy.

Updates to several tasks to request regions in a specific format.


Corrects a problem in the auto-generated bash-shell setup script.

13 Apr 2016
[New] simulate_psf

A simplified interface to MARX, to perform both raytrace PSF simulations or projecting ChaRT/SAOTrace rayfiles to the detector-plane for an existing observation.


Updated to automatically install the latest version of MARX available.


Added checks to error out if blanksky background files are used as input; a minor bug fixed that attempted to write history to calibration files.

27 Jan 2016
fluximage, merge_obs, flux_obs

New "random" parameter has been added to these scripts to control the random parameter used to reproject the HRC-I background events.


New "random" parameter has been added to control the stream of random CHIPY values.

  • Support added for models which specify an initialization string in the model parameter file, such as "snapec".

  • Support for XSpec convolution models in CIAO/Sherpa 4.8 will be added at a later date.


The routines in this module have been updated to be compatible with ChaRT v2.

[New] sherpa_contrib.utils.renorm New function added that changes the normalization of a source model so that the total predicted signal matches the observed data.
sherpa_contrib.utils.estimate_weighted_expmap Function has been updated to work in CIAO 4.8.

Updated for the new parameters added to readout_bkg, fluximage, flux_obs, and merge_obs scripts.

15 Dec 2015
multiple scripts The scripts package has been updated for the CIAO 4.8 release. The Analysis Scripts section of the release notes has a list of all the changes.

Script needs updating to be compatible with CIAO 4.8.

21 Sep 2015
[New] readout_bkg

Script to model the Out of Time (OOT) contribution of bright and extended sources to the ACIS background.

[New] install_marx

New script that automates the standard steps necessary to download, build, and install MARX 5.1.

[New] download_obsid_caldb *EXPERIMENTAL* Intended for users with limited disk space or internet access/bandwidth; this script downloads only the subset of CalDB files required to analyze one observation at a time. As additional observations are processed, the CalDB will grow incrementally as new files are accrued.
[New] detilt Corrects the time-dependent tilt of LETG/HRC-S spectra by adjusting the TG_D column values.
[New] dewiggle Corrects the LETG/HRC-S spectra by adjusting the TG_D values of events to remove small "wiggles" to straighten the dispersed spectra.
[New] symmetrize Adjusts the LETG/HRC-S spectra by adjusting the TG_D values of events to make cross-dispersion profiles more symmetric about TG_D=0.
tgsplit Bug fix for ACIS CC-mode data, where ARF and RMF files could not be associated with individual spectral files.

Missing ahelp files for the Python group module have been placed in the $ASCDS_INSTALL/contrib/doc/xml directory so that they can be accessible to the user.

30 Jun 2015
merge_obs, reproject_obs, flux_obs

These scripts have been updated to work with multi-ObI datasets that have been processed with splitobs.


The path name is now removed from the file names stored in the ANCRFILE, RESPFILE, and BACKFILE keywords.


Bug fixed, where vector columns of coordinates were split into individual columns, which caused failures when handling image files.

07 Apr 2015
  • Checks the file names in the primary and secondary directory against the file names in the level 1 event file header.
  • The absolute input and output path names are now checked for whitespaces and will error out.
  • Supports FAINT_BIAS datasets.
  • Additional time and spatial filters are applied to ensure that the level 2 event file only contains events when the aspect solution exists.
  • ACIS TIMED-mode observations now have their GTIs aligned to expsure frame time boundaries.
  • Only the +/- 1st-order responses are created for grating observations.
  • The orders parameter has been added to allow the creation of responses for an arbitrary set of orders.
  • By default, the responses for different orders are produced in parallel. This is controlled by the newly introduced parallel and nproc parameters.
  • Better handling of non-bad pixel ardlib parameters, such as contamination models and detector QE/QEU files.
  • Handling of COLDEN failures fixed.
  • The absolute input and output path names are now checked for whitespaces and will error out.
  • Additional per-source data products are now saved, including image, exposure map, flux image, PSF, and the net count-rate probability density function.
  • The output .flux file now contains the CHIP_ID, CHIPX, and CHIPY values for the nominal source location.
  • Setting the mskfile, bpixfile, and dtffile parameters to "none" is now passed onto the underlying tools. Leaving the value as blank, "", instructs the tool to locate the files from the event file meta-data.
  • The spectral model parameters can now take special tokens: %NRAO_NH% and/or %BELL_NH%. These tokes are replaced with the values reported by the COLDEN tool for the source's location. The value %GAL% can also be used as short-hand for %NRAO_NH%.
  • The per-chip live time (LIVTIMEx) is now used rather than the LIVETIME value for the aimpoint chip.
[New] splitobs

Automates the steps necessary to separate multi-ObI and interleaved-mode observations into individual directories compatible with chandra_repro. For multi-ObI grating observations, the REGION block is attached to the level 2 event file.

[New] gti_align

For ACIS observations only. Synchronizes the input GTIs to the ACIS exposure boundaries.

[New] multi_chip_gti

Create a single multi-chip GTI from individual GTIs.


The output metadata (including block order) may be different.


Bug fixed when checking that all input files have the same channel grid.

dax spectral fits

Fix logic to allow background to be optionally used.


Adds tool history to output file and corrects the logic when applied to areas outside a sub-arrayed dataset.


Adds tool history to output file.

  • ahelp file added.
  • New routine to convert to Chandra coordinates from sky(x,y).
  • Forces the Pixlib() initialization to only happen once.
04 Dec 2014
  • The default verbosity level is now 1.
  • Script updated to handle the removal of the calc_cc_times parameter in acis_process_events.

The file found from the MASKFILE header keyword in the input event file is now optional when running the tool when no fovfile is set.


An ObsID may now be given instead of an object name or position.


Bug fixed affecting observations with multiple aspect solution files.


Updated to open the CALDB version file as read-only.


Updated for the new tools and updated parameter files introduced in CIAO 4.7.

04 Nov 2014
[New] combine_grating_spectra
  • Allows users to combine spectra from positive and negative grating orders and to combine spectra across multiple observations (or sources).
  • Works with either Type II PHA files retrieved from the the archive or created by chandra_repro, as well as Type I files available from the TGCat catalog.
  • Response files and background files are handled automatically.
  • Output is a set of Type I PHA files for each order and arm, and the associated responses.
  • This script replaces the add_grating_orders and add_grating_spectra scripts. They will be removed from a future scripts release.
[New] tgsplit
  • Convert a Type II PHA file to a set of Type I source and background PHA files. _UP and _DN (down) grating arm background spectra are combined.
  • Given a stack of response files (ARFs and RMFs), it will attempt to match the responses to the correct spectra and update the ANCRFILE and RESPFILE keywords as appropriate.

A bug was fixed causing failures when a weighted ARF and an unweighted RMF are to be created for -110C ACIS data.

  • A value of NONE is now valid for the src_arf, src_rmf, bkg_pha, bkg_arf, or bkg_rmf parameters. If a parameter is set to NONE, then those respective files will not be combined, even if they are located via the ANCRFILE, RESPFILE or BACKFILE header keywords.
  • A bug was fixed where the script errors out if any of the background is zero in the same channel in all the input spectra when bscale_method=counts.
  • New Statistics → Net Counts option to obtain the net counts individually in each of the regions.
  • Moved and renamed the Statistics → Photometry (srcflux) task from the Regions menu. Fixed a bug when multiple source or background regions are selected.
  • Renamed the Statistics → All tasks to dmstat.
  • Tasks which use XPA to get information or report results have been updated to check that only a single DS9 session is running. The previous behavior of the tasks was unpredictable.
24 Sep 2014
  • A FOV file is now created with a _repro_fov1.fits extension, along with the other output products.
  • STATFILT header keyword added to level 2 event files created with 32-bit status.

Corrects the ONTIME/LIVETIME/EXPOSURE keywords in the combined ARF. The times in the PHA files, as used by Sherpa and XSpec, are unchanged.

  • A new tmpdir parameter has been added.
  • Information output to the screen has been enhanced and re-formatted.
  • Improved error messages for when weighted response creations fails.
  • Bad pixel file handling enhanced to avoid corrupt ardlib.
  • A new binsize hidden parameter has been added to support sub-pixel analysis for small regions.
  • A new tmpdir parameter has been added to avoid hard-coded paths to /tmp.
fluximage, flux_obs, merge_obs, and reproject_obs
  • Minor improvements to error messages and handling data with missing keywords.
  • When reprojecting data, the reprojection now only happens if the new tangent point is more than 0.05 arcesec away from the current tangent point (merge_obs and reproject_obs).
search_csc and obsid_search_csc
  • The MSBS (master source basic summary) column macro has been corrected.
  • The checks for whether the CXC servers are online have been improved.

Bug fixed affecting 32-bit systems where the CLSTBITS header keyword was being written out incorrectly; the STATUS column was otherwise correct.

[New] convert_xspec_user_model

*EXPERIMENTAL* Compile a XSpec user-model for use in Sherpa.

This script is an experiment to provide similar functionality to the initpackage Sherpa script, compiling XSpec user-model into a module usable within Sherpa.

Only additive, multiplicative, and convolution models are supported.

Although Fortran, C, and C++ models are all supported, there may be difficulties in compiling models if you are using a gcc/gfortran version significantly different to that used to compile CIAO 4.6 (namely version 4.1).

Models that require the --udmget switch to initpackage are not supported.

[New] sherpa_contrib.xspec.local

The Python lmod function is provided by this module to load XSpec user-models compiled with the convert_xspec_user_model script.

[New] sherpa_contrib.xspec.xsconvolve

*EXPERIMENTAL* This module provides an interface to the XSpec convolution models. For example:

# Apply the X-Spec gsmooth convolution model to the sum of a
# powerlaw and gaussian
sherpa> from sherpa_contrib.xspec.xsconvolve import load_xsgsmooth
sherpa> load_xsgsmooth("gsm")
sherpa> set_source( * gsm( +

This code has seen limited testing, and should be used with caution.

Sherpa does not have an equivalent to the energies command, so some models, such as the reflect model, may be unusable and edge effects from the convolution should be considered.


The module has been updated to us $ASCDS_WORK_PATH when creating temporary files and directories when appropriate, rathen than always using /tmp. The tmpdir argument has been added to the new_pfiles_environment() and new_tmpdir() context managers and the add_tool_history() function.


The XImage-based color lookup-tables have been updated to contain 256 colors; usable by ChIPS and DS9. The bluebase2 lookup-table has been updated to replace invalid values.

12 Jun 2014
[New] monitor_photom

Create light curves from optical data from the aspect camera.


[New] summarize_status_bits

Provide summary of the status bits set for the rows and what each bit means for an event file.

[New] apply_fov_limits

Create an image of an event file using the limits from an FOV file.


Bug fixed where the background photon flux values, BG_PHOTFLUX, were all calculated to be zero. Subsequently, the NET_PHOTFLUX_APER value and corresponding errors were not background subtracted.


Script re-written to use Python tempfile. New parameters bscale_method and exp_origin added for expert-users.

fluximage, flux_obs, and merge_obs
  • FOV file is now made using an aspect solution that has been time-filtered to match the GTI of the event files when calculating the an observation's sky area coverage.
  • When processing HRC data, the bands parameter can be used to apply a PI filter. For example, bands=30:200:1.1 will use the PI range 30 to 200 for the analysis and evaluate the instrument map at 1.1 keV.
  • HRC-I background subtraction has been modified, adding additional metadata about the particle background scaling factor appled during background subtraction. Scaling the background by the particle flux, rather than the exposure time, for subtraction is supported by the new bkgparams and background=particle parameters.
  • Better handling of observations with multiple asol files.
  • Fixed issues handling outroots pointing to nested directory paths.
  • Galactic neutral hydrogen column densities added to the spectrum files with the header keywords NRAO_nH and Bell_nH for the source extraction position derived from COLDEN.

Support added for evt1a and adat (PCAD ACA images) file types.


File history added to output file header.


Bug fix to support image files.

[New]ciao_contrib.region.check_fov.FOVFiles module Query a stack of FOV files to find which observations include a given RA and Dec.
ciao_contrib.runtool module Updated for new and updated script changes.
09 Apr 2014

Bug fix to the Python module to avoid an error being thrown.


Work around for DM issues handling regions used by CIAO analysis functions in DS9.

26 Mar 2014
[New] ecf_calc

Provides the encircled counts fraction (ECF) of from a circular region around a given source position as a function of radius.

  • Retain the unsubtracted and particle background images when cleanup=no withg HRC-I data, when background subtraction is selected.
  • Now deletes all the instrument map files when cleanup=yes and multiple bands are specified.
chips_contrib.helix module Fix allowing the start, hue, gamma, and nlev arguments to be used in load_colormap_cubehelix() and get_cubehelix().
03 Feb 2014

Fixed issue that caused failure in CIAO 4.6.1

fluximage and merge_obs
  • Fixed issues seen when setting the maskfile parameter to NONE.
  • For HRC-I data, the BEVTFILE keyword is set to the name of the background event file used for background subtraction in fluximage.
  • Changes made to try and avoid incompatiblities between CIAO and FTools parameter files.
[New]ciao_contrib.proptools module Experimental Python interface to the Chandra proposal tools: colden, precess, and dates.
12 Dec 2013
multiple scripts The scripts package has been updated for the CIAO 4.6 release. The Analysis Scripts section of the release notes has a list of all the changes.
17 Oct 2013

Provides the LaTeX identifier macro used to describe observations in papers written for AAS managed publications.

See: CDA Data Literature Links for more information.

search_csc and obsid_search_csc
  • Fixed the retrieval of data products.
  • Fixed use of the combination column definitions in the columns parameter.
coords.format.deg2dec module Fix for small negative declinations.
07 Aug 2013
  • The asol, badpix, pbk, and mask files defined in the event file header will be used by default by the script—if they are located in their standard sub-directories—unless explicitly specified.
  • The correct parameter has been renamed correctpsf.
  • Default PI filter removed for non-grating HRC-S observations. Using a PI=0:300 filter for HRC data may decrease noise, but has not been sufficiently studied. The filter may be applied by the user, if desired.
  • Minor bug fix for when two non-interleave mode event files are found in the secondary/ directory. An additional change has been made to delay creation of the output directory until the inputs have been verified.
search_csc and obsid_search_csc

New scripts that allow users to search the Chandra Source Catalog (CSC) from the command-line:

Both scripts can retrieve arbitrary sets of columns from the CSC and save the results as a tab-delimited ASCII file. Additionally, the per source and per observation data products—including event files; images; spectra; lightcurves; and their associated response files (PSF, RMF, ARF, exposure maps)—may be retrieved.

See: CSC Command-line Interface

download_chandra_obsid and find_chandra_obsid

Support of downloading from mirror sites added, rather than requiring direct access to the Chandra Data Archive.

merge_obs, reproject_obs, and flux_obs
  • Improved handling of input files containing DM filters.
  • Description of the bands parameter has been updated, since the low- and high-energy values are required for ACIS data, and should not be given for HRC data.
chips_contrib Python modules
  • The chips_contrib.pyplot module—which provides a limited emulation of the matplotlib pyplot module, allowing for the use of pyplot commands with ChIPS—has been added.
  • The chips_contrib.decorators module has been added.
ahelp documentation

New ahelp pages added; describes some of the Python routines used by the scripts, in particular download_chandra_obsid and find_chandra_obsid.

ciao_contrib.runtool module Updated to include the new and updated scripts introduced in this release.
28 Jun 2013
merge_obs Bug fixes when stacks of ancillary files given.
24 Apr 2013
merge_obs, reproject_obs, and flux_obs
  • Improved handling of HRC data, including warnings when data needs reprocessing due to different PI characteristics and better support for some subspace filters that appear in Repro IV.
  • Event files with OBS_ID keyword of Merged are automatically skipped.
  • Interleaved-mode data can now be combined without explicitly listing e1 and e2 observations.
  • Handling of missing ancillary files, such as the PBK file, has been improved.
  • The asol argument is checked to make sure an aspect histogram is not used by mistake.
fluximage The asol argument is checked to make sure an aspect histogram is not used by mistake.
  • Supports interleaved-mode observations without the user needing to split the e1 and e2 observations into separate directories.
  • New recreate_tg_mask parameter added. By default, the existing region appended to the original evt2 file is now used rather than recreated using tgdetect and tg_create_mask.
  • When reprocessing an observation using gratings, the ARF and RMF files for each order and arm are now created. They are saved into a tg sub-directory of the output directory.
add_ds9_contours and read_ds9_contours Bug fix so the tools function in CIAO 4.5.
tgmask2reg and reg2tgmask

New scripts to assist in making custom region extraction masks for tgextract2.



New scripts to that will take a Type II PHA file produced by tgextract or tgextract2 and will create the ARF and RMF for each order and grating arm.

ciao_contrib.runtool module Updated to include the new and changes scripts in this release.
Due to a naming conflict, these parameter files that provide access to the suite of auxiliary color lookup-tables have been changed.
13 Dec 2012
multiple scripts The scripts package has been updated for the CIAO 4.5 release. The Analysis Scripts section of the release notes has a list of all the changes.

Last modified: 12 April 2017
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: Smithsonian Institution, Copyright © 1998-2017. All rights reserved.