empirical_psd#

sionna.phy.signal.empirical_psd(x: torch.Tensor, show: bool = True, oversampling: float = 1.0, ylim: Tuple[float, float] = (-30, 3), precision: Literal['single', 'double'] | None = None) Tuple[torch.Tensor, torch.Tensor][source]#

Computes the empirical power spectral density.

Computes the empirical power spectral density (PSD) of tensor x along the last dimension by averaging over all other dimensions. Note that this function simply returns the averaged absolute squared discrete Fourier spectrum of x.

Parameters:
  • x (torch.Tensor) – Signal of which to compute the PSD with shape […, N] (torch.complex)

  • show (bool) – Indicates if a plot of the PSD should be generated

  • oversampling (float) – Oversampling factor

  • ylim (Tuple[float, float]) – Limits of the y axis. Only relevant if show is True.

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

Outputs:
  • freqs – [N], torch.float. Normalized frequencies.

  • psd – [N], torch.float. PSD.

Examples

import torch
from sionna.phy.signal import empirical_psd

x = torch.randn(100, 256, dtype=torch.complex64)
freqs, psd = empirical_psd(x, show=False)
print(freqs.shape, psd.shape)
# torch.Size([256]) torch.Size([256])