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.BlockConstellation 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
MapperandDemapper.- Parameters:
constellation_type (str) – Type of constellation. One of “qam”, “pam”, or “custom”. For “custom”, the constellation
pointsmust 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_typeis “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,
precisionis used.device (str | None) – Device for tensor operations. If None,
deviceis 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 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.
- 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:
constellation_type (str | None)
num_bits_per_symbol (int | None)
constellation (sionna.phy.mapping.Constellation | None)
precision (Literal['single', 'double'] | None)
device (str | None)