HammingWindow#

class sionna.phy.signal.HammingWindow(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 Hamming window function.

The window function is applied through element-wise multiplication.

The Hamming window is defined by

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

where \(N\) is the window length and \(a_0 = \frac{25}{46}\).

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 HammingWindow

window = HammingWindow()
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)