This guide is intended to provide a comprehensive overview of the processing and analysis of Chandra data obtained with either of the Chandra X-Ray Observatory's transmission grating instruments (HETG or LETG). It will provide a description of the tools, data, and processes in the contexts of pipeline processing, data-quality assessment, re-processing, and analysis. It will cover some of the special instrument modes, such as ACIS CC-mode, or blocked zero-order cases. It will also give examples of common problems and their solutions.
This guide is not a detailed reference manual. To that end, the
help-files are available for each tool and provide an explicit list of
all input and output files and control parameters. Manuals for other
components of the system, set-by-step threads, and useful scripts are
also available. These will be referenced here.
Intended Audience
It is assumed that the reader is already familiar with the basics of
Chandra data products (such as an event-list) and the CIAO suite of
software. Some additional information will be given here as it
pertains to the high-resolution spectra, but for the fundamentals of
CIAO, data-model, sherpa, CHIPS, event-files, filtering, etc., please
refer to the material in your local CIAO distribution (e.g.,
$ASCDS_INSTALL/doc/html/chips/index.html, or
$ASCDS_INSTALL/doc/html/doc/html/sherpa/index.html), your
contextual ``ahelp'' files (e.g., ``ahelp dm''), or
the CIAO web-based material
(http://cxc.harvard.edu).
This guide is intended to be a ``living'' document, and will be updated as frequently as required. It will hence be available on-line only, and provide links to detailed information. The most recent version of this document will be available at http://space.mit.edu/CXC/analysis/AGfCHRS.html.
If there is information you would like to find here, please contact me.
Models can also be found in the form of ``off-the-shelf''
responses, particularly as a Response Matrix File (RMF) and
Auxiliary Response File (ARF) (see
proposal planning files; grating RMFs are also in the
CALDB).
Chandra Dictionary
A collection of terms and definitions can be found in the
Chandra/CIAO Dictionary.
See this on-line list to bone-up on your acronyms, to review the
difference between a Response Matrix, an Auxiliary Response, or a
Spectral Response Matrix, or to see what is in a Chandra
event-list.
CIAO Basics
The basics (and details) of CIAO (``Chandra Interactive Analysis of
Observations'') can be found on-line at
CIAO Home.
If you have CIAO installed, here are some example help commands
which summarize grating processing tools:
CIAO Threads and Scripts
Some commonly-performed sequences of operations have been written as
``threads,'' which are specific instantiations of CIAO commands,
with supporting commentary. The scripts are threads, or parts
thereof, which have been written in a shell-language (usually
sh) to perform a more general function, using command-line
arguments. These are not part of your distribution, but are
available on-line. Useful grating threads and scripts will be
described below, and links provided.
The figure shows a schematic of the
process, starting at ``Level 1'' (focal-plane instrument-specific and
aspect transformations have been done).
The three panels correspond roughly represent the levels of processing. The pipeline does most of the first two (omitted are: destreak, mkgarf, asphist, and mkgrmf (mkgrmf is ciao new for 2.2)); the bottom panel is user analysis.
In the diagram, ovals represent processes and are labeled with tool names. The rounded-corner rectangles represent calibration data, and the square-cornered rectangles represent data-products. Not all inputs, outputs or control parameters are shown (see the detailed help files).
Observers receive a binned spectrum from the pipeline as a standard product. They may not need to use the event file, but may take the ancillary products (such as aspect solution, bad-pixel list), make responses, and proceed with spectral analysis. However, improvements in calibration, discovery of bugs in the system, or improved analysis techniques may require re-processing of the events. Or healthy scientific skepticism may generate interest in details of the event processing and files in order to verify the products and better understand the quality, limitations, and potential of the data. So these steps and data will be described, but the first look may skip past the events and go right into spectral analysis using the binned spectrum.
[At the time of this writing (February, 2001), the pipelines do not compute grating effective areas (ARFs). We are evaluating whether we can add this step to the pipelines.]
Event Processing
Grating Event Coordinates
``Level 1.5'' processing refers to the determination of zero-order
centroids, definition of spectral regions, and computation of
diffraction coordinates. The resulting products are a source table,
an augmented event-list, and a spatial region, with the event-list
being the fundamental product. (The standard product has the region
converted to FITS format and appended to the event file.)
The spatial region is used to classify the ``Level 1'' events geometrically according to the part of the spectrum in which they fall. Using the aspect solution, the instantaneous transformation is done using the event's three-dimensional chip coordinate, projection of zero-order centroid from sky to chip, location of the grating node, grating facet mean characteristics, and camera location along the translation direction (SIM_Z). If the detector is ACIS, the energy resolution is used to sort orders, according to a spatially-dependent detector response calibration file. The attributes of each photon thus determined are appended to the event-list as new columns. These columns are (TG stands for ``Transmission Grating''):
By default, tg_create_mask generates region sizes which are wide enough in the cross-dispersion direction to contain both source and local background. When binning (see about PHA files below), sub-selections are made with smaller cross-dispersion widths.
Details of the ASCII region format are here.
The FITS format is much more general, and more generally supported. For example, regions in this format can be used as Data-Model filters. An example columns and contents of a region FITS file are here.
The ASCII regions can be converted to FITS (and
optionally appended to another file) with dmrega2fits.
Zero-order Region and Source Detection
The zero-order region is a circle centered on the brightest source
detected near the aim-point. Pipeline processing only searches for
one source. The region size is adjusted to be many times larger than
the local point-spread-function. Parameters to
tgdetect may be customized to generate source tables for
multiple sources, or other sources in the field, and then input to
tg_create_mask to make multi-source spatial region
filters. Tgdetect uses the more general
celldetect program, but adds a few control parameters.
One important one is snr_ratio_limit, which specifies the
faintest sources to detect, compared to the brightest. It must be set
to less than 1.0 to detect additional sources in the field.
Aspect Dither, Aspect Offsets, and Coordinate Transformations
The spacecraft pointing is intentionally ``dithered'' in order to spread
signal over large regions, relative to a detector pixel, since the PSF
is comparable to a pixel, but the efficiency calibration has a larger
scale. A source image in detector coordinates will show a lissajous
pattern with periods of about 1000 seconds (or a filled square, if the
exposure is much longer).
In addition to controlled motion of the optical axis, there is uncontrolled (but measured) thermal flexure of the optical bench, resulting in science instrument module (SIM) motion. The six aspect parameters are stored in the aspect solution (asol) file, and in an aspect offsets (aoff) file. The latter differs in units, storing the optical axis coordinates as a difference from the mean value in detector pixels.
Grating event coordinates are computed by using the aspect solution to
project the zero-order sky centroid onto the detector at the time of
each event, then solving for the diffraction coordinates using the
chip coordinates (in 3 dimensions) of the detected photon, the
zero-order location, and grating geometry.
Source Table
The source table (src1a.fits file) for grating observations
differs a bit from the non-grating source case. The table contains an
explicit additional column, TG_SRCID, which gives a source
number. An implicit difference is that if there are multiple
observation intervals (``OBIs''), then the table is formed by merging
each OBI's table with the previous using source-matching to form a
unique source identifier column. This is because all OBI's are merged
later in the processing, and we want one binned spectrum for each
source, not multiple.
CCD PHA, Gain, Energy, and Order-Sorting
Diffraction gratings disperse light into multiple orders, according to
the one-dimensional grating equation: order*wavelength = Period *
sin(diffraction_angle). At any diffraction angle, different
wavelengths overlap. CCD energy resolution is enough to separate
orders, and hence, determine the wavelength and order for each photon
(TG_M and TG_LAM in the event file) using the
dispersed coordinate (TG_MLAM) and knowledge of the CCD
resolution and photon's CCD low-resolution energy.
The CCD gain is the calibration quantity which relates the detected signal (``PHA'') to nominal (or blurred) energy (ENERGY column in the event file). The gain depends upon the CCD, the CCD quadrant, and upon x,y location within the quadrant, and to some extent on energy. The gain also depends on epoch, mainly through operating temperature.
The blurring of the input photon energy to CCD detected ENERGY is stored in the Response Matrix Function, whose width, like the gain, also depends upon CCD and event location within the CCD.
Grating event order sorting is done by taking the ratio of the diffraction order*wavelength (uniquely determined from the diffraction angle) to the CCD ``wavelength''. If the value is within the CCD resolution of an integer value, then that integer value is assigned as the order.
The expected boundaries in CCD energy vs energy are pre-computed for each CCD, and for each position on each CCD. Since the values used originally came from CCD RMFs, the parameter in tg_resolve_events is named ``rmfile''. It is NOT an RMF however, and should not be confused with one. The currently used tables are called ``osip'' files, for ``Order Sorting and Integrated Probability''. They are maps vs chip position of the CCD main peak's energy width vs energy. The widths are approximately 3*sigma of the Gaussian fit to the main peak of the CCD response. Since the CCD resolution changes substantially with CHIPY, the width of the 3*sigma region is asymmetric in plus and minus orders. We have tuned the widths slightly from 3*sigma to accomodate gain correction inaccuracies and order crowding. The software truncates any overlap at the halfway point (i.e., order 2 is always from ratios between 1.5 and 2.5).
Prior to definition of the OSIP tables, a position-independent
order-sorting table was used. This had widths dependent on
CCD_ID, since the CCD energy resolution can change abruptly
between chips (e.g., Front Illuminated to Back Illuminated). This
table is somewhat broader than the OSIP, and also allows a
user-selectable ``fudge-factor'' on the width. This can be somewhat
more forgiving for troublesome data (unstable gain, CC-mode). However,
the effective area is not calibrated for arbitrary ``fudge-factors'';
this should not matter increased widths, but may for smaller regions
which truncate the PHA distribtions.. The old-style file is termed
``IRMF'', for Integrated Response Matrix File (but is NOT a
response matrix). The fudge factors are the energ_lo_adj and
energ_hi_adj parameters to tg_resolve_events.
LETG/HRC-S and Overlapping Orders
The HRC detectors have little energy resolution. Overlapping orders
cannot be sorted. The TG_M column is either -1 or +1, and
TG_LAM=abs(TG_MLAM), to preserve consistency in format with
the HETG event file.

A picture of the bow-tie and PI region geometries are shown in
the figures:
``Type I'' files have sequential channels stored in sequential rows, and the corresponding counts in another column. ``Type II'' is a transpose of this: the COUNTS and CHANNEL columns are array columns. For a single-spectrum file, there would be only one row.
``Type II'' is the default for Chandra grating spectra, since each observation is comprised of at least two orders (LETGS). For HETGS, we bin from -3 to +3 for two gratings by default, and thus have 12 counts histograms per observation. Instead of creating 12 files, we use one Type II format.
The CXC program used to bin Chandra spectra is tgextract.
Extensions to the Standard Formats
We have added a few useful fields to the PHA files.
Other coordinates are possible through custom use of tgextract.
It is up to the user to decide how (and whether) to combine and apply these background arrays.
Currently, the ratio of the background region width to the source region width is constant with wavelength, even for the ``bow-tie'' region. If this restriction is lifted, then the quantites are no longer scalar and will become array columns in the Type II PHA file, or regular columns in a Type I PHA file.
ColNo Name Unit Type Comment 1 SPEC_NUM Int2 Spectrum number 2 ROWID String[64] Source or a background region. 3 SHAPE String[16] Shape of region 4 TG_LAM angstrom Real4 Dispersion coordinate vector for SHAPE 5 TG_D degrees Real4 Cross-dispersion coordinate vector for SHAPE 6 R[2] (angstrom, degrees) Real4(2) Raduis vector for SHAPE 7 ROTANG degrees Real4 Rotation angle for SHAPE 8 COMPONENT Int2 Component number to which SHAPE belongs. 9 INCLUDE Int2 Inclusion (1;default) or exclusion (0) 10 TG_SRCID Int2 Source identification number 11 TG_M Int2 Diffraction orderIf there are both _UP and _DOWN background arrays, then there are three rows for each order. The SHAPE column is BOX for HETG, and could be either BOX for LETG or POLYGON for LETGS with the ``bow-tie'' filter. The box centers are given by the TG_LAM, TG_D columns, and the R column gives the full-width of the box.
| Grating | Minimum | Bin size | # bins |
| Wavelength | |||
| HEG | 1.0 | 0.0025 | 8192 |
| MEG | 1.0 | 0.0050 | 8192 |
| LEG | 1.0 | 0.0125 | 16384 |
| LEG/ACIS-S | 1.0 | 0.0125 | 8192 |
Coarser gridding, if desired for lower signal data, may be obtained with parameters to tgextract, or by applying ``grouping'' during a fit.
If the detector is ACIS, then orders -3 to +3 (excluding 0) are binned into the standard PHA file.
If the detector is HRC, then the orders are called -1 or +1; it must be understood that these are the sum of overlapping orders, to be deconvolved (if necessary) through modeling.
| Quantity | Description | Example CALDB File |
| GAIN | Required by acis_process_events, and important for order-sorting by tg_resolve_events. | acisD2000-01-29gainN0001.fits |
| WPSF | Width of PSF vs. off-axis angle, used by tg_create_mask to size the zero-order region radius and mask cross-dispersion widths. | hrmaD1996-11-01wpsfN0001.fits |
| OSIP | Order-Sorting, Integrated Probability | acisD2000-01-29osipN0004.fits |
| RMF | Integrated Response Matrix File, an alterntative to the OSIP | acisD1999-08-26irmfN0002.fits |
| GEOM | Contains geometry and grating parameters (periods) required for coordinate transformations in acis_process_events, hrc_process_events, and tg_resolve_events. | telD1999-07-23geomN0002.fits |
| TGMASK2 | Spatial bow-tie filter, used by tgextract on LETG/HRC-S data. | letgD1999-07-22regN0002.fits |
| TGPIMASK2 | HRC-S PI-wavelength region, used before tgextract | letgD1999-07-22pireg075_N0001.fits |
ACIS, Blocked Zero Order
For some bright sources (such as X-Ray binaries), the zero-order
region is blocked via on-board software. If ACIS is in timed-exposure
mode, then the best way to determine the zero-order sky centroid is
from the intersection of the frame-shift streak and the MEG trace. To
provide a template for editing, tg_create_mask can be run
(with possibly adjusted parameters) to create a mask for some bright
point in the spectrum (this uses the observational configuration and
produces regions with the correct roll). Then the output file can be
edited manually to offset the centers of the source and order regions.
If ACIS is in CC-mode and zero order is blocked, there is no frame-shift streak. In this case, one may be able to use an initial guess, then refine the position by bisecting the detector silicon edge features in the spectrum.
Neither of these work-arounds has been implemented automatically. These modes require intervention to create a valid region file (usually done with tgdetect and tg_create_mask), after which processing can proceed as usual with tg_resolve_events.
Pileup/Zero Order Centroid Error
For ACIS, bright zero-order sources can have severe pileup. (Pileup
is the coincidence of multiple photons in the same pixel during an
ACIS frame-time.) Severe pileup can distort the zero-order image
profile and cause the centroid to be erroneous. Symptoms of pileup
are an image which has the central peak suppressed or missing.
If the centroid is erroneous, then the wavelength scale will be offset in an antisymmetric fashion in each grating. Offsets can be different in HEG and MEG, depending on the direction of the zero-order centroid error.
This error can be handled by either manually editing the zero-order
centroid (in the src1a.fits file or in the region file), or
by averaging the wavelengths of plus and minus order feature
measurements.
Multiple Sources
Pipeline processing is only designed to process the brightest source
in the field. Multiple sources can be detected and a region mask
constructed by manual configuration of tgdetect to specify
the region of interest and a signal-to-noise ratio factor down from
the brightest source found.
Tg_create_mask will create masks for up to 10 sources.
Tg_resolve_events will apply this mask and attempt to resolve
orders and sources in spatially confused regions by the CCD
pulse-height, which for some source configurations can result in
unambiguous identification. The resulting event list has columns for
the source ID, and a column which has bits set (a source map) to
indicate other all possible sources, if the event is not
resolved. Quantitative use of these ambiguous events is left to the
user.
Extended Sources
Extended sources present special challenges to dispersed spectra.
Techniques will be refined and incorporated into CIAO as experience
accumulates. Currently, all extended source grating observations are
processed by the pipelines as if they were point sources. Custom user
reprocessing is necessary, whose nature depends upon the source extent
and the information desired.
Some help is available with current tools. For example, tg_create_mask can be run for one grating arm (HEG or MEG), which may be desired to omit collision of HEG and MEG near zero order. Then, the mask widths can be manually edited to make them very wide (or the width_factor_arms used to expand the region). Thus, tg_resolve_events will order-sort photons within that region, and they can be binned with tgextract for customized cross-dispersion regions.
Note, however, that the wavelengths are determined for a zero order point. Interpretation of wavelengths is ambiguous. Also, mkgarf computes the ARF for a point source. We currently have no provision for extended source grating ARFs.
The ARF is observation dependent, since it depends upon the zero-order position and dither pattern, which determine the mean position of wavelengths on the detector (whose QE(E) depends upon position) and the history of position with time. The RMF is weakly dependent upon the observation, particularly for HRC-S, whose 3-plate geometry deviates significantly from the ideal focal surface. (We do not support position-dependent RMFs, but count on sources being near the nominal aim-point.)
The grating ARFs can be made with the program, mkgarf. Since each detector element is independent and can have its own live-time, mkgarf works on one chip at a time. Some useful Grating Spectroscopy Scripts package multiple runs and the final merging.
Until CIAO 2.2, grating RMFs were on-the-shelf (in the calibration database). With CIAO 2.2, custom RMFs can be made with mkgrmf. The customization is solely in the choice of grids and spectral regions, but this important to facilitate analyses which use non-default wavelength gridding.
The rigorous definition of the responses can be found in Davis (2001).
Summary of Response Generating Software and Data
GUIDE is the initial implementation of S-lang based high-resolution spectroscopic functions in the integrated CIAO software. CIAO has a larger suite of generalized fitting routines (Sherpa) and a FITS output model format (Model Descriptor List, or MDL file). CIAO 3 will have a fully integrated S-lang interpreter, and will allow direct import of ISIS modules to extend or replace GUIDE.
Out-House
Some third-party options for spectral analysis and modeling are:
PINTofALE,
CHIANTI,
SPEX,
XSPEC,
XSTAR.
Spectroscopic Analysis Methods and Issues
Analysis of high-resolution spectra is best done on a feature-basis,
rather than by global fits. For example, one could perform fits of
APED models to an entire HETG spectral order (or orders) in XSPEC.
However, the data are now richer than the models, and the fit can
easily be meaningless in terms of individual line features due to
small inaccuracies in wavelength or emissivity. Instead, the
preferred approach is to identify and measure individual features or
small groups of features, and to then fit those results with physical
models, such as for determination of differental emission measures,
abundances, or densities. (Global fitting may still serve adequately
to characterize contnuua.)
Some Miscellaneous Items
The script, add_grating_orders adds plus and minus orders (same absolute value), and divides by the ARF.
Orders with different absolute values (i.e., 1,2,3) may be combined by either running tgextract once for each order with the proper gridding parameters (remember: tgextract scales by order), or by binning with dmcopy, e.g. (in sh syntax):
fevt=Evt/acisf01451_000N003_evt2.fits
flt_1="tg_srcid=1,tg_part=1,2,tg_m=-3,-2,-1,1,2,3"
flt_2="tg_d=-0.000663889:0.000663889,tg_lam=1:25.005"
fbin="bin tg_lam=1:25.00:0.01"
fout=iip_lc_pha.fits
dmcopy ${fevt}"[${flt_1},${flt_2}][${fbin}]" ${fout} clob+
(However, the result will not be in standard CXC PHA Type II grating
spectral format. That is left as an exercise for the reader. And
there may not be a totally-CIAO solution (yet).)
If orders are summed, then summed ARFs are also needed, on the proper
grid. The grid can be selected with a mkgarf parameter. The
summing can be done with dmtcalc and dmpaste.