Chandra X-Ray Observatory
Skip to the navigation links
Last modified: December 2010

Jump to: Description · Examples · See Also

AHELP for CIAO 4.3 Sherpa v1


Context: data


Simulate a generic data set with a chosen model and add noise


fake( [id=None] )


The fake command simulates a generic data set by evaluating a chosen source model over a blank data set created with the dataspace1d command; Poisson noise is added to the modeled data values. The dataspace1d command creates an empty data array with a user-defined grid; the user specifies the grid 'start' and 'stop' points, and optionally the grid 'step' size or 'numbins' and data set type ('dstype', default is Data1dInt).

Example 1

sherpa> dataspace1d(0.1,10,0.01)
sherpa> set_model(gauss1d.g1)
sherpa> fake()

The fake command evaluates a 1D Gaussian model function over an empty 1D data array created with the dataspace1d command. The modeled values are simulated with Poisson noise and stored to data set id=1. Since the 'dstype' argument was not explicitly set in the dataspace1d command, the empty array has the default data set type Data1DInt.

sherpa> dataspace1d(0.1,10,0.01)
sherpa> set_model(gauss1d.g1)
sherpa> fake()

sherpa> show_data()
Data Set: 1
Filter: 0.1050-10.0050 x
name      = dataspace1d
xlo       = Float64[991]
xhi       = Float64[991]
y         = Float64[991]
staterror = None
syserror  = None

sherpa> show_model()
Model: 1
   Param        Type          Value          Min          Max      Units
   -----        ----          -----          ---          ---      -----
   g1.fwhm      thawed           10  1.17549e-38  3.40282e+38           
   g1.pos       thawed            0 -3.40282e+38  3.40282e+38           
   g1.ampl      thawed            1 -3.40282e+38  3.40282e+38      

Example 2

sherpa> dataspace1d(1,10,id=2,dstype=DataPHA)
sherpa> set_model(2, xspowerlaw.p1)
sherpa> fake(2)

Here, the fake command is used to generate a generic 1D PHA data set using a powerlaw model function. Since the 'step' argument was not explicitly set in the dataspace1d command, the empty data array is created using the default grid step size of 1. The modeled values are simulated with Poisson noise and stored to data set id=2.

Example 3

sherpa> dataspace2d([256,256])
sherpa> set_model(
sherpa> bb.xpos=128
sherpa> bb.ypos=128
sherpa> fake()
sherpa> image_model()

The fake command is used to generate a 2D dataset using a beta2d model combined with a 2D constant (const2d).

See Also

copy_data, dataspace1d, dataspace2d, delete_data, fake_pha, get_axes, get_bkg_plot, get_counts, get_data, get_data_plot, get_dep, get_dims, get_error, get_quality, get_specresp, get_staterror, get_syserror, group_sherpa, load_arf, load_arrays, load_ascii, load_bkg, load_bkg_arf, load_bkg_rmf, load_data, load_grouping, load_image, load_multi_arfs, load_multi_rmfs, load_pha, load_quality, load_rmf, load_staterror, load_syserror, load_table, pack_image, pack_pha, pack_table, set_data, set_quality, ungroup, unpack_arf, unpack_arrays, unpack_ascii, unpack_bkg, unpack_data, unpack_image, unpack_pha, unpack_rmf, unpack_table
get_filter, load_filter, set_filter
get_default_id, list_bkg_ids, list_data_ids, list_response_ids
add_model, add_user_pars, clean, load_table_model, load_user_model, save_model, save_source
plot_data, set_xlinear, set_xlog, set_ylinear, set_ylog
save_arrays, save_data, save_delchi, save_error, save_filter, save_grouping, save_image, save_pha, save_quality, save_resid, save_staterror, save_syserror, save_table
calc_data_sum, calc_data_sum2d, calc_ftest, calc_kcorr, calc_mlr, calc_model_sum2d, calc_source_sum2d, get_rate
contour, contour_data, contour_ratio, get_ratio, get_resid, histogram1d, histogram2d, image_data, rebin

Last modified: December 2010
Smithsonian Institute Smithsonian Institute

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