Create PHA Background File for Use in XSPEC
[CIAO 3.4 Science Threads]
OverviewLast Update: 1 Dec 2006 - updated for CIAO 3.4: corrected a filename Synopsis: The grating threads show how to create a PHA spectrum file for grating observations. The files can then be read into Sherpa, and analyzed as desired. However, if you wish to use XSPEC, the file needs to be in a format that it can read. Purpose: Run the tg_bkg script to take the output from the grating threads and produce a PHA background file suitable for use in XSPEC. Read this thread if: you prefer to do your grating analysis in XSPEC. If you do all your fitting and modeling in Sherpa, you DO NOT need to complete this thread. Related Links:
|
Contents
Background Information
tg_bkg makes a background file that is compatible with XSPEC. Sherpa will be able to use it, but it can already read the arrays directly from the PHA file. The script sums the BACKGROUND_UP and BACKGROUND_DOWN columns and adjusts the scale factor keyword (BACKSCAL) accordingly. Since it is designed to keep the same format as the PHA file, i.e. the rows in both files correspond to one another, it is a more convenient way of inspecting the background.
It is important to note that these are estimates to the background. Since they are binned adjacent to the spectrum source region, they will have a contribution from the wings of the PSF. They also have a contribution from signal aliased in chipy during the frame shift at the level of (usually) 41 ms frame shift / 3200 ms integration / 1024 rows, or 1.25e-5 times the source rate (HEG+MEG or LEG, all orders). The source count rate at that diffraction angle gets smeared during the frame shift.
Get Started
Sample ObsID used: 459 (HETG/ACIS-S, 3C 273)
File types needed: pha2
This thread uses the tg_bkg script. The most recent version of tg_bkg is v1.1 (22 July 2005):
unix% grep Id `which tg_bkg` # Id: tg_bkg,v 1.1 2005/07/22 dph
Please check that you are using the most recent version before continuing. If you do not have the script installed or need to update to a newer version, please refer to the Scripts page.
It is assumed that you have already completed the HETG/ACIS-S, LETG/ACIS-S, LETG/HRC-S, or LETG/HRC-I grating spectra thread and therefore have a PHA spectrum file.
Run the tg_bkg Script
The only input required is the PHA file, so we are now ready to run tg_bkg. Executing the script without any input shows the syntax:
unix% tg_bkg USAGE: /soft/ciao/contrib/bin/tg_bkg tg_pha_in [tg_bkg_pha_out] Sum BACKGROUND_UP, BACKGROUND_DOWN from CXC TG PHA file Write out background PHA file (of same type as input) Adjust BACKSCAL Input file may be compressed. Output is never compressed. If output filename is omitted, the ouput file has the input name with _bkg appended. EXAMPLES: tg_bkg acisf0145N003_pha2.fits acisf0145N003_bkg_pha2.fits tg_bkg acisf0145N003_pha2.fits tg_bkg acisf0145N003_pha2.fits.gz acisf0145N003_bkg_pha2.fits tg_bkg acisf0145N003_pha2.fits.gz (This is a shell script; you can alter it to suit your own tastes.)
First, make sure the input file has write permission (since the script updates the BACKFILE keyword), then run the script:
unix% chmod +w acisf00459N002_pha2.fits unix% tg_bkg acisf00459N002_pha2.fits Input file has been changed, BACKFILE keyword has been added
The newly created file may be examined with dmlist:
unix% dmlist acisf00459N002_pha2.fits_bkg cols -------------------------------------------------------------------------------- Columns for Table Block SPECTRUM -------------------------------------------------------------------------------- ColNo Name Unit Type Range 1 SPEC_NUM Int2 1:32767 Spectrum Number 2 TG_M Int2 -62:62 Diffraction order (m) 3 TG_PART Int2 0:99 Spectral component (HEG, MEG, LEG, HESF parts) 4 TG_SRCID Int2 1:32767 Source ID, output by detect 5 X pixel Real4 0.50: 65534.50 X sky coord of source 6 Y pixel Real4 0.50: 65534.50 Y sky coord of source 7 CHANNEL[8192] Int2(8192) 1:32767 Vector of spectral bin numbers. 8 BIN_LO[8192] angstrom Real8(8192) 0: 400.0 Bin boundry, left edge 9 BIN_HI[8192] angstrom Real8(8192) 0: 400.0 Bin boundry, right edge 10 COUNTS[8192] Int2(8192) - User defined column
The COUNTS column is the sum of the BACKGROUND_UP and BACKGROUND_DOWN columns from the original pha2.fits file.
Summary
This thread is now complete; the file can be read into XSPEC and used for grating analysis.
History
04 Jan 2005 | reviewed for CIAO 3.2: no changes |
28 Jul 2005 | tg_bkg script updated to v1.1: fixed Mac OS X awk syntax problem |
06 Dec 2005 | reviewed for CIAO 3.3: no changes |
01 Dec 2006 | updated for CIAO 3.4: corrected a filename |