deeptrack.sources.rng Module#

Classes that extend Numpy and Python rng generators.

This utility package extends the random number generator objects for both Python and Numpy by adding functions to generate several instances as well as dependency tracking with DeepTrackNode objects.

Key Features#

  • Extends Random Number Generators

    Lets the user instance as many rng’s as desired, with either Numpy or the Python standard library.

Module Structure#

  • NumpyRNG: Class that generates multiple numpy random number generators.

  • PythonRNG: Class that generates multiple python random number generators.

Examples#

Generate 3 rng’s with different seeds, and get a random number from them:

>>> from deeptrack.sources import rng
>>> python_rng = rng.PythonRNG(n_states=3, seed=123)
>>> for i, generator in enumerate(python_rng._generate_states()):
>>>     print(f"RNG {i}: Random Number -> {generator.randint(0, 100)}")

Classes#

DeepTrackNode([action])

Object corresponding to a node in a computation graph.

NumpyRNG(n_states[, seed])

Class that generates multiple numpy random number generators.

PythonRNG(n_states[, seed])

Class that generates multiple random.Random number generators.

Source(**kwargs)

A class that represents one or more sources of data.