Using MARX to Create an Event File
OverviewLast Update: 31 Jul 2007 - updates for ciao3.4 Synopsis: The output of ChaRT is a set of rays (a PSFRAYS table) which cannot be used directly in your analysis; it must be converted into a suitable format, i.e. a pseudo event file. The MARX software is used to project the rays onto the detector plane. Using MARX allows us to take into account all changes to the photon distribution emerging from the HRMA due to the detector response. In particular, the detector QE & QEU and the roll are accounted for. In addition to simulating the detector response, MARX uses the ray weights to account for the mirror effects, i.e. different efficiency of different shells at different angles/energies. Related Links:
|
Contents
- Get Started
- Setting up MARX
- Get Source Coordinates
- Projecting the Rays
- Create an Event File
- Summary
- History
- Images
Get Started
This example uses HRMA_theta5.949_phi197.7_en1.7_d2.fits, which was created in the Introduction to ChaRT Data Files thread. Also:
Sample ObsID used: 942 (ACIS-S, NGC 4244)
File types needed: evt2
Setting up MARX
The recently released MARX v4.0.8 includes the roll of the telescope in the simulation. If you are not running MARX v4.0.8, download and install this version of MARX before continuing. Make sure that the installation is complete by following the directions in the INSTALL file (e.g. run ./configure).
Set up your environment to access all the files and directories which MARX needs:
unix% setenv MARX_DIR <local_marx_directory> unix% set path = ($path $MARX_DIR/bin) unix% setenv MARX_DATA_DIR $MARX_DIR/marx/data
Get Source Coordinates
Before running the simulation, it is necessary to determine the nominal position and roll of the telescope during the observation. All of these values are stored in the header of the level=2 event file:
unix% dmlist acisf00942N003_evt2.fits header | grep _NOM 0055 RA_NOM 184.3430399825 Real8 Nominal RA 0056 DEC_NOM 37.7808853898 Real8 Nominal Dec 0057 ROLL_NOM 230.8753656982 Real8 Nominal Roll
Additionally, the source coordinates for the PSF are required. These were determined in the Determine the Off-axis Angle section of the Preparing to Run ChaRT thread:
unix% punlearn dmcoords unix% dmcoords acisf00942N003_evt2.fits dmcoords>: sky 4704 3700 (RA,Dec): 12:16:57.136 +37:43:35.94 (RA,Dec): 184.23807 37.72665 deg THETA,PHI 5.949' 197.74 deg (Logical): 4704.00 3700.00 SKY(X,Y): 4704.00 3700.00 DETX,DETY 3405.57 3875.41 CHIP ACIS-S2 573.49 753.83 TDET 3448.49 2455.83 dmcoords>: q
This step could also be done with dmcoords in non-interactive mode:
unix% dmcoords acisf00942N003_evt2.fits opt=sky x=4704 y=3700 celfmt=deg unix% pget dmcoords ra dec 184.2380699128197 37.72665053564964
If this simulation is intended for an on-axis source, then SourceRA = RA_NOM and SourceDEC = DEC_NOM. If you are doing an off-axis simulation, they shouldn't be the same.
Projecting the Rays
In order to analyze the spatial distribution of the PSF, we need to project the PSF rays in HRMA_theta5.949_phi197.7_en1.7_d2.fits onto the detector plane. MARX enables us to do so.
Copy over the parameter file locally:
unix% cp $MARX_DIR/marx.par ./marx.par
and set the necessary parameters:
unix% pset ./marx SAOSACFile=HRMA_theta5.949_phi197.7_en1.7_d2.fits unix% pset ./marx OutputDir=HRMA_theta5.949_phi197.7_en1.7_d2.dir unix% pset ./marx DitherModel=INTERNAL unix% pset ./marx SourceType=SAOSAC unix% pset ./marx RA_Nom=184.34304 unix% pset ./marx Dec_Nom=37.78089 unix% pset ./marx Roll_Nom=230.87537 unix% pset ./marx SourceRA=184.23807 unix% pset ./marx SourceDEC=37.72665 unix% pset ./marx DetectorType=ACIS-S unix% pset ./marx GratingType=NONE unix% pset ./marx ExposureTime=0.0
There are two things to note in the pset commands:
-
Make sure to use the correct detector for the DetectorType parameter; valid options are HRC-S, ACIS-S, HRC-I, or ACIS-I.
-
The Exposuretime is set to 0.0 to ensure that the simulated output has the desired exposure length. The "Simulation Control: Exposure Time" section of the MARX manual (PDF) has more information on setting this parameter.
Now run the tool. Note the syntax (@@) required to use the local parameter file; see Example 9 of ahelp parameter for details.
unix% marx @@marx.par
MARX version 4.0.8, Copyright (C) 2002 Massachusetts Institute of Technology
... screen output omitted...
Initializing source type SAOSAC...
Opening SAOSAC fits file HRMA_theta5.949_phi197.7_en1.7_d2.fits
System initialized.
Starting simulation. NumRays = 1000000, dNumRays = 100000
Collecting 100000 photons...
100000 collected.
Reflecting from HRMA
Detecting with ACIS-S
Writing output to directory 'HRMA_theta5.949_phi197.7_en1.7_d2.dir' ...
Total photons: 100000, Total Photons detected: 63234, (efficiency: 0.632340)
(efficiency this iteration 0.632340) Total time: 104.245460
Collecting 100000 photons...
91864 collected.
Reflecting from HRMA
Detecting with ACIS-S
Writing output to directory 'HRMA_theta5.949_phi197.7_en1.7_d2.dir' ...
Total photons: 191864, Total Photons detected: 121203, (efficiency: 0.631713)
(efficiency this iteration 0.631031) Total time: 200.724344
unix%
Create an Event File
MARX creates a number of ASCII files in the specified directory (HRMA_theta5.949_phi197.7_en1.7_d2.dir):
unix% ls HRMA_theta5.949_phi197.7_en1.7_d2.dir b_energy.dat pha.dat xpos.dat detector.dat sky_dec.dat ycos.dat energy.dat sky_ra.dat ypixel.dat marx.par time.dat ypos.dat mirror.dat xcos.dat zcos.dat obs.par xpixel.dat zpos.dat
These .dat files need to be converted to a FITS event file before they can be used in CIAO. The MARX tool marx2fits does this, given the directory name and the output filename:
unix% marx2fits HRMA_theta5.949_phi197.7_en1.7_d2.dir marx_HRMA_theta5.949_phi197.7_en1.7_d2.fits Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/time.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/detector.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/energy.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/b_energy.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/xpos.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/ypos.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/zpos.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/xcos.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/ycos.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/zcos.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/xpixel.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/ypixel.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/pha.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/mirror.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/sky_ra.dat Examining HRMA_theta5.949_phi197.7_en1.7_d2.dir/sky_dec.dat unix%
The file may be viewed in ds9:
unix% ds9 marx_HRMA_theta5.949_phi197.7_en1.7_d2.fits &
as shown in Figure 1
.
Notice that MARX includes a simulation of the
ACIS readout
streak in the output.
Summary
The output file (marx_HRMA_theta5.949_phi197.7_en1.7_d2.fits) is a pseudo event file that can be used, for example, to create an image of the PSF.
History
| 27 Jun 2003 | original version, updated for CIAO 3.0: layout |
| 02 Dec 2004 | added note about setting ExposureTime parameter |
| 16 Feb 2005 | reviewed for CIAO 3.3: no changes |
| 31 Jul 2007 | updates for ciao3.4 |
