Last modified: December 2014

Jump to: Description · Examples · See Also

AHELP for CIAO 4.12 Sherpa v1


Context: data


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




The fake command simulates a generic data set by evaluating a chosen source model over a blank data set, with Poisson noise is added to the modeled data values. The dataspace1d or dataspace2d commands are typically used to create 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'); however, the load_* commands such as load_data, load_image, or load_pha may also be also used to set the array grid.


Example 1

sherpa> dataspace1d(0.1, 10, 0.01)
sherpa> set_source(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> 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_source()
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_source(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, 300])
sherpa> set_source( +
sherpa> bb.xpos = 128
sherpa> bb.ypos = 128
sherpa> fake()
sherpa> image_model()

The fake command is used to generate a 2D dataset - with 256 X pixels and 300 Y pixels - using a beta2d model combined with a 2D constant (const2d).

See Also

copy_data, dataspace1d, dataspace2d, datastack, 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, 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_template_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