About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: 31 Mar 2008
Hardcopy (PDF): A4 | Letter

Creating ACIS RMFs with mkacisrmf

CIAO 4.0 Science Threads



Overview

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

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:

  • you are working with -120 C ACIS imaging data or the zero-order of a grating observation taken in (V)FAINT mode. mkacisrmf is fully calibrated for all ten ACIS chips in these modes.

  • you are working with -120 C ACIS imaging data or the zero-order of a grating observation taken in GRADED mode on one of the back-illuminated chips (ACIS-S1 and S3). The ACIS GRADED Mode Data section has more information.

  • you are working with -110 C ACIS imaging data or the zero-order of a grating observation taken on one of the back-illuminated chips (ACIS-S1 and S3). The -110 C Data section has more information.

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

Related Links:

Proceed to the HTML or hardcopy (PDF: A4 | letter) version of the thread.




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 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.

Make sure that your data are taken are the proper focal plane temperature (any chip at -120 C, BI chips at -110 C) and that an acceptable gain has been applied:

unix% dmkeypar evt2.fits fp_temp echo+
153.60722351

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

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

Check the mode of the observation, which is recorded in the DATAMODE header keyword:

unix% dmkeypar evt2.fits DATAMODE echo+
FAINT 

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.

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.

Running specextract

Since calibration is only available for the two chips in GRADED mode, the specextract script will use mkrmf to create the RMF response files. If your source is on ACIS-S1 or S3, follow the instructions in the Using mkacisrmf with the specextract script section to create a new RMF file with mkacisrmf.


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. However, in either case, the infile parameter must be set to the version N0005 P2_RESP file:

unix% pset mkacisrmf \
      infile=$CALDB/data/chandra/acis/cpf/p2_resp/acisD2000-01-29p2_respN0005.fits

Responses for the front-illuminated chips at -110 C should still be created by running mkrmf.

Running specextract

Since calibration is only available for the two chips, specextract script will use mkrmf to create the RMF response files. If your source is on ACIS-S1 or S3, follow the instructions in the Using mkacisrmf with the specextract script section to create a new RMF file with mkacisrmf.



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=pcadf084244404N001_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/bcf/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+
/soft/ciao/CALDB/data/chandra/acis/bcf/gain/acisD2000-01-29gain_ctiN0006.fits

This event file has been reprocessed with the version 6 gain file.

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/cpf/p2_resp/
acisD2000-01-29p2_respN0002.fits
acisD2000-01-29p2_respN0003.fits
acisD2000-01-29p2_respN0004.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.

unix% mkacisrmf \
      infile=$CALDB/data/chandra/acis/cpf/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/bcf/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/cpf/fefs/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.

specextract reads the source and background file header keywords to determine when the observation was taken and what calibration has been applied. The script then does a CALDB lookup to compare the calibration applied to the event file and the most recent file available in the CALDB. This means that the data needs to have been processed with the very newest calibration, not just a "good enough" version; that is, even if the new calibration will have a minimal effect on your data, specextract requires that it be applied for the "use mkacisrmf" switch to be triggered.

Users who don't wish to reprocess can still use specextract and run mkacisrmf afterwards to create a new RMF file. This approach is also appropriate for users who have run specextract on GRADED mode or -110 C data and want to create an RMF for a source on ACIS-S1 or S3.

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

Since this file has an older CTI-corrected gain file applied, specextract used mkrmf to create the RMFs. The version N0005 calibration is sufficient for mkacisrmf, though, so it is possible to run the tool independently of the script to create a new response file.

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/cpf/p2_resp/
acisD2000-01-29p2_respN0002.fits
acisD2000-01-29p2_respN0003.fits
acisD2000-01-29p2_respN0004.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/cpf/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=pcadf084271087N001_asol1.fits \
      gain=$CALDB/data/chandra/acis/bcf/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/cpf/p2_resp/
acisD2000-01-29p2_respN0002.fits
acisD2000-01-29p2_respN0003.fits
acisD2000-01-29p2_respN0004.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% pset dmcoords asolfile="pcadf084244404N002_asol1.fits"
unix% dmcoords acis_evt2.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:

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

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.0): WARNING: Found "pixlib" library parameters

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

mkwarf infile="acis_src1.[WMAP]" outfile="acis_src1.warf" weightfile="acis_src1.wfef" spectrumfile=""
egridspec="0.3:9.5:0.01" threshold="0" feffile="CALDB" mskfile="" mirror="HRMA" 
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

Return to Threads Page: Top | All | Imag Spec
Hardcopy (PDF): A4 | Letter
Last modified: 31 Mar 2008


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-2004. All rights reserved.