Repository navigation
Releases
v1.2.0: MIMO, AI-for-wireless & MCP server
CommPy 1.2.0 adds multiple-antenna MIMO support, an optional deep-learning
layer (commpy.ml), and an optional MCP server exposing CommPy to AI agents.
No breaking changes to the public API.
What's new
MIMO — i.i.d. Rayleigh channel (rayleigh_channel_matrix, mimo_awgn),
Alamouti space-time block coding (alamouti_encode/alamouti_decode),
spatial-multiplexing detectors (zf_detector, mmse_detector, ml_detector,
kbest_detector), and MIMO capacity (mimo_capacity, ergodic_mimo_capacity).
AI-for-wireless (optional, commpy[ml]) — a PyTorch layer under commpy.ml:
a differentiable AWGN channel, an end-to-end learned Autoencoder, a
NeuralDemapper, and a trainable NeuralMinSumDecoder for LDPC. Not imported by
default, so the base install stays NumPy/SciPy-only.
MCP server (optional, commpy[mcp]) — a commpy-mcp Model Context Protocol
server: capability listing, channel capacity, and uncoded/coded BER sweeps.
Docs & tooling — a Gallery page with generated figures, an opt-in benchmark
suite, fixed doc links, and a quickstart notebook covering the modern codes.
Install
pip install --upgrade commpy # base
pip install --upgrade "commpy[ml]" # + PyTorch AI layer
pip install --upgrade "commpy[mcp]" # + MCP serverFull changelog: v1.1.0...v1.2.0
v1.1.0: LDPC, Polar & Turbo codes
Highlights
CommPy 1.1.0 adds the three modern standard forward-error-correcting codes —
LDPC, polar, and turbo — that underpin 5G-NR, LTE, Wi-Fi and DVB. All
three decode directly from the soft-decision LLRs produced by
Modulator.soft_demodulate, and the new simulate_coded_ber turns a
coding-gain waterfall into a one-liner.
No breaking changes to the public API (commpy.*).
import numpy as np
from commpy import PolarCode, CRC, MPSKModulator, Channels
mod = MPSKModulator(2) # BPSK
code = PolarCode(block_length=128, k=64, crc=CRC.crc8()) # CRC-aided SCL (5G-style)
message = np.random.randint(0, 2, code.k)
rx = Channels.awgn(mod.modulate(code.encode(message)), snr_db=2.0)
llr = mod.soft_demodulate(rx, noise_var=10 ** -0.2)
decoded, codeword, _ = code.decode(llr, list_size=8)Added
Channel coding (FEC)
- LDPC —
LDPCCodewith vectorized belief propagation (sum-product &
normalized min-sum), Gallager (from_gallager) and quasi-cyclic
(from_base_graph) constructions, a systematic GF(2) generator that tolerates
rank-deficient parity-check matrices, and a ready rate-½ QC code. - Polar —
PolarCodewith successive-cancellation (SC) and CRC-aided
SC-list (CA-SCL) decoding (reuses theCRCclass), Bhattacharyya /
Gaussian-approximation frozen-set construction, and exact log-domain path
metrics verified equal to maximum-likelihood decoding. - Turbo —
TurboCode, a rate-⅓ parallel-concatenated code with
recursive-systematic constituent encoders and iterative log-MAP (BCJR)
decoding through an interleaver.
Simulation
simulate_coded_ber— Monte-Carlo BER sweep for any soft-input code
(modulate → channel →soft_demodulate→ decode); the coded counterpart of
simulate_ber.
Changed
plot_waterfallclamps confidence-interval error bars at 0, so the very small
error rates typical of coded curves no longer trip a matplotlib error.
Examples
ldpc_coding_gain_demo.py,polar_scl_demo.py,turbo_coding_gain_demo.py
Install
pip install --upgrade commpyFull changelog: v1.0.0...v1.1.0
v1.0.0: Channel Coding, OFDM & Information Theory: From Modulation Toolkit to Full Comms Stack
CommPy grows from a small modulation/channel-model toolkit into a comprehensive
communications-engineering library: forward error correction, a generic PHY layer,
OFDM, information theory, and queuing theory — all vectorized on NumPy/SciPy, with
an optional Numba fast path for the one inherently sequential hot loop (Viterbi
decoding).
No breaking changes to the public API. Three imports broken since an earlier
package rename are fixed as part of this release.
Highlights
Channel coding (FEC)
- Block codes:
CRC(CRC-8/16-XMODEM/32 presets + customCRCConfig),
HammingCode, genericCyclicCode,BCHCode,ReedSolomonCode— error decoding
via Berlekamp-Massey/Chien search/Forney, plus a separate erasures-only decoder
correcting up ton-kerasures (double the error-only capability). - Convolutional codes:
Trellis,ConvolutionalEncoder,viterbi_decode
(hard- and soft-decision, zero-tail termination, optional Numba JIT acceleration). - Interleaving:
BlockInterleaver,ConvolutionalInterleaver(Ramsey type-II).
Modulation & PHY
- A generic, Gray-coded
Modulatorengine —MPSKModulator,MQAMModulator,
MPAMModulator— with vectorized hard-decision demodulation and soft-decision
(LLR) output for feeding straight into Viterbi. - Original per-scheme classes (
OOK_Modulator,BPSK_Modulator, etc.) kept for
backward compatibility; theQPSK_Modulatorlist-vs-array bug is fixed. raised_cosine_filter/root_raised_cosine_filterpulse shaping, drop-in
compatible withIQWaveform.zf_equalizer/mmse_equalizerlinear FIR channel equalizers.gardner_timing_error,estimate_cfo_mth_power,costas_loop_bpsk
synchronization primitives.
OFDM
OFDMModulator/OFDMDemodulatorwith configurable active subcarriers and
cyclic prefix.papr,papr_db,papr_ccdffor peak-to-average power ratio analysis.
Information theory
binary_entropy,mutual_information,channel_capacity_bsc,
channel_capacity_awgn,channel_capacity_dmc(Blahut-Arimoto).huffman_codes/huffman_encode/huffman_decodeand
arithmetic_encode/arithmetic_decode(exact-rational arithmetic coding).rate_distortion_binary(closed-form binary rate-distortion function).
Networking
MM1Queue,MM1KQueue,MMcQueue— closed-form M/M/1-family queuing models.
Galois fields
PrimeField(GF(p)) generalized onto a newFiniteFieldbase; newGF2m
(GF(2^m)) via vectorized log/antilog tables — the algebraic foundation for
BCH/Reed-Solomon.
Fixed
- Three stale
CommPy→commpyimports (from an earlier package rename) that
brokePrimeField, the test suite, andIQWaveform's demo block. QPSK_Modulator's list-vs-array equality bug (silently produced wrong/empty
output forndarray/tupleinput).commpy.__version__now actually exists (previously documented but absent).
Infrastructure
- CI now runs
ruff,mypy --strict, andpyteston every push/PR across
Python 3.10–3.12, including a dedicated job for the Numba-absent fallback path. scipyis now a hard dependency;numbais an optionalcommpy[fast]extra.- Test suite grew from 3 tests to 324, including exhaustive brute-force
cross-validation for BCH/Reed-Solomon decoding and Viterbi-vs-maximum-likelihood
checks. - New
examples/directory: 8 runnable, tested scripts, including a full-chain
capstone (Huffman → convolutional code → BPSK → multipath channel → ZF
equalization → soft-decision Viterbi → decompression).
Stats
- Source: ~760 → ~3,750 lines
- Tests: 3 → 324 (all passing)
- Public API surface: 12 → ~65 exported names
Full changelog: see docs/CHANGELOG.md