HannWindow#

class sionna.phy.signal.HannWindow(normalize: bool = False, precision: Literal['single', 'double'] | None = None, device: str | None = None, **kwargs)[source]#

Bases: sionna.phy.signal.window.Window

Block for defining a Hann window function.

The window function is applied through element-wise multiplication.

The Hann window is defined by

\[w_n = \sin^2 \left( \frac{\pi n}{N} \right), 0 \leq n \leq N-1\]

where \(N\) is the window length.

Parameters:
  • normalize (bool) – If True, the window is normalized to have unit average power per coefficient. 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 computation. If None, device is used.

Inputs:

x – […, N], torch.complex or torch.float. The input to which the window function is applied. The window function is applied along the last dimension. The length of the last dimension N must be the same as the length of the window function.

Outputs:

y – […, N], torch.complex or torch.float. Output of the windowing operation.

Examples

import torch
from sionna.phy.signal import HannWindow

window = HannWindow()
x = torch.randn(32, 64)
y = window(x)
print(y.shape)
# torch.Size([32, 64])

Methods

build(input_shape: tuple) None[source]#

Initialize the block based on the inputs’ shapes.

Subclasses can override this method to create tensors or sub-blocks whose sizes depend on the input shapes.

Parameters:
  • *arg_shapes – Shapes of the positional arguments. Can be tuples (for tensors) or nested structures thereof (for lists/dicts of tensors).

  • **kwarg_shapes – Shapes of the keyword arguments. Can be tuples (for tensors) or nested structures thereof (for lists/dicts of tensors).

  • input_shape (tuple)