Examining Grating Spectra and Regions: PHA2 files
![[CXC Logo]](../../imgs/cxc-logo.gif)
CIAO 4.0 Science Threads
OverviewLast Update: 6 Jun 2008 - added "opt=all" to dmcopy commands so all blocks are kept in the grating files Synopsis: An overview of displaying grating data Type II PHA files and the source and background extraction regions. Related Links:
|
Contents
- What is a PHA2 File?
- Examining the Files with Prism
- Displaying the Spectrum
- Displaying ACIS and HRC Extraction Regions
- History
-
Images
- Prism view of ACIS-S HETG dataset
- Prism view of ACIS-S LETG dataset
- Expanded view of BIN_LO column
- Prism view of HRC-S LETG dataset
- Prism view of HRC-I LETG dataset
- View of order +1 spectrum with Prism
- View of order +1 spectrum with ChIPS
- View of order +/-1 spectrum with Sherpa: count rate per keV
- View of order +/-1 spectrum with Sherpa: counts
- Data with source and background regions overlaid
- HRC/LETG data with bow-tie extraction region
What is a PHA2 File?
A Type II PHA file is a standard FITS format in which each row contains array columns. The PHA file is a product of standard data processing and is identified by the pha2.fits extension; note that the "2" in the filename refers to the fact that it is a level=2 data product, not that it is a Type II file. In the case that the user has to manually reprocess an event file (e.g. when applying an updated order sorting table), the PHA2 spectrum file is obtained from the level 2 event file by tgextract; see the HETG/ACIS-S Grating Spectra for an example of this.
The SPECTRUM block of a PHA2 file has 13 columns of data:
ColNo Name Description
1 SPEC_NUM Spectrum Number
2 TG_M Diffraction order (m)
3 TG_PART Spectral component (HEG, MEG, LEG, HESF parts)
4 TG_SRCID Source ID, output by tgdetect
5 X X sky coord of source
6 Y Y sky coord of source
7 CHANNEL[8192] Vector of spectral bin numbers.
8 COUNTS[8192] Counts array (a spectrum)
9 STAT_ERR[8192] Statistical uncertainty (error) on counts colum
10 BACKGROUND_UP[8192] Upper Background count vector.
11 BACKGROUND_DOWN[8192] Lower Background count vector.
12 BIN_LO[8192] Bin boundary, left edge
13 BIN_HI[8192] Bin boundary, right edge
There are two columns that are especially relevant when doing analysis:
- TG_M indicates the order of the spectrum (+/- 1, +/-2, +/- 3)
- TG_PART indicates the spectral component / grating arm (1 = HEG, 2 = MEG, 3 = LEG)
Examining the Files with Prism
Sample ObsIDs used: 459 (HETG/ACIS-S 3C 273); 460 (LETG/HRC-S, 3C 273); 1198 (LETG/ACIS-S, 3C 273); 1800 (LETG/HRC-I, PKS2155-304)
File types needed: evt2; pha2
ACIS-S HETG/LETG Observations
We can use prism to examine the PHA2 file for ObsID 459:
unix% prism acisf00459N002_pha2.fits &
which will give you something like
Figure 1
.
In this example, there are twelve rows - all the +/-
orders for both HEG and MEG - for the observation. The
columns CHANNEL, COUNTS,
BIN_LO, etc. are all so-called "vector
columns"; each contains a vector of elements which, in
this example, is 8192 elements long.
An ACIS-S/LETG observation (ObsID 1198)
looks similar in
Prism
but only contains 6 rows (+/-
orders for the LEG).
Each vector column can be viewed as follows:
unix% prism acisf00459N002_pha2.fits & left-click on column of interest (to select column) Navigate menu -> Expand Column (to expand column)
Figure 3
shows the
(partial) result of the expansion of column
BIN_LO.
HRC-S/HRC-I LETG Observations
Examining an HRC-S/LETG observation (ObsID 460) is done in the same way as an ACIS grating observation:
unix% prism hrcf00460N004_pha2.fits &
but
there is an important difference in the results. As seen in the
Prism display
,
there are only two rows for the LEG observation.
HRC-S cannot resolve
orders and the COUNTS in the +/- 1 order are in fact the
total counts of
all orders combined.
Also, the BIN_LO and BIN_HI
columns should be considered for reference only;
they actually represent the boundary wavelength of the +/- 1 order alone,
while photons from all orders are included in the spectra.
The same holds true for HRC-I/LETG observations, as seen
Figure 5
in the example of ObsID
1800.
Displaying the Spectrum
With Prism
The quickest way to display one of the spectra of a PHA2 file is with Prism. For example a user who wants to take a quick look at BIN_LO vs. COUNTS for the order +1 (TG_M=1) of the HEG spectrum (TG_PART=1) should do the following (ObsId 459):
unix% prism acisf00459N002_pha2.fits & middle-click on row #4 (to select spectrum) left-click on BIN_LO column (to select X-axis column) left-click on COUNTS column (to select Y-axis column) Vizualization menu -> Interactive plot (to view the plot)
For this example, the line style was set to "noline" and
the "cross" symbol was used. As visible from the
output in Figure 6
, the
plot is good for a general overview only (are there
enough counts, are there striking features, etc.).
The Introduction
to ChIPS thread (S-Lang or Python) has more information on
plotting data.
With ChIPS
In order to display a spectrum with ChIPS, we need to specify which row in the file should be plotted. This example uses row 4, the +1 order HEG spectrum for the observation, chosen by the "[#row=4]" filter. Note that this example uses the Python interface to ChIPS:
unix% chips chips> make_figure("acisf00459N002_pha2.fits[#row=4][cols bin_lo,counts]") chips> set_curve("symbol.style=none") chips> set_plot_title("ACIS+HEG order=+1")
These commands produce the plot shown in Figure 7
. Quit ChIPS
before continuing:
chips> quit
With Sherpa
Sherpa can also be used to plot a PHA2 spectrum. Sherpa reads all the rows and allows you to specify individual ones for plotting or fitting purposes:
unix% sherpa ----------------------------------------------------- Welcome to Sherpa: CXC's Modeling and Fitting Package ----------------------------------------------------- Version: CIAO 4.0 sherpa> load_pha("acisf00459N002_pha2.fits") statistical errors were found in file 'acisf00459N002_pha2.fits' but not used; to use them, re-read with use_errors=True read background_up into a dataset from file acisf00459N002_pha2.fits read background_down into a dataset from file acisf00459N002_pha2.fits ... sherpa> plot_data(3) sherpa> add_plot() sherpa> grid_objects(1,2,0.18,0.18) sherpa> plot_data(4, clearwindow=False) sherpa> current_plot("all") sherpa> limits(X_AXIS, AUTO, 5)
Figure 8
shows the plot of
the HEG -1 order (row 3, upper drawing area) and +1
order (row 4, lower drawing area) that is created. To
plot the data in CHANNEL vs. COUNTS:
sherpa> erase sherpa> get_data(3).units="channel" sherpa> get_data(4).units="channel" sherpa> plot_data(3) sherpa> add_plot() sherpa> grid_objects(1,2,0.18,0.18) sherpa> plot_data(4, clearwindow=False)
These commands create Figure
9
.
sherpa> exit Goodbye.
Displaying ACIS and HRC Extraction Regions
Each pha2 file has a second block, named REGION, which stores the regions used by tgextract to extract the source and background spectra.
There are three regions associated with each order: source, upper background, and lower background. For an ACIS/HETG observation, this gives 36 regions: 12 spectral components (+/- 3, +/- 2, and +/- 1 for HEG and MEG) times 3 regions apiece (source and two backgrounds).
To look at the columns of a REGION block:
unix% dmlist "acisf00459N002_pha2.fits[REGION]" cols -------------------------------------------------------------------------------- Columns for Table Block REGION -------------------------------------------------------------------------------- ColNo Name Unit Type Range 1 SPEC_NUM Int2 1:32767 Spectrum number 2 ROWID String[64] Source or a background 3 SHAPE String[16] Shape of region 4 TG_LAM angstrom Real4 0: 400.0 Dispersion coordinate 5 TG_D degrees Real4 -2.0: 2.0 Cross-dispersion coordinate 6 R[2] (angstrom , degrees) Real4(2) -Inf:+Inf Raduis vector for SHAPE 7 ROTANG degrees Real4 -360.0: 360.0 Rotation angle for SHAPE 8 TG_PART Int2 0:9 Grating part index (HEG=1, MEG=2, LEG=3) 9 TG_SRCID Int2 1:32767 Source identification number 10 TG_M Int2 -62:62 Diffraction order 11 COMPONENT Int2 - Component number
ds9 cannot display these regions as they are written in the pha2 file. In order to view them, we need to rename the (TG_LAM,TG_D) columns to (X,Y) so that ds9 knows how to interpret them. We will also need to create images in (TG_LAM,TG_D) coordinates, on which we can display the regions.
The following dmcopy commands create image and region files for the 1st and 3rd orders of the MEG arm:
unix% dmcopy \
"acisf00459N002_evt2.fits[bin tg_lam=0:30:0.08,tg_d=-0.01:0.01:0.00008][tg_m=-1,1,tg_part=2]" \
459_order1.fits opt=all
unix% dmcopy \
"acisf00459N002_evt2.fits[bin tg_lam=0:15:0.08,tg_d=-0.01:0.01:0.00008][tg_m=-3,3,tg_part=2]" \
459_order3.fits opt=all
unix% dmcopy \
"acisf00459N002_pha2.fits[region][tg_m=1,tg_part=2][cols x=tg_lam,y=tg_d,*]" \
region_order1.fits opt=all
unix% dmcopy \
"acisf00459N002_pha2.fits[region][tg_m=3,tg_part=2][cols x=tg_lam,y=tg_d,*]" \
region_order3.fits opt=all
In creating the images, the filter includes + and - orders to obtain more events in the image. Since the regions are the same for +/- orders, it is only necessary to copy one (the + orders were used here). The image limits are typical for ACIS/HETG observations, but will need to be adjusted for other configurations.
To display the event files with the regions overlaid:
unix% ds9 -tile 459_order1.fits -region region_order1.fits -cmap a\
459_order3.fits -region region_order3.fits -cmap a
which produces Figure 10
.
We can see that all events are contained within at least one
extraction region.
For HRC/LETG data, a bow-tie extraction region is used. Using similar dmcopy commands as for the ACIS data:
unix% dmcopy \
"hrcf00460N004_evt2.fits[bin tg_lam=0:210:0.25,tg_d=-2:2:0.0008][tg_m=-1,1,tg_part=3]" \
hrc_order1_img.fits opt=all
unix% dmcopy \
"hrcf00460N004_pha2.fits[REGION][tg_m=1,tg_part=3][cols x=tg_lam,y=tg_d,*]" \
hrc_region_order1.fits opt=all
To display the file and regions:
unix% ds9 hrc_order1_img.fits -region hrc_region_order1.fits -cmap b &
which produces Figure 11
.
History
| 01 Jun 2004 | reviewed for CIAO 3.2: no changes |
| 06 Dec 2005 | updated for CIAO 3.3: version numbers |
| 01 Dec 2006 | updated for CIAO 3.4: ChIPS and Sherpa versions |
| 24 Jan 2008 | updated for CIAO 4.0: updated ChIPS and Sherpa syntax |
| 06 Jun 2008 | added "opt=all" to dmcopy commands so all blocks are kept in the grating files |
