Last modified: 7 November 2022

How can I simulate a PHA data set in Sherpa, with/without added Poisson noise?

The Sherpa fake_pha function is available for simulating a PHA data set, given a user-specified source model, integration time, and instrument response (ARF and RMF or RSP). The model parameters - which may have been previously fitted to an actual data set - are used to create the fake spectrum, which contains Poisson noise determined by the model parameters and integration time.

At the moment, there is no explicit way to prevent fake_pha from adding Poisson noise to the simulated counts; however, artificially increasing the exposure time until the fractional noise level is less than some threshold, would render the added Poisson noise irrelevant. This is the recommended method for faking spectra with integer counts; for non-integer counts, the recommended approach is to evaluate the given model and set the model-predicted counts as the data, using the set_counts function as shown below.

sherpa> set_source("faked", xsphabs.abs1*powlaw1d.p1)   
sherpa> fake_pha("faked", arf="arf.fits", rmf="rmf.fits", exposure=10000)  

sherpa> spectral_coords = get_indep("faked") 
sherpa> mdl = get_model("faked")
sherpa> counts = mdl(*spectral_coords)

sherpa> set_counts("faked", counts)