Construct and apply exposure maps

CIAO provides a variety of tools that can be combined to produce an exposure map that accounts for ACIS chip edges and gaps, aspect corrections, hot pixels and columns and telescope vignetting. A CIAO science thread exists but currently has significant limitations (e.g. treats single CCDs rather than the entire ACIS array). S. Koch, working the P. Broos and D. Huenemoerder (CXC), provides a Perl script create_exposure_map that appears to work well for creating an exposure map for a specified event list with an associated aspect offsets file (acis*.aoff1.fits). Type the following command: The input parameters are:
xmin, xmax, ymin, ymax- the bounding box of the region of interest (ROI) given in [X,Y] coordinates, ds9 can be helpful here. The maximum coordinates should be of the form 5999.99 rather than 6000.
binsize - desired binning given in ACIS pixels. A bin factor of 4 gives a 1024x1024 map for a full ACIS I+S array, while a bin factor of 2 gives a 1024x1024 map for the ACIS I array.
event list - your filtered event list which will be used to create a sky image.
aspect_file - an aspect offsets file provided by the ASC for your dataset (*.aoff1.fits).
spectrum_file - The default (just press Enter) gives the exposure map for a 4 keV monochromatic source. For an energy-dependent exposure map, input here an ASCII file with two columns, energy in keV and spectral weight. The second column must sum to 1.0. There should be no blank lines. This option is not yet well-tested.
Choose null filter: '1'

The script prompts for a filter to get rid of aspect offsets which are bogus. For example:
((x_offsets!=0.0)&&(y_offsets!=0.0)&&(roll_offsets!=0.0))
is a filter I used for M82.
Be sure to examine your aspect offsets file closely (e.g. using IDL TARA).
A null filter is acceptable.

The script creates a bunch of intermediate files in the current directory:
sky_image.fits - binned image of the sky over the region you selected.
sky_image_norm.fits - the sky image normalized by the exposure map.
expmap_[0-9].fits - chip-by-chip exposure maps
wexpmap_[0-9].fits - expmap_[0-9].fits weighted by total exposure time
expmap_all.fits - exposure map for the ROI (combination of wexpmap_[0-9].fits
sim.fits - aspect offsets file corrected for SIM location.
filtered_event_list.fits - your filtered event list which has been further filtered by the GTI tables.
gti.fits - gti tables filtered by user-specified aspect offsets filter (see above).
gti.fixed.fits - a hack which subtracts a very small amount of time from STOP times in GTI tables. This fixes a problem with dmgti which causes the first time bin of a bad time interval to not be filtered away.
instmap_[0-9].fits - chip-by-chip maps created by the CIAO tool mkinstmap.

Note 1: Discussions between P. Broos and CXC elucidate that the map produced by the CIAO tool "mkexpmap" does not have any time information in it. It should not strictly be called an exposure map, but rather is a map of the average effective area of ACIS projected onto the sky (taking chip gaps & edges and bad columns convolved with dither into account) with units of cm^2. It would be better called an "effective area map" and has typical values around 300 cm^2. The script create_exposure_map given here multiplies this effective area map by the CCD-dependent exposure time found in the FITS header keywords EXPOSUR?. Thus, the units of the map produced here is in units of s*cm^2. We do not know of a tool that divides the product by cm^2 to give a true exposure map in units of seconds. One subtlety is that the effective area map is calculated for a monoenergetic source at 4 keV, which is clearly inaccurate for real (particularly soft) sources. Users should also double-check the accuracy of GTI files, particularly the first and last entries (see item below).

Note 2: A misalignment between the exposure map and the data has been found for older (c.1999) ACIS data. If present, the aspect offset file must be recreated using CIAO acis_process_events.

It can be surprisingly tricky to determine accurately the exposure time of an ACIS observation. The following is extracted from a memo by E. Feigelson (CXC Helpdesk #3529) on this question.