About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/fakeit.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 fakeit Context: sherpa

Synopsis

Creates a simulated 1-D dataset.

Syntax

sherpa> FAKEIT [#]

# specifies the number of the dataset to be simulated (default dataset
number is 1).

Description

The FAKEIT command creates a simulated 1- or 2-D dataset. It cannot be successfully issued without first:

  • defining a SOURCE model stack; and
  • defining a grid over which to evaluate the model stack.

The user may define the grid in one of three ways:

  • reading in a dataset (in which case, the faked data will replace the read-in amplitudes);
  • specifying a DATASPACE; or
  • defining an instrument stack that contains a response matrix file (RMF), from which a dataspace may be inferred; note that an instrument stack be defined automatically if PHA data are input, and the PHA data file header keywords RESPFILE and/or ANCRFILE point to existing files.

If one defines a dataspace and plans to use XSPEC models, then one must use the HISTOGRAM modifier to the DATASPACE command, since XSPEC models expect the dataset to be binned. Otherwise, the simulated data set may be either binned or unbinned.

Other, optional information may be input before FAKEIT is run.

  • A background dataset (see the command BACK) or a background model stack (BACKGROUND). If PHA data are input, a background dataset will be automatically input if the header keyword BACKFILE points to an existing file.
  • Values for the FAKEIT parameters TIME and BACKSCALE. If PHA data are input, TIME and BACKSCALE will have default settings corresponding to the values of the header keywords EXPTIME and BACKSCAL. These may of course be changed; see below.

Values of the FAKEIT parameters may be set as follows:

sherpa> FAKEIT TIME = <time>
sherpa> FAKEIT BACKSCALE = <backscale>

where <time> is in seconds, <backscale> is a dimensionless number.

Background data and/or models are treated as follows in FAKEIT:

  • If a background model stack is defined, it is evaluated on the source data grid, and the resulting background amplitudes are added to the source amplitudes (taking into account differences in exposure time and backscale). Faked data are then sampled given the sum. If background data exist, they are not altered. If the source dataset was background-subtracted prior to the command FAKEIT being issued, it will not be background-subtracted afterwards.
  • If no background model stack is defined, and the data are background-subtacted, then the source model stack is evaluated directly, and the new, faked data are background-subtracted. Note that subsequently issuing an UNSUBTRACT command in CIAO 3.0 is unwise, because as an artifact of the algorithm the unsubtracted data will not be integer counts data.
  • If no background model stack is defined, and the data are not background-subtacted, then the source model stack is evaluated directly, and the (properly scaled) background data are added to the faked data.

FAKEIT creates a new dataset and keeps it in memory (the Sherpa number assigned to this dataset is specified with # in the FAKEIT command). This new dataset may then be treated as though it were a dataset that the user had read from a file (e.g., it may be plotted using the LPLOT DATA [#] command; it may be used in a fit, etc.). Note that if the user has previously read a dataset, it will be overwritten with the new dataset created by FAKEIT.

Note that in CIAO 3.0, there is no facility for faking background spectra (i.e., there is no BFAKEIT command).

Example 1

Simulate a dataset, with an instrument model:

sherpa> RSP[instrumentA](data/example2.rmf,data/example2.arf)
The inferred file type is ARF.  If this is not what you want, please
specify the type explicitly in the data command.
sherpa> INSTRUMENT = instrumentA

The above commands define an instrument model named instrumentA, using the RMF and ARF files data/example2.rmf and data/example2.arf respectively. Next, a background data file is input:

sherpa> BACK data/example2_bkg.pha
The inferred file type is PHA.  If this is not what you want, please
specify the type explicitly in the data command.

The FAKEIT parameters are then set:

sherpa> FAKEIT TIME = 33483.2
sherpa> FAKEIT BACKSCALE = 0.0441895
sherpa> SHOW FAKEIT
Fakeit exposure time: 33483.2 seconds.
Fakeit backscale: 0.0441895

And, a simple source model expression is defined:

sherpa> PARAMPROMPT OFF
Model parameter prompting is off
sherpa> SOURCE = POW[modela]
sherpa> modela.gamma=2
sherpa> modela.ampl.min=0.000001
sherpa> modela.ampl=0.0003
sherpa> modela.ref=1

Finally, a simulated dataset is created:

sherpa> FAKEIT
FAKEIT: The current background data have been added to the faked spectrum.

This simulated dataset may be plotted, and written as PHA and ASCII files:

sherpa> LPLOT DATA
sherpa> WRITE DATA sim1.pha PHA
Write X-Axis: Energy (keV)  Y-Axis: Counts
sherpa> WRITE DATA sim1.dat ASCII
Write X-Axis: Energy (keV)  Y-Axis: Flux (Counts/sec/keV)

Example 2

Simulate a dataset, utilizing a previously input PHA file:

sherpa> ERASE ALL
sherpa> DATA data/example2.pha
The inferred file type is PHA.  If this is not what you want, please
specify the type explicitly in the data command.
WARNING: using systematic errors specified in the PHA file.
RMF is being input from:
  <directory_path>/example.rmf
ARF is being input from:
  <directory_path>/example.arf
Background data are being input from:
  <directory_path>/example_bkg.pha
sherpa> SHOW

Optimization Method: Levenberg-Marquardt
Statistic:           Chi-Squared Gehrels

-----------------
Input data files:
-----------------

Data 1: example2.pha pha.
Total Size: 95 bins (or pixels)
Dimensions: 1
Total counts (or values): 1688
Exposure: 33483.25 sec
Count rate: 0.050 cts/sec
Backscal: 0.044189

  Background 1: /data/simteste/Testing/sherpaTest/data/example2_bkg.pha pha.
  Total Size: 512 bins (or pixels)
  Dimensions: 1
  Total counts (or values): 2220
  Exposure: 108675.66 sec
  Count rate: 0.020 cts/sec
  Backscal: 0.044189

  The data are NOT background subtracted.


------------------------------
Defined analysis model stacks:
------------------------------

instrument source 1 = AutoReadResponse
instrument back 1 = AutoReadResponse

------------------------------------
Defined instrument model components:
------------------------------------

rsp1d[AutoReadResponse]
    Param   Type      Value        Min        Max                 Units
    -----   ----      -----        ---        ---                 -----
 1    rmf string: "/data/simteste/Testing/sherpaTest/data/example2.rmf"
 2    arf string: "/data/simteste/Testing/sherpaTest/data/example2.arf"

sherpa> SHOW FAKEIT
Fakeit exposure time: 33483.2 seconds.
Fakeit backscale: 0.0441895

After inputting a PHA dataset, the SHOW command confirms that an instrument model has been automatically defined using RMF and ARF files. Also, a background data file has been automatically read. The SHOW FAKEIT command confirms that the input data file contained the exposure time, backscale, and areascale keywords pertinent to the observation. Next, a source model expression is defined, and then a simulated dataset is created and written:

sherpa> PARAMPROMPT OFF
Model parameter prompting is off
sherpa> SOURCE = POW[modelA]
sherpa> modelA.gamma=2
sherpa> modelA.ampl.min=0.000001
sherpa> modelA.ampl=0.0003
sherpa> modelA.ref=1
sherpa> FAKEIT
FAKEIT: The current background data have been added to the faked spectrum.
sherpa> WRITE DATA simA.pha PHA
Write X-Axis: Energy (keV)  Y-Axis: Counts

Example 3

Simulate a second dataset:

sherpa> RSP[instrumentB](data/example2.rmf,data/example2.arf)
The inferred file type is ARF.  If this is not what you want, please
specify the type explicitly in the data command.
sherpa> INSTRUMENT 2 = instrumentB
sherpa> BACK 2 data/example2_bkg.pha
The inferred file type is PHA.  If this is not what you want, please
specify the type explicitly in the data command.
sherpa> FAKEIT 2 TIME = 66966.4
sherpa> FAKEIT 2 BACKSCALE = 0.0441895
sherpa> SOURCE 2 = POW[modelB]
sherpa> modelB.gamma=2
sherpa> modelB.ampl.min=0.000001
sherpa> modelB.ampl=0.0003
sherpa> modelB.ref=1
sherpa> FAKEIT 2
FAKEIT: The current background data have been added to the faked spectrum.
sherpa> LPLOT 2 DATA 1 DATA 2
sherpa> WRITE DATA 2 fakeit3.pha PHA
Write X-Axis: Energy (keV)  Y-Axis: Counts

These commands define a second instrument model, input a background data file for dataset number 2, set the FAKEIT parameters for dataset number 2, and define a second source model. The command FAKEIT 2 then creates simulated dataset number 2. Both simulated datasets are then plotted, and the second dataset is written to the data file fakeit3.pha.

Example 4

Simulate a dataset, without an instrument model:

sherpa> ERASE ALL
sherpa> PARAMPROMPT OFF
Model parameter prompting is off
sherpa> SOURCE = POW[modela]
sherpa> DATASPACE (1:1000:2)
sherpa> FAKEIT TIME = 33483.2
sherpa> FAKEIT BACKSCALE = 0.0441895
sherpa> SHOW FAKEIT
Fakeit exposure time: 33483.2 seconds.
Fakeit backscale: 0.0441895

sherpa> modela.gamma=2
sherpa> modela.ampl.min=0.000001
sherpa> modela.ampl=0.0003
sherpa> modela.ref=1
sherpa> FAKEIT
sherpa> LPLOT DATA

Instead of defining an instrument model, the DATASPACE command is used to define the appropriate grid over which to calculate the model values.

Example 5

Fake a 2-D image:

sherpa> DATASPACE (1:256:1,1:256:1)
sherpa> PARAMPROMPT OFF
sherpa> INSTRUMENT = FPSF2D[p]
sherpa> p.file = psf.fits
sherpa> SOURCE = GAUSS2D[g]
sherpa> g.xpos = 128
sherpa> g.ypos = 128
sherpa> g.ampl = 100
sherpa> g.fwhm = 25
sherpa> FAKEIT

Bugs

See the Sherpa bug pages online for an up-to-date listing of known bugs.

Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.