kaira.modulations.PSKModulator

Inheritance diagram of PSKModulator

Inheritance diagram for PSKModulator

class kaira.modulations.PSKModulator(order: Literal[4, 8, 16, 32, 64] = 4, gray_coding: bool = True, constellation: Tensor | None = None, *args, **kwargs)[source]

Bases: BaseModulator

General M-ary Phase-Shift Keying (PSK) modulator.

Maps groups of bits to complex constellation points around the unit circle. Follows standard digital communications convention with Gray coding.

Methods

__init__

Initialize the PSK modulator.

forward

Modulate bit groups to PSK symbols.

plot_constellation

Plot the PSK constellation diagram.

reset_state

Reset any stateful components.

Attributes

bits_per_symbol

Number of bits per symbol.

constellation

bit_patterns

bit_to_symbol_map

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

Initialize the PSK modulator.

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

  • gray_coding – Whether to use Gray coding for constellation mapping

  • constellation – Optional custom constellation points (overrides order)

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

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

Modulate bit groups to PSK symbols.

Parameters:
  • x – Input tensor of bits with shape (…, M) or direct indices into the constellation

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

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

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

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