Skip to the navigation links
Last modified: 14 Jan 2009
Where are the PDFs?

Grouping a Grating Spectrum

CIAO 4.2 Science Threads



Overview

Last Update: 14 Jan 2009 - updated for CIAO 4.2: ObsID 459 file versions

Synopsis:

In order to use Gaussian statistics to fit a model to a dataset it is often necessary to "group" the data - i.e. combine channels until you have enough counts - before use. Since it is not possible to group all the rows in a PHA2 spectrum file at once, the individual spectra first need to be "split" from the file with dmtype2split. Then the dmgroup tool is used to perform the desired grouping.

Purpose:

To show how to split a PHA2 file into multiple PHA1 files, and then group the individual spectra.

Read this thread if:

you want to group the data in a PHA file.

Related Links:




Contents



Get Started

Sample ObsIDs used: 459 (HETG/ACIS-S, 3C 273); 460 (LETG/HRC-S, 3C 273)

File types needed: pha2



Split the PHA File

The tool dmtype2split creates a PHA1 file for selected rows of a PHA2 file. It is only necessary to set the infile and outfile parameters:

  • infile: a row filter is used to select the desired spectra from the input file. Note that there is a rows parameter in dmtype2split, but it has been deprecated and will be removed in the future. The Examining Grating Spectra thread explains the rows in the PHA2 file.

  • outfile: the number of outfile names given must match the number of rows in the infile parameter. The name of the output block - usually [SPECTRUM] - must be specified.

Single spectrum

To obtain one particular spectrum from the PHA2 file:

unix% dmtype2split "acisf00459N004_pha2.fits[#row=1]" "459_heg_m1.fits[SPECTRUM]"

The 459_heg_m1.fits output file contains the HEG -3 order spectrum. This information is stored in the header of the new file:

unix% dmkeypar 459_heg_m1.fits TG_M echo+
-3
unix% dmkeypar 459_heg_m1.fits TG_PART echo+
1

Users are not limited to row filters, however. You can explicitly pick the data using any DM filter, such a grating part and order:

unix% dmtype2split "acisf00459N004_pha2.fits[tg_m=-3,tg_part=1]" "459_heg_m1_b.fits[SPECTRUM]"

This filter doesn't require you to know which row of the PHA file corresponds to which spectrum.


Multiple spectra

If no filter is specified, the tool creates a PHA1 file for every row in the input. For this case, we must specify a stack of output filenames:

unix% dmtype2split hrcf00460N004_pha2.fits "leg_m1.fits[SPECTRUM], leg_p1.fits[SPECTRUM]"

The output names could also have been provided in an external file:

unix% cat output.lis 
leg_m1_b.fits[SPECTRUM]
leg_p1_b.fits[SPECTRUM]

unix% dmtype2split hrcf00460N004_pha2.fits @output.lis

Either command will create two spectra, one from each row in the HRC-S/LETG file. The content of the parameter file may be examined with plist dmtype2split.



Group the Spectra

The PHA1 files are simply grouped with dmgroup. In this example, we add every 10 bins in the original file together:

unix% dmgroup infile="leg_p1.fits[SPECTRUM]" outfile=leg_p1_bin10.pha \
      binspec="1:16384:10" grouptypeval="" grouptype=BIN ycolumn="counts" \
      xcolumn="channel"

The dmgroup help file explains all the available grouping options. The content of the parameter file may be examined with plist dmgroup.

Resolution and default grids

The PHA2 file default grid oversamples the instrumental resolution by a factor of about 4-5. While the desired bin size depends upon the analysis, a factor of 2 can always be accommodated without degrading the resolution. For detection and identification of spectral features without an RMF-based model, grouping to the FWHM of the resolution may be desirable. For line profile modeling using a grating RMF, oversampling is appropriate. For continuum modeling, grouping by much more than the resolution for sufficient statistical significance may be preferred. For modeling of lines and continuum with current incomplete atomic line models, oversampling provides a more reliable empirical continuum determination.

For any grouping, use of the grating RMF will correctly represent the convolved model.

For guidance, here are the resolution (FWHM) and default grids (from tgextract or mkgrmf) for each of the gratings:

Grating Part Resolution (Å) Default Binsize (Å) Oversampling Factor
HEG 0.012 0.0025 4.8
MEG 0.023 0.005 4.6
LEG 0.05 0.0125 4.0



Summary

If you have not yet created instrument response files (gRMFs and gARFs), follow the appropriate CIAO Grating threads to do so.

Otherwise, proceed to the Sherpa grating threads for information on how to model and fit the data:




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


        infile = hrcf00460N004_pha2.fits Input type II file
       outfile = @output.lis      Enter output file name(s)
         (rows = )                Row numbers
      (clobber = no)              OK to overwrite existing output file(s)?
      (verbose = 0)               Verbosity level
         (mode = ql)              
    


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


        infile = leg_p1.fits[SPECTRUM] Input dataset name
       outfile = leg_p1_bin10.pha Output dataset name
     grouptype = BIN              Grouping type
  grouptypeval = 0                Grouping type value
       binspec = 1:16384:10       Binning specification
       xcolumn = channel          Name of x-axis
       ycolumn = counts           Name of y-axis
      (tabspec = )                Tab specification
    (tabcolumn = )                Name of tab column
     (stopspec = )                Stop specification
   (stopcolumn = )                Name of stop column
    (errcolumn = )                Name of error column
      (clobber = no)              Clobber existing output file?
      (verbose = 0)               Verbosity level
    (maxlength = 0)               Maximum size of groups (in channels)
         (mode = ql)              
    

History

08 Apr 2005 original version, new for CIAO 3.2
12 Apr 2005 changes made to Resolution and default grids section (renamed from "Binning to instrumental resolution")
05 Dec 2005 reviewed for CIAO 3.3: no changes
01 Dec 2006 reviewed for CIAO 3.4: no changes
11 Jan 2008 updated for CIAO 4.0: specify output block name ("[SPECTRUM]") for dmtype2split; Sherpa links point to the Sherpa Beta website
12 Feb 2009 updated for CIAO 4.1: Sherpa links point to 4.1 website
14 Jan 2009 updated for CIAO 4.2: ObsID 459 file versions

Return to Threads Page: Top | All | Grating

Where are the PDFs?
Last modified: 14 Jan 2009