|AHELP for CIAO 4.9 Sherpa v1||
Simulate an observed spectrum based on a theoretical model.
fake_pha( id, arf, rmf, exposure, [backscal=None, areascal=None, grouping=None, grouped=False, quality=None, bkg=None] )
The fake_pha command creates a spectrum (PHA dataset) with faked counts given a source model and the instrument response files (e.g. ARF and RMF). The generated counts will contain Poisson noise.
Background counts may be included in the simulation by setting the 'bkg' parameter with background data previously read into the Sherpa session from a PHA file. The background counts are appropriately scaled, a Poisson draw is taken of the scaled background counts, and then that is added to the simulated source counts. (If there are multiple backgrounds, then the average of the backgrounds is added to the simulated source counts.) Leaving the 'bkg' parameter empty will generate a spectrum containing only source counts.
Before fake_pha can be run, a model with the same id as the faked dataset must be defined; see "ahelp set_source"
- id - id for the faked dataset. Any existing id will be overwritten, so use different values to compare results from more than one simulation or to compare a simulation to real data.
- arf - accepts an ARF filename or a Sherpa data object that contains the ARF data (see "unpack_arf"). Set to None for no ARF.
- rmf - accepts an RMF filename or a Sherpa data object that contains the RMF data (see "unpack_rmf"). This file is required.
- exposure - length of observation in seconds. Required input.
- backscal - background scaling factor; default=None
- areascal - area scaling factor; default=None
- grouping - integer array of grouping flags; default=None
- grouped - boolean to indicate if data is grouped; default=False
- quality - integer array of quality flags; default=None
- bkg - PHA data for the background; default=None (in this case, only source counts are simulated)
If a source data set by data set ID is used and contains no grouping flags then 'grouped' should be negated.
sherpa> fake_pha(1, arf="data_arf.fits", rmf="data_rmf.fits", exposure=50000) sherpa> fake_pha(1, "data_arf.fits", "data_rmf.fits", exposure=50000)
These two commands are equivalent ways of running fake_pha with the ARF and RMF filenames specified.
The ARF and RMF response files associated with dataset 1 are loaded directly with fake_pha() and used to simulate a 50ks source spectrum, ungrouped by default, and without a background component. The faked data overwrites the existing dataset with id=1.
sherpa> set_source(1,const1d.c1*powlaw1d.p1) sherpa> fake_pha(1, arf=get_arf(), rmf=get_rmf(), exposure=10000, grouped=True, bkg=get_bkg())
A model is defined for dataset 1, then fake_pha is run to simulate a grouped, 10ks source-plus-background spectrum, using the responses and background data associated with PHA data set 1 (replacing the loaded PHA data in data set 1 with the faked counts).
sherpa> arf1=unpack_arf("data_arf.fits") sherpa> set_arf(1, arf1, 1) sherpa> rmf1=unpack_rmf("data_rmf.fits") sherpa> set_rmf(1, rmf1, 1) sherpa> fake_pha(1, arf=arf1, rmf=rmf1, exposure=30000)
The ARF and RMF response files associated with dataset 1 are loaded with the unpack_arf/rmf functions and assigned response data set ID "1" with the set_arf/rmf functions. Data set 1 and its instrument response are then used to simulate a 30ks, ungrouped, source-only spectrum with fake_pha. The faked data overwrites the existing dataset with id=1.
sherpa> fake_pha(1, arf=get_arf(), rmf=get_rmf(), exposure=50000)
Using the ARF and RMF associated with dataset 1 - obtained via the get_arf and get_rmf commands - simulate a 50ks ungrouped source spectrum. The faked data overwrites the existing dataset with id=1.
sherpa> rmf = unpack_rmf("3c273.rmf") sherpa> set_source(xsphabs.abs1*powlaw1d.p1) sherpa> fake_pha(1, arf=None, rmf=rmf, exposure=10000,grouped=True)
A 10ks grouped spectrum is faked with just an RMF (no ARF).
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.