Marx 4.3.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 30 ksec observation of a point source whose spectrum is represented by an absorbed powerlaw, with a spectral index of 1.8, and a column density to 10^22 atoms/cm^2. The normalization of the powerlaw will be set to 0.001 photons/keV/cm^2/s at 1 keV. Creating the spectral file
The 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 xspec,
isis, or sherpa. Marx is distributed with a
script called 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. The plawflux.tbl spectrum 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 to marx as command line parameters:
marx SourceFlux=-1 SpectrumType="FILE" SpectrumFile="plawflux.tbl" \
ExposureTime=30000 OutputDir=plaw DitherModel="INTERNAL" \
GratingType="NONE" DetectorType="ACIS-S"
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);
fit_fun("phabs(1)*powerlaw(1)");
set_par (1, 1, 1);
fit_counts;
list_par;
group_data (1,4);
eval_counts;
plot_open("plawfit.ps/CPS");
rplot_counts (1);
plot_close ();
exit (0);
This script produced the following parameter values with a chi-square of 1.0:
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.0009525749 0 1e+10 3 powerlaw(1).PhoIndex 0 0 1.801373 -2 9
This example shows that the marx simulation is consistent with the underlying calibration products. |
| This page was last updated Feb 21, 2008 by John E. Davis. Technical questions should be addressed to marx-help at space mit edu. |