PilotPattern#

class sionna.phy.ofdm.PilotPattern(mask: numpy.ndarray | torch.Tensor, pilots: numpy.ndarray | torch.Tensor, normalize: bool = False, precision: Literal['single', 'double'] | None = None, device: str | None = None)[source]#

Bases: sionna.phy.object.Object

Class defining a pilot pattern for an OFDM ResourceGrid.

A PilotPattern defines how transmitters send pilot sequences for each of their antennas or streams over an OFDM resource grid. It consists of two components, a mask and pilots. The mask indicates which resource elements are reserved for pilot transmissions by each transmitter and its respective streams. In some cases, the number of streams is equal to the number of transmit antennas, but this does not need to be the case, e.g., for precoded transmissions. The pilots contains the pilot symbols that are transmitted at the positions indicated by the mask. Separating a pilot pattern into mask and pilots enables the implementation of a wide range of pilot configurations, including trainable pilot sequences.

The pilots are mapped onto the mask from the smallest effective subcarrier and OFDM symbol index to the highest effective subcarrier and OFDM symbol index. It is important to keep this order of mapping in mind when designing more complex pilot sequences.

Parameters:
  • mask (numpy.ndarray | torch.Tensor) – Tensor indicating resource elements reserved for pilot transmissions with shape [num_tx, num_streams_per_tx, num_ofdm_symbols, num_effective_subcarriers]

  • pilots (numpy.ndarray | torch.Tensor) – The pilot symbols to be mapped onto the mask with shape [num_tx, num_streams_per_tx, num_pilots]

  • normalize (bool) – If True, the pilots are normalized to an average energy of one across the last dimension. 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.

Notes

Note that num_effective_subcarriers is the number of subcarriers that can be used for data or pilot transmissions. Due to guard carriers or a nulled DC carrier, this number can be smaller than the fft_size of the ResourceGrid.

Examples

The following code snippet shows how to define a simple custom PilotPattern for a single transmitter sending two streams:

import numpy as np
from sionna.phy.ofdm import PilotPattern

num_tx = 1
num_streams_per_tx = 2
num_ofdm_symbols = 14
num_effective_subcarriers = 12

# Create a pilot mask
mask = np.zeros([num_tx,
                 num_streams_per_tx,
                 num_ofdm_symbols,
                 num_effective_subcarriers])
mask[0, :, [2,11], :] = 1
num_pilot_symbols = int(np.sum(mask[0,0]))

# Define pilot sequences
pilots = np.zeros([num_tx,
                   num_streams_per_tx,
                   num_pilot_symbols], np.complex64)
pilots[0, 0, 0:num_pilot_symbols:2] = (1+1j)/np.sqrt(2)
pilots[0, 1, 1:num_pilot_symbols:2] = (1+1j)/np.sqrt(2)

# Create a PilotPattern instance
pp = PilotPattern(mask, pilots)

# Visualize non-zero elements of the pilot sequence
pp.show(show_pilot_ind=True)

Attributes

property num_tx: int#

Number of transmitters

property num_streams_per_tx: int#

Number of streams per transmitter

property num_ofdm_symbols: int#

Number of OFDM symbols

property num_effective_subcarriers: int#

Number of effective subcarriers

property num_pilot_symbols: int#

Number of pilot symbols per transmit stream

property num_data_symbols: int#

Number of data symbols per transmit stream

property normalize: bool#

Get/set if the pilots are normalized or not

property mask: torch.Tensor#

Mask of the pilot pattern with shape [num_tx, num_streams_per_tx, num_ofdm_symbols, num_effective_subcarriers]

property pilots: torch.Tensor#

Get/set the possibly normalized tensor of pilot symbols with shape [num_tx, num_streams_per_tx, num_pilots].

If pilots are normalized, the normalization will be applied after new values for pilots have been set. If this is not the desired behavior, turn normalization off.

Methods

show(tx_ind: int | List[int] | None = None, stream_ind: int | List[int] | None = None, show_pilot_ind: bool = False) List[matplotlib.figure.Figure][source]#

Visualizes the pilot patterns for some transmitters and streams.

Parameters:
  • tx_ind (int | List[int] | None) – Indices of transmitters to include. If None, all transmitters are included.

  • stream_ind (int | List[int] | None) – Indices of streams to include. If None, all streams are included.

  • show_pilot_ind (bool) – If True, the indices of the pilot symbols are shown. Defaults to False.

Outputs:

figs – List of matplotlib figure objects showing each the pilot pattern from a specific transmitter and stream