Skip to the navigation links
Last modified: 21 Jun 2010
Where are the PDFs?

Source Position for Grating Data with a Piled or Blocked Zero Order

CIAO 4.2 Science Threads


Last Update: 21 Jun 2010 - An updated version of the Chandra ABC Guide to Pileup is now linked to this thread.


The tgdetect tool is used to find the centroid of the zero-order image in a grating event list. If the zero-order source is piled, there is the potential for the centroid to be incorrect due to the "hole" created in the data.

When observing a bright source (e.g. Cygnus X-2, ObsID 1102), the proposer may choose to have the zero-order region blocked via on-board software to avoid telemetry problems.

Either of these situations may result in a misplaced zero order, which affects event order sorting and will lead to incorrect wavelength scales.


To determine the correct source position for a grating observation with piled or blocked zero order. New spectral data is extracted with the updated source position.

Read this thread if:

you are working with an ACIS grating observation that suffers from pileup or was done with the zero order blocked.

Related Links:


About the Chandra Grating Data Archive and Catalog

The Chandra Grating Data Archive and Catalog (TGCat) is a browsable interface to analysis-quality spectral products (binned spectra and corresponding response files). TGCat makes it easy to find observations of a particular object, type of object, or type of observation, to quickly assess the quality and potential usefulness of the spectra with pre-computed graphics or custom-generated plots of binned and combined counts or fluxe spectra. Spectra, responses, event files, and summary products may be downloaded as a package.

TGCat runs standard CIAO tools, but also includes customized extractions for non-standard cases to refine the zeroth order position or to use regions appropriate for extended sources. Non-standard extractions details are provided in "verification and validation" comments for users.

Most public grating observations are available and new ones are added soon after they are released. See the list of of observations not included for exceptions. Many of the observations currently in this list will be included when we add enhanced processing for more difficult cases (multiple sources, very extended sources).

Please consider using the spectrum and responses (PHA, ARF, and RMF files) from TGCat in your analysis.

Get Started

Sample ObsID used: 1927 (HETG/ACIS-S, Vela X-1)

File types needed: evt1; asol1

This is a grating observation which suffers from pileup, as as evident in the "hole" in the source, seen in Figure 1. The same approach may be applied to an observation in which the zero order was blocked (Figure 2).

Accuracy of this method

The method described herein is the best available in CIAO at this time. The results of this thread should be used as a first approximation to the location of the zero order. Users may need to iterate manually to find a solution sufficiently accurate for reliable spectral analysis.

Be aware that the dmcoords output can be off by half a pixel, which can amount to more than a FWHM between plus and minus orders.

The most accurate way to determine the zero-order sky centroid is from the intersection of the frame-shift streak and the trace of the MEG arm. The tg_findzo script performs this calculation and is accurate to better than 0.1 pixel. Figure 3 shows line count profiles for plus and minus orders for different zero-order source position determinations. The top plot shows the profiles for the position found by dmcoords, while the bottom plot uses the position from tg_findzo.

Note that tg_findzo requires that ISIS be installed.

[Thumbnail image: The plots are wavelength [Angstrom] vs counts/bin.]

[Version: full-size, postscript]

[Print media version: The plots are wavelength [Angstrom] vs counts/bin.]

Figure 3: Comparison of line count profiles based on zero-order position determination

The top plot shows the profiles for the position found by dmcoords, while the bottom plot uses the position from tg_findzo.

Determine the Correct Source Location

Whether the observation is piled or blocked, it is difficult to determine accurately from the data file where the center of the source distribution should be. A workaround for this situation is to use the known position from SIMBAD, NED, or another reputable source.

From SIMBAD, we find that the known position for Vela X-1 in ICRS coordinates (ep=2000 eq=2000) is (RA,DEC) = (09:02:06.86, -40:33:16.9).

The CIAO grating tools require the source values to be in sky coordinates, so we need to use dmcoords to convert them. After setting the celestial coordinate format to sexagesimal, the tool is run in interactive mode:

unix% punlearn dmcoords
unix% pset dmcoords asolfile=pcadf097928048N002_asol1.fits
unix% pset dmcoords celfmt=hms
unix% dmcoords acisf01927_000N002_evt1.fits
dmcoords>: cel 09:02:06.86 -40:33:16.9
(RA,Dec):     09:02:06.859    -40:33:16.90
(RA,Dec):      135.52858      -40.55469 deg
THETA,PHI           35.8"         10.07 deg
(Logical):        4165.65       4118.84
SKY(X,Y):         4165.65       4118.84
DETX,DETY         4168.05       4109.21
CHIP ACIS-S3       286.00        253.26
TDET              4203.00       1955.26
GDPX,GDPY        32768.50      16384.50
GAC R,D            0.00          0.00
ENERGY 1.000000
ZO(RA,Dec):     09:02:06.860    -40:33:16.90
ZO(RA,Dec):      135.52858      -40.55469 deg
ZO SKY(X,Y):         4165.65       4118.84
ZO DETX,DETY         4168.05       4109.21
dmcoords>: q

The new source position in sky pixels is (4165.65, 4118.84).

Run tg_create_mask with New Source Position

While it is possible to manually input a source position into tgdetect, the tool will only use it as a starting point for the source detection. There is no guarantee that the output region will be centered on the coordinates we want.

Instead of running tgdetect again, we proceed to tg_create_mask. This tool determines the location of the HEG and MEG arms and creates a mask that will be used for the spectral extraction. The use_user_pars option and related parameters allow us to set the zero-order position, which is used exactly as it is input.

unix% punlearn tg_create_mask
unix% pset tg_create_mask infile=acisf01927_000N002_evt1.fits
unix% pset tg_create_mask outfile=1927_evt1_L1a.fits
unix% pset tg_create_mask use_user_pars=yes
unix% pset tg_create_mask last_source_toread=A
unix% pset tg_create_mask sA_id=1
unix% pset tg_create_mask sA_zero_x=4165.65
unix% pset tg_create_mask sA_zero_y=4118.84
unix% pset tg_create_mask sA_zero_rad=50
unix% pset tg_create_mask sA_width_heg=35
unix% pset tg_create_mask sA_width_meg=35
unix% tg_create_mask
Input event file or stack (acisf01927_000N002_evt1.fits): 
Output region file or stack (1927_evt1_L1a.fits): 
Observed grating type (header_value|HETG|HEG|MEG|LETG) (HETG|HEG|MEG|LETG|header_value|HEADER_VALUE) (header_value): 
Source A - x position of zero order (1:65536) (4165.65): 
Source A - y position of zero order (1:65536) (4118.84): 

The contents of the parameter file may be checked using plist tg_create_mask.

The mask file contains a circle for the source and two rotated boxes that define the grating arms. The source position matches that which we gave to tg_create_mask:

unix% dmlist 1927_evt1_L1a.fits"[cols shape,sky]" data
Data for Table Block REGION
Region Block: Circle(4165.65,4118.84,0)&Box(4092.58,4101.92,0,0)&Box(4090.76,4114.81,0,0)
ROW    SHAPE              SKY(X,Y)

     1 circle             (     4165.6499023438,     4118.839843750)
     2 rotbox             (     4092.5839843750,     4101.9169921875)
     3 rotbox             (     4090.7583007812,     4114.8095703125)

The mask region can also be overlaid on the event file:

unix% ds9 acisf01927_000N002_evt1.fits &

Then use Region → Load Regions → 1927_evt1_L1a.fits to display the regions, as shown in Figure 4.

[Thumbnail image: The region mask outlines the photons from the source and the grating arms.]

[Version: full-size]

[Print media version: The region mask outlines the photons from the source and the grating arms.]

Figure 4: Event file with region file overlaid

The regions are loaded from the L1a.fits file, which was made by tg_create_mask.

Creating a New Spectrum

Now that an accurate mask file exists, there will not be any issue with the source location in the rest of the spectral extraction process. From this point, continue with the grating analysis from the "Run tg_resolve_events" step of the HETG/ACIS-S or LETG/ACIS-S grating spectra thread.

Parameters for /home/username/cxcds_param/tg_create_mask.par

## TG_CREATE_MASK -- Calculates the mask regions of the grating arms
##    for AXAF flight L1 grating data files.  The output is a region
##    file(s) in sky coordinates.
        infile = acisf01927_000N002_evt1.fits Input event file or stack
       outfile = 1927_evt1_L1a.fits Output region file or stack
 input_pos_tab =                  Input table with zero order positions or stack
   grating_obs = header_value     Observed grating type (header_value|HETG|HEG|MEG|LETG)
     sA_zero_x = 4170.59          Source A - x position of zero order
     sA_zero_y = 4123.34          Source A - y position of zero order
     sB_zero_x = 1                Source B - x position of zero order
     sB_zero_y = 1                Source B - y position of zero order
     sC_zero_x = 1                Source C - x position of zero order
     sC_zero_y = 1                Source C - y position of zero order
     sD_zero_x = 1                Source D - x position of zero order
     sD_zero_y = 1                Source D - y position of zero order
     sE_zero_x = 1                Source E - x position of zero order
     sE_zero_y = 1                Source E - y position of zero order
     sF_zero_x = 1                Source F - x position of zero order
     sF_zero_y = 1                Source F - y position of zero order
     sG_zero_x = 1                Source G - x position of zero order
     sG_zero_y = 1                Source G - y position of zero order
     sH_zero_x = 1                Source H - x position of zero order
     sH_zero_y = 1                Source H - y position of zero order
     sI_zero_x = 1                Source I - x position of zero order
     sI_zero_y = 1                Source I - y position of zero order
     sJ_zero_x = 1                Source J - x position of zero order
     sJ_zero_y = 1                Source J - y position of zero order
(input_psf_tab = CALDB)           Calibration file with mirror psf vs off-axis angle
     (detector = header_value)    Detector type: ACIS | HRC-I | HRC-S | header_value
(radius_factor_zero = 50)              A scale factor which multiplies the app. calculation of the one-sigma zero order 
(width_factor_hetg = 35)              A scale factor which multiplies the one-sigma width of the heg/meg mask in the cro
ss-dispersion direction
(width_factor_letg = 40)              A scale factor which multiplies the one-sigma width of the letg mask in the cross-
dispersion direction
(r_astig_max_hetg = 0.5600000000000001) Max grating r coord (deg, along the dispersion) for HETG astigmatism calc
(r_astig_max_letg = 1.1)             Max grating r coord (deg, along the dispersion) for LETG astigmatism calc
(r_mask_max_hetg = 0.992)           Max grating r coord (deg) for HETG mask (to support offset pointing)
(r_mask_max_letg = 2.1)             Max grating r coordinate (deg) for LETG mask (to support offset pointing)
# --------------------------------------------------------------------------
# The parameters below are to be set ONLY if the user wants to use their
# own grating mask sizes instead of having the masks automatically generated.
# Only ONE input file, with up to 10 soures, can be processed using the user 
# params.  @ lists of multiple files can only be done with automated mask
# processing, or by running each file individually with hand set mask sizes.
# To start, you MUST set the following parameters:
# > pset tg_create_mask use_user_pars=yes last_source_toread=[letter A -> J]
# The parameter last_source_toread should be set to the last source letter
# for which you will enter parameters.  If you want to input 2 sources 
# (regardless of their source id's), the last_source_toread=B. Sections
# A -> J are for (upto) 10 user specified sources.  In each sections, 
# each source must have an ID, a zero order center position specified, 
# as well as the grating mask width(s).  An example with 2 HETG sources, 
# with src_id's 6 and 3:
# > pset tg_create_mask use_user_pars=yes last_source_toread=B
# > pset tg_create_mask sA_id=6 sA_zero_x=4762.34 sA_zero_y=2344.29 
# > pset tg_create_mask sA_zero_rad=35 sA_width_heg=25 sA_width_meg=28
# > pset tg_create_mask sB_id=3 sB_zero_x=4063.54 sB_zero_y=6346.62 
# > pset tg_create_mask sB_zero_rad=45 sB_width_heg=50 sB_width_meg=75
#              (units are all in sky pixels)
# NOTE: for Continuous Clocking data (CC mode), the HETG mask does not
# require the s#_width_heg, since the meg mask will encompase the entire
# data set.  HEG event processing in CC mode is done using the next 
# tool tg_resolve_events.
# --------------------------------------------------------------------------
(use_user_pars = yes)             Use the user defined mask parameters below: yes or no?
(last_source_toread = A)               Last source name to be read; character A->J.
# --------------------------------------------------------------------------
#                       Source A parameters
# --------------------------------------------------------------------------
        (sA_id = 1)               Source A - source id number
  (sA_zero_rad = 50)              Source A - radius of zero order mask
 (sA_width_heg = 35)              Source A - width of heg mask in sky pixels
 (sA_width_meg = 35)              Source A - width of meg mask in sky pixels
 (sA_width_leg = )                Source A - width of leg mask in sky pixels


04 Apr 2006 new for CIAO 3.3: original version
01 Dec 2006 reviewed for CIAO 3.4: no changes
11 Jan 2008 updated for CIAO 4.0: ds9 now automatically looks for the "[REGION]" extension in the region file, so it doesn't have to be specified; filenames and screen output updated for reprocessed data (version N002 files)
12 Feb 2009 updated for CIAO 4.1: images are inline; added more information about
13 Mar 2009 script actually named tg_findzo
16 Jun 2009 added About the Chandra Grating Data Archive and Catalog section
27 Jan 2010 reviewed for CIAO 4.2: no changes
21 Jun 2010 An updated version of the Chandra ABC Guide to Pileup is now linked to this thread.

Return to Threads Page: Top | All | Grating

Where are the PDFs?
Last modified: 21 Jun 2010