Skip to the navigation links
Last modified: 9 Mar 2010
Where are the PDFs?

Weighting ARFs and RMFs: multiple sources

CIAO 4.2 Science Threads



Overview

Last Update: 9 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.

Synopsis:

If you want to extract the spectrum of a large region, or combine data from multiple regions (either from the same or different observations), then you may need to use a weighted ARF and RMF for the spectral analysis. This is 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:

To create a spectrum that represents a number of point sources present in the field, and a corresponding ARF and RMF that can be used to analyze it.

Read this thread if:

you are working with an ACIS observation and need to create weighted response files.

Calibration Updates:

Related Links:




Contents



Get Started

Sample ObsID used: 3207 (ACIS-S, 3C 294)

File types needed: evt2; pbk0

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). We edit the source list to remove the sources associated with the cluster and call the file sources.reg:

unix% cat sources.reg
# Region file format: CIAO version 1.0
ellipse(3939.4357,3732.243,7.142696,4.653104,172.86662)
ellipse(3935.1591,3755.9318,5.739083,4.011079,30.437381)
ellipse(4126.3902,3766.8049,8.421373,4.722948,171.29588)
ellipse(4225.8158,3808.7368,4.642884,2.922545,23.596452)
ellipse(4312.625,3827.1739,3.669518,2.628658,51.097196)
ellipse(4048.2967,3970.6626,3.217036,2.852803,29.930597)
ellipse(3914.5,3975.1957,4.103609,2.641764,11.690158)
ellipse(4179.5663,4078.3072,4.651295,3.218534,8.70706)
ellipse(3930.2083,4128.6458,5.829675,4.386953,148.60169)
ellipse(4190.5162,4140.3595,4.932062,3.468396,147.4741)
ellipse(3935.91,4186.88,6.375586,5.434096,62.644568)
ellipse(3993.3478,3702.9348,6.323811,4.862423,31.230777)

To save time, we filter the event list using this list:

unix% punlearn dmcopy
unix% dmcopy "acisf03207N002_evt2.fits[sky=region(sources.reg)]" sources.evt2


Create the WMAP

The mkwarf tool takes as input an image of the field - in detector coordinates - which we refer to as the WMAP. This image can either be stored in the WMAP block of a spectrum created by dmextract or as an image by using the DM binning syntax with dmcopy.

A. Using dmextract

To create a WMAP block in a PHA file, dmextract must be given a binning specification for its wmap option. As the WMAP must be in detector coordinates, and the suggested binning factor is 8, we have

unix% punlearn dmextract
unix% pset dmextract infile="sources.evt2[bin pi]"
unix% pset dmextract outfile=sources.pi 
unix% pset dmextract wmap="[bin det=8]"
unix% dmextract
Input event file  (sources.evt2[bin pi]): 
Enter output file name (sources.pi): 

The file sources.pi contains both the source spectrum and WMAP. You can check the parameter file that was used with plist dmextract.

Note that dmextract allows additional filters to be specified for the wmap parameter. This means that you can filter the WMAP on energy - e.g. the 0.5 to 2.0 keV band - without having to have a separate WMAP:

unix% pset dmextract wmap="[energy=500:2000][bin det=8]"

Running dmlist on the output file shows the WMAP block:

unix% dmlist sources.pi blocks
 
--------------------------------------------------------------------------------
Dataset: sources.pi
--------------------------------------------------------------------------------
 
     Block Name                          Type         Dimensions
--------------------------------------------------------------------------------
Block    1: WMAP                           Image      Int2(1024x1024)
Block    2: SPECTRUM                       Table         4 cols x 1024     rows
Block    3: GTI7                           Table         2 cols x 1        rows
Block    4: GTI6                           Table         2 cols x 4        rows
Block    5: GTI3                           Table         2 cols x 8        rows
Block    6: GTI2                           Table         2 cols x 4        rows
Block    7: GTI1                           Table         2 cols x 6        rows

B. Using dmcopy

If we use dmcopy directly, we are free to choose any energy range for the WMAP. Here we use the soft band (0.5 to 2.0 keV), which effectively count-weights the averaging of the responses, whereas use of harder energies, where the background dominates, would use area-weighting. As with the dmextract option, we use the detector coordinate system with a binning factor of 8:

unix% dmcopy "sources.evt2[energy=500:2000][bin det=8]" sources.wmap8

This command creates a WMAP image in detector coordinates:

unix% dmlist sources.wmap8 blocks
 
--------------------------------------------------------------------------------
Dataset: sources.wmap8
--------------------------------------------------------------------------------
 
     Block Name                          Type         Dimensions
--------------------------------------------------------------------------------
Block    1: EVENTS_IMAGE                   Image      Int2(1024x1024)
Block    2: GTI7                           Table         2 cols x 1        rows
Block    3: GTI6                           Table         2 cols x 4        rows
Block    4: GTI3                           Table         2 cols x 8        rows
Block    5: GTI2                           Table         2 cols x 4        rows
Block    6: GTI1                           Table         2 cols x 6        rows


Create the weighted ARF (mkwarf)

Two methods of creating WMAPs were illustrated In the previous section. Here we show how each of them is used in mkwarf.

A. Using the WMAP from a PHA file

Unlike mkarf, mkwarf must be given an energy grid that lies within the range of energies of the FEF file. The ACIS detector is is calibrated over the range 0.224004 - 12 keV. An easy way to find the allowed range is to run mkwarf with an energy range that definitely extends outside the allowed values - we use 0.01 to 11 keV here.

In this run, the WMAP created with dmextract (sources.pi) is used:

unix% punlearn mkwarf
unix% pset mkwarf infile="sources.pi[WMAP]"
unix% pset mkwarf outfile=sources.warf
unix% pset mkwarf pbkfile=acisf131209384N002_pbk0.fits
unix% pset mkwarf dafile=CALDB
unix% pset mkwarf weightfile=sources.wgt
unix% pset mkwarf egridspec=0.01:11:0.01
unix% mkwarf
Input detector WMAP (sources.pi[WMAP]): 
Output weighted ARF file (sources.warf): 
Output FEF weights (sources.wgt): 
Input Spectral weighting file (<filename>|NONE) (): 
Output energy grid [kev] (0.01:11:0.01): 
Parameter block file (acisf131209384N002_pbk0.fits): 
# mkwarf (CIAO 4.2): The following error occurred 286 times:
        ERROR: Min egridspec energy=0.01 below min FEF energy=0.224004

In some cases, there will be an error about the upper limit as well:

# mkwarf (CIAO 4.2): The following error occurred 286 times:
        ERROR: Max egridspec energy=13 above max FEF energy=12

Change the energy range to begin at 0.23 and re-run mkwarf:

unix% pset mkwarf egridspec=0.23:11:0.01
unix% mkwarf
Input detector WMAP (sources.pi[WMAP]): 
Output weighted ARF file (sources.warf): 
Output FEF weights (sources.wgt): 
Input Spectral weighting file (<filename>|NONE) (): 
Output energy grid [kev] (0.23:11:0.01): 
Parameter block file (acisf131209384N002_pbk0.fits): 

The output from mkwarf is a weighted ARF (sources.warf) and a weights file (sources.wgt). You can check the parameter file that was used with plist mkwarf.


B. Using an image as a WMAP

Since we used the WMAP within the PHA file as the value for the infile parameter in the previous mkwarf run, we had to specify the extension name of the block containing the WMAP data (i.e. the "[WMAP]" DM filter). Here we use a similar filter to avoid seeing several warning generated by ardlib; it is not required that you specify the block. Remember that now we are using the WMAP created with dmcopy (sources.wmap8).

Since the energy range was determined in the previous example, it is not necessary to run the tool twice:

unix% punlearn mkwarf
unix% pset mkwarf infile="sources.wmap8[EVENTS_IMAGE]"
unix% pset mkwarf outfile=sources_img.warf
unix% pset mkwarf pbkfile=acisf131209384N002_pbk0.fits
unix% pset mkwarf dafile=CALDB
unix% pset mkwarf weightfile=sources_img.wgt
unix% pset mkwarf egridspec=0.23:11:0.01
unix% mkwarf
Input detector WMAP (sources.wmap8[EVENTS_IMAGE]): 
Output weighted ARF file (sources_img.warf): 
Output FEF weights (sources_img.wgt): 
Input Spectral weighting file (<filename>|NONE) (): 
Output energy grid [kev] (0.23:11:0.01): 
# mkwarf (CIAO 4.2): WARNING: Input image name was "EVENTS_IMAGE" instead of "WMAP".  Will attempt to use.

A few notes on warning messages:

  • The warning message seen above can be ignored in this case, since we know that sources.wmap8 was created as a WMAP image (i.e. the detector coordinate system was used).

  • If your source is near a chip boundary, then mkwarf may not be able to determine the chip location of every pixel in the WMAP (this has to do with the lack of SIM info in the image); details are available in this FAQ. This will lead to warnings such as:

    Couldn't determine chip position for pixel: (3884.500000,3588.500000) with value=1.000000. Skipping pixel
    Couldn't determine chip position for pixel: (3884.500000,3596.500000) with value=5.000000. Skipping pixel
    

    In the vast majority of cases, the number of counts ignored (i.e. the sum of the "value" of each ignored pixel) is much smaller than the total signal in the WMAP. However, this may not be the case for small regions near chip boundaries. dmstat may be used to determine the sum of all pixels in the WMAP for comparison to the sum of the ignore pixel values.


C. Which FEF was Used by mkwarf

Unlike mkarf, mkwarf does not need to be told the FEF file to use, as it can query the CALDB to find the matching file (see "ahelp caldb" for more information on the syntax of the CALDB tool interface). To find out which FEF file it used, either set verbose=2 before running the tool (it gets printed out during execution), examine the FEFFILE keyword in the file header, or use the acis_fef_lookup script (available from the Scripts page), specifying a chipid of none. We show examples of these methods here (the output assumes that the $CALDB environment variable is set to /soft/ciao/CALDB):

unix% mkwarf verbose=2
...
# mkwarf (CIAO 4.2): Mapping response regions to FEF regions

# mkwarf (CIAO 4.2): CALDB: Using CALDB 4

# mkwarf (CIAO 4.2): CALDB: Query resolved to
"/soft/ciao/CALDB/data/chandra/acis/fef_pha/acisD2000-01-29fef_pha_ctiN0004.fits" 

# mkwarf (CIAO 4.2): Mapping response regions to FEF regions. Done
...

and

unix% dmkeypar sources.wgt FEFFILE echo+
/soft/ciao/CALDB/data/chandra/acis/fef_pha/acisD2000-01-29fef_pha_ctiN0004.fits

and

unix% acis_fef_lookup sources.evt2 none 1 1
/soft/ciao/CALDB/data/chandra/acis/fef_pha/acisD2000-01-29fef_pha_ctiN0004.fits[2]


Create the weighted RMF (mkrmf)

The mkrmf tool uses the weightfile from mkwarf to create the weighted RMF. The tool queries the CALDB for the correct FEF file and the energy axis grid is ignored since the grid is read from the weights file. (Although the axis1 parameter is ignored, a syntactically-correct value must be entered; this example uses axis1="energy=0:1".)

If you don't want any information printed to the screen, leave the verbosity setting for mkrmf at 0.

unix% punlearn mkrmf
unix% pset mkrmf infile=CALDB
unix% pset mkrmf outfile=sources.wrmf
unix% pset mkrmf axis1="energy=0:1"
unix% pset mkrmf axis2="pi=1:1024:1"
unix% pset mkrmf weights=sources.wgt
unix% mkrmf verbose=1
name of FEF input file (CALDB): 
name of RMF output file (sources.wrmf): 
axis-1(name=lo:hi:btype) (energy=0:1): 
axis-2(name=lo:hi:btype) (pi=1:1024:1): 

        *** mkrmf parameter inputs ***
                  input file: CALDB
                 output file: sources.wrmf
                weights file: sources.wgt
                       axis1: energy=0:1
                       axis2: pi=1:1024:1
                    log file: STDOUT
                       axis3: none
                       axis4: none
                       axis5: none
                   threshold: 1.00e-05
                output formt: legacy
        clobber(1=yes, 0=no): 0
               verbose level: 1


WARNING: 0 parameters to search on
WARNING: Did not find 'GRATTYPE' in supplied header, skipping it

CALDB -> /soft/ciao/CALDB/data/chandra/acis/fef_pha/acisD2000-01-29fef_pha_ctiN0004.fits


Atten: grid input,"energy=0:1", is ignored as a weights file, "sources.wgt", is found.

Total 41 regions to be processed:
--- Region #1 processed
--- Region #2 processed
...
--- Region #41 processed

The output from mkrmf is a weighted RMF (sources.wrmf). You can check the parameter file that was used with plist mkrmf.



Updating the header (dmhedit)

The file header needs updating in order for Sherpa to automatically pick up the ARF and RMF when the source is read in:

unix% punlearn dmhedit
unix% dmhedit infile=sources.pi filelist= operation=add key=RESPFILE value=sources.wrmf
unix% dmhedit infile=sources.pi filelist= operation=add key=ANCRFILE value=sources.warf


Fitting

The source spectrum (sources.pi) can now be analyzed - using the ARF sources.warf and RMF sources.wrmf - in Sherpa, as described in the Introduction to Fitting PHA Spectra thread.

To fit source and background spectra simultaneously with distinct RMFs and ARFs, follow the Independent Background Responses thread.



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.

  • If multiple datasets are being combined to create a single WMAP, the observations must have very similar SIM_Z values. As a change in SIM_Z of 1 mm corresponds to a change of 41.7 pixels (i.e. 1/pixel size) and the shift should be << 32 pixels, a suggested tolerance is 0.1 mm (~ 4 pixels).

  • The energy bin size is important when creating a weighted ARF, since it is also used by mkrmf to create the weighted RMF. Although both mkwarf and mkrmf will run successfully if the bin size is not specified (and so defaults to 1.0 keV), the results will not adequately describe the instrument response, leading to obviously-incorrect fits. Therefore, when mkwarf is run, the bin size should always be specified for the egridspec parameter.

Analysis Caveats

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. 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/dmextract.par


#--------------------------------------------------------------------
#
# DMEXTRACT -- extract columns or counts from an event list
#
#--------------------------------------------------------------------
        infile = sources.evt2[bin pi] Input event file 
       outfile = sources.pi       Enter output file name
          (bkg = )                Background region file or fixed background (counts/pixel/s) subtraction
        (error = gaussian)        Method for error determination(poisson|gaussian|<variance file>)
     (bkgerror = gaussian)        Method for background error determination(poisson|gaussian|<variance file>)
      (bkgnorm = 1.0)             Background normalization
          (exp = )                Exposure map image file
       (bkgexp = )                Background exposure map image file
      (sys_err = 0)               Fixed systematic error value for SYS_ERR keyword
          (opt = pha1)            Output file type: pha1 
     (defaults = ${ASCDS_CALIB}/cxo.mdb -> /soft/ciao-4.0/data/cxo.mdb) Instrument defaults file
         (wmap = [bin det=8])     WMAP filter/binning (e.g. det=8 or default)
      (clobber = no)              OK to overwrite existing output file(s)?
      (verbose = 0)               Verbosity level
         (mode = ql)              



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


        infile = sources.pi[WMAP] Input detector WMAP
       outfile = sources.warf     Output weighted ARF file
    weightfile = sources.wgt      Output FEF weights
  spectrumfile =                  Input Spectral weighting file (<filename>|NONE)
     egridspec = 0.23:11:0.01     Output energy grid [kev]
       pbkfile = acisf131209384N002_pbk0.fits Parameter block file
    (threshold = 0)               Percent threshold cut for FEF regions
      (feffile = CALDB)           FEF file
      (mskfile = )                Mask file
     (asolfile = )                Stack of aspect solution files
       (mirror = HRMA)            ARDLIB Mirror specification
 (detsubsysmod = )                Detector sybsystem modifier
       (dafile = CALDB)           Dead area file
    (ardlibpar = ardlib)          Parameter file for ARDLIB files
      (geompar = geom)            Parameter file for Pixlib Geometry files
      (clobber = no)              Clobber existing outputs
      (verbose = 0)               Tool chatter level
         (mode = ql)              



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


        infile = CALDB            name of FEF input file
       outfile = sources.wrmf     name of RMF output file
         axis1 = energy=0:1       axis-1(name=lo:hi:btype)
         axis2 = pi=1:1024:1      axis-2(name=lo:hi:btype)
      (logfile = STDOUT)          name of log file
      (weights = sources.wgt)     name of weight file
       (thresh = 1e-5)            low threshold of energy cut-off probability
       (outfmt = legacy)          RMF output format (legacy|cxc)
      (clobber = no)              overwrite existing output file (yes|no)?
      (verbose = 0)               verbosity level (0 = no display)
        (axis3 = none)            axis-3(name=lo:hi:btype)
        (axis4 = none)            axis-4(name=lo:hi:btype)
        (axis5 = none)            axis-5(name=lo:hi:btype)
         (mode = ql)              



History

04 Jan 2005 updated for CIAO 3.2: added information about mkacisrmf (see Creating the RMF: mkrmf vs mkacisrmf section)
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.

Return to Threads Page: Top | All | Imag Spec

Where are the PDFs?
Last modified: 9 Mar 2010