file: isis_spectrum.txt Use MARX to simulate an HETG observation of a powerlaw w/lines. # - - - Create the spectral file This is similar to the ACIS example except that the source is brighter and has a less steep powerlaw. Create the .par file using isis and XSPEC models: Use a power law and include two "flourescence" lines (Fe, Ne) for fun: These steps are carried out in the "working directory". Start isis: [unix] isis Define the model: isis> fit_fun("phabs(1)*powerlaw(1)+gauss(1)+gauss(2)"); isis> list_par; % This will show the model parameters. Set the model parameters: isis> set_par(1, 0.80); isis> set_par(2, 0.020); isis> set_par(3, 1.20); Set the Gaussian line parameters. It's also possible to set the parameters by name instead of their number. Note that the "center" must be specified in Angstroms, so keV values are converted using Const_hc [ keV A ]. Fe line and Ne line centers isis> set_par("gauss(1).center", Const_hc/6.4038); isis> set_par("gauss(2).center", Const_hc/0.8486); Set the areas and widths of the lines: isis> set_par("gauss(1).area", 3.0e-4); isis> set_par("gauss(2).area", 1.0e-4); Make the lines have small but non-zero widths of 0.020 A FWHM, or sigma = 0.020/2.35 = 0.0085 A. These correspond to velocity widths of: c * 0.020/1.936 = ~ 3100 km/s FWHM for Fe line c * 0.020/14.61 = ~ 410 km/s FWHM for Ne line isis> set_par("gauss(1).sigma", 0.0085); isis> set_par("gauss(2).sigma", 0.0085); Show the parameters isis> list_par; phabs(1)*powerlaw(1)+gauss(1)+gauss(2) idx param tie-to freeze value min max 1 phabs(1).nH 0 0 0.8 0 100000 10^22 2 powerlaw(1).norm 0 0 0.02 0 1e+10 3 powerlaw(1).PhoIndex 0 0 1.2 -2 9 4 gauss(1).area 0 0 0.0003 0 0 photons/s/cm^2 5 gauss(1).center 0 0 1.936103 0 0 A 6 gauss(1).sigma 0 0 0.0085 0 1 A 7 gauss(2).area 0 0 0.0001 0 0 photons/s/cm^2 8 gauss(2).center 0 0 14.61044 0 0 A 9 gauss(2).sigma 0 0 0.0085 0 1 A Save the model/parameters to a file and exit isis. isis> save_par ("plaw_hetg.par"); isis> exit; Now , use marxflux to evaluate the .par file to create a MARX spectrum file. Here a fine binning is used having bins with dE/E = 0.0003 (v_bin = 90 km/s). This gives a high resolution spectrum across the whole 1 to 40 A (0.31 to 12.4 keV) range suitable for use with the HETG as well as, e.g., future microcalorimeter instruments. [unix] ./marxflux -e '_A(exp([log(1.0):log(40.0):0.0003]))' \ plaw_hetg.par plawflux_hetg.tbl The plawflux_hetg.tbl file can now be used by marx to define the spectrum. ................... FYI: compare the flux of this model with the "plaw.p" of the ACIS simulation. Use isis to read in and evaluate the models: Define a wavelength grid to evaluate the model (fit function) on, from 8 keV to 0.5 keV, in 2000 bins: isis> (lo, hi) = linear_grid (Const_hc/8.0, Const_hc/0.5, 2000); The model used for the ACIS example: isis> load_par("plaw.p"); isis> facis = eval_fun(lo,hi); The model for this HETG simulation: isis> load_par("plaw_hetg.par"); isis> fhetg = eval_fun(lo,hi); The total fluxes: isis> sum(facis); 0.00059783 % photons/sec/cm^2 isis> sum(fhetg); 0.0253021 The ACIS example has ~ 6.0e-4 ph/s/cm^2, whereas this HETG example has 2.5e-2 ph/s/cm^2 or a factor of ~ 42 times the photon rate over the 0.5 to 8 keV range. Can also plot the spectra: isis> yrange(); ylog; isis> xrange(); xlin; isis> label("Wavelength (A)","Flux (ph/s/cm^2/bin)","Simulation spectra"); isis> hplot(lo, hi, fhetg); isis> ohplot(lo, hi, facis,2); Or versus log Energy: isis> yrange(); ylog; isis> xrange(); xlog; isis> label("Energy (keV)","Flux (ph/s/cm^2/bin)","Simulation spectra"); isis> hplot(Const_hc/hi, Const_hc/lo, fhetg); isis> ohplot(Const_hc/hi, Const_hc/lo, facis); .....................