Skip to the navigation links
Last modified: 16 June 2010
Where are the PDFs?

Creating ACIS RMFs with mkacisrmf

CIAO 4.2 Science Threads



Overview

Last Update: 16 Jun 2010 - changed energy range in Using mkacisrmf with the psextract script section

Synopsis:

The tool mkacisrmf separates the RMF calculation process into two components: an "ideal" component which describes the CCD spectral response prior to the effects of CTI, and a spatially varying component which incorporates the changes in the response produced by CTI.

Technical details on mkacisrmf are available from the Creating ACIS RMFs why topic.

Purpose:

To create an RMF for an ACIS imaging observation (or zeroth-order grating) with the newest calibration available. This thread also explains how to run mkacisrmf after using the psextract script or specextract script.

Read this thread if:

Get Started shows how to check the mode of your observation.

Related Links:




Contents



Get Started

File types needed: asol1

The observation-specific aspect solution files are needed if you are running mkacisrmf for the extracted spectrum case or using specextract. The tool uses the aspect solution (asolfile parameter) to derive the correct instrument coordinates for the WMAP, so there is no need to include it when making an RMF at a specific location.

The responses that mkacisrmf creates are intended for use with data that has the time-dependent gain adjustment and CTI correction applied.

Input data requirements

In order to use mkacisrmf, the observation must:

  • be taken are the proper focal plane temperature (any chip at -120 C, BI chips at -110 C)

  • have a CTI_APP header keyword.

    If CTI_APP is not found, follow the instructions in the ACIS CTI_APP Keyword Required section of the ACIS CTI Correction why topic to add the keyword. This thread may produce incorrect results without issuing an error if the keyword is missing.

  • have been processed with an acceptable version of the gain file.

    Any CTI-corrected gain file since version 4 is good enough for use with this tool; read the Creating ACIS RMFs why topic for information on using consistent calibration.

  • be taken in the right data mode.

    mkacisrmf can be used on any observation taken in (V)FAINT mode, including continuous-clocking CC(33)_FAINT mode. The tool can also be used on GRADED mode data on the BI chips.

The keyword values in the sample data file evt2.fits show that it can be used with mkacisrmf:

unix% dmkeypar evt2.fits fp_temp echo+
153.60722351

unix% dmkeypar evt2.fits CTI_APP echo+
PPPPPBPBPP

unix% dmkeypar evt2.fits gainfile echo+
/soft/ciao/CALDB/data/chandra/acis/bcf/gain/acisD2000-01-29gain_ctiN0006.fits

unix% dmkeypar evt2.fits DATAMODE echo+
FAINT 

ACIS GRADED Mode Data

There is limited use for mkacisrmf when working with data taken in GRADED mode. The data must have the time-dependent gain adjustment applied; there is no CTI correction for GRADED mode.

unix% dmkeypar acis_evt1.fits DATAMODE echo+
GRADED

It is appropriate to use mkacisrmf for observations taken in GRADED mode with the source on a back-illuminated chip (ACIS-S1 or S3) only.

For these chips, run mkacisrmf for the extracted spectrum case or the specific location case, depending on which best suits the data analysis.

Responses for the front-illuminated chips in GRADED mode data should still be created by running mkrmf.


ACIS -110 C Data

There is limited use for mkacisrmf when working with data taken at the -110 C focal plane temperature. The data must have the time-dependent gain adjustment applied; the TGAIN calibration for -110 C was first released in CALDB 3.4.3. There is no CTI correction for this temperature.

unix% dmkeypar acis_evt1.fits FP_TEMP echo+
163.952042

It is appropriate to use mkacisrmf for observations taken at -110 C with the source on a back-illuminated chip (ACIS-S1 or S3) only.

For these chips, run mkacisrmf as shown in the extracted spectrum case or the specific location case, depending on which best suits the data analysis.

Responses for the front-illuminated chips at -110 C should still be created by running mkrmf. Note that if the input file contains -110 C data and has the CTI-correction applied but the source is actually on a front-illuminated chip, mkacisrmf fails with an error:

unix% # mkacisrmf (CIAO 4.2): ERROR: No non-zero pixels map to valid
chip coordinates in the supplied wmap='src.pi[WMAP]' file

mkacisrmf infile=CALDB outfile=src.wrmf energy="0.3:11.0:0.01"
channel="1:1024:1" chantype=PI wmap=src.pi"[WMAP]" gain=CALDB
clobber=yes verbose=2 mode=h  failed.

Error: Failed to create RMF for evt2.fits[sky=region(src.reg)]


Using mkacisrmf

A. Creating an RMF to match an extracted spectrum

This method is the recommended way of constructing RMFs with mkacisrmf.

In this scenario, the user has extracted a spectrum from a given region using dmextract and wishes to compute a matching RMF. For example:

unix% dmextract \
      "data_evt2.fits[(x,y)=circle(4232,3289,30)][bin pi=1:1024:1]" \
      test_src.pi  wmap="det=8"

unix% mkacisrmf infile=CALDB \
      outfile=test_wrmf.fits \
      energy=0.3:9.5:0.005 \
      channel=1:1024:1 \
      chantype=PI \
      wmap=test_src.pi \
      asolfile=pcadf084244404N002_asol1.fits \
      gain=CALDB

The wmap option in the call to dmextract creates a weight map (see the documentation for dmextract) which mkacisrmf will use to create a counts-weighted RMF over the extraction region. The WMAP is stored in an extension of the spectrum file.

mkacisrmf creates a weighted RMF appropriate for the spectral extraction region. The asolfile parameter is set to the observation-specific aspect solution, which is used to derive the correct instrument coordinates for the WMAP. The energy range is chosen as 0.3:9.5:0.005 in order to avoid an error from mkwarf later in the analysis.

The infile parameters is set to "CALDB" so that the tool will use the information in the wmap file header to determine the P2_RESP calibration file to use. Similarly, the gain parameter should be set to "CALDB" in order to ensure that the gain file which matches the P2_RESP file is used.

If you prefer, it is acceptable to give a full path to the gain file in the CALDB, e.g.

unix% pset mkacisrmf \
      gain=$CALDB/data/chandra/acis/det_gain/acisD2000-01-29gain_ctiN0006.fits

The corresponding mkrmf syntax is:

unix% mkrmf infile=CALDB outfile=sources.wrmf \
      axis1="energy=0:1" axis2="pi=1:1024:1" weights=sources.wgt

B. Creating an RMF at a specific location

For this case, it is assumed the user wishes to create an RMF file for a specific location on one of the ACIS CCDs, independent of a given dataset or extraction region. In this situation, the infile and gain filenames must be supplied, since the tool does not have access to any source data to determine which calibration files should be used.

Determine which gain file was used in the data processing:

unix% dmkeypar evt2.fits gainfile echo+
acisD2000-01-29gain_ctiN0006.fits

Choose the mkacisrmf calibration file (called a "P2_RESP" file). The P2_RESP and gain files are released in pairs of matching versions, so simply choose the file which has the same "N000x" version as the gain:

unix% ls -1 $CALDB/data/chandra/acis/p2_resp/
acisD1999-09-16p2_respN0005.fits
acisD2000-01-29p2_respN0005.fits
acisD2000-01-29p2_respN0006.fits

For this gain, acisD2000-01-29gain_ctiN0006.fits, use the acisD2000-01-29p2_respN0006.fits file as the infile parameter.

When running mkacisrmf, be sure that the path to the input response and gain files is correct for the local CALDB installation. The ACIS detector is calibrated over the range 0.224004 - 12 keV; choosing values outside this range may result in errors in the analysis.

unix% mkacisrmf \
      infile=$CALDB/data/chandra/acis/p2_resp/acisD2000-01-29p2_respN0006.fits \
      outfile=location_rmf.fits \
      wmap=none \
      energy=0.3:10.0:0.005 \
      channel=1:1024:1 \
      chantype=PI \
      ccd_id=7 \
      chipx=645 \
      chipy=10 \
      gain=$CALDB/data/chandra/acis/det_gain/acisD2000-01-29gain_ctiN0006.fits 

This command creates an RMF at a position of (645, 10) in CHIP coordinates on CCD 7.

The corresponding mkrmf syntax is:

unix% mkrmf \
      infile="$CALDB/data/chandra/acis/fef_pha/acisD1999-09-16fef_phaN0002.fits[FUNCTION][ccd_id=7,chipx=641:672,chipy=1:32]" \
      outfile=3c273.rmf axis1="energy=0.1:11.0:0.01" axis2="pi=1:1024:1"

C. Using mkacisrmf with the specextract script

specextract, a script for creating ACIS spectra, has the ability to determine when mkacisrmf should be used in place of mkrmf.

As of CIAO 4.2, specextract uses the input event file to query the CALDB for a P2_RESP file, the calibration used by mkacisrmf. If a calibration file exists, specextract runs mkacisrmf to create the RMF. This improvement means that specextract will choose mkacisrmf for all the valid observation cases.

In the event that a user does need to run mkacisrmf after specextract to create a new RMF file, follow these steps.

unix% dmkeypar acis_evt2.fits GAINFILE echo+
acisD2000-01-29gain_ctiN0005.fits

Choose the mkacisrmf calibration file (called a "P2_RESP" file). The P2_RESP and gain files are released in pairs of matching versions, so simply choose the file which has the same "N000x" version as the gain:

unix% ls -1 $CALDB/data/chandra/acis/p2_resp/
acisD1999-09-16p2_respN0005.fits
acisD2000-01-29p2_respN0005.fits
acisD2000-01-29p2_respN0006.fits

For this gain, acisD2000-01-29gain_ctiN0005.fits, use the acisD2000-01-29p2_respN0005.fits file as the infile parameter.

If you intend to use XSpec instead of Sherpa to model and fit the data, Read the "Matching the ARF and RMF energy grids" caveat before continuing.

Now run the tool:

unix% mkacisrmf \
      infile="$CALDB/data/chandra/acis/p2_resp/acisD2000-01-29p2_respN0005.fits" \
      outfile=acis_new_rmf.fits \
      energy=0.3:10.0:0.005 \
      channel=1:1024:1 \
      chantype=PI \
      wmap=acis_src1.pi \
      asolfile=pcadf084271087N002_asol1.fits \
      gain=$CALDB/data/chandra/acis/det_gain/acisD2000-01-29gain_ctiN0005.fits 

The wmap parameter is set to the source spectrum file created by specextract. The script always creates a x WMAP block, so this approach will work with any specextract output. The new RMF file is named acis_new_rmf.fits.

Be sure to update the spectrum file header to contain the name of the new RMF file.


D. Using mkacisrmf with the psextract script

The psextract script uses the mkrmf tool to create the RMF. Users who have the correct calibration applied to the data may run mkacisrmf independently to create a new RMF.

unix% dmkeypar acis_point_evt2.fits GAINFILE echo+
acisD2000-01-29gain_ctiN0005.fits

The file has an appropriate CTI-corrected gain applied to it, so we can use mkacisrmf. For the point source case, mkacisrmf is run in "Creating an RMF at a specific location" mode.

Choose the mkacisrmf calibration file (called a "P2_RESP" file). The P2_RESP and gain files are released in pairs of matching versions, so simply choose the file which has the same "N000x" version as the gain:

unix% ls -1 $CALDB/data/chandra/acis/p2_resp/
acisD1999-09-16p2_respN0005.fits
acisD2000-01-29p2_respN0005.fits
acisD2000-01-29p2_respN0006.fits

For this gain, acisD2000-01-29gain_ctiN0005.fits, we should use the acisD2000-01-29p2_respN0005.fits file as the infile parameter.

To get the necessary coordinate information (ccd_id, chipx, chipy), convert the source region information to chip coordinates with dmcoords:

unix% punlearn dmcoords 
unix% dmcoords acis_evt2.fits asolfile="pcadf084244404N002_asol1.fits" 
dmcoords>: sky 4072.125 4245.625            
(RA,Dec):     18:33:33.590    -10:34:08.00
(RA,Dec):      278.38996      -10.56889 deg
THETA,PHI          1.239'          6.09 deg
(Logical):        4072.12       4245.62
SKY(X,Y):         4072.12       4245.62
DETX,DETY         4246.75       4112.53
CHIP ACIS-S3       367.19        383.66
TDET              4284.19       2085.66

dmcoords>: quit

Now we have all the information to run the tool. Sherpa requires that the ARF and RMF cover the same energy range (i.e. have the same endpoints), so the energy parameter is set to the range used by psextract, namely 0.1:11.0:0.01.

unix% mkacisrmf \
      infile="$CALDB/data/chandra/acis/p2_resp/acisD2000-01-29p2_respN0005.fits" \
      outfile=acis_point_rmf.fits \
      energy=0.1:11.0:0.01 \
      channel=1:1024:1 \
      chantype=PI \
      wmap=none \
      ccd_id=7 chipx=367.19 chipy=383.66 \
      gain=$CALDB/data/chandra/acis/det_gain/acisD2000-01-29gain_ctiN0005.fits

INFO: Effective user energy (keV) grids will be re-arranged in
     0.25000 - 11.00000

The ACIS detector is calibrated over the range 0.224004 - 12 keV; the warning indicates that the lower end of the range is adjusted to fall inside the calibration. The new RMF file is named acis_point_rmf.fits.

Making a new ARF:

If you intend to use XSpec instead of Sherpa to model and fit the data, Read the "Matching the ARF and RMF energy grids" caveat before continuing.

psextract users who intend to finish the data analysis in XSpec should now remake the ARF file to ensure that the grid matches the RMF. To do so, get the mkarf command from the history in the ARF file. Change the engrid parameter to use the new RMF file, and rerun mkarf.

unix% dmhistory 3c273.arf tool=mkarf
mkarf asphistfile="3c273.asphist" outfile="3c273.arf" sourcepixelx="4145.9587485" sourcepixely="4045.8953985" 
engrid="grid(3c273.rmf[MATRIX][cols ENERG_LO,ENERG_HI])" obsfile="acis_dstrk_evt2.fits" 
pbkfile="acisf063875928N002_pbk0.fits" dafile="CALDB" mirror="HRMA" detsubsys="ACIS-S3" 
grating="HETG" maskfile="NONE" ardlibparfile="ardlib.par" geompar="geom" verbose="0" 
clobber="no"  

unix% dmhistory 3c273.arf tool=mkarf action=pset

unix% pset mkarf outfile="3c273_new.arf"
unix% pset mkarf engrid="grid(acis_point_rmf.fits[MATRIX][cols ENERG_LO,ENERG_HI])"

unix% mkarf 

Be sure to update the spectrum file header to contain the name of the new RMF (RESPFILE keyword) and ARF (ANCRFILE keyword).



Update the Spectrum File Header

Update the RESPFILE keyword in the header of the source (and background) spectrum file with the name of the new RMF. For example:

unix% dmhedit infile=acis_src1.pi filelist="" operation=add \
      key=RESPFILE value=acis_new_rmf.fits

If the spectrum was created with one of the CIAO scripts (e.g. specextract or acisspec), the header keyword will contain the name of the file created with mkrmf. The wrong file could be selected during fitting if the keyword is not updated.



Caveat: Setting the channel type

All the examples in this thread use the default chantype value of "PI". If you extracted a spectrum in PHA space instead, you need to change this parameter setting, as well as the channel value:

unix% pset mkacisrmf chantype=pha channel=1:4096:2

As explained in the dmextract help file, the default binning used for PHA files is "1:4096:2".



Caveat: Matching the ARF and RMF energy grids

Sherpa allows you to use different energy grids for your ARF and RMF files, but XSpec does not. XSpec will still run if the grids do not match, but it issues a warning and sets all values in the ARF to unity (1).

There are two approaches to creating an ARF-RMF pair with the same gridding: Match an existing ARF or Create the RMF first.

Match an existing ARF

If the specextract or acisspec scripts were used, you already have an ARF file for the data. Rather than remake both the RMF and ARF, get the grid information from the history in the ARF file:

unix% dmhistory acis_src1.warf tool=all
# dmhistory (CIAO 4.2): WARNING: Found "pixlib" library parameters

# dmhistory (CIAO 4.2): WARNING: Found "ardlib" library parameters

mkwarf infile="acis_src1.[WMAP]" outfile="acis_src1.warf" weightfile="acis_src1.wfef"
egridspec="0.3:9.5:0.01" threshold="0" feffile="CALDB" mskfile="" mirror="HRMA" spectrumfile="" 
detsubsysmod="" ardlibpar="ardlib" geompar="geom" clobber="no" verbose="2"  

Use the egridspec value as input for the energy parameter in mkacisrmf:

unix% pset mkacisrmf energy="0.3:9.5:0.01"

This method cannot be used with the ARFs created by psextract. That script creates the RMF first and uses it to define the ARF gridding, so the engrid parameter value looks like "grid(3c273.rmf[MATRIX][cols ENERG_LO,ENERG_HI])". The Using mkacisrmf with the psextract script section has special instructions for those users.


Create the RMF first

Since mkacisrmf can change the requested grid to match the calibration data, create the RMF first and then use it to define the energy grid when creating the ARF. This will work for both mkarf and mkwarf:

unix% pset mkarf \
      engrid="grid(sources_ciao.wrmf[cols ENERG_LO,ENERG_HI])"

or

unix% pset mkwarf \
      egridspec="grid(sources_ciao.wrmf[cols ENERG_LO,ENERG_HI])"


History

15 Dec 2004 original version, new for CIAO 3.2
12 Jan 2005 created Matching the number of energy bins
28 Feb 2005 updated chipx/y values in Using mkacisrmf Instead of mkrmf: Example 1; expanded information in Matching the number of energy bins section
12 Apr 2005 clarification on how gain is specified in Using mkacisrmf Instead of mkrmf section
09 May 2005 a corrected calibration file has been released in CALDB 3.0.3. All users should download the patch to obtain the updated calibration.
23 Jun 2005 CIAO 3.2.2 patch: new calibration file in CALDB 3.1.0; the Using mkacisrmf section was rewritten to be more descriptive
01 Aug 2005 changed energy range to energy=0.3:9.5:0.005 in Creating an RMF to match an extracted spectrum due to an issue with mkwarf
15 Dec 2005 updated for CIAO 3.3: new calibration files in CALDB 3.2.0; added ACIS GRADED Mode Data section
15 Feb 2006 created Using mkacisrmf with the specextract script section
14 Jun 2006 corrected link in "Calibration Updates"; clarified information on GRADED mode data; added information on choosing a P2_RESP file for a given gain
25 Jul 2006 created Using mkacisrmf with the psextract script section
25 Aug 2006 showed how to find ARF energy grid in Caveat: Matching the ARF and RMF energy grids section (renamed from "Matching the number of energy bins"). In the case where one of the CIAO scripts was used (e.g. psextract), it is not necessary to remake both the ARF and RMF in order to have the grids match.
18 Dec 2006 updated for CIAO 3.4: new calibration files in CALDB 3.3.0; CIAO version in warnings
30 Mar 2007 changed how the tool is run in the Using mkacisrmf with the psextract script section; added Caveat: Setting the channel type
15 May 2007 updated for CALDB 3.4.0: CALDB lookup works for ACIS GRADED mode, so users can run mkacisrmf for the extracted spectrum case as well as the specific location case
30 Jan 2008 updated for CIAO 4.0: include new asolfile parameter for extracted spectrum case and using specextract (it affects the WMAP, so there is no change when making an RMF at a specific location); removed outdated calibration updates; switched order of "match an extracted spectrum" and "specific location" sections so that the recommended method is listed first
31 Mar 2008 updated for CALDB 3.4.3: use mkacisrmf for -110 BI chips if TGAIN calibration has been applied, see -110 C Data section
09 Feb 2009 updated for CIAO 4.1: input data must have a CTI_APP keyword; paths to calibration files (P2_RESP, GAIN) updated for CALDB 4
24 Feb 2009 GRADED mode data analysis should always use the P2_RESP N0005 file
27 Feb 2009 GRADED mode data analysis should always use the P2_RESP N0005 file for the RMF at a specific location only
05 Mar 2009 the Caveat: Matching the ARF and RMF energy grids applies to Sherpa users due to a current limitation
16 Feb 2010 updated for CIAO 4.2: specextract uses a CALDB query to decide which RMF tool should be used - it can now choose the right file for GRADED mode and -110 C observations; the Matching the ARF and RMF energy grids caveat applies only to XSpec (Sherpa 4.2 has a bug fix so it no longer requires the grids to match)
09 Mar 2010 The ACIS detector is calibrated over the range 0.224004 - 12 keV; choosing values outside this range may result in errors in the analysis (e.g. from mkwarf).
22 Mar 2010 added the error message for the "-110 C data on a front-illuminated chip" case to the -110 C Data section
16 Jun 2010 changed energy range in Using mkacisrmf with the psextract script section

Return to Threads Page: Top | All | Imag Spec

Where are the PDFs?
Last modified: 16 June 2010