| AHELP for CIAO 4.4 Sherpa v2 | fake_pha |
Context: data |
Synopsis
Simulate a PHA dataset with faked counts using Poisson noise
Syntax
fake_pha( id, arf, rmf, exposure, [backscal=None, areascal=None, grouping=None, grouped=False, quality=None, bkg=None] )
Description
The fake_pha command creates a PHA dataset with faked counts given a source model and a grid (e.g. ARF and RMF). The generated counts will contain Poisson noise.
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")
- rmf - accepts an RMF filename or a Sherpa data object that contains the RMF data (see "unpack_rmf")
- exposure - length of observation in seconds
- 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
If a source data set by data set ID is used and contains no grouping flags then 'grouped' should be negated.
Example 1
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 dataset, ungrouped by default. The faked data overwrites the existing dataset with id=1.
Example 2
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 dataset with fake_pha. The faked data overwrites the existing dataset with id=1.
Example 3
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 dataset. The faked data overwrites the existing dataset with id=1.
Example 4
sherpa> set_source("faked",const1d.c1*powlaw1d.p1)
sherpa> fake_pha("faked", arf=get_arf(), rmf=get_rmf(), exposure=10000,
grouped=True, bkg=get_bkg())A model is defined for the dataset id "faked", then fake_pha is run to simulate a grouped 10ks dataset.
Example 5
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 dataset is faked with just an RMF (no ARF).
Bugs
See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.
See Also
- data
- fake, load_pha, pack_pha, unpack_bkg, unpack_pha

![[Sherpa Logo]](../imgs/sherpa_logo_navbar.gif)