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]#
Bases:
objectSionna 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.Methods
- torch_rng(device: str | None = None) torch._C.Generator[source]#
torch.Generator : PyTorch random number generator for the specified device
Example#
from sionna.phy import config config.seed = 42 # Set seed for deterministic results # Use generator instead of torch.randn noise = torch.randn([4], generator=config.torch_rng())
Attributes
- property cdtype: torch.dtype#
torch.dtype : Default PyTorch dtype for complex floating point numbers
- property dtype: torch.dtype#
torch.dtype : Default PyTorch dtype for real floating point numbers
- property np_cdtype: numpy.dtype#
np.dtype : Default NumPy dtype for complex floating point numbers
- property np_dtype: numpy.dtype#
np.dtype : Default NumPy dtype for real floating point numbers
- property np_rng: numpy.random._generator.Generator#
np.random.Generator : NumPy random number generator
Example#
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])
- property precision: Literal['single', 'double']#
"single"(default) |"double": Default precision used for all computationsThe
"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").
- property py_rng: random.Random#
random.Random : Python random number generator
Example#
from sionna.phy import config config.seed = 42 # Set seed for deterministic results # Use generator instead of random val = config.py_rng.randint(0, 10)
- property seed: int | None#
None (default) | int : 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 reproducibility of results. It defaults to None which implies that a random seed will be used and results are non-deterministic.
Example#
# This code will lead to deterministic results from sionna.phy import config from sionna.phy.mapping import BinarySource config.seed = 42 print(BinarySource()([10]))