VariableGaussianBackground

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

Bases: GaussianBackgroundGenerator

Simulation generator for a variable Gaussian 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 = VariableGaussianBackground(bkgd)

# generate a single deviate
next(gen)

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

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

  • seed (int, optional) – The RNG seed

Yields:

(BackgroundSpectrum) – A Gaussian 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