VariablePoissonBackground

class gdt.core.simulate.generators.VariablePoissonBackground(bkgd, rng=None)[source]

Bases: PoissonBackgroundGenerator

Simulation generator for a variable Poisson Background.

This non-homogeneous approximation allows the amplitude of the spectrum to be adjusted, thereby scaling the simulated counts. Once initialized, a single deviate or many deviates can be generated:

gen = VariablePoissonBackground(bkgd)

# generate a single deviate
next(gen)

# generate 10 deviates
[next(gen) for i in range(10)]

# change the amplitude to half of the initialized amplitude
gen.amp = 0.5
Parameters:
  • bkgd (BackgroundSpectrum) – A modeled background spectrum

  • seed (int, optional) – The RNG seed

Yields:

(BackgroundSpectrum) – A Poisson random deviate of the spectrum

Attributes Summary

amp

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=1 gives the initialized amplitude.

Type:

(float)

Methods Documentation

set_rng(rng)

Set/change the generator.

Parameters:

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