kaira.modulations.PAMModulator

Inheritance diagram of PAMModulator

Inheritance diagram for PAMModulator

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

Bases: BaseModulator

Pulse Amplitude Modulation (PAM) modulator.

Maps groups of bits to amplitude levels for transmission.

Standard PAM modulation with uniform amplitude levels. Can use Gray coding for bit-to-symbol mapping, and supports normalization to unit average energy.

Methods

__init__

Initialize the PAM modulator.

forward

Modulate bit groups to PAM symbols.

plot_constellation

Plot the PAM constellation diagram.

reset_state

Reset any stateful components.

Attributes

bits_per_symbol

Number of bits per symbol.

levels

constellation

bit_patterns

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

Initialize the PAM modulator.

Parameters:
  • order – Modulation order (must be a power of 2)

  • 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 PAM 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 PAM symbols with shape (…, N)

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

Plot the PAM 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).