kaira.modulations.QAMModulator

Inheritance diagram of QAMModulator

Inheritance diagram for QAMModulator

class kaira.modulations.QAMModulator(order: Literal[4, 16, 64, 256], gray_coding: bool = True, normalize: bool = True, *args, **kwargs)[source]

Bases: BaseModulator

Quadrature Amplitude Modulation (QAM) modulator.

Maps groups of bits to constellation points with different amplitudes and phases.

Methods

__init__

Initialize the QAM modulator.

forward

Modulate bit groups to QAM symbols.

plot_constellation

Plot the QAM constellation diagram.

reset_state

Reset any stateful components.

Attributes

bits_per_symbol

Number of bits per symbol.

constellation

bit_patterns

constellation: Tensor
bit_patterns: Tensor
__init__(order: Literal[4, 16, 64, 256], gray_coding: bool = True, normalize: bool = True, *args, **kwargs) None[source]

Initialize the QAM modulator.

Parameters:
  • order – Modulation order (must be a perfect square and power of 4)

  • gray_coding – Whether to use Gray coding for mapping

  • normalize – If True, normalize constellation to unit energy

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

forward(x: Tensor, *args, **kwargs) Tensor[source]

Modulate bit groups to QAM symbols.

Parameters:
  • x – Input tensor of bits with shape (…, K*N), where K is bits_per_symbol

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

Complex tensor of QAM symbols with shape (…, N)

plot_constellation(**kwargs) Tuple[Figure, Axes][source]

Plot the QAM constellation diagram.

Parameters:

**kwargs – Additional arguments passed to plot_constellation

Returns:

Matplotlib figure object

property bits_per_symbol: int

Number of bits per symbol.

reset_state() None

Reset any stateful components.

For modulators with memory (like differential schemes).