SpectrumSimulation¶
-
class
gammapy.spectrum.SpectrumSimulation(livetime, source_model, aeff, edisp=None, background_model=None, alpha=None)[source]¶ Bases:
objectSimulate
SpectrumObservation.For a usage example see spectrum_simulation.html
Parameters: livetime :
QuantityLivetime
source_model :
SpectralModelSource model
aeff :
EffectiveAreaTableEffective Area
edisp :
EnergyDispersion, optionalEnergy Dispersion
background_model :
SpectralModel, optionalBackground model
alpha : float, optional
Exposure ratio between source and background
Attributes Summary
e_recoReconstructed energy binning. npred_backgroundPredicted background ( CountsSpectrum).npred_sourcePredicted source CountsSpectrum.Methods Summary
reset()Clear all results. run(seed)Simulate SpectrumObservationList.simulate_background_counts(rand)Simulate background PHACountsSpectrum.simulate_obs(obs_id[, seed])Simulate one SpectrumObservation.simulate_source_counts(rand)Simulate source PHACountsSpectrum.Attributes Documentation
-
e_reco¶ Reconstructed energy binning.
-
npred_background¶ Predicted background (
CountsSpectrum).Calls
gammapy.spectrum.utils.CountsPredictor().
-
npred_source¶ Predicted source
CountsSpectrum.Calls
gammapy.spectrum.utils.CountsPredictor().
Methods Documentation
-
run(seed)[source]¶ Simulate
SpectrumObservationList.The seeds will be set as observation ID. Previously produced results will be overwritten.
Parameters: seed : array of ints
Random number generator seeds
-
simulate_background_counts(rand)[source]¶ Simulate background
PHACountsSpectrum.Background counts are added to the on vector. Furthermore background counts divided by alpha are added to the off vector.
TODO: At the moment the source IRFs are used. Make it possible to pass dedicated background IRFs.
Parameters: rand: `~numpy.random.RandomState`
random state
-
simulate_obs(obs_id, seed='random-seed')[source]¶ Simulate one
SpectrumObservation.The result is stored as
obsattributeParameters: obs_id : int
Observation identifier
seed : {int, ‘random-seed’, ‘global-rng’,
RandomState}see :func:~`gammapy.utils.random.get_random_state`
-
simulate_source_counts(rand)[source]¶ Simulate source
PHACountsSpectrum.Source counts are added to the on vector.
Parameters: rand: `~numpy.random.RandomState`
random state
-