SourceSpectrumGenerator

class gdt.core.simulate.generators.SourceSpectrumGenerator(rsp, function, params, exposure, rng=None)[source]

Bases: SimGenerator

Simulation generator for a Poisson source spectrum.

Once initialized, a single deviate or many deviates can be generated:

gen = SourceSpectrumGenerator(rsp, function params, exposure)

# generate a single deviate
next(gen)

# generate 10 deviates
[next(gen) for i in range(10)]
Parameters:
  • rsp (Rsp) – A detector response object

  • function (Function) – A photon model function

  • params (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

Methods Summary

set_rng(rng)

Set/change the generator.

Methods Documentation

set_rng(rng)

Set/change the generator.

Parameters:

rng (numpy.random.Generator) – random number generator