Repository navigation
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