kaira.channels.AWGNChannel

Inheritance diagram of AWGNChannel

Inheritance diagram for AWGNChannel

class kaira.channels.AWGNChannel(avg_noise_power: float | None = None, snr_db: float | None = None, *args: Any, **kwargs: Any)[source]

Bases: BaseChannel

Additive white Gaussian noise (AWGN) channel for signal transmission.

This channel adds Gaussian noise to the input signal, supporting both real and complex-valued inputs automatically. For complex inputs, noise is added to both real and imaginary components. AWGN channels are fundamental in communication theory and commonly used as a baseline model [Proakis and Salehi, 2007].

Mathematical Model:

y = x + n where n ~ N(0, σ²) for real inputs or n ~ CN(0, σ²) for complex inputs

Parameters:
  • avg_noise_power (float, optional) – The average noise power σ².

  • snr_db (float, optional) – SNR in dB (alternative to avg_noise_power).

Example

>>> # For real-valued signals
>>> channel = AWGNChannel(avg_noise_power=0.1)
>>> x_real = torch.ones(10, 1)
>>> y_real = channel(x_real)  # Real noisy output
>>> # For complex-valued signals (same channel works)
>>> x_complex = torch.complex(torch.ones(10, 1), torch.zeros(10, 1))
>>> y_complex = channel(x_complex)  # Complex noisy output

Methods

__init__

Initialize the AWGN channel.

forward

Apply AWGN to the input signal.

get_config

Get a dictionary of the channel's configuration.

Attributes

avg_noise_power

snr_db

__init__(avg_noise_power: float | None = None, snr_db: float | None = None, *args: Any, **kwargs: Any)[source]

Initialize the AWGN channel.

Parameters:
  • avg_noise_power (float, optional) – The average noise power σ².

  • snr_db (float, optional) – SNR in dB (alternative to avg_noise_power).

  • *args – Variable length argument list passed to the base class.

  • **kwargs – Arbitrary keyword arguments passed to the base class.

avg_noise_power: float | None
snr_db: float | None
forward(x: Tensor, *args: Any, csi=None, noise=None, **kwargs: Any) Tensor[source]

Apply AWGN to the input signal.

Parameters:
  • x (torch.Tensor) – The input tensor.

  • *args – Additional positional arguments (unused).

  • csi (Optional[torch.Tensor]) – Channel state information (unused in AWGN).

  • noise (Optional[torch.Tensor]) – Pre-generated noise tensor. If provided, this noise will be added instead of generating new noise.

  • **kwargs – Additional keyword arguments (unused).

Returns:

The output tensor with AWGN added.

Return type:

torch.Tensor

get_config() Dict[str, Any]

Get a dictionary of the channel’s configuration.

This method returns a dictionary containing the channel’s parameters, which can be used to recreate the channel instance.

Returns:

Dictionary of parameter names and values

Return type:

Dict[str, Any]