{Please send comments to: dph@space.mit.edu}

Analysis Guide for Chandra High Resolution Spectroscopy

(Revision 2001.10.02 CIAO 2.2)
IIPeg spectrum



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.

Concepts and Resources

Instruments' Basics

Fundamental theory and operation of the Chandra diffraction grating instruments are given in the Proposers' Observatory Guide (POG). Such useful details as effective areas, spectral resolution, background levels, can be found there.

Instrument Models

The MARX simulator is the calibration model for HETG, but it also simulates LETG and any combination of grating and focal-plane cameras. The output is event-based, and utilities exist which can format output into FITS event files and an aspect solution, which can then be processed with CIAO tools.

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:

  • ahelp hetg
  • ahelp letg
  • ahelp tg | grep '(tools)'
  • ahelp grating
  • ahelp gratings

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.

Processing Overview

Processing of Chandra high resolution spectra can be divided into two major areas: pre-PHA and post-PHA. Pre-PHA encompasses all the event and aspect processing required to assign wavelength coordinates and to compute responses. The event-list with grating coordinates can be binned into the counts spectrum, or ``PHA'' file. Post-PHA proccessing is the application of responses and measurement of the binned spectrum to derive source properties and physical source models consistent with the observed spectrum.

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 (October, 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''):

Source identifier index. Up to ten sources can be resolved simultaneously. The pipeline only detects the brightest source.
The spatial part of the spectrum: 0 - zero-order; 1 - HEG; 2 - MEG; 3 - LEG; 99 - unresolved.
Diffraction coordinate. This is a signed, real value, and is the photon's diffraction angle in degrees from the zero order centroid, in the direction parallel to the dispersion. The focal-length used is the Rowland spacing - the separation of the grating node and detector on an axial ray.
The cross-dispersion angle, in degrees, also using the Rowland spacing as the focal-length. Note that that the grating plate scale is a slightly different from that of imaging-mode. Grating mode will maintain square pixels in tg_r,tg_d angular coordinates, but will not be the same as sky X,Y angles, by the factor of about 8637/10062 = 0.858
The order times wavelength, in Angstroms.
If the detector has sufficient energy resolution (e.g., is ACIS), then the order can be resolved using the photon ENERGY coordinate (linearized, scaled PHA). This is a signed integer diffraction order. Unresolved photons are assigned to order 99.
If the photon is resolved, then this is the wavelength, in Angstroms. TG_LAM is non-negative; unresolved photons are assigned wavelengths of 0.0.
This is a bitmap used to record whether a photon's source is ambiguous. If there are multiple sources in the field, then HETG orders will cross. It is possible that the CCD ENERGY will not resolve the photon uniquely. If not, a bit is set for each possible source. Note that only one diffraction coordinate is stored. It is up to user-modeling to either apply source knowledge to use these photons in the spectrum.

Spatial Region Files

The geometry for LETG and HETG spatial regions is shown schematically in the following two figures. Since positive spacecraft roll rotates the grating arms clockwise in the sky x-y pixel-plane, these examples are for rolls of a little less than 180 degrees, and negative orders are to the right.

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.

HETG spatial region LETG spatial region
The spatial regions which are used to label events are stored in two formats, ASCII and FITS. In CIAO 2.2 and later, the ASCII region will no longer be needed, but will be supported for back-compatibility. The region is written by tg_create_mask and applied by tg_resolve_events. The FITS-format is required by tgextract to bin spectra using default parameters.

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. The 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).

It is possible to bypass the OSIP tables and to specify order-sorting limits which are constant with wavelength (see the order-sorting figures below), via the osort_hi and osort_lo parameters of tg_resolve_events.

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.

Graphical Examples

Sky Image, with regions colored MEG order-sorting HEG order-sorting MEG events, diffraction coordinatesHEG events, diffraction coordinates

Event Filters

There are some events which can easily be identified as being of other than cosmic origin (source or background). Some are routinely filtered out of the Level 1 file to make the Level 2 events file (*evt2.fits), and before binning spectra. Others are either more subjective, or not well enough understood yet to be done automatically. Some important filters are:

Bad Pixels (standard):
These are hot or dead detector pixels, for which valid events cannot be determined. Bad pixel lists come as a calibration database file of permanently known bad pixels, and as an obervation-specific file of transient bad pixels (as for a temporarily corrupted CCD bias map). These are merged and applied during standard processing.

Grade (ACIS only; standard):
relates to geometry of PHA signals an event ``island'' (3x3 or 5x5 neighborhood). Valid grades are 0, 2, 3, 4, and 6. A different grade-set would require a different QE calibration. No difference in grade-filters are used for grating data.

Energy (ACIS only; non-standard):
Background photons (or piled zero-order) can have non-physical energies. The size of the event file can be reduced by keeping only events with ENERGY<10000, for example.

Status (standard):
Event files have a STATUS column, which is a bitmap. Each bit pertains to a different instrumental characteristic which can generate a bad event. If status is non-zero, the event gets filtered.

Streak (ACIS-only; non-standard):
CCD S4 (chip_id=8) has a spurious background signal which looks like horizontal (parallel to CHIPX) streaks in an image. These can create significant artifacts in a grating spectrum. The destreak program (two varieties: stand-alone C, or CIAO version) can be used to look for the correlations along a row in the same frame, and remove them or flag them. This should be the last filter applied.

``Bow-Tie'' (HRC-S only; standard):
LETG/HRC-S spectra have significant instrumental background. The width of the spectrum increases with wavelength, due to Rowland geometry astigmatism. The bow-tie is a spatial region filter applied before binning to follow the astigmatic width and reduce the area binned in the cross-dispersion region. The bow-tie also defines a background binning region which maintains a constant background to source region size.

PI-wavelength region (LETG/HRC-S only; non-standard):
HRC-S does not have enough spatial resolution to sort orders, but there is a non-uniform PI distribution which depends upon energy. Calibration analysis has shown that some non-source events can be discriminated via their PI values. There is a small loss of source photons, and there are several region filters with different rejection criteria. (One of these may become part of pipeline processing).

A picture of the bow-tie and PI region geometries are shown in the figures:

LETGS Bow-Tie Spatial Filter LETGS PI Region Filter

Afterglow (ACIS-only; standard):
Cosmic rays and other energetic particles can leave a large amount of charge in a pixel. The initial charge is rejected by it's grade (geometric distribution), but the decaying charge can masquerade as photon events. Acis_detect_afterglow is run routinely by the pipelines to detect these glowing pixels statistically, and a status bit is set for the ones found. This is not foolproof, however, since bright emission lines can have a high probability of being flagged; but then, they also have a high probability of having ``pileup''. (For the brightest lines in the brightest sources, e.g., Capella, the effect is about 3%.)

Binned Spectra (``PHA'' Files)

After events have been resolved and filtered, they can be binned into one-dimensional counts histograms. If the detector is ACIS, they can be further separated by grating and order. The histogram files are called ``PHA'' files for historical reasons. ``PHA'' originally stood for ``Pulse Height Analyzer'', or ``Pulse Height Amplitude.'' Today, it refers more to a file format for storing binned spectra. We have adopted two such standard formats, PHA ``Type I'' and ``Type II'' FITS files, but added some Chandra-specific components.

``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.
is a column which gives a serial index to the row.

is the diffraction order.

is an index to the type of grating (1 =>HEG; 2=>MEG; 3=>LEG).

is a source identifier, and is equal to the source number in the source table.

X, Y
are columns giving the sky centroid of the zero-order. This is used when computing the effective area, since the chip-boundaries in the spectrum depend upon where the source is placed on the detector.

These are by default wavelength coordinate grids. The standard format does not store the energy coordinate, since it is deferred to the response matrix. Since grating spectra are high-resolution (i.e., the response matrix is nearly diagnonal), the energy coordinate is well defined. We use wavelength, since that is a linear coordinate for transmission grating spectra. These are also array columns in Type II files. For back-compatibility, we store them in increasing energy order (but linearly in wavelength).

Other coordinates are possible through custom use of tgextract.

These are background counts arrays, binned in regions adjacent to the source region. (Default spectrum widths are given in the tgextract help file.) Background events undergo the same event-resolution process as source events. In fact, tg_resolve_events does not distinguish between background or source; that is only done when binning. There are two arrays because the geometry is not necessarily symmetric, especially for HETGS near the zero-order, or if there are confusing sources in the field.

It is up to the user to decide how (and whether) to combine and apply these background arrays. Background rejection is high with ACIS because of the order-sorting. Two non-background components of these pseudo-background arrays are the faint wings of the cross-dispersion line spread function (LSF), and charge aliasing during the ACIS frame shift. Since the charge still collects during the 41 msec frame shift, the charge which would have been in a few pixels is spread among them all. The fraction of charge spread is equal to the frame-shift-time divided by the frame time, wwhich for the default timed exposure, is 0.041/3.200 = 0.0128.

These are the divisors by which to scale the background counts arrays to represent the expected background counts in each of the source, BACKGROUND_UP, and BACKGROUND_DOWN regions (I.e., the value should be greater than 1.0; default values are near 5.0, so that the combined background regions have ten times the width of the source region). If the values are constant with row (spectrum order and grating), then they are keywords in the header. If not, then they become columns in the SPECTRUM table.

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.

The binning region(s) are attached as an extension in the PHA file, as a block named ``REGION''. A region extension has the columns:

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)   Radius 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 order

If 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.

Default Spectrum Grids

The default grids for binned spectra were chosen to be easy to remember and to slightly oversample the resolution. The first order grids are:
GratingMinimumBin size# bins
HEG 1.0 0.0025 8192
MEG 1.0 0.0050 8192
LEG 1.0 0.0125 16384
LEG/ACIS-S1.0 0.0125 8192
Higher-order grids are obtained by dividing the first order value by the order. (This makes the minimum wavelength bin well below where there is any effective area (24 keV for 2nd order, 36 for 3rd, etc), but maintains a constant geometrical binning region.)

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.

Summary of Grating-specific Reference Data

The following table lists the most important calibration database files used in processing events up to binned spectra.
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
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
IRMF [superceded by OSIP, or osort_lo,osort_hi in CIAO 2.2] Integrated Response Matrix File, an alterntative to the OSIP acisD1999-08-26irmfN0002.fits

Cases Requiring Customized Processing


ACIS can be run in Continuous-Clocking (CC) mode for high time resolution. Spatial information in the cross-dispersion direction is lost. We can still process HETGS data, however, into binned MEG and HEG spectra. In this mode, orders still separate according to pulse-height. The odd-orders' pulse-height regions are unambiguously from MEG. If even, we assume to be HEG since MEG even order efficiency is low (e.g., MEG ``2nd'' order is really mostly HEG 1st; MEG ``4th'' is really HEG 2nd, and so on). The pipeline applies an iterative step in processing CC-mode, first assuming events are from MEG, and guessing the CHIPY position given the zero-order position and CHIPX, then if the order is odd, it re-resolves it assuming HEG.

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, or by bisecting hyperbolas in ENERGY vs X,Y plots.

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.

High-Resolution Spectral Responses

There are two fundamental components to the spectral response: the effective area, and line-spread-function (LSF). We represent these in the FITS formats (defined in various OGIP (Office of Guest Investigator Programs) memos) as the Auxiliary Response Function (ARF) and Redistribution Matrix Function (RMF). The ARF is effective area vs. energy function. The RMF is the probability vs output channel for a given input energy. We store both in the traditional format as a table in increasing energy order, but we use grids which are linear in wavelength, since the gratings disperse linearly in that coordinate.

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.

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 primarily in the choice of grids and spectral regions, but this important to facilitate analyses which use non-default wavelength gridding. Mkgrmf also incorporates effects due to off-axis angle and cross-dispersion width on the LSF.

The rigorous definition of the responses can be found in Davis (2001).

Summary of Response Generating Software and Data

Make a grating ARF for a specified chip, order, and source position given an aspect histogram.
(New tool for CIAO 2.2) Make a grating RMF given a grid specification. The grating RMF is the redistribution from input energy to output channel in the dispersion direction. It is nearly diagonal for any single order. It depends upon the cross-dispersion region. Default regions are wide enough to contain 98% of the signal. Narrower regions may be desired in crowded regions, or in attempt to improve the resolution by omitting a scattering halo. Mkgrmf applies this cross-dispersion factor to the resulting matrix.
Add the per-chip ARF pieces into one ARF, applying weighting by EXPOSURE.
the sum of the Good Time Intervals (GTI) times the live-time-factor (or 1-DTCOR, the Dead Time CORrection factor). DTCOR for ACIS comes from the header, and for HRC, from a table. For ACIS, there is one GTI table per CCD.
program to compute the aspect histogram for a given chip. The aspect histogram is the duration of the pointing, weighted by the GTI and DTCOR, for each aspect offset bin in the dither pattern. It is a table of duration vs. x-offset and y-offset. The sum of the duration column is the EXPOSURE.
asp_apply_sim: [superceded by asphist in CIAO 2.2]
A program to add the SIM (science instrument module) offsets to the optical axis offsets before making an aspect histogram. This reduces the dimensionality from 6 to 3 without losing any information crucial to the response. (But it does lose information crucial for coordinate transformations, so don't use the product for event-processing.) Also adds some range-keywords to the header, which are used by asphist.
asp_calc_offsets: [superceded by asphist in CIAO 2.2]
program to convert the aspect solution into into offsets.
the calibration database, which is the repository of all instrument calibration files (such as quantum efficiency, mirror area, and geometry). Many parameters can simply say ``CALDB'', and the proper file will be looked up by date of observation, for time-dependent calibration quantities.
Analysis Reference Data Library: an interface to the CALDB and other reference data. The ARDlib interface isolates the mission dependence from the generic object (such as a quantum efficiency vs energy). It can provide a many-to-one construction of CALDB files to one analysis object (such as by multiplying filter and detector efficiencies). It has a large parameter file, ardlib.par. See Davis (1999) for a description of ARDLib.
the Order Sorting and Integrated Probability table is used by tg_resolve_events for order-sorting, but it also contains the Integrated Probability: the fraction of the CCD response enclosed within the order-sorting energy limits. This is analogous to a PSF-fraction used in imaging analysis, and is a necessary factor in computing the ARF with mkgarf.

Response Gridding Issues

Generally, the energy grids of and ARF and RMF must match, and they should be at resolution high enough to separate important features of the models. In practice, for convenience, and since the grating spectrometers are high resolution, we make the PHA, ARF, and RMF have the same energy grids. The PHA grid should still be thought of as a ``smeared'' wavelength grid, and the ARF and RMF as having the model grids. It is a convenience of high-resolution that we can make them the same (usually; see Spectral Analysis).

Spectral Analysis

Software Packages


There are many options and modes for spectral analysis. ISIS is a stand-alone, S-lang based package especially developed by CXC for analysis of Chandra grating spectra and as an interface to the Astrophysical Plasma Emissivity Database (APED). ISIS is programmable and extensible. It can also do more than high-resolution spectroscopy; J.Davis has implemented a pile-up model for imaging CCD spectroscopy which is now part of the ISIS distribution.

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 2.2 has a fully integrated S-lang interpreter, and will allow direct import of ISIS modules to extend or replace GUIDE. While ISIS can be imported, connections have not yet been made between underlying libraries (that is a major CIAO 3 effort).


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

RMF-less analysis:
With high-resolution data, it is not always necessary to use the RMF (line-profile). If only the integrated flux is of interest, and there are no instrumental features within a spectral feature, then it suffices to divide the counts by the ARF to get a ``smeared'' flux per bin. (Both ISIS and Sherpa/GUIDE support RMF-less, or more accurately, diagonal RMF analysis.)
Order summing?
Summing of orders is definitely useful for inspection, visualization and presentation. It is not clear that it is better than joint-fitting for analysis, since each order contains slightly different information (or even systematic errors). ISIS and Sherpa/GUIDE support multiple-order fitting with a single model. If orders are combined, care must be taken to combine ARFs in a meaningful way.

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):

       fbin="bin tg_lam=1:25.00:0.01"
       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.

Multi-order Response:
For LETG/HRC-S observations, a multi-order response may be required to assess higher order counts, especially for hard continuum sources. The multi-order response is either the sum over m of ARF(m)*RMF(m), or the support of multiple RMF,ARF pairs for a single PHA file and model. Neither are adequately supported yet, but both are in progress (as of 2001.10.02). The former implementation has restrictive gridding issues: to add the responses, all have to be on the same grid, and the grid has to be as fine as the highest resolution you wish to obtain. The latter allows each to be optimally gridded, but entails multiple model evaluations for each grid.
Parametric or responsive fitting:
Emission lines can either be fit by using parametric models, such as a sum of Gaussian components, or by using the LSF contained in an RMF, and folding the model through the response. Parametric fits can be done either on counts or fluxed counts. RMF-based fitting removes line width and shape parameters, and also automatically applies the energy dependence of the resolution.
Spectral-Timing Analysis
This is not explicitly supported in CIAO or ISIS, but it is possible to construct data products for spectral-timing work. Dmcopy can be used to bin into a wavelength-time image. Lightcurve can be used with dm-filters to form light curves in spectral regions, and an exposure record. Mean ARFs can be used if bins are comparable to the dither period (~1000 s), or if features of interest are not near chip gaps.

Calibration issues

Information on the HETGS calibration status and accuracy can be found at HETG User Information page. LETGS information is on the LETG User Information page.

David Huenemoerder (617-253-4283)
MIT Center for Space Research
NE80-6023, Cambridge, MA 02139

Updates: 2001 February 26
2001 June 7 (added table of contents)
2001 October 2 (CIAO 2.2 revisions)