SymbolSource#

class sionna.phy.mapping.SymbolSource(constellation_type: str | None = None, num_bits_per_symbol: int | None = None, constellation: sionna.phy.mapping.Constellation | None = None, return_indices: bool = False, return_bits: bool = False, precision: Literal['single', 'double'] | None = None, device: str | None = None, **kwargs: Any)[source]#

Bases: sionna.phy.block.Block

Generates a tensor of random constellation symbols.

Optionally, the symbol indices and/or binary representations of the constellation symbols can be returned.

Parameters:
  • constellation_type (str | None) – Type of constellation. One of “qam”, “pam”, or “custom”. For “custom”, an instance of Constellation must be provided.

  • num_bits_per_symbol (int | None) – Number of bits per constellation symbol, e.g., 4 for QAM16. Only required for constellation_type in [“qam”, “pam”].

  • constellation (sionna.phy.mapping.Constellation | None) – If no constellation is provided, constellation_type and num_bits_per_symbol must be provided. Defaults to None.

  • return_indices (bool) – If enabled, the function also returns the symbol indices. Defaults to False.

  • return_bits (bool) – If enabled, the function also returns the binary symbol representations (i.e., bit labels). Defaults to False.

  • precision (Literal['single', 'double'] | None) – Precision used for internal calculations and outputs. If set to None, precision is used.

  • device (str | None) – Device for tensor operations. If None, device is used.

  • kwargs (Any)

Inputs:

shape – 1D tensor/array/list, int. Desired shape of the output tensor.

Outputs:
  • symbolsshape, torch.complex. Tensor filled with random symbols of the chosen constellation_type.

  • symbol_indicesshape, torch.int32. Tensor filled with the symbol indices. Only returned if return_indices is True.

  • bits – [shape, num_bits_per_symbol], torch.float. Tensor filled with the binary symbol representations (i.e., bit labels). Only returned if return_bits is True.

Examples

import torch
from sionna.phy.mapping import SymbolSource

source = SymbolSource("qam", 4)
symbols = source([10, 100])
print(symbols.shape)
# torch.Size([10, 100])