VariableSourceSpectrumGenerator¶
- class gdt.core.simulate.generators.VariableSourceSpectrumGenerator(rsp, function, params, exposure, rng=None)[source]¶
Bases:
SourceSpectrumGeneratorSimulation generator for a Poisson source spectrum, efficient for generating deviates when the source spectrum amplitude changes.
Once initialized, a single deviate or many deviates can be generated:
gen = AmpFreeSourceSpectrumGenerator(rsp, function params, exposure) # generate a single deviate next(gen) # generate 10 deviates [next(gen) for i in range(10)] # change amplitude, and generate a new deviate gen.amp = 0.01 next(gen)
- Parameters:
rsp (
Rsp) – A detector response objectfunction (
Function) – A photon model functionparams (iterable) – The parameters for the function
exposure (float) – The source exposure
seed (int, optional) – The RNG seed
- Yields:
(
EnergyBins) – A Poisson random deviate of the initialized source spectrum
Attributes Summary
The amplitude, relative to initialized spectrum.
Methods Summary
set_rng(rng)Set/change the generator.
Attributes Documentation
- amp¶
The amplitude, relative to initialized spectrum. Setting
amp=1gives the initialized amplitude.- Type:
(float)
Methods Documentation
- set_rng(rng)¶
Set/change the generator.
- Parameters:
rng (numpy.random.Generator) – random number generator