Configuration

Sionna PHY’s configuration API. It can be used to set global variables which can be used by all of its modules and functions.

class sionna.phy.config.Config[source]

Sionna PHY Configuration Class

This singleton class is used to define global configuration variables and random number generators that can be accessed from all modules and functions. It is instantiated immediately and its properties can be accessed as sionna.phy.config.desired_property.

property np_cdtype

Default NumPy dtype for complex floating point numbers

Type:

np.dtype

property np_rdtype

Default NumPy dtype for real floating point numbers

Type:

np.dtype

property np_rng

NumPy random number generator

from sionna.phy import config
config.seed = 42 # Set seed for deterministic results

# Use generator instead of np.random
noise = config.np_rng.normal(size=[4])
Type:

np.random.Generator

property precision

Default precision used for all computations

The “single” option represents real-valued floating-point numbers using 32 bits, whereas the “double” option uses 64 bits. For complex-valued data types, each component of the complex number (real and imaginary parts) uses either 32 bits (for “single”) or 64 bits (for “double”).

Type:

“single” (default) | “double”

property py_rng

Python random number generator

from sionna.phy import config
config.seed = 42 # Set seed for deterministic results

# Use generator instead of random
int = config.py_rng.randint(0, 10)
Type:

random.Random

property seed

Get/set seed for all random number generators

All random number generators used internally by Sionna can be configured with a common seed to ensure reproducability of results. It defaults to None which implies that a random seed will be used and results are non-deterministic.

# This code will lead to deterministic results
from sionna.phy import config
from sionna.phy.mapping import BinarySource
config.seed = 42
print(BinarySource()([10]))
tf.Tensor([0. 1. 1. 1. 1. 0. 1. 0. 1. 0.], shape=(10,), dtype=float32)
Type:

None (default) | int

property tf_cdtype

Default TensorFlow dtype for complex floating point numbers

Type:

tf.dtype

property tf_rdtype

Default TensorFlow dtype for real floating point numbers

Type:

tf.dtype

property tf_rng

TensorFlow random number generator

from sionna.phy import config
config.seed = 42 # Set seed for deterministic results

# Use generator instead of tf.random
noise = config.tf_rng.normal([4])
Type:

tf.random.Generator