commkit 3.12.0__tar.gz → 3.13.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {commkit-3.12.0 → commkit-3.13.0}/AGENTS.md +4 -2
- {commkit-3.12.0 → commkit-3.13.0}/CHANGELOG.md +33 -1
- {commkit-3.12.0 → commkit-3.13.0}/PKG-INFO +5 -4
- {commkit-3.12.0 → commkit-3.13.0}/README.md +4 -3
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/bench_signal_pipeline.py +1 -1
- {commkit-3.12.0 → commkit-3.13.0}/commkit/__init__.py +1 -1
- {commkit-3.12.0 → commkit-3.13.0}/commkit/analysis/linewidth/phase.py +5 -2
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/linear.py +99 -45
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/polarization.py +24 -20
- {commkit-3.12.0 → commkit-3.13.0}/commkit/mapping/constellation.py +7 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/mapping/llr.py +4 -2
- {commkit-3.12.0 → commkit-3.13.0}/commkit/math.py +154 -4
- commkit-3.13.0/commkit/metrics/__init__.py +186 -0
- commkit-3.13.0/commkit/metrics/_blind.py +405 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/metrics/_common.py +83 -7
- {commkit-3.12.0 → commkit-3.13.0}/commkit/metrics/information.py +12 -8
- commkit-3.13.0/commkit/metrics/quality.py +560 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/multirate.py +9 -18
- {commkit-3.12.0 → commkit-3.13.0}/commkit/plotting/analysis.py +1 -1
- {commkit-3.12.0 → commkit-3.13.0}/commkit/plotting/constellation.py +35 -20
- {commkit-3.12.0 → commkit-3.13.0}/commkit/recovery/_common.py +3 -2
- {commkit-3.12.0 → commkit-3.13.0}/commkit/recovery/bps.py +11 -6
- {commkit-3.12.0 → commkit-3.13.0}/commkit/recovery/pll.py +13 -7
- {commkit-3.12.0 → commkit-3.13.0}/commkit/spectral.py +4 -17
- {commkit-3.12.0 → commkit-3.13.0}/examples/06-awgn-and-performance-metrics.ipynb +7 -4
- {commkit-3.12.0 → commkit-3.13.0}/examples/09-laser-phase-noise.ipynb +1 -1
- {commkit-3.12.0 → commkit-3.13.0}/examples/10-front-end-impairments.ipynb +1 -1
- {commkit-3.12.0 → commkit-3.13.0}/examples/12-sampling-clock-recovery.ipynb +9 -2
- {commkit-3.12.0 → commkit-3.13.0}/examples/14-blind-carrier-phase-recovery.ipynb +14 -3
- {commkit-3.12.0 → commkit-3.13.0}/examples/15-pilot-aided-carrier-recovery.ipynb +11 -4
- {commkit-3.12.0 → commkit-3.13.0}/examples/17-adaptive-equalization.ipynb +17 -7
- {commkit-3.12.0 → commkit-3.13.0}/examples/20-chromatic-dispersion.ipynb +7 -1
- {commkit-3.12.0 → commkit-3.13.0}/examples/24-coherent-transceiver-end-to-end.ipynb +8 -3
- commkit-3.13.0/examples/25-noise-snr-and-metrics-in-the-receiver.ipynb +1495 -0
- commkit-3.12.0/examples/25-carrier-phase-characterization.ipynb → commkit-3.13.0/examples/26-carrier-phase-characterization.ipynb +2 -2
- commkit-3.12.0/examples/26-laser-linewidth-self-heterodyne.ipynb → commkit-3.13.0/examples/27-laser-linewidth-self-heterodyne.ipynb +10 -10
- commkit-3.12.0/examples/27-laser-linewidth-short-delay-and-flicker.ipynb → commkit-3.13.0/examples/28-laser-linewidth-short-delay-and-flicker.ipynb +5 -5
- commkit-3.12.0/examples/28-laser-linewidth-self-homodyne-iq.ipynb → commkit-3.13.0/examples/29-laser-linewidth-self-homodyne-iq.ipynb +5 -5
- commkit-3.12.0/examples/29-measurement-template-self-heterodyne.ipynb → commkit-3.13.0/examples/30-measurement-template-self-heterodyne.ipynb +2 -2
- commkit-3.12.0/examples/30-measurement-template-self-homodyne-iq.ipynb → commkit-3.13.0/examples/31-measurement-template-self-homodyne-iq.ipynb +2 -2
- {commkit-3.12.0 → commkit-3.13.0}/examples/README.md +13 -7
- {commkit-3.12.0 → commkit-3.13.0}/pyproject.toml +2 -2
- {commkit-3.12.0 → commkit-3.13.0}/tests/common/reference_impl.py +21 -7
- {commkit-3.12.0 → commkit-3.13.0}/tests/core/test_signal.py +5 -5
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_fiber_estimation.py +8 -3
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_linear.py +26 -3
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_polarization.py +46 -2
- {commkit-3.12.0 → commkit-3.13.0}/tests/metrics/test_common.py +10 -4
- {commkit-3.12.0 → commkit-3.13.0}/tests/metrics/test_information.py +11 -6
- commkit-3.13.0/tests/metrics/test_quality.py +661 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plotting/test_plot_constellation.py +31 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plugins/transfer_trace.py +2 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/recovery/test_bps.py +55 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/recovery/test_pll.py +21 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_api_contracts.py +8 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_math.py +45 -1
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_signal_pipeline.py +4 -12
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_spectral.py +0 -15
- {commkit-3.12.0 → commkit-3.13.0}/uv.lock +1 -1
- commkit-3.12.0/commkit/metrics/__init__.py +0 -135
- commkit-3.12.0/commkit/metrics/quality.py +0 -281
- commkit-3.12.0/tests/metrics/test_quality.py +0 -232
- {commkit-3.12.0 → commkit-3.13.0}/.gitattributes +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/.github/icon.svg +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/.github/logo.svg +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/.github/workflows/ci.yml +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/.github/workflows/publish.yml +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/.gitignore +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/.python-version +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/LICENSE +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0002_pre_v2.json +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0003_v2_0.json +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0004_fiber_dbp.json +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0005_gpu_decoder_path.json +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0006_perf_cleanup.json +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0007_v3_0.json +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0008_v3_1.json +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0009_audit_2026_12.json +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/bench_block_blind.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/bench_block_lms.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/bench_bps.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/bench_coding.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/bench_equalizers.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/bench_fiber.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/bench_filters.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/bench_gardner.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/bench_import.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/bench_llr.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/bench_mapping.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/bench_sync_misc.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/benchutils.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/conftest.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/record_baseline.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/benchmarks/workloads.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_array.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_bits.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_circular.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_constants.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/bps.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/coding.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/compiler.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/filters.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/graphs.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/llr.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/selftest.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/src/algebraic.cu +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/src/bps_anchor.cu +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/src/bps_min_d2.cu +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/src/cs_block.cu +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/src/iir.cu +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/src/interpolate.cu +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/src/ldpc.cu +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/src/llr.cu +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_cuda/src/selftest.cu +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_dispersion.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_fft.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_fiber.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_interpolation.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_numba_frequency.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_numba_interpolation.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_overlap_save.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_peaks.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_random.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_sequences.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/_value.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/analysis/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/analysis/_common.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/analysis/allan.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/analysis/drift.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/analysis/fm_noise.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/analysis/interferometry.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/analysis/linewidth/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/analysis/linewidth/dsh.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/analysis/linewidth/result.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/analysis/trajectory.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/backend.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/_galois.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/_gf2.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/_ldpc_tables.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/_numba_loops.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/_numba_trellis.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/algebraic.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/base.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/convolutional.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/crc.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/exit.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/interleaving.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/ldpc.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/linear.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/performance.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/polar.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/product.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/ratematch.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/shaping.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/coding/turbo.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/core/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/core/_signal_input.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/core/frame.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/core/generation.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/core/preamble.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/core/signal.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/_block/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/_block/_blind.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/_block/_dd.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/_block/_engine.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/_common.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/_numba_loops.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/_sequential/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/_sequential/_blind.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/_sequential/_dd.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/_sequential/_setup.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/fiber/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/fiber/compensation.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/fiber/estimation.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/iq.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/pilots.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/equalization/result.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/filtering/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/filtering/_numba_loops.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/filtering/linear.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/filtering/pulses.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/filtering/response.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/frequency.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/impairments/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/impairments/fiber_channel.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/impairments/frontend.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/impairments/noise.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/impairments/source.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/io.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/logger.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/mapping/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/mapping/_demap.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/mapping/_lattice.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/mapping/_numba_llr.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/mapping/bits.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/mapping/gray.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/mapping/shaping.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/metrics/awgn.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/metrics/error_rates.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/plotting/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/plotting/coding.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/plotting/equalizer.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/plotting/eye.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/plotting/filter_response.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/plotting/frequency.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/plotting/recovery.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/plotting/spectral.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/plotting/theme.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/plotting/timing.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/plotting/waveform.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/py.typed +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/recovery/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/recovery/_numba_loops.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/recovery/carrier_phase.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/recovery/corrections.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/recovery/estimates.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/recovery/pilots.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/recovery/tikhonov.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/recovery/viterbi_viterbi.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/smoothing.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/timing/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/timing/_numba_loops.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/timing/clock_recovery.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/commkit/timing/synchronization.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/00-getting-started.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/01-constellations-and-bit-mapping.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/02-spectral-analysis.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/03-digital-filters.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/04-pulse-shaping-and-matched-filtering.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/05-multirate-and-resampling.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/07-channel-coding.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/08-probabilistic-shaping-and-coded-modulation.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/11-frame-synchronization-and-timing.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/13-frequency-offset-estimation.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/16-linear-channel-equalization.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/18-blind-equalization.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/19-polarization-multiplexing.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/21-nonlinear-fiber-and-backpropagation.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/22-direct-and-self-coherent-detection.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/examples/23-fec-in-optical-standards.ipynb +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/scripts/sanitize.sh +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/analysis/test_allan.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/analysis/test_drift.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/analysis/test_fm_noise.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/analysis/test_interferometry.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/analysis/test_linewidth.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/analysis/test_trajectory.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_algebraic.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_coding_base.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_convolutional.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_crc.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_exit.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_gf2.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_interleaving.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_ldpc.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_ldpc_exit.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_ldpc_kernel.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_ldpc_tables.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_linear_codes.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_performance.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_polar.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_product.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_ratematch.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_shaping.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/coding/test_turbo.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/common/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/common/coding.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/common/conversions.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/common/kernel_utils.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/common/memory.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/common/metrics.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/common/periodic.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/common/scoring.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/common/signals.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/common/theory.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/common/transfers.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/common/user_block.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/conftest.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/core/test_frame.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/core/test_generation.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/core/test_preamble.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/core/test_psqam.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/core/test_signal_input.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/core/test_signal_mimo.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_blind.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_block.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_bps_kernel.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_cold_start.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_cpr.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_cs_kernel.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_equalizer_oracles.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_fiber_compensation.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_iq.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_mimo.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_result.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_sequential.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_state.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/equalization/test_winit.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/impairments/test_fiber_channel_linear.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/impairments/test_fiber_channel_nonlinear.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/impairments/test_frontend.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/impairments/test_noise.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/impairments/test_source.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/mapping/test_bits.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/mapping/test_constellation.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/mapping/test_gray.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/mapping/test_lattice.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/mapping/test_llr.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/metrics/test_awgn.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/metrics/test_error_rates.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plotting/test_plot_analysis.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plotting/test_plot_coding.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plotting/test_plot_equalizer.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plotting/test_plot_eye.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plotting/test_plot_filter_response.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plotting/test_plot_frequency.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plotting/test_plot_recovery.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plotting/test_plot_spectral.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plotting/test_plot_theme.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plotting/test_plot_timing.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plotting/test_plot_waveform.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plugins/__init__.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/plugins/precision_trace.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/recovery/test_carrier_phase.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/recovery/test_corrections.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/recovery/test_joint.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/recovery/test_pilots.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/recovery/test_recovery_oracles.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/recovery/test_tikhonov.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/recovery/test_viterbi_viterbi.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_array.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_backend.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_bit_packing.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_cuda_infra.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_dispersion.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_examples.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_fiber.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_filter_response.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_filtering.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_frequency.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_import_hygiene.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_imports.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_interpolation.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_io.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_logger.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_multirate.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_peaks.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_pulse_shaping.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_receiver_chain.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_smoothing.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_value.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/test_working_memory.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/timing/test_clock_recovery.py +0 -0
- {commkit-3.12.0 → commkit-3.13.0}/tests/timing/test_synchronization.py +0 -0
|
@@ -89,6 +89,8 @@ Dependencies point downward only:
|
|
|
89
89
|
- Never stores pipeline results; `__init__` does no hidden work (factories do generation/normalization). `to()` and `replace()` share arrays; `clone()` copies mutable waveform/reference arrays.
|
|
90
90
|
- **Alignment invariant:** reference symbol *k* matches symbol period *k*; trailing-trim transforms slice via `inp.wrap(y, num_symbols=n)`. Metrics raise on mismatch and never align, rotate or permute silently.
|
|
91
91
|
- **Dimensionless samples:** impairments never rescale the signal component. Absolute-power models take `<where>_power_dbm` (`launch_`, `received_`, `lo_`, summed over channels) and return samples in input units (square-law: input power units). PSDs are in sample units per Hz.
|
|
92
|
+
- **One reference scale, the constellation's:** whatever relates samples to a constellation (`noise_var`, decisions, distances, LLRs, overlays) is on its scale: `Es` = its average power at the symbol rate, `Es/sps` per sample on a waveform. A block that needs that scale fits it itself, by the data-aided gain against a reference (`math._data_aided_gain`) or the blind moment gain (`math._blind_gain`), never by measured average power, which counts the noise as signal (symbols `1/sqrt(1 + 1/SNR)` inside), and returns its data unrescaled (BPS, PLL, metrics, overlays). Metric and estimate gains measure magnitude only; a rotation stays visible.
|
|
93
|
+
- **No measured rescaling inside blocks:** blocks take no `normalize=` flag; a user rescales explicitly with `math.normalize`. The one exception is the adaptive equalizers' AGC (their step sizes need unit-power input), which returns its factor and accepts it back (`EqualizerResult.input_norm_factor`, `state`, `apply_taps(input_norm_factor=)`), so an absolute calibration (shot-noise units through frozen taps) survives the chain. Exact known gains (`correct_power`) are fine, and an estimate carries a meaningful scale itself rather than leaving one for the data to be rescaled by (tone polarization matrices have unit-norm columns: unitary for a lossless channel).
|
|
92
94
|
|
|
93
95
|
### Signatures, Signal awareness & objects
|
|
94
96
|
|
|
@@ -103,10 +105,10 @@ Dependencies point downward only:
|
|
|
103
105
|
|
|
104
106
|
### Returns, naming & glossary
|
|
105
107
|
|
|
106
|
-
- **Returns:** transforms preserve type/device/rank (updating `sampling_rate` on rate change); estimators reduce time on input device (`(N,) -> 0-d`, `(C, N) -> (C,)`); metrics & analysis summaries (`evm`, `snr`, `noise_variance`, `ber`, `fer`, `ser`, `gmi`, `ngmi`, `mi`, `estimate_linewidth`, `allan_deviation`, `frequency_drift`) return host `float` or `np.ndarray (C,)` and raise on empty selections; sample-rate outputs stay on device. Multi-value returns are frozen dataclasses (no dicts; no >2-tuples except `backend.dispatch()`). Equalizers return `EqualizerResult`.
|
|
108
|
+
- **Returns:** transforms preserve type/device/rank (updating `sampling_rate` on rate change); estimators reduce time on input device (`(N,) -> 0-d`, `(C, N) -> (C,)`); metrics & analysis summaries (`evm`, `snr`, `noise_variance`, `esn0`, `ber`, `fer`, `ser`, `gmi`, `ngmi`, `mi`, `estimate_linewidth`, `allan_deviation`, `frequency_drift`) return host `float` or `np.ndarray (C,)` and raise on empty selections; sample-rate outputs stay on device. Multi-value returns are frozen dataclasses (no dicts; no >2-tuples except `backend.dispatch()`). Equalizers return `EqualizerResult`.
|
|
107
109
|
- **Estimate subclasses:** method-specific diagnostics live in subclasses with no `None` fields (named for one method like `MthPowerEstimate` or a family like `BlockPhaseEstimate`). Verbs and plots accept the base class: one `plot_<quantity>_estimate` per quantity dispatches on subclass, and estimates carry the metadata their plot needs.
|
|
108
110
|
- **Verbs:** `apply_*` (impairment/model), `estimate_<q>(x, method)` (measure -> `<Q>Estimate`), `correct_<q>(x, how)` (remove via estimate or method -> corrected data), `resolve_*` (discrete ambiguity), `generate` (synthesis), `encode`/`decode` (FEC), `plot_*` (all plots except `apply_default_theme`). Choose algorithms by object, never function-name suffix or string (no `recover_*`/`compensate_*`); `method=` strings select numerical flavors or implementation modes (`"maxlog"|"exact"`, `"fir"|"fft"`, `"blocks"|"whole_record"`). Plain nouns for computations (`allan_deviation`).
|
|
109
|
-
- **Glossary:** `num_taps`, `step_size`, `sps`, `constellation`, `pulse`, `rng`, `<part>_rng`, `num_symbols`, `num_channels` (never `streams`), `sampling_rate`, `symbol_rate`, `nfft`, `regularization`, `max_iterations`. Noise: `noise_var` = E|n|² in
|
|
111
|
+
- **Glossary:** `num_taps`, `step_size`, `sps`, `constellation`, `pulse`, `rng`, `<part>_rng`, `num_symbols`, `num_channels` (never `streams`), `sampling_rate`, `symbol_rate`, `nfft`, `regularization`, `max_iterations`. Noise (definitions in the `commkit.metrics` docstring): `noise_var` = E|n|² per sample in the samples received, which constellation-relating consumers (`compute_llr`, `mi`/`gmi`, EXIT, MMSE `correct_channel`, linewidth) take on the constellation's scale (`metrics.noise_variance` reports it there; `apply_awgn(noise_var=)` adds it in the samples' units, a fixed floor); `snr_db` = power ratio in the samples it is about (per sample over the simulated band for `apply_awgn`, per symbol for `metrics.snr`); `esn0_db` = textbook Es/N0 per symbol, independent of dtype (real samples carry N0/2; demapping/information funcs accept `noise_var` or `esn0_db`); Eb/N0 = Es/N0 per information bit (`ErrorRateCurve.ebn0_db`); `osnr_db` = signal over ASE power in `reference_bandwidth`. A blind variant of a data-aided metric is `blind=True` with a `constellation`, never a separate name. Unit-named sizes: `num_symbols`, `num_blocks`, `info_bits`, `blocks_per_frame`, `num_variables`, `num_segments` (in `coding`, `length`/`n` = codeword bits, `k` = info bits). Scaling: `math.normalize` (explicit measured rescale, never a block flag), `correct_power` (known rate-change gain), `*_normalization` (coefficient scale); plots use `relative` and `annotations` (`gid` via `_guide`). Windows: `search_range` `(start, stop)`, `search_band` (Hz half-width). SI values have no suffix (`_s` only if paired with samples); non-SI use `_db`, `_dbm`, `_deg`, `_nm`, `_km`, `_ps_nm_km`, `_ppm`, `_db_hz` (or `normalized_*`).
|
|
110
112
|
|
|
111
113
|
### Code style & simplicity
|
|
112
114
|
|
|
@@ -4,6 +4,37 @@ Notable changes to CommKit, newest first. Performance figures are from the refer
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [3.13.0] - 2026-12-06
|
|
8
|
+
|
|
9
|
+
One reference scale, the constellation's: every block that relates samples to a constellation fits that scale itself and returns its data unrescaled, and blind metrics fit instead of deciding.
|
|
10
|
+
|
|
11
|
+
### Changes that may need code updates
|
|
12
|
+
|
|
13
|
+
- **`evm(blind=True)`, and the new blind `snr` and `noise_variance`, fit the gain and the noise by maximum likelihood** (the symbols as the constellation plus Gaussian noise) instead of measuring against the nearest point. The blind EVM now matches the data-aided one wherever the symbols show the constellation (uniform QAM and PSK from about −5 dB, shaped QAM near its operating point); the nearest-point reading was 1.7 dB (QPSK) to 6.3 dB (64-QAM) too optimistic at 0 dB. Where the clusters overlap too far for any blind estimate, a WARNING reports the fit's standard error and its likelihood margin over noise alone.
|
|
14
|
+
- **No block rescales data by a measured power any more**; rescale explicitly with `math.normalize`. Removed: `decimate_to_symbol_rate(normalize=)` (it discarded the absolute scale by default and never returned the factor), `apply_taps(normalize=)` (pass `input_norm_factor=result.input_norm_factor` to apply frozen taps on the run's scale; without it the taps filter the samples as given), `correct_polarization(normalize=)` and `add_pilot_tone(renormalize=)` (use `math.normalize(x, mode="symbol_power", sps=sps, axis=-1)`). The adaptive equalizers' AGC stays, with its factor returned.
|
|
15
|
+
- **Tone polarization estimates have unit-norm phasor columns**: `PolarizationEstimate` matrices are the channel's own inverse (unitary for a lossless channel) instead of carrying the inverse tone amplitude, ×4.5 at a −10 dB pilot and ×14 at −20 dB. `correct_polarization` output is in the input's units without a rescaling, and `PolarizationEstimate.matrix` seeds a butterfly equalizer at the right scale.
|
|
16
|
+
- **BPS and the decision-directed PLL put symbols on the constellation's scale by the blind moment (M2M4) gain**, not by average power, which counted the noise as signal: BPS at 8 dB on 16-QAM now errs 7.4° RMS instead of 8.4°, and the PLL's loop gain no longer scales with the constellation's power. Their results change slightly.
|
|
17
|
+
- **`plot_constellation(overlay_ideal=True)` scales the ideal points onto the data**: by the data-aided gain when the Signal's reference pairs with the symbols, by the blind gain otherwise.
|
|
18
|
+
- **`snr`, `evm` and `noise_variance` log a WARNING when the symbols are rotated against the reference** by more than 22.5°: the rotation counts as error and caps the SNR at `-10 log10(2 - 2 cos θ)` dB.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `metrics.esn0(samples, *, signal_band=None, nperseg=1024)`: Es/N0 from the spectrum before any DSP, with the noise floor as the median outside the band (robust to spurs and tones) and the band centre searched (robust to a frequency offset).
|
|
23
|
+
- `snr`, `noise_variance` with `blind=True` and a `constellation`; `estimate_gain(blind=True, constellation=)`, the phase-insensitive moment gain.
|
|
24
|
+
- Notebook 25, *Noise, SNR and metrics in the receiver*; notebooks 25 to 30 are now 26 to 31.
|
|
25
|
+
|
|
26
|
+
### Performance
|
|
27
|
+
|
|
28
|
+
- BPS and the PLL compute the blind moment gain instead of the power normalization: 1.05 (BPS) and 1.06 (PLL) on the CPU for 2 x 20 000 symbols (in-process paired A/B, 7 rounds; the fixed cost of the second moment), 1.08 and 1.07 on the GPU (paired A/B against 3.12.0, 7 alternating rounds, fastest runs). The moments are one fused, two-stage CuPy reduction on the GPU (0.14 ms for 2 x 2^20 samples against 2.2 ms for one stage).
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- The documented `esn0_db` equivalent of `noise_var` for real symbols (`snr - 3.01` dB, not `snr`).
|
|
33
|
+
|
|
34
|
+
### Development
|
|
35
|
+
|
|
36
|
+
- AGENTS.md rules "One reference scale, the constellation's" and "No measured rescaling inside blocks", and a rewritten noise glossary (`noise_var`, `snr_db`, `esn0_db`, Eb/N0, `osnr_db`, defined per symbol, sample or bit).
|
|
37
|
+
|
|
7
38
|
## [3.12.0] - 2026-12-06
|
|
8
39
|
|
|
9
40
|
The 2026-12-05 audit: high-severity numerical fixes across coding, equalization, synchronization and mapping; a reference-aided `mi`; an optional symbol rate; scalar validation on every value object; strict typing everywhere; and sharper audits.
|
|
@@ -880,7 +911,8 @@ See the [GitHub release](https://github.com/lokgar/commkit/releases/tag/v1.1.0)
|
|
|
880
911
|
|
|
881
912
|
First release. See the [GitHub release](https://github.com/lokgar/commkit/releases/tag/v1.0.0).
|
|
882
913
|
|
|
883
|
-
[Unreleased]: https://github.com/lokgar/commkit/compare/v3.
|
|
914
|
+
[Unreleased]: https://github.com/lokgar/commkit/compare/v3.13.0...HEAD
|
|
915
|
+
[3.13.0]: https://github.com/lokgar/commkit/compare/v3.12.0...v3.13.0
|
|
884
916
|
[3.12.0]: https://github.com/lokgar/commkit/compare/v3.11.0...v3.12.0
|
|
885
917
|
[3.11.0]: https://github.com/lokgar/commkit/compare/v3.10.2...v3.11.0
|
|
886
918
|
[3.10.2]: https://github.com/lokgar/commkit/compare/v3.10.1...v3.10.2
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: commkit
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.13.0
|
|
4
4
|
Summary: A Python library for high-performance digital communications research.
|
|
5
5
|
Project-URL: Homepage, https://github.com/lokgar/commkit
|
|
6
6
|
Project-URL: Repository, https://github.com/lokgar/commkit
|
|
@@ -157,7 +157,7 @@ CommKit never picks a device for you: data stays where you put it, and each func
|
|
|
157
157
|
| [`commkit.frequency`](https://github.com/lokgar/commkit/blob/main/commkit/frequency.py) | `estimate_frequency_offset` / `correct_frequency_offset` with `MthPower`, `MengaliMorelli`, `PilotSlope` and `SpectralPeak`; static and blockwise. |
|
|
158
158
|
| [`commkit.recovery`](https://github.com/lokgar/commkit/tree/main/commkit/recovery) | `estimate_carrier_phase` / `correct_carrier_phase` with `ViterbiViterbi`, `BPS`, `PLL`, `Tikhonov`, `ConstantPhase`, `PilotInterpolation`, `PilotTone(s)`; cycle-slip correction; the Wiener phase smoother `smooth_phase`; `resolve_phase_ambiguity` and `resolve_channel_permutation`. |
|
|
159
159
|
| [`commkit.equalization`](https://github.com/lokgar/commkit/tree/main/commkit/equalization) | Sequential `lms`, `rls`, `cma`, `rde` (Numba) and frequency-domain `block_lms`, `block_cma`, `block_rde` (CuPy, CUDA graphs), butterfly MIMO, inline carrier recovery (`cpr=PLL()` / `BPS()`), continuation with `state=`, `estimate_channel` and `correct_channel` (ZF / MMSE), the data-aided gain (`estimate_gain` / `correct_gain`); pilot-aided CMA and RDE from a frame's pilots (`EqualizerPilots`); polarization demultiplexing on pilot tones (`estimate_polarization(x, PolarizationTones(...))` / `correct_polarization`); chromatic-dispersion estimation (blind scans, data-aided fit) and compensation, digital backpropagation (`correct_fiber_propagation`); blind IQ-imbalance estimate and correction (inverse, Löwdin, Gram-Schmidt). |
|
|
160
|
-
| [`commkit.metrics`](https://github.com/lokgar/commkit/tree/main/commkit/metrics) | `evm`, `snr`, `ber`, `fer`, `ser`, `gmi`, `ngmi`, `mi`, including shaped constellations; pre-FEC and post-FEC (`ber(decoded, sig)`); `noise_variance` for LLRs; the AWGN closed forms `awgn_ser`, `awgn_ber`, `awgn_mi`, `awgn_gmi`; host values per channel. |
|
|
160
|
+
| [`commkit.metrics`](https://github.com/lokgar/commkit/tree/main/commkit/metrics) | `evm`, `snr`, `ber`, `fer`, `ser`, `gmi`, `ngmi`, `mi`, including shaped constellations; pre-FEC and post-FEC (`ber(decoded, sig)`); `noise_variance` for LLRs; blind estimates (`blind=True`) and the spectral Es/N0 (`esn0`); the AWGN closed forms `awgn_ser`, `awgn_ber`, `awgn_mi`, `awgn_gmi`; host values per channel. |
|
|
161
161
|
| [`commkit.analysis`](https://github.com/lokgar/commkit/tree/main/commkit/analysis) | Laser and carrier-phase characterization: `estimate_linewidth` (increment slope, β-separation, delayed self-heterodyne FM-PSD / increment / Lorentzian), FM-noise PSDs, drift separation, Allan deviation. |
|
|
162
162
|
| [`commkit.math`](https://github.com/lokgar/commkit/blob/main/commkit/math.py) | `rms`, `normalize`, dB conversions. |
|
|
163
163
|
| [`commkit.smoothing`](https://github.com/lokgar/commkit/blob/main/commkit/smoothing.py) | Display and estimation smoothers (moving average, Savitzky-Golay, 2-D density). Signal-chain filters are in `filtering`. |
|
|
@@ -193,13 +193,14 @@ With [`uv`](https://github.com/astral-sh/uv), use `uv pip install` in place of `
|
|
|
193
193
|
|
|
194
194
|
## Examples
|
|
195
195
|
|
|
196
|
-
[`examples/`](https://github.com/lokgar/commkit/tree/main/examples) is a course in
|
|
196
|
+
[`examples/`](https://github.com/lokgar/commkit/tree/main/examples) is a course in 32 Jupyter notebooks, one topic each, in teaching order (install the `notebook` extra and run `jupyter lab examples`):
|
|
197
197
|
|
|
198
198
|
- **00-05, signals and DSP**: the `Signal`, constellations and bit mapping, spectra, filters, pulse shaping and matched filtering, resampling;
|
|
199
199
|
- **06-10, channel, coding and performance**: AWGN and the metrics (SNR, BER, LLRs, GMI), channel coding, probabilistic shaping and coded modulation, laser phase noise, front-end impairments;
|
|
200
200
|
- **11-19, receiver algorithms**: frame synchronization, sampling-clock recovery, frequency-offset estimation, blind and pilot-aided carrier recovery, linear, adaptive and blind equalization, polarization demultiplexing;
|
|
201
201
|
- **20-24, optical fiber systems**: chromatic dispersion, the nonlinear fiber with digital backpropagation, direct and self-coherent detection, FEC in optical standards, and an end-to-end coherent transceiver;
|
|
202
|
-
- **25
|
|
202
|
+
- **25, measuring performance**: noise, SNR and the metrics in a receiver (the data-aided model, rotations, the spectral Es/N0, blind estimates, keeping the absolute scale);
|
|
203
|
+
- **26-31, characterization**: carrier phase and laser linewidth measurements, with templates for real captures.
|
|
203
204
|
|
|
204
205
|
[`examples/README.md`](https://github.com/lokgar/commkit/blob/main/examples/README.md) lists every notebook with its topics. The quickstart above appears cell by cell in `00-getting-started` and `17-adaptive-equalization`. The notebooks are committed without outputs and run in CI.
|
|
205
206
|
|
|
@@ -121,7 +121,7 @@ CommKit never picks a device for you: data stays where you put it, and each func
|
|
|
121
121
|
| [`commkit.frequency`](https://github.com/lokgar/commkit/blob/main/commkit/frequency.py) | `estimate_frequency_offset` / `correct_frequency_offset` with `MthPower`, `MengaliMorelli`, `PilotSlope` and `SpectralPeak`; static and blockwise. |
|
|
122
122
|
| [`commkit.recovery`](https://github.com/lokgar/commkit/tree/main/commkit/recovery) | `estimate_carrier_phase` / `correct_carrier_phase` with `ViterbiViterbi`, `BPS`, `PLL`, `Tikhonov`, `ConstantPhase`, `PilotInterpolation`, `PilotTone(s)`; cycle-slip correction; the Wiener phase smoother `smooth_phase`; `resolve_phase_ambiguity` and `resolve_channel_permutation`. |
|
|
123
123
|
| [`commkit.equalization`](https://github.com/lokgar/commkit/tree/main/commkit/equalization) | Sequential `lms`, `rls`, `cma`, `rde` (Numba) and frequency-domain `block_lms`, `block_cma`, `block_rde` (CuPy, CUDA graphs), butterfly MIMO, inline carrier recovery (`cpr=PLL()` / `BPS()`), continuation with `state=`, `estimate_channel` and `correct_channel` (ZF / MMSE), the data-aided gain (`estimate_gain` / `correct_gain`); pilot-aided CMA and RDE from a frame's pilots (`EqualizerPilots`); polarization demultiplexing on pilot tones (`estimate_polarization(x, PolarizationTones(...))` / `correct_polarization`); chromatic-dispersion estimation (blind scans, data-aided fit) and compensation, digital backpropagation (`correct_fiber_propagation`); blind IQ-imbalance estimate and correction (inverse, Löwdin, Gram-Schmidt). |
|
|
124
|
-
| [`commkit.metrics`](https://github.com/lokgar/commkit/tree/main/commkit/metrics) | `evm`, `snr`, `ber`, `fer`, `ser`, `gmi`, `ngmi`, `mi`, including shaped constellations; pre-FEC and post-FEC (`ber(decoded, sig)`); `noise_variance` for LLRs; the AWGN closed forms `awgn_ser`, `awgn_ber`, `awgn_mi`, `awgn_gmi`; host values per channel. |
|
|
124
|
+
| [`commkit.metrics`](https://github.com/lokgar/commkit/tree/main/commkit/metrics) | `evm`, `snr`, `ber`, `fer`, `ser`, `gmi`, `ngmi`, `mi`, including shaped constellations; pre-FEC and post-FEC (`ber(decoded, sig)`); `noise_variance` for LLRs; blind estimates (`blind=True`) and the spectral Es/N0 (`esn0`); the AWGN closed forms `awgn_ser`, `awgn_ber`, `awgn_mi`, `awgn_gmi`; host values per channel. |
|
|
125
125
|
| [`commkit.analysis`](https://github.com/lokgar/commkit/tree/main/commkit/analysis) | Laser and carrier-phase characterization: `estimate_linewidth` (increment slope, β-separation, delayed self-heterodyne FM-PSD / increment / Lorentzian), FM-noise PSDs, drift separation, Allan deviation. |
|
|
126
126
|
| [`commkit.math`](https://github.com/lokgar/commkit/blob/main/commkit/math.py) | `rms`, `normalize`, dB conversions. |
|
|
127
127
|
| [`commkit.smoothing`](https://github.com/lokgar/commkit/blob/main/commkit/smoothing.py) | Display and estimation smoothers (moving average, Savitzky-Golay, 2-D density). Signal-chain filters are in `filtering`. |
|
|
@@ -157,13 +157,14 @@ With [`uv`](https://github.com/astral-sh/uv), use `uv pip install` in place of `
|
|
|
157
157
|
|
|
158
158
|
## Examples
|
|
159
159
|
|
|
160
|
-
[`examples/`](https://github.com/lokgar/commkit/tree/main/examples) is a course in
|
|
160
|
+
[`examples/`](https://github.com/lokgar/commkit/tree/main/examples) is a course in 32 Jupyter notebooks, one topic each, in teaching order (install the `notebook` extra and run `jupyter lab examples`):
|
|
161
161
|
|
|
162
162
|
- **00-05, signals and DSP**: the `Signal`, constellations and bit mapping, spectra, filters, pulse shaping and matched filtering, resampling;
|
|
163
163
|
- **06-10, channel, coding and performance**: AWGN and the metrics (SNR, BER, LLRs, GMI), channel coding, probabilistic shaping and coded modulation, laser phase noise, front-end impairments;
|
|
164
164
|
- **11-19, receiver algorithms**: frame synchronization, sampling-clock recovery, frequency-offset estimation, blind and pilot-aided carrier recovery, linear, adaptive and blind equalization, polarization demultiplexing;
|
|
165
165
|
- **20-24, optical fiber systems**: chromatic dispersion, the nonlinear fiber with digital backpropagation, direct and self-coherent detection, FEC in optical standards, and an end-to-end coherent transceiver;
|
|
166
|
-
- **25
|
|
166
|
+
- **25, measuring performance**: noise, SNR and the metrics in a receiver (the data-aided model, rotations, the spectral Es/N0, blind estimates, keeping the absolute scale);
|
|
167
|
+
- **26-31, characterization**: carrier phase and laser linewidth measurements, with templates for real captures.
|
|
167
168
|
|
|
168
169
|
[`examples/README.md`](https://github.com/lokgar/commkit/blob/main/examples/README.md) lists every notebook with its topics. The quickstart above appears cell by cell in `00-getting-started` and `17-adaptive-equalization`. The notebooks are committed without outputs and run in CI.
|
|
169
170
|
|
|
@@ -19,7 +19,7 @@ def _pipeline(sig, xp, sync):
|
|
|
19
19
|
out = filtering.matched_filter(out)
|
|
20
20
|
out = multirate.resample(out, sps_out=2)
|
|
21
21
|
out = equalization.apply_taps(
|
|
22
|
-
out, xp.asarray([1.0 + 0.0j], dtype=xp.complex64),
|
|
22
|
+
out, xp.asarray([1.0 + 0.0j], dtype=xp.complex64), sps=2
|
|
23
23
|
)
|
|
24
24
|
sync()
|
|
25
25
|
return out
|
|
@@ -134,8 +134,11 @@ class IncrementSubtract(_Value):
|
|
|
134
134
|
Parameters
|
|
135
135
|
----------
|
|
136
136
|
noise_var : float or array_like, optional
|
|
137
|
-
Complex noise variance ``σ_n²`` of
|
|
138
|
-
|
|
137
|
+
Complex noise variance ``σ_n²`` of the symbols scaled to unit power,
|
|
138
|
+
that is the noise-to-signal ratio ``1/SNR``, one value or one per
|
|
139
|
+
channel ``(C,)``: :func:`commkit.metrics.noise_variance` for a
|
|
140
|
+
factory (unit-power) constellation, divided by the constellation's
|
|
141
|
+
power otherwise. For an SNR in dB: ``10 ** (-snr_db / 10)``.
|
|
139
142
|
``None`` subtracts nothing.
|
|
140
143
|
reference : array_like, optional
|
|
141
144
|
Transmitted symbols aligned with the phase, ``(N,)`` or ``(C, N)``,
|
|
@@ -27,7 +27,8 @@ from ..backend import ArrayType, dispatch, to_device
|
|
|
27
27
|
from ..core._signal_input import S, SignalInput
|
|
28
28
|
from ..core.signal import Signal
|
|
29
29
|
from ..logger import logger
|
|
30
|
-
from ..
|
|
30
|
+
from ..mapping import Constellation
|
|
31
|
+
from ..math import _blind_gain, _data_aided_gain, _next_pow2
|
|
31
32
|
from ._common import _build_padded_samples, _normalize_inputs
|
|
32
33
|
|
|
33
34
|
__all__ = [
|
|
@@ -97,7 +98,12 @@ def correct_channel(
|
|
|
97
98
|
``(C, C, L)`` for MIMO, where ``[i, j]`` is the FIR from input ``j``
|
|
98
99
|
to output ``i``. Cast to the precision of ``samples``.
|
|
99
100
|
noise_var : float, default 0.0
|
|
100
|
-
Noise variance
|
|
101
|
+
Noise variance ``σ² = E|n|²`` per sample of the MMSE regularization,
|
|
102
|
+
on the scale where the transmitted signal has its nominal power
|
|
103
|
+
(``E|x|² = Es / sps``, the constellation's scale): the regularization
|
|
104
|
+
assumes that power and does not measure it, so for samples ``a``
|
|
105
|
+
times larger pass ``σ²`` of the samples divided by ``a²``. ``0.0``
|
|
106
|
+
gives ZF.
|
|
101
107
|
center_tap : int, optional
|
|
102
108
|
Index of lag 0 in an impulse response ``how``, in ``[0, L)``;
|
|
103
109
|
``None`` takes 0, a causal response (``rx = convolve(tx, h)[:N]``).
|
|
@@ -248,7 +254,6 @@ def apply_taps(
|
|
|
248
254
|
weights: ArrayType,
|
|
249
255
|
*,
|
|
250
256
|
sps: int | None = None,
|
|
251
|
-
normalize: bool = True,
|
|
252
257
|
input_norm_factor: float | np.ndarray | None = None,
|
|
253
258
|
samples_prefix: ArrayType | None = None,
|
|
254
259
|
pad_mode: str = "zeros",
|
|
@@ -276,14 +281,15 @@ def apply_taps(
|
|
|
276
281
|
sps : int, optional
|
|
277
282
|
Samples per symbol, an integer. Taken from the Signal; required for
|
|
278
283
|
array input. A value that disagrees with the Signal raises.
|
|
279
|
-
normalize : bool, default True
|
|
280
|
-
Divide each channel of ``samples`` by its RMS first (unit mean
|
|
281
|
-
power), as the adaptive equalizers do. ``False`` when the caller has already scaled the
|
|
282
|
-
input as in the run that produced ``weights``.
|
|
283
284
|
input_norm_factor : float or array_like, optional
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
285
|
+
Divide ``samples`` (and ``samples_prefix``) by this factor first:
|
|
286
|
+
the ``EqualizerResult.input_norm_factor`` of the run that produced
|
|
287
|
+
``weights``, whose taps were learned on input divided by it. A
|
|
288
|
+
``float`` for SISO, ``(C,)`` for MIMO. An exact known factor, so
|
|
289
|
+
another capture (vacuum noise for a calibration) goes through the
|
|
290
|
+
taps on the run's scale. By default the taps are applied to the
|
|
291
|
+
samples as given, in their own units: nothing is measured or
|
|
292
|
+
rescaled.
|
|
287
293
|
samples_prefix : array_like, optional
|
|
288
294
|
Input samples that precede ``samples`` (e.g. the end of the previous
|
|
289
295
|
record), at least ``num_taps // 2`` per channel: its last
|
|
@@ -327,7 +333,7 @@ def apply_taps(
|
|
|
327
333
|
n_sym = N // sps
|
|
328
334
|
|
|
329
335
|
_at_eq_norm = None
|
|
330
|
-
if
|
|
336
|
+
if input_norm_factor is not None:
|
|
331
337
|
x, _at_eq_norm = _normalize_inputs(x, input_norm_factor=input_norm_factor)
|
|
332
338
|
|
|
333
339
|
if weights.ndim != 3 or weights.shape[:2] != (C, C):
|
|
@@ -523,16 +529,16 @@ def estimate_channel(
|
|
|
523
529
|
|
|
524
530
|
@dataclass(frozen=True, eq=False)
|
|
525
531
|
class GainEstimate(_Record):
|
|
526
|
-
"""The
|
|
527
|
-
:func:`estimate_gain`, removed by :func:`correct_gain`.
|
|
532
|
+
"""The amplitude gain of symbols on a reference's or constellation's
|
|
533
|
+
scale, from :func:`estimate_gain`, removed by :func:`correct_gain`.
|
|
528
534
|
|
|
529
535
|
The constructor takes the same fields.
|
|
530
536
|
|
|
531
537
|
Attributes
|
|
532
538
|
----------
|
|
533
539
|
value : ndarray
|
|
534
|
-
Gain ``g
|
|
535
|
-
|
|
540
|
+
Gain ``g`` per channel, float64: 0-d for ``(N,)`` input, ``(C,)``
|
|
541
|
+
for ``(C, N)``, on the input's device.
|
|
536
542
|
"""
|
|
537
543
|
|
|
538
544
|
value: ArrayType
|
|
@@ -542,29 +548,52 @@ def estimate_gain(
|
|
|
542
548
|
symbols: ArrayType | Signal,
|
|
543
549
|
reference: ArrayType | None = None,
|
|
544
550
|
*,
|
|
551
|
+
blind: bool = False,
|
|
552
|
+
constellation: Constellation | None = None,
|
|
545
553
|
num_skip_symbols: int = 0,
|
|
546
554
|
) -> GainEstimate:
|
|
547
|
-
"""Measure the
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
:
|
|
556
|
-
|
|
557
|
-
|
|
555
|
+
"""Measure the amplitude gain of symbols against a reference or, blindly,
|
|
556
|
+
a constellation.
|
|
557
|
+
|
|
558
|
+
The gain ``g`` per channel is the amplitude at which the transmitted
|
|
559
|
+
symbols appear in the received ones ``r``, so ``r / g`` is on the scale
|
|
560
|
+
of the reference (or the constellation). Both estimates are unbiased at
|
|
561
|
+
any SNR, unlike the gain of a power normalization, which counts the
|
|
562
|
+
noise as signal and shrinks the symbols by ``1/sqrt(1 + 1/SNR)``, and
|
|
563
|
+
both measure only the magnitude: a rotation is left to carrier recovery.
|
|
564
|
+
|
|
565
|
+
* Data-aided (default): ``g = |<r s*>| / <|s|^2>`` against the reference
|
|
566
|
+
``s``; AWGN is uncorrelated with ``s``. It is the gain
|
|
567
|
+
:func:`~commkit.metrics.evm`, :func:`~commkit.metrics.snr`,
|
|
568
|
+
:func:`~commkit.metrics.noise_variance` and the information rates of a
|
|
569
|
+
Signal divide by.
|
|
570
|
+
* ``blind=True``: from the second and fourth moments of ``r`` (M2M4).
|
|
571
|
+
With Gaussian noise of kurtosis ``k_n`` (2 for complex symbols, 3 for
|
|
572
|
+
real ones) and the constellation's ``k = E|s|^4 / E^2|s|^2``, the
|
|
573
|
+
signal power is ``S = sqrt((k_n <|r|^2>^2 - <|r|^4>) / (k_n - k))``
|
|
574
|
+
and ``g = sqrt(S / E|s|^2)``. It needs no decision and no phase, so
|
|
575
|
+
it holds before carrier recovery and under a frequency offset; it is
|
|
576
|
+
the gain BPS and the PLL put the symbols on the constellation with.
|
|
577
|
+
Its spread is about 0.06 dB at 0 dB SNR for 2^14 symbols of QAM, and
|
|
578
|
+
it assumes Gaussian noise. A near-Gaussian constellation (shaped QAM
|
|
579
|
+
at middle entropies, ``k`` within 0.1 of ``k_n``) carries no moment
|
|
580
|
+
contrast and gets the power normalization's gain instead.
|
|
558
581
|
|
|
559
582
|
Parameters
|
|
560
583
|
----------
|
|
561
584
|
symbols : array_like or Signal
|
|
562
585
|
Received symbols at one sample per symbol, ``(N,)`` or ``(C, N)``. A
|
|
563
586
|
Signal must be at one sample per symbol; its ``reference.symbols`` is
|
|
564
|
-
the default reference
|
|
587
|
+
the default reference and its ``constellation`` the default
|
|
588
|
+
constellation.
|
|
565
589
|
reference : array_like, optional
|
|
566
590
|
Transmitted symbols, ``(N,)`` (shared by every channel) or the shape
|
|
567
|
-
of ``symbols``. Required for arrays
|
|
591
|
+
of ``symbols``. Required for arrays unless ``blind=True``.
|
|
592
|
+
blind : bool, default False
|
|
593
|
+
Estimate from the moments of the symbols and the constellation
|
|
594
|
+
instead of the reference.
|
|
595
|
+
constellation : Constellation, optional
|
|
596
|
+
Constellation for ``blind=True``. Defaults to the Signal's.
|
|
568
597
|
num_skip_symbols : int, default 0
|
|
569
598
|
Leading symbols left out of the estimate (for example equalizer
|
|
570
599
|
training or convergence).
|
|
@@ -577,11 +606,12 @@ def estimate_gain(
|
|
|
577
606
|
Raises
|
|
578
607
|
------
|
|
579
608
|
ValueError
|
|
580
|
-
Without a reference
|
|
581
|
-
``
|
|
582
|
-
|
|
609
|
+
Without a reference (unless ``blind=True``) or with one and
|
|
610
|
+
``blind=True``, without a constellation for ``blind=True``, on a
|
|
611
|
+
shape mismatch, if ``num_skip_symbols`` is negative or leaves no
|
|
612
|
+
symbol, or for a frame Signal or one not at one sample per symbol.
|
|
583
613
|
TypeError
|
|
584
|
-
If ``num_skip_symbols`` is not an integer.
|
|
614
|
+
If ``num_skip_symbols`` is not an integer or ``blind`` not a bool.
|
|
585
615
|
|
|
586
616
|
See Also
|
|
587
617
|
--------
|
|
@@ -591,34 +621,58 @@ def estimate_gain(
|
|
|
591
621
|
--------
|
|
592
622
|
>>> y = correct_gain(y, estimate_gain(y, tx))
|
|
593
623
|
>>> llrs = compute_llr(y, constellation=c, noise_var=noise_variance(y, tx))
|
|
624
|
+
>>> y = correct_gain(y, estimate_gain(y, blind=True, constellation=c))
|
|
594
625
|
"""
|
|
595
626
|
name = "estimate_gain()"
|
|
596
627
|
skip = require_int(num_skip_symbols, f"{name}: num_skip_symbols", low=0)
|
|
628
|
+
if not isinstance(blind, bool):
|
|
629
|
+
raise TypeError(f"{name}: blind must be a bool, got {type(blind).__name__}.")
|
|
597
630
|
inp = SignalInput(symbols, name)
|
|
598
631
|
y, xp, _ = dispatch(inp.symbols())
|
|
599
|
-
ref = inp.reference_symbols(reference, required=True)
|
|
600
632
|
y2, was_1d = as_2d(y, name="symbols")
|
|
601
|
-
d2 = broadcast_channels(
|
|
602
|
-
to_device(ref, "cpu" if xp is np else "gpu"), y2.shape[0], xp, name="reference"
|
|
603
|
-
)
|
|
604
|
-
if d2.shape[-1] != y2.shape[-1]:
|
|
605
|
-
raise ValueError(
|
|
606
|
-
f"{name}: shape mismatch: symbols have {y2.shape[-1]} symbols, the "
|
|
607
|
-
f"reference {d2.shape[-1]}."
|
|
608
|
-
)
|
|
609
633
|
if skip >= y2.shape[-1]:
|
|
610
634
|
raise ValueError(
|
|
611
635
|
f"{name}: num_skip_symbols={skip} leaves no symbol of {y2.shape[-1]}."
|
|
612
636
|
)
|
|
613
|
-
|
|
614
|
-
|
|
637
|
+
if blind:
|
|
638
|
+
if reference is not None:
|
|
639
|
+
raise ValueError(
|
|
640
|
+
f"{name}: blind=True estimates from the constellation; drop reference=."
|
|
641
|
+
)
|
|
642
|
+
c = inp.constellation(constellation, required=True, purpose=" for blind=True")
|
|
643
|
+
g = _blind_gain(y2[:, skip:], xp, c._kurtosis, c.power(), dtype=xp.float64)
|
|
644
|
+
g = g[:, 0]
|
|
645
|
+
else:
|
|
646
|
+
ref = inp.reference_symbols(reference)
|
|
647
|
+
if ref is None:
|
|
648
|
+
raise ValueError(
|
|
649
|
+
f"{name}: no reference symbols: pass reference=, use a Signal "
|
|
650
|
+
"with a reference, or blind=True."
|
|
651
|
+
)
|
|
652
|
+
d2 = broadcast_channels(
|
|
653
|
+
to_device(ref, "cpu" if xp is np else "gpu"),
|
|
654
|
+
y2.shape[0],
|
|
655
|
+
xp,
|
|
656
|
+
name="reference",
|
|
657
|
+
)
|
|
658
|
+
if d2.shape[-1] != y2.shape[-1]:
|
|
659
|
+
raise ValueError(
|
|
660
|
+
f"{name}: shape mismatch: symbols have {y2.shape[-1]} symbols, "
|
|
661
|
+
f"the reference {d2.shape[-1]}."
|
|
662
|
+
)
|
|
663
|
+
g = _data_aided_gain(y2[:, skip:], d2[:, skip:], xp, dtype=xp.float64)
|
|
664
|
+
g = g[:, 0]
|
|
615
665
|
if logger.isEnabledFor(logging.INFO):
|
|
616
|
-
logger.info(
|
|
666
|
+
logger.info(
|
|
667
|
+
"estimate_gain%s: g = %s",
|
|
668
|
+
" (blind)" if blind else "",
|
|
669
|
+
np.round(to_device(g, "cpu"), 4).tolist(),
|
|
670
|
+
)
|
|
617
671
|
return GainEstimate(value=restore_1d(was_1d, g))
|
|
618
672
|
|
|
619
673
|
|
|
620
674
|
def correct_gain(samples: S, how: GainEstimate) -> S:
|
|
621
|
-
"""Divide samples by a
|
|
675
|
+
"""Divide samples by a gain, onto the reference's or constellation's scale.
|
|
622
676
|
|
|
623
677
|
Parameters
|
|
624
678
|
----------
|
|
@@ -408,13 +408,17 @@ class PolarizationTones:
|
|
|
408
408
|
amplitude of tone ``f_j`` in received channel ``i`` is
|
|
409
409
|
``T[i, j] = J[i, j] · α_j``, with ``α_j`` the transmitted tone amplitude
|
|
410
410
|
of stream ``j``. The measured matrix of tone phasors is therefore
|
|
411
|
-
``T = J · diag(α)
|
|
411
|
+
``T = J · diag(α)``. Its columns are scaled to unit norm, which removes
|
|
412
|
+
the tone amplitudes without a measurement on the data, and
|
|
413
|
+
``W = pinv(T diag(1/‖T_j‖))`` unmixes::
|
|
412
414
|
|
|
413
|
-
W r = diag(
|
|
415
|
+
W r = diag(‖J_j‖ · e^{-j∠α_j}) · s,
|
|
414
416
|
|
|
415
|
-
|
|
416
|
-
``
|
|
417
|
-
|
|
417
|
+
each stream at the amplitude it arrives with (``‖J_j‖ = 1``, its
|
|
418
|
+
transmitted amplitude, for a lossless channel, where ``W`` is unitary)
|
|
419
|
+
and a constant phase that the carrier recovery removes. The output
|
|
420
|
+
stays in the input's units, and ``W`` seeds a butterfly equalizer at the
|
|
421
|
+
right scale. Each tone labels its stream, so output row ``j`` is always the stream of
|
|
418
422
|
``tone_frequencies[j]``: there is no permutation ambiguity, unlike after
|
|
419
423
|
blind equalization (see :func:`commkit.recovery.resolve_channel_permutation`).
|
|
420
424
|
|
|
@@ -606,7 +610,7 @@ def _estimate_tones(
|
|
|
606
610
|
f_used = f_tones
|
|
607
611
|
|
|
608
612
|
if track_bandwidth is None:
|
|
609
|
-
T = _tone_phasor_matrix(xw, f_used, sampling_rate)
|
|
613
|
+
T = _unit_columns(_tone_phasor_matrix(xw, f_used, sampling_rate), xp)
|
|
610
614
|
# pinv covers the over-determined C > K case and equals the inverse
|
|
611
615
|
# when square.
|
|
612
616
|
W = xp.linalg.pinv(T) # (K, C)
|
|
@@ -630,7 +634,7 @@ def _estimate_tones(
|
|
|
630
634
|
grid_np, grid, grid_step = _inversion_grid(
|
|
631
635
|
grid_step, track_bandwidth, sampling_rate, N, xp
|
|
632
636
|
)
|
|
633
|
-
Tg = _tracked_jones(xw, h, f_used, grid_np, grid, sampling_rate)
|
|
637
|
+
Tg = _unit_columns(_tracked_jones(xw, h, f_used, grid_np, grid, sampling_rate), xp)
|
|
634
638
|
Wg = _regularized_inverse(Tg, xp)
|
|
635
639
|
G = int(grid_np.shape[0])
|
|
636
640
|
logger.info(
|
|
@@ -763,6 +767,17 @@ def _tracked_jones(
|
|
|
763
767
|
return xp.moveaxis(T_t[:, :, grid], 2, 0).astype(xp.complex128) # (G, C, K)
|
|
764
768
|
|
|
765
769
|
|
|
770
|
+
def _unit_columns(T: ArrayType, xp: Any) -> ArrayType:
|
|
771
|
+
"""Tone-phasor matrices ``(..., C, K)`` with unit-norm columns.
|
|
772
|
+
|
|
773
|
+
Column ``j`` is ``J_j · α_j``: dividing by its norm removes the tone
|
|
774
|
+
amplitude ``|α_j|`` (and, at the edges of a track, the zero padding the
|
|
775
|
+
tracking filter averaged in), so the inverse is the channel's own.
|
|
776
|
+
"""
|
|
777
|
+
norm = xp.linalg.norm(T, axis=-2, keepdims=True)
|
|
778
|
+
return T / xp.where(norm > 0, norm, 1.0)
|
|
779
|
+
|
|
780
|
+
|
|
766
781
|
def _regularized_inverse(Tg: ArrayType, xp: Any) -> ArrayType:
|
|
767
782
|
"""Left inverses ``(G, K, C)`` of the ``(G, C, K)`` Jones stack.
|
|
768
783
|
|
|
@@ -784,7 +799,6 @@ def correct_polarization(
|
|
|
784
799
|
how: PolarizationEstimate | PolarizationMethod | ArrayType,
|
|
785
800
|
*,
|
|
786
801
|
sampling_rate: float | None = None,
|
|
787
|
-
normalize: bool = True,
|
|
788
802
|
trim_edges: bool = False,
|
|
789
803
|
) -> S:
|
|
790
804
|
"""Unmix polarizations: ``y[:, n] = W(n) · x[:, n]``.
|
|
@@ -803,11 +817,6 @@ def correct_polarization(
|
|
|
803
817
|
Sampling rate in Hz, for a method ``how``. Taken from the Signal;
|
|
804
818
|
required for array input with a method. A value that disagrees with
|
|
805
819
|
the Signal raises.
|
|
806
|
-
normalize : bool, default True
|
|
807
|
-
Rescale each output row to the mean input power per channel, which
|
|
808
|
-
removes the tone-amplitude scale of a tone estimate and keeps the
|
|
809
|
-
library's power convention. With ``trim_edges=True`` the power is
|
|
810
|
-
measured over the retained samples.
|
|
811
820
|
trim_edges : bool, default False
|
|
812
821
|
Drop the ``how.edge`` samples at each end, where a tracked estimate
|
|
813
822
|
averaged in the zero padding of its tracking filter and leaves
|
|
@@ -820,7 +829,8 @@ def correct_polarization(
|
|
|
820
829
|
ndarray or Signal
|
|
821
830
|
Demultiplexed streams, ``(K, N)``: one row per transmitted stream,
|
|
822
831
|
row ``j`` the stream of the estimate's ``tone_frequencies[j]``. Same
|
|
823
|
-
complex dtype and device as the input
|
|
832
|
+
complex dtype and device as the input, in the input's units: the
|
|
833
|
+
matrices are applied as given, never rescaled by a measured power.
|
|
824
834
|
|
|
825
835
|
Raises
|
|
826
836
|
------
|
|
@@ -873,12 +883,6 @@ def correct_polarization(
|
|
|
873
883
|
)
|
|
874
884
|
valid = slice(guard, N - guard)
|
|
875
885
|
demuxed = demuxed[:, valid]
|
|
876
|
-
if normalize:
|
|
877
|
-
x_kept = x[:, valid]
|
|
878
|
-
# Single-pass BLAS reduction - no full-record |x|² temporary.
|
|
879
|
-
p_in = xp.vdot(x_kept, x_kept).real / x_kept.size
|
|
880
|
-
p_out = xp.mean(xp.abs(demuxed) ** 2, axis=-1, keepdims=True) # (K, 1)
|
|
881
|
-
demuxed = demuxed * xp.sqrt(p_in / xp.where(p_out > 0, p_out, 1.0))
|
|
882
886
|
return inp.wrap(demuxed.astype(x.dtype, copy=False))
|
|
883
887
|
|
|
884
888
|
|
|
@@ -437,6 +437,13 @@ class Constellation:
|
|
|
437
437
|
def _storage_dtype(self) -> type:
|
|
438
438
|
return np.complex64 if self.is_complex else np.float32
|
|
439
439
|
|
|
440
|
+
@cached_property
|
|
441
|
+
def _kurtosis(self) -> float:
|
|
442
|
+
"""``E|s|^4 / E^2|s|^2`` under the pmf, for the blind moment gain."""
|
|
443
|
+
p = np.abs(self.points) ** 2
|
|
444
|
+
w = np.full(p.size, 1.0 / p.size) if self.pmf is None else self.pmf
|
|
445
|
+
return float(w @ p**2 / (w @ p) ** 2)
|
|
446
|
+
|
|
440
447
|
@cached_property
|
|
441
448
|
def _square_grid(self) -> tuple[float, float, int, np.ndarray] | None:
|
|
442
449
|
"""Cache of :func:`._lattice.find_square_grid`."""
|
|
@@ -50,8 +50,10 @@ def compute_llr(
|
|
|
50
50
|
Variance ``sigma^2 = E[|n|^2]`` of the noise in ``symbols``, on the
|
|
51
51
|
constellation's scale: of circular complex noise for complex
|
|
52
52
|
symbols, of real noise for real ones (what
|
|
53
|
-
:func:`~commkit.metrics.noise_variance` measures
|
|
54
|
-
|
|
53
|
+
:func:`~commkit.metrics.noise_variance` measures, the same LLRs as
|
|
54
|
+
``esn0_db`` set to :func:`~commkit.metrics.snr` for complex symbols
|
|
55
|
+
and to ``snr - 3.01`` for real ones). Give this or
|
|
56
|
+
``esn0_db``.
|
|
55
57
|
esn0_db : float, optional
|
|
56
58
|
Es/N0 of the channel in dB, instead of ``noise_var``: Es is the
|
|
57
59
|
constellation's average energy, and the noise variance follows as
|