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.ObjectClass defining a pilot pattern for an OFDM ResourceGrid.
A
PilotPatterndefines how transmitters send pilot sequences for each of their antennas or streams over an OFDM resource grid. It consists of two components, amaskandpilots. Themaskindicates 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. Thepilotscontains the pilot symbols that are transmitted at the positions indicated by themask. Separating a pilot pattern intomaskandpilotsenables 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
maskwith shape [num_tx, num_streams_per_tx, num_pilots]normalize (bool) – If True, the
pilotsare 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,
precisionis used.device (str | None) – Device for tensor operations. If None,
deviceis used.
Notes
Note that
num_effective_subcarriersis 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 thefft_sizeof theResourceGrid.Examples
The following code snippet shows how to define a simple custom
PilotPatternfor 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 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