Constellation#

class sionna.phy.mapping.Constellation(constellation_type: str, num_bits_per_symbol: int, points: numpy.ndarray | torch.Tensor | None = None, normalize: bool = False, center: bool = False, precision: Literal['single', 'double'] | None = None, device: str | None = None, **kwargs: Any)[source]#

Bases: sionna.phy.block.Block

Constellation that can be used by a (de-)mapper.

This class defines a constellation, i.e., a complex-valued vector of constellation points. The binary representation of the index of an element of this vector corresponds to the bit label of the constellation point. This implicit bit labeling is used by the Mapper and Demapper.

Parameters:
  • constellation_type (str) – Type of constellation. One of “qam”, “pam”, or “custom”. For “custom”, the constellation points must be provided.

  • num_bits_per_symbol (int) – Number of bits per constellation symbol, e.g., 4 for QAM16.

  • points (numpy.ndarray | torch.Tensor | None) – Custom constellation points of shape [2**num_bits_per_symbol]. Only used when constellation_type is “custom”. Defaults to None.

  • normalize (bool) – If True, the constellation is normalized to have unit power. Only applies to custom constellations. Defaults to False.

  • center (bool) – If True, the constellation is ensured to have zero mean. Only applies to custom constellations. 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)

Outputs:

points – [2**num_bits_per_symbol], torch.complex. (Possibly) centered and normalized constellation points.

Examples

from sionna.phy.mapping import Constellation

# Create a 16-QAM constellation
const = Constellation("qam", 4)
points = const()
print(points.shape)
# torch.Size([16])

# Visualize the constellation
const.show()

Attributes

property constellation_type: str#

Constellation type (“qam”, “pam”, or “custom”)

property num_bits_per_symbol: int#

Number of bits per symbol

property num_points: int#

Number of constellation points

property normalize: bool#

Get/set if the constellation is normalized

property center: bool#

Get/set if the constellation is centered

property points: torch.Tensor#

Get/set constellation points of shape [2**num_bits_per_symbol]

Methods

show(labels: bool = True, figsize: Tuple[float, float] = (7, 7)) matplotlib.figure.Figure[source]#

Generate a scatter-plot of the constellation.

Parameters:
  • labels (bool) – If True, the bit labels will be drawn next to each constellation point. Defaults to True.

  • figsize (Tuple[float, float]) – Width and height in inches. Defaults to (7, 7).

Outputs:

figplt.Figure. The matplotlib figure object.

static check_or_create(*, constellation_type: str | None = None, num_bits_per_symbol: int | None = None, constellation: sionna.phy.mapping.Constellation | None = None, precision: Literal['single', 'double'] | None = None, device: str | None = None) sionna.phy.mapping.Constellation[source]#

Either creates a new constellation or checks an existing one.

Parameters: