Marx 5.0.0 |
Simulating a user-defined spectrum with Marx | ||||||||||||||||||||||||
|
The purpose of this example is to show how to use marx to simulate an ACIS observation of a point source with a user-specified spectrum. For simplicity, suppose that we wish to simulate a 3000 ksec observation of an on-axis point source whose spectrum is represented by an absorbed powerlaw, with a spectral index of 1.8, and a column density of 10^22 atoms/cm^2. The normalization of the powerlaw will be set to 0.001 photons/keV/cm^2/s at 1 keV. The large exposure time was chosen to illustrate the consistency of the marx ray trace with that of the underlying calibration data. Creating the spectral fileThe first step is to create a 2-column text file that tabulates the flux [photons/sec/keV/cm^2] (second column) as a function of energy [keV] (first column). The easiest way to create such a file is to make use of a spectral modeling program such as isis, sherpa or xspec. The rest of this tutorial is given in the context of isis. In isis the absorbed powerlaw model is specified using:
isis> fit_fun("phabs(1)*powerlaw(1)");
isis> set_par(1, 1);
isis> set_par(2, 0.001);
isis> set_par(3, 1.8);
isis> list_par;
phabs(1)*powerlaw (1)
idx param tie-to freeze value min max
1 phabs(1).nH 0 0 1 0 100000 10^22
2 powerlaw(1).norm 0 0 0.001 0 0.01
3 powerlaw(1).PhoIndex 0 0 1.8 1 3
isis> save_par ("plaw.p");
The next step is to convert the parameter file plaw.p to the spectrum file that marx expects. The marxflux script may be used to create a file called plawflux.tbl in the appropriate format via unix% ./marxflux -e '[0.3:14.0:0.003]' plaw.p plawflux.tblThis script requires isis to be installed and linked to at least version 2.1 of the S-Lang library. (Marx is distributed with a script called xspec2marx that may be used to create such a file
for xspec. More information about using this script in conjunction
with xspec may be found in the marx
documentation).
The plawflux.tbl file is input to marx using the following marx.par parameters: SpectrumType=FILE SpectrumFile=plawflux.tbl SourceFlux=-1The SpectrumType parameter is set to FILE to indicate that
marx is to read the spectrum from the file specified by the
SpectrumFile parameter. The SourceFlux parameter may be
used to indicate the integrated flux of the spectrum. The value of -1
as given above means that the integrated flux is to be taken from the
file.
Running marxThe next step is to run marx in the desired configuration. Some prefer to use tools such as pset to update the marx.par file and then run marx. Here, the parameters will be explicitly passed to marx via the command line:
marx SourceFlux=-1 SpectrumType="FILE" SpectrumFile="plawflux.tbl" \
ExposureTime=3000000 TStart=2012.5 \
OutputDir=plaw GratingType="NONE" DetectorType="ACIS-S" \
DitherModel="INTERNAL" RA_Nom=30 Dec_Nom=40 Roll_Nom=50 \
SourceRA=30 SourceDEC=40 \
Verbose=yes mode=h
This will run the simulation and place the results in a subdirectory
called plaw. The results may be converted to a standard Chandra
level-2 fits file by the marx2fits program:
marx2fits plaw plaw_evt2.fits
The resulting fits file (plaw_evt2.fits) may be further processed
with standard CIAO tools. As some of these tools require the aspect
history, the marxasp program will be used to create an aspect
solution file that matches the simulation:
marxasp MarxDir="plaw" OutputFile="plaw_asol1.fits"
Analyzing the simulated dataArmed with the simulated event file plaw_evt2.fits and the aspect
solution file plaw_asol1.fits, a PHA file, ARF and RMF may be
made using the standard CIAO tools. A Bourne shell script that does
this may be found here. These files may
be used in a spectral modelling program such as isis to see whether or
not one can reach the desired science goal from the simulated
observation. For this example, the goal is to verify that the marx
simulation is consistent with the input spectrum. To this end, isis
will be used to fit an absorbed powerlaw to the pha spectrum. The
figure below showing the resulting fit was created via the following
isis script:
load_dataset ("plaw_pha.fits", "plaw_rmf.fits", "plaw_arf.fits");
rebin_data (1, 30);
xnotice_en (1, 0.3, 11);
fit_fun("phabs(1)*powerlaw(1)");
set_par(1,1,1);
fit_counts;
list_par;
plot_open("plawfit.ps/CPS");
xrange(0.3,11);
rplot_counts (1);
plot_close ();
This script produced the following parameter values with a reduced
chi-square of 1.2:
Parameters[Variable] = 3[2]
Data bins = 600
Chi-square = 722.847
Reduced chi-square = 1.208774
phabs(1)*powerlaw(1)
idx param tie-to freeze value min max
1 phabs(1).nH 0 1 1 0 100000 10^22
2 powerlaw(1).norm 0 0 0.001003397 0 1e+10
3 powerlaw(1).PhoIndex 0 0 1.826904 -2 9
The
The residuals show that the model is systematically high for some energies. The reason for this can be traced back to energy-dependent scattering where photons are scattered outside the extraction region. The CIAO effective area does not include this loss factor, and as a result, this omission appears in the residuals. This effect is apparant because of the enormous number of counts in this simulation. |
| This page was last updated Jan 25, 2012 by John E. Davis. Technical questions should be addressed to marx-help at space mit edu. |