Chandra X-Ray Observatory (CXC)
Skip to the navigation links
Last modified: 3 Dec 2012

URL: http://cxc.harvard.edu/ciao/threads/wresp_multiple_sources/thread.html

Extract Spectrum and Response Files for a Field of Sources

CIAO 4.5 Science Threads


Overview

Synopsis:

A field of sources may be treated as multiple point sources that are coadded together for spectral analysis or as a single, multi-source region. The appropriate Response Matrix Files (RMFs) and Ancillary Response Files (ARFs) are created for each spectrum. In the latter case, the responses are weighted because the RMF and ARF vary with detector location: the RMF is defined as constant across FEF tiles, whose size depends on both the position on and focal-plane temperature of the ACIS chip, while the ARF varies with position in the detector plane.

Purpose:

Create a spectrum for a field of sources in two ways:

The specextract script automates the analysis for each case.

Related Links:

Last Update: 3 Dec 2012 - Review for CIAO 4.5; updated file versions


Contents


Get Started

Download the sample data: 3207 (ACIS-S, 3C 294)

unix% download_chandra_obsid 3207 evt2,asol,msk,bpix,pbk

A region file created by wavdetect is used as well; you should therefore have completed the Running wavdetect thread (or copy the region file listed below). The source list has been edited to remove the two sources associated with the cluster:

unix% cat sources.reg
# Region file format: CIAO version 1.0
ellipse(4182.497732,3621.173608,10.455548,6.450037,26.925381)
ellipse(3939.649524,3732.324762,4.798420,3.082648,12.363714)
ellipse(3807.310175,3754.790175,8.156800,5.292405,39.884795)
ellipse(3935.108132,3756.258462,6.148238,4.777950,42.764282)
ellipse(4126.380000,3766.280000,3.799803,2.404724,24.380137)
ellipse(4225.763077,3808.258462,7.622831,5.553007,170.424463)
ellipse(4312.560856,3826.923209,3.749302,2.677427,51.362851)
ellipse(3777.544348,3936.343188,8.421529,4.640209,13.663050)
ellipse(3736.511429,3966.791429,8.491634,7.168205,56.079864)
ellipse(4048.256393,3970.646230,3.254182,2.753219,49.490802)
ellipse(4298.990000,3995.178333,4.938663,3.087310,110.986889)
ellipse(4179.545556,4078.407500,2.633250,2.325793,161.765668)
ellipse(4440.130000,4091.625000,7.437549,5.133004,78.389632)
ellipse(3930.199184,4128.720000,5.923853,4.750415,164.068192)
ellipse(4190.332593,4140.584198,2.732475,2.336045,42.939774)
ellipse(3787.795556,4153.164444,6.157032,5.073007,60.858566)
ellipse(3936.110968,4186.429677,5.911227,4.109855,10.860226)
ellipse(4357.134737,4200.798947,5.333181,4.921092,105.836969)
ellipse(3688.104811,4356.666322,6.661713,4.641603,146.466341)
ellipse(4284.640000,3535.520000,4.242641,3.286335,0.000000)
ellipse(3992.787170,3703.172830,7.560371,4.764133,13.754230)
ellipse(3570.088485,3864.992727,6.107877,4.898941,173.922797)

Option A: Coadding Multiple Spectra

A pointlike spectrum, an aperture-corrected ARF, and an RMF are extracted for each source in the list. The spectra and responses are then coadded for the spectral analysis. For a step-by-step explanation of the analysis, read the Extract Spectrum and Response Files for a Pointlike Source thread and the Coadding Spectra and Responses thread.

Copy the sourcelist file and edit it to create a stack for input to specextract: Add "acisf03207N003_evt2.fits[sky=" to the beginning of each line and a closing brace (]) to the end. The resulting file looks like:

unix% cat sources.lis
acisf03207N003_evt2.fits[sky=ellipse(4182.497732,3621.173608,10.455548,6.450037,26.925381)]
acisf03207N003_evt2.fits[sky=ellipse(3939.649524,3732.324762,4.798420,3.082648,12.363714)]
acisf03207N003_evt2.fits[sky=ellipse(3807.310175,3754.790175,8.156800,5.292405,39.884795)]
acisf03207N003_evt2.fits[sky=ellipse(3935.108132,3756.258462,6.148238,4.777950,42.764282)]
acisf03207N003_evt2.fits[sky=ellipse(4126.380000,3766.280000,3.799803,2.404724,24.380137)]
acisf03207N003_evt2.fits[sky=ellipse(4225.763077,3808.258462,7.622831,5.553007,170.424463)]
acisf03207N003_evt2.fits[sky=ellipse(4312.560856,3826.923209,3.749302,2.677427,51.362851)]
acisf03207N003_evt2.fits[sky=ellipse(3777.544348,3936.343188,8.421529,4.640209,13.663050)]
acisf03207N003_evt2.fits[sky=ellipse(3736.511429,3966.791429,8.491634,7.168205,56.079864)]
acisf03207N003_evt2.fits[sky=ellipse(4048.256393,3970.646230,3.254182,2.753219,49.490802)]
acisf03207N003_evt2.fits[sky=ellipse(4298.990000,3995.178333,4.938663,3.087310,110.986889)]
acisf03207N003_evt2.fits[sky=ellipse(4179.545556,4078.407500,2.633250,2.325793,161.765668)]
acisf03207N003_evt2.fits[sky=ellipse(4440.130000,4091.625000,7.437549,5.133004,78.389632)]
acisf03207N003_evt2.fits[sky=ellipse(3930.199184,4128.720000,5.923853,4.750415,164.068192)]
acisf03207N003_evt2.fits[sky=ellipse(4190.332593,4140.584198,2.732475,2.336045,42.939774)]
acisf03207N003_evt2.fits[sky=ellipse(3787.795556,4153.164444,6.157032,5.073007,60.858566)]
acisf03207N003_evt2.fits[sky=ellipse(3936.110968,4186.429677,5.911227,4.109855,10.860226)]
acisf03207N003_evt2.fits[sky=ellipse(4357.134737,4200.798947,5.333181,4.921092,105.836969)]
acisf03207N003_evt2.fits[sky=ellipse(3688.104811,4356.666322,6.661713,4.641603,146.466341)]
acisf03207N003_evt2.fits[sky=ellipse(4284.640000,3535.520000,4.242641,3.286335,0.000000)]
acisf03207N003_evt2.fits[sky=ellipse(3992.787170,3703.172830,7.560371,4.764133,13.754230)]
acisf03207N003_evt2.fits[sky=ellipse(3570.088485,3864.992727,6.107877,4.898941,173.922797)]

We set an output root, 3c294, and allow specextract to number the spectra and responses (3c294_src1, 3c294_src2, etc):

unix% punlearn specextract
unix% pset specextract infile=@sources.lis
unix% pset specextract outroot=3c294
unix% pset specextract weight=no
unix% pset specextract correct=yes
unix% pset specextract asp=pcadf131209709N003_asol1.fits
unix% pset specextract mskfile=acisf03207_000N003_msk1.fits
unix% pset specextract badpixfile=acisf03207_000N003_bpix1.fits
unix% pset specextract pbkfile=acisf131209384N003_pbk0.fits
unix% pset specextract combine=yes

The weight parameter is set to "no" to tell the script to make a pointlike ARF and the correct parameter is set to "yes" so that arfcorr will be run to correct the ARF. The final pset - combine=yes - means the specextract will call combine_spectra to coadd the spectra and responses.

Run the tool with verbose=1 for screen output that reports the progress. Here we have run with verbose=0, as the screen output for 22 sources is too long to include.

unix% specextract mode=h

The contents of the parameter file may be checked with plist specextract.

Six files are created for each source in the list:

3c294_src1.arf            original source ARF
3c294_src1_asphist7.fits  aspect histogram
3c294_src1.corr.arf       corrected source ARF
3c294_src1_grp.pi         grouped source spectrum
3c294_src1.pi             ungrouped source spectrum
3c294_src1.rmf            source RMF

and the coadded spectrum and response files to use in the fitting are:

3c294_combined_src.arf
3c294_combined_src.pi
3c294_combined_src.rmf

Note that combine_spectra ignored any grouping flags in the input spectra, so the output spectrum is ungrouped.

Proceed to the Fitting section for instructions on how to analyse the data.


Option B: Extracting a Weighted Spectrum

A weighted spectrum and response files are extracted from the field of sources, essentially treating them as an extended source. For a step-by-step explanation of the analysis, read the Extract Spectrum and Response Files for an Extended Source thread.

unix% punlearn specextract
unix% pset specextract infile="acisf03207N003_evt2.fits[sky=region(sources.reg)]"
unix% pset specextract outroot=field
unix% pset specextract weight=yes
unix% pset specextract correct=no
unix% pset specextract asp=pcadf131209709N003_asol1.fits
unix% pset specextract mskfile=acisf03207_000N003_msk1.fits
unix% pset specextract badpixfile=acisf03207_000N003_bpix1.fits
unix% pset specextract pbkfile=acisf131209384N003_pbk0.fits

Run the tool with verbose=1 for screen output that reports the progress:

unix% specextract verbose=1 mode=h
  
Running: specextract
  Version:    20 November 2012

Setting bad pixel file for item 1 of 1 in input list

Extracting src spectra for item 1 of 1 in input list

Creating src ARF for item 1 of 1 in input list

Creating src RMF for item 1 of 1 in input list

Using mkacisrmf...

Grouping src spectrum for item 1 of 1 in input list

Updating header of field.pi with RESPFILE and ANCRFILE keywords.
Updating header of field_grp.pi with RESPFILE and ANCRFILE keywords.

The contents of the parameter file may be checked with plist specextract.

The output files to use in fitting are:

field.pi (ungrouped) or field_grp.pi (grouped)
field.warf
field.wrmf

Proceed to the Fitting section for instructions on how to analyse the data.


Fitting

Either source spectrum can now be analyzed - using the related ARF and RMF - in Sherpa, as described in the Introduction to Fitting PHA Spectra thread.

In Figure 1, the two spectra are plotted with the same X-axis scale:

unix% sherpa
-----------------------------------------------------
Welcome to Sherpa: CXC's Modeling and Fitting Package
-----------------------------------------------------
CIAO 4.4 Sherpa version 1 Friday, December 2, 2011

sherpa-1> load_pha("3c294_combined_src.pi")
read ARF file 3c294_combined_src.arf
read RMF file 3c294_combined_src.rmf
sherpa-2> load_pha(2,"field.pi")
read ARF file field.warf
read RMF file field.wrmf

sherpa> ignore(5,None)
sherpa> plot("data", 1, "data", 2)
[Thumbnail image: ]

[Version: full-size]

[Print media version: ]

Figure 1: Both spectra plotted in Sherpa

The coadded spectrum is in the top plot, and the full-field weighted spectrum in the bottom plot.


Improving the weights

In these examples, we used the detected counts to weight the responses, when what what we really should be using is the incident flux - i.e. the source spectrum before it passes through the telescope/detector system. If we assume an incident spectrum, we can correct the detected counts to give the incident flux, and use that for the weights. Since we do not know the source spectrum, we can use an iterative scheme - where the best-fit spectrum of the source from the previous iteration is used to correct the WMAP for the current iteration, until the results converge. An alternative scheme is to continue to use the detected counts - i.e. make no correction for the telescope/detector response - but only use a restricted energy range where the response + model does not vary much; an example being the soft energy band for clusters of galaxies.

The spectrumfile parameter of mkwarf accepts an ASCII file containing a model of the source spectrum, which may be created by running the Calculating Spectral Weights thread. Note that the energy range of the spectral model should match that used to create the WMAP.

Note that, unlike mkinstmap, the input spectrum does not need to be normalized to unit flux.


Analysis Caveats

The algorithm used to calculate the weighted responses requires that there are no spatial variations in the source spectrum.

Users should be cautious about analyzing the data for sources near the edges of the ACIS CCDs.

  1. For X-rays passing through the mirrors, the very bottom of each CCD is obscured by the frame store. As a result, some of the events in rows with CHIPY <= 8 are not detected. (The set of rows affected varies from CCD to CCD.) Since the CIAO tools do not compensate for this effect, the ARFs and exposure maps for sources in these regions may be inaccurate.

  2. For sources within about thirty-two pixels of any edge of a CCD, the source may be dithered off the CCD during part of an observation. The aspect histogram, which is used to create ARFs and exposure maps, is designed to compensate for this effect.

  3. An ARF calculated at the edge of a chip will not be accurate since the response tools for spectral extraction (specifically the ARF) assume that 100% of the PSF is enclosed - i.e. on the chip - all the time, which may not be the case. The amount of error introduced depends on how close the source is to the edge, the morphology of the source, and the characteristics of the PSF, which depends on the source spectrum.

  4. A contaminant has accumulated on the optical-blocking filters of the ACIS detectors, as described in the ACIS QE Contamination why topic. Since there is a gradient in the temperature across the filters (the edges are colder), there is a gradient in the amount of material on the filters. (The contaminant is thicker at the edges.) Within about 100 pixels of the outer edges of the ACIS-I and ACIS-S arrays, the gradient is relatively steep. Therefore, the effective low-energy (' 1 keV) detection efficiency may vary within the dither pattern in this region. The ARF and instrument map tools are designed to read a calibration file which describes this spatial dependence.



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


        infile = @sources.lis     Source event file(s)
       outroot = 3c294            Output directory path + root name for output files
        weight = no               Should response files be weighted?
       correct = yes              Apply point source aperture correction to ARF?
       bkgfile =                  Background event file(s)
       bkgresp = yes              Create background ARF and RMF?
           asp = pcadf131209709N003_asol1.fits Source aspect solution or histogram file(s)
       combine = yes              Combine ungrouped output spectra and responses?
       pbkfile = acisf131209384N003_pbk0.fits pbkfile input to mkwarf
       mskfile = acisf03207_000N003_msk1.fits mskfile input to mkwarf
      (rmffile = CALDB)           rmffile input for CALDB
        (ptype = PI)              PI or PHA
    (grouptype = NUM_CTS)         Spectrum grouping type (same as grouptype in dmgroup)
      (binspec = 15)              Spectrum grouping specification (NONE,1:1024:10,etc)
(bkg_grouptype = NONE)            Background spectrum grouping type (NONE, BIN, SNR, NUM_BINS, NUM_CTS, or ADAPTIVE)
  (bkg_binspec = )                Background spectrum grouping specification (NONE,10,etc)
       (energy = 0.3:11.0:0.01)   Energy grid
      (channel = 1:1024:1)        RMF binning attributes
  (energy_wmap = 300:2000)        Energy range for (dmextract) WMAP input to mkacisrmf
      (binwmap = tdet=8)          Binning factor for (dmextract) WMAP input to mkacisrmf
   (binarfwmap = 1)               Binning factor for (sky2tdet) WMAP input to mkwarf
       (dafile = CALDB)           dafile input to mkwarf
   (badpixfile = acisf03207_000N003_bpix1.fits) Bad pixel file for the observation
      (clobber = no)              OK to overwrite existing output file?
      (verbose = 1)               Debug Level(0-5)
         (mode = ql)              
    


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


        infile = acisf03207N003_evt2.fits[sky=region(sources.reg)] Source event file(s)
       outroot = field            Output directory path + root name for output files
        weight = yes              Should response files be weighted?
       correct = no               Apply point source aperture correction to ARF?
       bkgfile =                  Background event file(s)
       bkgresp = yes              Create background ARF and RMF?
           asp = pcadf131209709N003_asol1.fits Source aspect solution or histogram file(s)
       combine = no               Combine ungrouped output spectra and responses?
       pbkfile = acisf131209384N003_pbk0.fits pbkfile input to mkwarf
       mskfile = acisf03207_000N003_msk1.fits mskfile input to mkwarf
      (rmffile = CALDB)           rmffile input for CALDB
        (ptype = PI)              PI or PHA
    (grouptype = NUM_CTS)         Spectrum grouping type (same as grouptype in dmgroup)
      (binspec = 15)              Spectrum grouping specification (NONE,1:1024:10,etc)
(bkg_grouptype = NONE)            Background spectrum grouping type (NONE, BIN, SNR, NUM_BINS, NUM_CTS, or ADAPTIVE)
  (bkg_binspec = )                Background spectrum grouping specification (NONE,10,etc)
       (energy = 0.3:11.0:0.01)   Energy grid
      (channel = 1:1024:1)        RMF binning attributes
  (energy_wmap = 300:2000)        Energy range for (dmextract) WMAP input to mkacisrmf
      (binwmap = tdet=8)          Binning factor for (dmextract) WMAP input to mkacisrmf
   (binarfwmap = 1)               Binning factor for (sky2tdet) WMAP input to mkwarf
       (dafile = CALDB)           dafile input to mkwarf
   (badpixfile = acisf03207_000N003_bpix1.fits) Bad pixel file for the observation
      (clobber = no)              OK to overwrite existing output file?
      (verbose = 1)               Debug Level(0-5)
         (mode = ql)              
    

History

04 Jan 2005 updated for CIAO 3.2: added information about mkacisrmf, see Creating the RMF: mkrmf vs mkacisrmf section (deprecated)
20 Dec 2005 updated for CIAO 3.3: default value of dmextract error and bkgerror parameters is "gaussian"; updated screen output accordingly
01 Feb 2006 added information about specextract thread
01 Dec 2006 updated for CIAO 3.4: CIAO and ChIPS versions; set mkrmf verbosity > 0 for screen output; parameter file updates for mkwarf
02 Feb 2007 updated for CALDB 3.3.0.1 patch
06 Mar 2007 added ACIS dead area correction section and example of setting the pbkfile and dafile parameters
24 Jan 2008 updated for CIAO 4.0: rewritten with ObsID 3207; turn off the ACIS dead area correction in the mkwarf step (application of the dead area correction is on by default); show_wgt.sl not included in this release; links point to Sherpa Beta website ; removed outdated calibration updates
04 Feb 2009 updated for CIAO 4.1: "ARDLIB warning ... Assuming the first "interesting" extension." no longer printed; updated path for CALDB 4; input data must have a CTI_APP keyword
19 Feb 2009 added a section on Fitting
12 Jan 2010 updated for CIAO 4.2: calibration update - the ACIS QE contamination model has been upgraded to vN0005.
09 Mar 2010 The ACIS detector is calibrated over the range 0.224004 - 12 keV; choosing values outside this range may result in errors from mkwarf.
15 Dec 2010 updated for CIAO 4.3: new ACIS contamination calibration file
01 Mar 2011 CALDB 4.4.2 release: fix to the header of the ACIS QE contamination file. Prior to this release, CIAO would fail when trying to look up the contamination model correction for chips ACIS-8 (S4) and ACIS-9 (S5).
26 Apr 2011 install version 2 of the tools package for CIAO 4.3 to fix the mkrmf bug.
20 Jul 2011 required software updates are listed in Synopsis
05 Mar 2012 revised for CIAO 4.4 (previous title was “Weighting ARFs and RMFs: multiple sources”): thread rewritten to show two cases - stack of sources and single, multi-source region; analysis is done with the specextract script.
03 Dec 2012 Review for CIAO 4.5; updated file versions

Return to Threads Page: Top | All | Imag Spec

Last modified: 3 Dec 2012
CXC logo

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2012. All rights reserved.