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 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 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");
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
SpectrumType=FILE SpectrumFile=plawflux.tbl SourceFlux=-1The
The 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=hThis will run the simulation and place the results in a subdirectory called
marx2fits plaw plaw_evt2.fitsThe resulting fits file (
marxasp MarxDir="plaw" OutputFile="plaw_asol1.fits"
Analyzing the simulated data
Armed with the simulated event file
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 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 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.