PhaSimulator¶
- class gdt.core.simulate.pha.PhaSimulator(rsp, function, params, exposure, bkgd, bkgd_distrib, rng=None)[source]¶
Bases:
objectSimulate PHA data given a modeled background spectrum, detector response, source spectrum, and exposure.
- Parameters:
rsp (
Rsp) – A detector response objectfunction (
Function) – A photon model functionparams (iterable) – The parameters for the function
exposure (float) – The source exposure
bkgd (
BackgroundSpectrum) – A modeled background spectrumbkgd_distrib (str) – The distribution from which the background is simulated; either ‘Poisson’ or ‘Gaussian’
rng (numpy.random.Generator, optional) – random number generator
Methods Summary
set_background(bkgd, bkgd_distrib)Set/change the background model.
set_rng(rng)Set/change the generator.
set_rsp(rsp)Set/change the detector response.
set_source(function, params, exposure)Set/change the source spectrum.
simulate_background(num_sims)Generate simulations of the modeled background spectrum.
simulate_source(num_sims)Generate simulations of the source spectrum.
simulate_sum(num_sims)Generate simulations of the background + source spectrum.
to_bak(num_sims[, tstart, tstop])Produce BAK objects from simulations.
to_pha(num_sims[, tstart, tstop])Produce PHA objects of the background + source from simulations.
to_phaii(num_sims[, bin_width])Produce a PHAII object by concatenating the simulations.
Methods Documentation
- set_background(bkgd, bkgd_distrib)[source]¶
Set/change the background model.
- Parameters:
bkgd (
BackgroundSpectrum) – A modeled background spectrumbkgd_distrib (str) – The distribution from which the background is simulated; either ‘Poisson’ or ‘Gaussian’
- set_rng(rng)[source]¶
Set/change the generator.
- Parameters:
rng (numpy.random.Generator) – random number generator
- set_rsp(rsp)[source]¶
Set/change the detector response.
- Parameters:
rsp (
Rsp) – A detector response object
- set_source(function, params, exposure)[source]¶
Set/change the source spectrum.
- Parameters:
function (
Function) – A photon model functionparams (iterable) – The parameters for the function
exposure (float) – The source exposure
- simulate_background(num_sims)[source]¶
Generate simulations of the modeled background spectrum.
- Parameters:
num_sims (int) – Number of simulations
- Returns:
(list of
BackgroundSpectrum)
- simulate_source(num_sims)[source]¶
Generate simulations of the source spectrum.
- Parameters:
num_sims (int) – Number of simulations
- Returns:
(list of
EnergyBins)
- simulate_sum(num_sims)[source]¶
Generate simulations of the background + source spectrum.
- Parameters:
num_sims (int) – Number of simulations
- Returns:
(list of
EnergyBins)
- to_pha(num_sims, tstart=None, tstop=None, **kwargs)[source]¶
Produce PHA objects of the background + source from simulations.
- Parameters:
num_sims (int) – Number of simulations
tstart (float, optional) – The start time. If not set, then is zero.
tstop (float, optional) – Then end time. If not set, then is the exposure.
**kwargs – Options passed to
from_data()
- Returns:
(list of
Pha)