Skip to content

Modulation Workflow

This example illustrates a modulation workflow using qsp-modulation.

Note

This is a conceptual example. Code snippets are illustrative. Verify against the current package API before use.


Overview

qsp-modulation provides tools for constructing modulated signals using quaternionic representations. This is useful when working with signals that carry phase, polarization, or geometric state information beyond what standard IQ modulation can represent.


Scenario

You want to:

  1. Generate a quaternionic symbol stream for a communication channel
  2. Modulate it onto a carrier
  3. Pass the result to a downstream signal chain

Symbol generation

# Conceptual example — not a tested API call
import numpy as np
import qsp_core
import qsp_modulation

# Define a constellation of symbol states in quaternion space
# (Illustrative — actual constellation design API may differ)
constellation = qsp_modulation.Constellation.from_geometry("qpsk_q")

# Generate a random bit stream
bits = np.random.randint(0, 2, size=1024)

# Map bits to quaternionic symbols
symbols = qsp_modulation.map_bits(bits, constellation)

print(f"Generated {len(symbols)} symbols")
print(f"Symbol type: {type(symbols)}")

Modulation

# Conceptual example
carrier_hz = 2.4e9
sample_rate_hz = 10e6

# Modulate symbols onto carrier
modulated = qsp_modulation.modulate(
    symbols,
    carrier_hz=carrier_hz,
    sample_rate_hz=sample_rate_hz,
)

Demodulation

# Conceptual example
# Assume `received` is a quaternionic signal after filtering
received = ...  # output from qsp_filter.apply(...)

demodulated_symbols = qsp_modulation.demodulate(
    received,
    carrier_hz=carrier_hz,
    sample_rate_hz=sample_rate_hz,
)

recovered_bits = qsp_modulation.unmap_symbols(demodulated_symbols, constellation)

Notes

  • Quaternionic constellations differ from standard IQ constellations. The additional degrees of freedom can encode polarization or spatial phase state alongside the standard IQ signal.
  • This example does not model channel effects. For realistic simulations, add channel noise and phase rotation before demodulation.
  • The actual API for Constellation, map_bits, and unmap_symbols should be verified against the qsp-modulation package documentation.