EventSpectrumGenerator

class gdt.core.simulate.generators.EventSpectrumGenerator(count_spectrum, dt, min_sep=0.0, rng=None)[source]

Bases: SimGenerator

Simulation generator producing Poisson arrival times for a source spectrum during a finite slice of time.

Photon losses from deadtime and detection/electronic processes can be accounted for by setting min_sep > 0. Once initialized, a single deviate or many deviates can be generated:

gen = EventSpectrumGenerator(spectrum, dt)

# generate a single deviate
next(gen)

# generate 10 deviates
[next(gen) for i in range(10)]
Parameters:
  • count_spectrum (np.array) – An array of counts in each energy channel

  • dt (float) – The width of the time slice in seconds

  • min_sep (float, optional) – The minimum possible time separation between events. Default is 2e-6 seconds.

  • rng (np.random.Generator, optional) – The random generator

Yields:

(np.array, np.array) – The arrival times and energy channels for each event

Attributes Summary

spectrum

The counts in each channel.

Methods Summary

set_rng(rng)

Set/change the generator.

Attributes Documentation

spectrum

The counts in each channel. The counts array will be converted to integer type.

Type:

(np.array)

Methods Documentation

set_rng(rng)

Set/change the generator.

Parameters:

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