Last modified: December 2013

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.11 Sherpa v1


Context: data


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"

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",
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.

Example 2

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).

Example 3

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.

Example 4

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.

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 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.

See Also

fake, load_pha, pack_pha, unpack_bkg, unpack_pha