commkit 3.9.0__tar.gz → 3.10.1__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.
Files changed (344) hide show
  1. {commkit-3.9.0 → commkit-3.10.1}/.github/workflows/ci.yml +8 -7
  2. {commkit-3.9.0 → commkit-3.10.1}/AGENTS.md +5 -3
  3. {commkit-3.9.0 → commkit-3.10.1}/CHANGELOG.md +72 -1
  4. {commkit-3.9.0 → commkit-3.10.1}/PKG-INFO +14 -6
  5. {commkit-3.9.0 → commkit-3.10.1}/README.md +13 -5
  6. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/conftest.py +5 -2
  7. {commkit-3.9.0 → commkit-3.10.1}/commkit/__init__.py +1 -1
  8. {commkit-3.9.0 → commkit-3.10.1}/commkit/_array.py +2 -1
  9. {commkit-3.9.0 → commkit-3.10.1}/commkit/_circular.py +25 -10
  10. commkit-3.10.1/commkit/_constants.py +9 -0
  11. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/bps.py +12 -3
  12. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/coding.py +17 -3
  13. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/graphs.py +3 -2
  14. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/llr.py +20 -10
  15. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/selftest.py +8 -1
  16. {commkit-3.9.0 → commkit-3.10.1}/commkit/_interpolation.py +7 -5
  17. {commkit-3.9.0 → commkit-3.10.1}/commkit/_numba_interpolation.py +3 -0
  18. {commkit-3.9.0 → commkit-3.10.1}/commkit/_overlap_save.py +5 -0
  19. {commkit-3.9.0 → commkit-3.10.1}/commkit/analysis/_common.py +5 -2
  20. {commkit-3.9.0 → commkit-3.10.1}/commkit/analysis/interferometry.py +3 -1
  21. {commkit-3.9.0 → commkit-3.10.1}/commkit/analysis/linewidth/dsh.py +2 -2
  22. {commkit-3.9.0 → commkit-3.10.1}/commkit/backend.py +6 -0
  23. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/exit.py +6 -3
  24. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/polar.py +3 -2
  25. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/product.py +10 -0
  26. {commkit-3.9.0 → commkit-3.10.1}/commkit/core/_signal_input.py +1 -1
  27. {commkit-3.9.0 → commkit-3.10.1}/commkit/core/frame.py +29 -8
  28. {commkit-3.9.0 → commkit-3.10.1}/commkit/core/generation.py +54 -19
  29. {commkit-3.9.0 → commkit-3.10.1}/commkit/core/preamble.py +17 -6
  30. {commkit-3.9.0 → commkit-3.10.1}/commkit/core/signal.py +13 -2
  31. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/_block/_dd.py +8 -9
  32. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/_block/_engine.py +6 -3
  33. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/_common.py +4 -3
  34. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/_numba_loops.py +8 -1
  35. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/_sequential/_dd.py +4 -3
  36. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/_sequential/_setup.py +7 -8
  37. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/linear.py +26 -6
  38. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/polarization.py +9 -0
  39. {commkit-3.9.0 → commkit-3.10.1}/commkit/filtering/fiber/compensation.py +15 -5
  40. {commkit-3.9.0 → commkit-3.10.1}/commkit/filtering/fiber/estimation.py +8 -2
  41. {commkit-3.9.0 → commkit-3.10.1}/commkit/filtering/linear.py +13 -5
  42. {commkit-3.9.0 → commkit-3.10.1}/commkit/filtering/response.py +26 -1
  43. {commkit-3.9.0 → commkit-3.10.1}/commkit/frequency.py +54 -16
  44. {commkit-3.9.0 → commkit-3.10.1}/commkit/impairments/fiber_channel.py +3 -1
  45. {commkit-3.9.0 → commkit-3.10.1}/commkit/impairments/frontend.py +13 -9
  46. {commkit-3.9.0 → commkit-3.10.1}/commkit/impairments/noise.py +11 -3
  47. {commkit-3.9.0 → commkit-3.10.1}/commkit/impairments/source.py +21 -5
  48. {commkit-3.9.0 → commkit-3.10.1}/commkit/io.py +26 -13
  49. {commkit-3.9.0 → commkit-3.10.1}/commkit/logger.py +37 -6
  50. {commkit-3.9.0 → commkit-3.10.1}/commkit/mapping/_demap.py +10 -2
  51. {commkit-3.9.0 → commkit-3.10.1}/commkit/mapping/constellation.py +27 -14
  52. {commkit-3.9.0 → commkit-3.10.1}/commkit/mapping/llr.py +2 -7
  53. {commkit-3.9.0 → commkit-3.10.1}/commkit/mapping/shaping.py +26 -6
  54. {commkit-3.9.0 → commkit-3.10.1}/commkit/math.py +4 -1
  55. {commkit-3.9.0 → commkit-3.10.1}/commkit/metrics/_common.py +4 -4
  56. {commkit-3.9.0 → commkit-3.10.1}/commkit/multirate.py +3 -1
  57. {commkit-3.9.0 → commkit-3.10.1}/commkit/plotting/__init__.py +4 -2
  58. {commkit-3.9.0 → commkit-3.10.1}/commkit/plotting/analysis.py +26 -19
  59. {commkit-3.9.0 → commkit-3.10.1}/commkit/plotting/coding.py +6 -4
  60. {commkit-3.9.0 → commkit-3.10.1}/commkit/plotting/constellation.py +29 -29
  61. {commkit-3.9.0 → commkit-3.10.1}/commkit/plotting/equalizer.py +16 -8
  62. {commkit-3.9.0 → commkit-3.10.1}/commkit/plotting/eye.py +41 -20
  63. commkit-3.10.1/commkit/plotting/filter_response.py +353 -0
  64. {commkit-3.9.0 → commkit-3.10.1}/commkit/plotting/frequency.py +31 -31
  65. {commkit-3.9.0 → commkit-3.10.1}/commkit/plotting/recovery.py +9 -7
  66. {commkit-3.9.0 → commkit-3.10.1}/commkit/plotting/spectral.py +72 -16
  67. {commkit-3.9.0 → commkit-3.10.1}/commkit/plotting/theme.py +112 -15
  68. {commkit-3.9.0 → commkit-3.10.1}/commkit/plotting/timing.py +10 -5
  69. {commkit-3.9.0 → commkit-3.10.1}/commkit/plotting/waveform.py +6 -2
  70. {commkit-3.9.0 → commkit-3.10.1}/commkit/recovery/_common.py +2 -1
  71. {commkit-3.9.0 → commkit-3.10.1}/commkit/recovery/_numba_loops.py +2 -1
  72. {commkit-3.9.0 → commkit-3.10.1}/commkit/recovery/bps.py +2 -2
  73. {commkit-3.9.0 → commkit-3.10.1}/commkit/recovery/corrections.py +37 -2
  74. {commkit-3.9.0 → commkit-3.10.1}/commkit/recovery/pilots.py +53 -4
  75. {commkit-3.9.0 → commkit-3.10.1}/commkit/recovery/tikhonov.py +4 -3
  76. {commkit-3.9.0 → commkit-3.10.1}/commkit/smoothing.py +17 -6
  77. {commkit-3.9.0 → commkit-3.10.1}/commkit/spectral.py +10 -4
  78. {commkit-3.9.0 → commkit-3.10.1}/commkit/timing/clock_recovery.py +8 -2
  79. {commkit-3.9.0 → commkit-3.10.1}/commkit/timing/synchronization.py +37 -3
  80. {commkit-3.9.0 → commkit-3.10.1}/examples/00-getting-started.ipynb +50 -23
  81. {commkit-3.9.0 → commkit-3.10.1}/examples/01-constellations-and-bit-mapping.ipynb +1 -7
  82. {commkit-3.9.0 → commkit-3.10.1}/examples/02-spectral-analysis.ipynb +86 -16
  83. {commkit-3.9.0 → commkit-3.10.1}/examples/03-digital-filters.ipynb +113 -23
  84. {commkit-3.9.0 → commkit-3.10.1}/examples/04-pulse-shaping-and-matched-filtering.ipynb +59 -33
  85. {commkit-3.9.0 → commkit-3.10.1}/examples/05-multirate-and-resampling.ipynb +3 -9
  86. {commkit-3.9.0 → commkit-3.10.1}/examples/06-awgn-and-performance-metrics.ipynb +1 -7
  87. {commkit-3.9.0 → commkit-3.10.1}/examples/07-channel-coding.ipynb +8 -18
  88. {commkit-3.9.0 → commkit-3.10.1}/examples/08-probabilistic-shaping-and-coded-modulation.ipynb +4 -11
  89. {commkit-3.9.0 → commkit-3.10.1}/examples/09-laser-phase-noise.ipynb +3 -8
  90. {commkit-3.9.0 → commkit-3.10.1}/examples/10-front-end-impairments.ipynb +80 -12
  91. {commkit-3.9.0 → commkit-3.10.1}/examples/11-frame-synchronization-and-timing.ipynb +1 -6
  92. {commkit-3.9.0 → commkit-3.10.1}/examples/12-sampling-clock-recovery.ipynb +4 -9
  93. {commkit-3.9.0 → commkit-3.10.1}/examples/13-frequency-offset-estimation.ipynb +11 -25
  94. {commkit-3.9.0 → commkit-3.10.1}/examples/14-blind-carrier-phase-recovery.ipynb +0 -5
  95. {commkit-3.9.0 → commkit-3.10.1}/examples/15-pilot-aided-carrier-recovery.ipynb +4 -10
  96. {commkit-3.9.0 → commkit-3.10.1}/examples/16-linear-channel-equalization.ipynb +56 -35
  97. {commkit-3.9.0 → commkit-3.10.1}/examples/17-adaptive-equalization.ipynb +1 -7
  98. {commkit-3.9.0 → commkit-3.10.1}/examples/18-blind-equalization.ipynb +0 -5
  99. {commkit-3.9.0 → commkit-3.10.1}/examples/19-polarization-multiplexing.ipynb +0 -5
  100. {commkit-3.9.0 → commkit-3.10.1}/examples/20-chromatic-dispersion.ipynb +38 -32
  101. {commkit-3.9.0 → commkit-3.10.1}/examples/21-nonlinear-fiber-and-backpropagation.ipynb +13 -18
  102. {commkit-3.9.0 → commkit-3.10.1}/examples/22-direct-and-self-coherent-detection.ipynb +40 -14
  103. {commkit-3.9.0 → commkit-3.10.1}/examples/23-fec-in-optical-standards.ipynb +1 -6
  104. {commkit-3.9.0 → commkit-3.10.1}/examples/24-coherent-transceiver-end-to-end.ipynb +3 -11
  105. {commkit-3.9.0 → commkit-3.10.1}/examples/25-carrier-phase-characterization.ipynb +19 -20
  106. {commkit-3.9.0 → commkit-3.10.1}/examples/26-laser-linewidth-self-heterodyne.ipynb +0 -5
  107. {commkit-3.9.0 → commkit-3.10.1}/examples/27-laser-linewidth-short-delay-and-flicker.ipynb +0 -5
  108. {commkit-3.9.0 → commkit-3.10.1}/examples/28-laser-linewidth-self-homodyne-iq.ipynb +1 -6
  109. {commkit-3.9.0 → commkit-3.10.1}/examples/29-measurement-template-self-heterodyne.ipynb +0 -5
  110. {commkit-3.9.0 → commkit-3.10.1}/examples/30-measurement-template-self-homodyne-iq.ipynb +0 -5
  111. {commkit-3.9.0 → commkit-3.10.1}/examples/README.md +5 -5
  112. {commkit-3.9.0 → commkit-3.10.1}/pyproject.toml +4 -3
  113. {commkit-3.9.0 → commkit-3.10.1}/scripts/sanitize.sh +7 -2
  114. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_exit.py +31 -0
  115. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_product.py +26 -0
  116. {commkit-3.9.0 → commkit-3.10.1}/tests/plotting/test_plot_equalizer.py +20 -0
  117. {commkit-3.9.0 → commkit-3.10.1}/tests/plotting/test_plot_eye.py +22 -0
  118. commkit-3.10.1/tests/plotting/test_plot_filter_response.py +597 -0
  119. {commkit-3.9.0 → commkit-3.10.1}/tests/plotting/test_plot_spectral.py +96 -0
  120. {commkit-3.9.0 → commkit-3.10.1}/tests/plotting/test_plot_theme.py +207 -4
  121. {commkit-3.9.0 → commkit-3.10.1}/tests/test_examples.py +13 -0
  122. {commkit-3.9.0 → commkit-3.10.1}/tests/test_filter_response.py +42 -0
  123. {commkit-3.9.0 → commkit-3.10.1}/tests/test_import_hygiene.py +5 -3
  124. {commkit-3.9.0 → commkit-3.10.1}/tests/test_interpolation.py +8 -0
  125. {commkit-3.9.0 → commkit-3.10.1}/uv.lock +14 -14
  126. commkit-3.9.0/commkit/_constants.py +0 -4
  127. commkit-3.9.0/commkit/plotting/filter_response.py +0 -192
  128. commkit-3.9.0/tests/plotting/test_plot_filter_response.py +0 -207
  129. {commkit-3.9.0 → commkit-3.10.1}/.gitattributes +0 -0
  130. {commkit-3.9.0 → commkit-3.10.1}/.github/icon.svg +0 -0
  131. {commkit-3.9.0 → commkit-3.10.1}/.github/logo.svg +0 -0
  132. {commkit-3.9.0 → commkit-3.10.1}/.github/workflows/publish.yml +0 -0
  133. {commkit-3.9.0 → commkit-3.10.1}/.gitignore +0 -0
  134. {commkit-3.9.0 → commkit-3.10.1}/.python-version +0 -0
  135. {commkit-3.9.0 → commkit-3.10.1}/LICENSE +0 -0
  136. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/baselines/Linux-CPython-3.14-64bit/0002_pre_v2.json +0 -0
  137. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/baselines/Linux-CPython-3.14-64bit/0003_v2_0.json +0 -0
  138. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/baselines/Linux-CPython-3.14-64bit/0004_fiber_dbp.json +0 -0
  139. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/baselines/Linux-CPython-3.14-64bit/0005_gpu_decoder_path.json +0 -0
  140. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/baselines/Linux-CPython-3.14-64bit/0006_perf_cleanup.json +0 -0
  141. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/baselines/Linux-CPython-3.14-64bit/0007_v3_0.json +0 -0
  142. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/baselines/Linux-CPython-3.14-64bit/0008_v3_1.json +0 -0
  143. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/bench_block_blind.py +0 -0
  144. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/bench_block_lms.py +0 -0
  145. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/bench_bps.py +0 -0
  146. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/bench_coding.py +0 -0
  147. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/bench_equalizers.py +0 -0
  148. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/bench_fiber.py +0 -0
  149. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/bench_filters.py +0 -0
  150. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/bench_gardner.py +0 -0
  151. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/bench_import.py +0 -0
  152. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/bench_llr.py +0 -0
  153. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/bench_mapping.py +0 -0
  154. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/bench_signal_pipeline.py +0 -0
  155. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/bench_sync_misc.py +0 -0
  156. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/benchutils.py +0 -0
  157. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/record_baseline.py +0 -0
  158. {commkit-3.9.0 → commkit-3.10.1}/benchmarks/workloads.py +0 -0
  159. {commkit-3.9.0 → commkit-3.10.1}/commkit/_bits.py +0 -0
  160. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/__init__.py +0 -0
  161. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/compiler.py +0 -0
  162. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/filters.py +0 -0
  163. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/src/algebraic.cu +0 -0
  164. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/src/bps_anchor.cu +0 -0
  165. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/src/bps_min_d2.cu +0 -0
  166. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/src/cs_block.cu +0 -0
  167. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/src/iir.cu +0 -0
  168. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/src/interpolate.cu +0 -0
  169. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/src/ldpc.cu +0 -0
  170. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/src/llr.cu +0 -0
  171. {commkit-3.9.0 → commkit-3.10.1}/commkit/_cuda/src/selftest.cu +0 -0
  172. {commkit-3.9.0 → commkit-3.10.1}/commkit/_dispersion.py +0 -0
  173. {commkit-3.9.0 → commkit-3.10.1}/commkit/_fft.py +0 -0
  174. {commkit-3.9.0 → commkit-3.10.1}/commkit/_fiber.py +0 -0
  175. {commkit-3.9.0 → commkit-3.10.1}/commkit/_numba_frequency.py +0 -0
  176. {commkit-3.9.0 → commkit-3.10.1}/commkit/_peaks.py +0 -0
  177. {commkit-3.9.0 → commkit-3.10.1}/commkit/_random.py +0 -0
  178. {commkit-3.9.0 → commkit-3.10.1}/commkit/_sequences.py +0 -0
  179. {commkit-3.9.0 → commkit-3.10.1}/commkit/analysis/__init__.py +0 -0
  180. {commkit-3.9.0 → commkit-3.10.1}/commkit/analysis/allan.py +0 -0
  181. {commkit-3.9.0 → commkit-3.10.1}/commkit/analysis/drift.py +0 -0
  182. {commkit-3.9.0 → commkit-3.10.1}/commkit/analysis/fm_noise.py +0 -0
  183. {commkit-3.9.0 → commkit-3.10.1}/commkit/analysis/linewidth/__init__.py +0 -0
  184. {commkit-3.9.0 → commkit-3.10.1}/commkit/analysis/linewidth/phase.py +0 -0
  185. {commkit-3.9.0 → commkit-3.10.1}/commkit/analysis/linewidth/result.py +0 -0
  186. {commkit-3.9.0 → commkit-3.10.1}/commkit/analysis/trajectory.py +0 -0
  187. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/__init__.py +0 -0
  188. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/_galois.py +0 -0
  189. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/_gf2.py +0 -0
  190. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/_ldpc_tables.py +0 -0
  191. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/_numba_loops.py +0 -0
  192. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/algebraic.py +0 -0
  193. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/base.py +0 -0
  194. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/convolutional.py +0 -0
  195. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/crc.py +0 -0
  196. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/interleaving.py +0 -0
  197. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/ldpc.py +0 -0
  198. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/linear.py +0 -0
  199. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/performance.py +0 -0
  200. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/ratematch.py +0 -0
  201. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/shaping.py +0 -0
  202. {commkit-3.9.0 → commkit-3.10.1}/commkit/coding/turbo.py +0 -0
  203. {commkit-3.9.0 → commkit-3.10.1}/commkit/core/__init__.py +0 -0
  204. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/__init__.py +0 -0
  205. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/_block/__init__.py +0 -0
  206. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/_block/_blind.py +0 -0
  207. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/_sequential/__init__.py +0 -0
  208. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/_sequential/_blind.py +0 -0
  209. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/pilots.py +0 -0
  210. {commkit-3.9.0 → commkit-3.10.1}/commkit/equalization/result.py +0 -0
  211. {commkit-3.9.0 → commkit-3.10.1}/commkit/filtering/__init__.py +0 -0
  212. {commkit-3.9.0 → commkit-3.10.1}/commkit/filtering/fiber/__init__.py +0 -0
  213. {commkit-3.9.0 → commkit-3.10.1}/commkit/filtering/pulses.py +0 -0
  214. {commkit-3.9.0 → commkit-3.10.1}/commkit/impairments/__init__.py +0 -0
  215. {commkit-3.9.0 → commkit-3.10.1}/commkit/mapping/__init__.py +0 -0
  216. {commkit-3.9.0 → commkit-3.10.1}/commkit/mapping/_lattice.py +0 -0
  217. {commkit-3.9.0 → commkit-3.10.1}/commkit/mapping/_numba_llr.py +0 -0
  218. {commkit-3.9.0 → commkit-3.10.1}/commkit/mapping/bits.py +0 -0
  219. {commkit-3.9.0 → commkit-3.10.1}/commkit/mapping/gray.py +0 -0
  220. {commkit-3.9.0 → commkit-3.10.1}/commkit/metrics/__init__.py +0 -0
  221. {commkit-3.9.0 → commkit-3.10.1}/commkit/metrics/awgn.py +0 -0
  222. {commkit-3.9.0 → commkit-3.10.1}/commkit/metrics/error_rates.py +0 -0
  223. {commkit-3.9.0 → commkit-3.10.1}/commkit/metrics/information.py +0 -0
  224. {commkit-3.9.0 → commkit-3.10.1}/commkit/metrics/quality.py +0 -0
  225. {commkit-3.9.0 → commkit-3.10.1}/commkit/py.typed +0 -0
  226. {commkit-3.9.0 → commkit-3.10.1}/commkit/recovery/__init__.py +0 -0
  227. {commkit-3.9.0 → commkit-3.10.1}/commkit/recovery/carrier_phase.py +0 -0
  228. {commkit-3.9.0 → commkit-3.10.1}/commkit/recovery/estimates.py +0 -0
  229. {commkit-3.9.0 → commkit-3.10.1}/commkit/recovery/pll.py +0 -0
  230. {commkit-3.9.0 → commkit-3.10.1}/commkit/recovery/viterbi_viterbi.py +0 -0
  231. {commkit-3.9.0 → commkit-3.10.1}/commkit/timing/__init__.py +0 -0
  232. {commkit-3.9.0 → commkit-3.10.1}/commkit/timing/_numba_loops.py +0 -0
  233. {commkit-3.9.0 → commkit-3.10.1}/tests/analysis/test_allan.py +0 -0
  234. {commkit-3.9.0 → commkit-3.10.1}/tests/analysis/test_drift.py +0 -0
  235. {commkit-3.9.0 → commkit-3.10.1}/tests/analysis/test_fm_noise.py +0 -0
  236. {commkit-3.9.0 → commkit-3.10.1}/tests/analysis/test_interferometry.py +0 -0
  237. {commkit-3.9.0 → commkit-3.10.1}/tests/analysis/test_linewidth.py +0 -0
  238. {commkit-3.9.0 → commkit-3.10.1}/tests/analysis/test_trajectory.py +0 -0
  239. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_algebraic.py +0 -0
  240. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_coding_base.py +0 -0
  241. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_convolutional.py +0 -0
  242. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_crc.py +0 -0
  243. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_gf2.py +0 -0
  244. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_interleaving.py +0 -0
  245. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_ldpc.py +0 -0
  246. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_ldpc_exit.py +0 -0
  247. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_ldpc_kernel.py +0 -0
  248. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_ldpc_tables.py +0 -0
  249. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_linear_codes.py +0 -0
  250. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_performance.py +0 -0
  251. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_polar.py +0 -0
  252. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_ratematch.py +0 -0
  253. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_shaping.py +0 -0
  254. {commkit-3.9.0 → commkit-3.10.1}/tests/coding/test_turbo.py +0 -0
  255. {commkit-3.9.0 → commkit-3.10.1}/tests/common/__init__.py +0 -0
  256. {commkit-3.9.0 → commkit-3.10.1}/tests/common/coding.py +0 -0
  257. {commkit-3.9.0 → commkit-3.10.1}/tests/common/conversions.py +0 -0
  258. {commkit-3.9.0 → commkit-3.10.1}/tests/common/kernel_utils.py +0 -0
  259. {commkit-3.9.0 → commkit-3.10.1}/tests/common/memory.py +0 -0
  260. {commkit-3.9.0 → commkit-3.10.1}/tests/common/metrics.py +0 -0
  261. {commkit-3.9.0 → commkit-3.10.1}/tests/common/periodic.py +0 -0
  262. {commkit-3.9.0 → commkit-3.10.1}/tests/common/reference_impl.py +0 -0
  263. {commkit-3.9.0 → commkit-3.10.1}/tests/common/scoring.py +0 -0
  264. {commkit-3.9.0 → commkit-3.10.1}/tests/common/signals.py +0 -0
  265. {commkit-3.9.0 → commkit-3.10.1}/tests/common/theory.py +0 -0
  266. {commkit-3.9.0 → commkit-3.10.1}/tests/common/user_block.py +0 -0
  267. {commkit-3.9.0 → commkit-3.10.1}/tests/conftest.py +0 -0
  268. {commkit-3.9.0 → commkit-3.10.1}/tests/core/test_frame.py +0 -0
  269. {commkit-3.9.0 → commkit-3.10.1}/tests/core/test_generation.py +0 -0
  270. {commkit-3.9.0 → commkit-3.10.1}/tests/core/test_preamble.py +0 -0
  271. {commkit-3.9.0 → commkit-3.10.1}/tests/core/test_psqam.py +0 -0
  272. {commkit-3.9.0 → commkit-3.10.1}/tests/core/test_signal.py +0 -0
  273. {commkit-3.9.0 → commkit-3.10.1}/tests/core/test_signal_input.py +0 -0
  274. {commkit-3.9.0 → commkit-3.10.1}/tests/core/test_signal_mimo.py +0 -0
  275. {commkit-3.9.0 → commkit-3.10.1}/tests/equalization/test_blind.py +0 -0
  276. {commkit-3.9.0 → commkit-3.10.1}/tests/equalization/test_block.py +0 -0
  277. {commkit-3.9.0 → commkit-3.10.1}/tests/equalization/test_bps_kernel.py +0 -0
  278. {commkit-3.9.0 → commkit-3.10.1}/tests/equalization/test_cold_start.py +0 -0
  279. {commkit-3.9.0 → commkit-3.10.1}/tests/equalization/test_cpr.py +0 -0
  280. {commkit-3.9.0 → commkit-3.10.1}/tests/equalization/test_cs_kernel.py +0 -0
  281. {commkit-3.9.0 → commkit-3.10.1}/tests/equalization/test_equalizer_oracles.py +0 -0
  282. {commkit-3.9.0 → commkit-3.10.1}/tests/equalization/test_linear.py +0 -0
  283. {commkit-3.9.0 → commkit-3.10.1}/tests/equalization/test_mimo.py +0 -0
  284. {commkit-3.9.0 → commkit-3.10.1}/tests/equalization/test_polarization.py +0 -0
  285. {commkit-3.9.0 → commkit-3.10.1}/tests/equalization/test_result.py +0 -0
  286. {commkit-3.9.0 → commkit-3.10.1}/tests/equalization/test_sequential.py +0 -0
  287. {commkit-3.9.0 → commkit-3.10.1}/tests/equalization/test_state.py +0 -0
  288. {commkit-3.9.0 → commkit-3.10.1}/tests/equalization/test_winit.py +0 -0
  289. {commkit-3.9.0 → commkit-3.10.1}/tests/impairments/test_fiber_channel_linear.py +0 -0
  290. {commkit-3.9.0 → commkit-3.10.1}/tests/impairments/test_fiber_channel_nonlinear.py +0 -0
  291. {commkit-3.9.0 → commkit-3.10.1}/tests/impairments/test_frontend.py +0 -0
  292. {commkit-3.9.0 → commkit-3.10.1}/tests/impairments/test_noise.py +0 -0
  293. {commkit-3.9.0 → commkit-3.10.1}/tests/impairments/test_source.py +0 -0
  294. {commkit-3.9.0 → commkit-3.10.1}/tests/mapping/test_bits.py +0 -0
  295. {commkit-3.9.0 → commkit-3.10.1}/tests/mapping/test_constellation.py +0 -0
  296. {commkit-3.9.0 → commkit-3.10.1}/tests/mapping/test_gray.py +0 -0
  297. {commkit-3.9.0 → commkit-3.10.1}/tests/mapping/test_lattice.py +0 -0
  298. {commkit-3.9.0 → commkit-3.10.1}/tests/mapping/test_llr.py +0 -0
  299. {commkit-3.9.0 → commkit-3.10.1}/tests/metrics/test_awgn.py +0 -0
  300. {commkit-3.9.0 → commkit-3.10.1}/tests/metrics/test_common.py +0 -0
  301. {commkit-3.9.0 → commkit-3.10.1}/tests/metrics/test_error_rates.py +0 -0
  302. {commkit-3.9.0 → commkit-3.10.1}/tests/metrics/test_information.py +0 -0
  303. {commkit-3.9.0 → commkit-3.10.1}/tests/metrics/test_quality.py +0 -0
  304. {commkit-3.9.0 → commkit-3.10.1}/tests/plotting/test_plot_analysis.py +0 -0
  305. {commkit-3.9.0 → commkit-3.10.1}/tests/plotting/test_plot_coding.py +0 -0
  306. {commkit-3.9.0 → commkit-3.10.1}/tests/plotting/test_plot_constellation.py +0 -0
  307. {commkit-3.9.0 → commkit-3.10.1}/tests/plotting/test_plot_frequency.py +0 -0
  308. {commkit-3.9.0 → commkit-3.10.1}/tests/plotting/test_plot_recovery.py +0 -0
  309. {commkit-3.9.0 → commkit-3.10.1}/tests/plotting/test_plot_timing.py +0 -0
  310. {commkit-3.9.0 → commkit-3.10.1}/tests/plotting/test_plot_waveform.py +0 -0
  311. {commkit-3.9.0 → commkit-3.10.1}/tests/plugins/__init__.py +0 -0
  312. {commkit-3.9.0 → commkit-3.10.1}/tests/plugins/precision_trace.py +0 -0
  313. {commkit-3.9.0 → commkit-3.10.1}/tests/plugins/transfer_trace.py +0 -0
  314. {commkit-3.9.0 → commkit-3.10.1}/tests/recovery/test_bps.py +0 -0
  315. {commkit-3.9.0 → commkit-3.10.1}/tests/recovery/test_carrier_phase.py +0 -0
  316. {commkit-3.9.0 → commkit-3.10.1}/tests/recovery/test_corrections.py +0 -0
  317. {commkit-3.9.0 → commkit-3.10.1}/tests/recovery/test_joint.py +0 -0
  318. {commkit-3.9.0 → commkit-3.10.1}/tests/recovery/test_pilots.py +0 -0
  319. {commkit-3.9.0 → commkit-3.10.1}/tests/recovery/test_pll.py +0 -0
  320. {commkit-3.9.0 → commkit-3.10.1}/tests/recovery/test_recovery_oracles.py +0 -0
  321. {commkit-3.9.0 → commkit-3.10.1}/tests/recovery/test_tikhonov.py +0 -0
  322. {commkit-3.9.0 → commkit-3.10.1}/tests/recovery/test_viterbi_viterbi.py +0 -0
  323. {commkit-3.9.0 → commkit-3.10.1}/tests/test_api_contracts.py +0 -0
  324. {commkit-3.9.0 → commkit-3.10.1}/tests/test_array.py +0 -0
  325. {commkit-3.9.0 → commkit-3.10.1}/tests/test_backend.py +0 -0
  326. {commkit-3.9.0 → commkit-3.10.1}/tests/test_bit_packing.py +0 -0
  327. {commkit-3.9.0 → commkit-3.10.1}/tests/test_cuda_infra.py +0 -0
  328. {commkit-3.9.0 → commkit-3.10.1}/tests/test_dispersion.py +0 -0
  329. {commkit-3.9.0 → commkit-3.10.1}/tests/test_fiber.py +0 -0
  330. {commkit-3.9.0 → commkit-3.10.1}/tests/test_filtering.py +0 -0
  331. {commkit-3.9.0 → commkit-3.10.1}/tests/test_frequency.py +0 -0
  332. {commkit-3.9.0 → commkit-3.10.1}/tests/test_io.py +0 -0
  333. {commkit-3.9.0 → commkit-3.10.1}/tests/test_logger.py +0 -0
  334. {commkit-3.9.0 → commkit-3.10.1}/tests/test_math.py +0 -0
  335. {commkit-3.9.0 → commkit-3.10.1}/tests/test_multirate.py +0 -0
  336. {commkit-3.9.0 → commkit-3.10.1}/tests/test_peaks.py +0 -0
  337. {commkit-3.9.0 → commkit-3.10.1}/tests/test_pulse_shaping.py +0 -0
  338. {commkit-3.9.0 → commkit-3.10.1}/tests/test_receiver_chain.py +0 -0
  339. {commkit-3.9.0 → commkit-3.10.1}/tests/test_signal_pipeline.py +0 -0
  340. {commkit-3.9.0 → commkit-3.10.1}/tests/test_smoothing.py +0 -0
  341. {commkit-3.9.0 → commkit-3.10.1}/tests/test_spectral.py +0 -0
  342. {commkit-3.9.0 → commkit-3.10.1}/tests/test_working_memory.py +0 -0
  343. {commkit-3.9.0 → commkit-3.10.1}/tests/timing/test_clock_recovery.py +0 -0
  344. {commkit-3.9.0 → commkit-3.10.1}/tests/timing/test_synchronization.py +0 -0
@@ -40,10 +40,11 @@ jobs:
40
40
 
41
41
  notebooks:
42
42
  name: Notebooks carry no outputs
43
- # Outputs (plots are base64 PNGs) would bloat the repository. The
44
- # nbstripout git filter strips them on commit once a clone runs
45
- # 'uv run nbstripout --install'; this required check catches a clone
46
- # without it before anything reaches main.
43
+ # Outputs (plots are base64 PNGs) and local kernel metadata would bloat or
44
+ # churn the repository. The nbstripout git filter strips both on commit
45
+ # once a clone runs 'uv run nbstripout --install' and
46
+ # 'git config filter.nbstripout.extrakeys "metadata.kernelspec metadata.language_info.version"';
47
+ # this required check catches a clone without it before anything reaches main.
47
48
  runs-on: ubuntu-latest
48
49
  steps:
49
50
  - uses: actions/checkout@v4
@@ -52,7 +53,7 @@ jobs:
52
53
  uses: astral-sh/setup-uv@v5
53
54
 
54
55
  - name: Every committed notebook is stripped
55
- run: uvx nbstripout@0.9.1 --verify $(git ls-files '*.ipynb')
56
+ run: uvx nbstripout@0.9.1 --verify --extra-keys "metadata.kernelspec metadata.language_info.version" $(git ls-files '*.ipynb')
56
57
 
57
58
  test:
58
59
  name: Test (Python ${{ matrix.python-version }} | ${{ matrix.resolution }})
@@ -122,14 +123,14 @@ jobs:
122
123
  tests/coding/test_linear_codes.py::TestMaximumLikelihood
123
124
  tests/timing/test_clock_recovery.py::TestEstimate::test_matches_oracle
124
125
  tests/timing/test_clock_recovery.py::TestValidation
125
- tests/test_interpolation.py
126
+ tests/test_interpolation.py tests/test_filtering.py
126
127
  -k "not waterfall and not threshold"
127
128
  --device=cpu --cov=commkit --cov-report=
128
129
 
129
130
  - name: Kernel coverage report
130
131
  run: >-
131
132
  uv run coverage report --show-missing --fail-under=85
132
- --include="commkit/equalization/_numba_loops.py,commkit/equalization/_sequential/*,commkit/_numba_frequency.py,commkit/recovery/*,commkit/coding/ldpc.py,commkit/coding/shaping.py,commkit/coding/polar.py,commkit/coding/convolutional.py,commkit/coding/turbo.py,commkit/timing/_numba_loops.py,commkit/_numba_interpolation.py"
133
+ --include="commkit/equalization/_numba_loops.py,commkit/mapping/_numba_llr.py,commkit/recovery/_numba_loops.py,commkit/coding/_numba_loops.py,commkit/timing/_numba_loops.py,commkit/_numba_interpolation.py,commkit/_numba_frequency.py"
133
134
 
134
135
  # GPU legs (--device=gpu / --device=all) require CuPy + CUDA and are run
135
136
  # manually or on a self-hosted runner; they are intentionally not part of
@@ -31,7 +31,8 @@ Always use `uv`. Python 3.12+.
31
31
 
32
32
  ```bash
33
33
  uv sync --all-extras # environment incl. GPU packages
34
- uv run nbstripout --install # once per clone: strip notebook outputs on commit
34
+ uv run nbstripout --install # once per clone: strip outputs and local metadata on commit
35
+ git config filter.nbstripout.extrakeys "metadata.kernelspec metadata.language_info.version"
35
36
  uv run pytest # CPU + GPU tests (default --device=all)
36
37
  uv run pytest --device=cpu # what CI runs
37
38
  uv run pytest --run-slow # also the long statistical validation (marker slow)
@@ -83,6 +84,7 @@ Dependencies point downward only:
83
84
  | Presentation | `plotting` | everything; **nothing imports plotting** (no `debug_plot`: plot functions consume results or recompute through public functions) |
84
85
 
85
86
  - **Responsibilities:** `filtering` holds signal-chain filters with a real frequency response; `smoothing` display and estimation smoothers only; `analysis` laser and phase characterization; `metrics` is the reporting layer.
87
+ - **Plot styling comes from the theme.** Plot functions take colors, fonts and sizes from `matplotlib.rcParams`, so they work under `apply_default_theme(dark=True)`, `dark=False` or any other style: cycle colors `C0`, `C1`, ... for curves and fitted annotations; `_reference_line()` (`plotting/theme.py`: the light red `_accent()`, its shade chosen by the background's luminance, a long dash, three quarters of `lines.linewidth`) for reference lines and guides, set apart from the faint grid; `_foreground()` (the text color) for markers that must contrast with the background and `_background()` for their edges; `image.cmap` for density images and spectrograms (a `cmap=None` default), with empty cells masked; `_line_width(scale)` and `_marker_area(scale)` relative to `lines.linewidth` and `lines.markersize`. Never a named or hex color, a `fontsize` or a fixed width or size outside `theme.py`; `"gray"` is the one neutral literal, for faint structure (rings, shading, legend keys). `tests/plotting/test_plot_theme.py` scans the sources for them.
86
88
  - **Plot axes in SI units** are labelled with the base unit in brackets (`Frequency [Hz]`, `Time [s]`) and get `_set_eng_formatter` (`plotting/theme.py`): at each draw it picks one SI prefix from the visible ticks and writes it into the label's unit (`Frequency [GHz]`), with plain numbers on the ticks. Pass data in SI units and never pre-scale it or prefix the label by hand; log axes keep a prefix per tick, as no single one fits decades.
87
89
  - **Codes are storable:** `io` stores a code as its class and constructor fields, so those fields are numbers, strings, tuples, host arrays, constellations or other codes.
88
90
  - **Splitting modules:** promote a flat module to a package only when it exceeds about 1000 lines *and* has two or more separable concerns. Never create a `utils/` package or one-function files.
@@ -156,7 +158,7 @@ Dependencies point downward only:
156
158
  - A size names its unit: `num_symbols`, `num_blocks` (codewords of a FEC code), `info_bits` (a code's information length where it is a parameter), `blocks_per_frame`, `num_variables`, `num_segments`. In `coding`, `length` and `n` mean the codeword length in bits and `k` the information length, nothing else.
157
159
  - A seeded part of a factory takes `<part>_rng` (`payload_rng`), with the semantics of `rng`.
158
160
  - `method=` strings name only a numerical flavor of one algorithm (`method="maxlog" | "exact"`); algorithms are objects.
159
- - Output scaling has three names: `normalize` (bool) measures the power and rescales to the library's convention; `correct_power` (bool) applies the exact, known gain of a rate change without measuring; `<thing>_normalization` (a string) chooses how coefficients are scaled (`taps_normalization="unit_energy" | "unity_gain"`).
161
+ - Output scaling has three names: `normalize` (bool) measures the power and rescales to the library's convention; `correct_power` (bool) applies the exact, known gain of a rate change without measuring; `<thing>_normalization` (a string) chooses how coefficients are scaled (`taps_normalization="unit_energy" | "unity_gain"`). A plot never rescales data under these names: `relative` (bool) draws a curve relative to its own peak (unit peak amplitude, 0 dB at the maximum) so curves of any scaling compare, and `annotations` (bool) draws the guides (fits, reference levels and markers): `True` by default where they belong to the result drawn, `False` where they are an optional reading aid (`plot_filter_response`, `plot_psd`). Guides are tagged with a `gid` and drawn once per axis when every overlay shares them (`_guide` in `plotting/theme.py`).
160
162
  - A search window is `search_range`, a `(start, stop)` pair in the axis's unit, or `search_band`, a half-width in Hz around a nominal frequency.
161
163
  - Values are in SI units without a suffix (`linewidth` in Hz, `drift_rate` in rad/s, `taus` in s). A result holding one quantity in two units suffixes the SI one (`lags` in samples, `lag_s`). A conventional non-SI unit goes into the name: `_db`, `_dbm`, `_deg`, `_nm`, `_km`, `_ps_nm_km`, `_ppm`, `_db_hz`. Normalized quantities say so (`normalized_bandwidth`). No second name for one quantity in another unit (no `center_frequency_ghz`); `center_wavelength_nm` is a different, derived quantity.
162
164
 
@@ -263,7 +265,7 @@ Docstrings describe the code as it is; a change in behavior updates them in the
263
265
  - **End-to-end chains** in `tests/test_receiver_chain.py` run several impairments and their receiver, scored against the source bits or AWGN theory, each with one correction left out as a failing baseline.
264
266
  - **Warnings are failures**: a WARNING from the `commkit` logger fails the test unless it is marked `allow_warnings` (it provokes a suspect result on purpose) or asserts the log through `caplog`. A WARNING that reports what the caller asked for is a log-level bug, fixed in the library.
265
267
  - **API changes never change expected values.** A signature change only changes how tests call the code; numerical changes land in their own commit with independent validation.
266
- - **Examples** are Jupyter notebooks in `examples/`, committed without outputs (the `nbstripout` filter, see [Commands](#2-commands)). `tests/test_examples.py` executes each one, so an API change updates the notebooks in the same commit.
268
+ - **Examples** are Jupyter notebooks in `examples/`, committed without outputs or local kernel metadata (the `nbstripout` filter, see [Commands](#2-commands)). `tests/test_examples.py` executes each one, so an API change updates the notebooks in the same commit.
267
269
  - They form a course: one topic per notebook, `NN-lowercase-words.ipynb`, in teaching order (signals and DSP, channel and metrics, coding, receiver algorithms, fiber systems, characterization). Each opens with what it covers and links the notebooks it builds on, and ends with a link to the next. A new notebook takes its place in the order and updates `examples/README.md` and its neighbors' links.
268
270
  - Every claim in the text matches what the cells print: run the notebook and read its numbers before committing. Keep each under about 20 s on the CPU.
269
271
  - Plots of hand-computed arrays go through `to_device(x, "cpu")`, so the notebooks run unchanged on the GPU.
@@ -4,6 +4,75 @@ Notable changes to CommKit, newest first. Performance figures are from the refer
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [3.10.1] - 2026-11-23
8
+
9
+ Bug fixes and alignment cleanups across the library from a full audit: stricter precision and host-sync hygiene, staircase and EXIT-chart correctness fixes, SI tick formatting, lazy `filtering` import, and tightened input validation. No public signatures changed.
10
+
11
+ ### Fixed
12
+
13
+ - **Core, I/O and mapping**:
14
+ - `import commkit` no longer eagerly imports `commkit.filtering` (nor Numba). `Preamble.symbols` and cached `SingleCarrierFrame` payload/pilot arrays are now read-only.
15
+ - `save_npz` and `load_npz` append `.npz` when missing without clobbering earlier dots in the filename (e.g. `run_1.5GHz` saves to `run_1.5GHz.npz`).
16
+ - `optimal_nu` and `Constellation.shaped(entropy=...)` reject entropies at or below the minimum-energy shell limit `log2(m_min)` instead of overflowing and returning the wrong entropy.
17
+ - `compute_llr` and `Constellation.llr` accept Python lists/sequences, reject non-positive or non-finite `noise_var`, and `Constellation._nearest` preserves double precision for non-square constellations and no longer divides by zero on integer inputs.
18
+ - `shape_pulse` handles integer symbol inputs and complex taps without truncation; `to_device` and `db_to_linear` reject foreign array types with `TypeError`; `validate_array` accepts NumPy scalars; `set_log_level` validates level names with `ValueError`.
19
+ - **Front-end DSP (`filtering`, `impairments`, `multirate`, `spectral`, `smoothing`, `timing`, `frequency`)**:
20
+ - `_numba_interpolation.interp` matches the GPU kernel when `p - floor(p)` rounds to `1.0` (e.g. `p = -1e-17`), preventing `NaN` outputs; empty `interpolate_piecewise` inputs now behave identically on CPU and GPU.
21
+ - `fir_filter(..., periodic=True)` folds taps on the data's device (no record-length host allocation on GPU), handles empty inputs and complex taps on real samples cleanly; `iir_filter` rejects empty `(0, 6)` SOS arrays; `fir_taps` validates `btype`.
22
+ - `apply_frequency_offset` accepts GPU `offset` arrays; `correct_frequency_offset` validates channel counts instead of broadcasting 1-D inputs into 2-D; `apply_coherent_detection` avoids catastrophic cancellation when LO RIN dominates; `add_pilot_tone` delivers the requested PSR on real inputs (`sqrt(2)` cosine amplitude); `decimate(..., factor=1)` succeeds with the default method.
23
+ - `correct_timing(mode="zero")` handles scalar shifts `abs(shift) >= N`; `correct_sampling_clock_offset` allows odd `sps` when given a `SamplingClockOffsetEstimate`; conflicting `Signal` properties are now checked in `apply_polarization_mixing` (`drift_rate=0`), `apply_awgn` (`snr_db`/`noise_var`), `estimate_timing` (array template) and `correct_polarization` (estimate/matrix).
24
+ - Fixed the dispersion sign in `apply_fiber_propagation`'s NLSE docstring to match the code (`+ j β₂/2`).
25
+ - **Receiver DSP (`equalization`, `recovery`, `metrics`, `analysis`)**:
26
+ - `cycle_slip` and `cs_block` Numba kernels compile without `fastmath` so running sums are not reassociated; inline cycle-slip repair in `cpr_loop` updates `bps_prev4`/`pll_phi` after a slip.
27
+ - `apply_taps` preserves `complex128` with `samples_prefix` / non-zero `pad_mode` and avoids NEP 50 promotion on MIMO prefixes; `block_lms` stores `phase_trajectory` in `float64`, keeps full BPS window length across short/final blocks and preserves `cs_H` across continuation calls.
28
+ - Adaptive equalizers align `lead = c_tap` and pilot de-boosting cleanly when `N % sps != 0`; `estimate_channel` dispatches on `samples` (not `reference`); `rls` checks weight finiteness before logging decision-power warnings.
29
+ - `Tikhonov` uses PMF-weighted power for shaped constellations and accounts for `C * block_size` in joint-channel mode; `_mth_power_geometry` handles constellations with a point at `0+0j`; `PilotTones` batches coherence host transfers out of the per-tone loop and validates Nyquist/channel bounds; BPS candidate angles are formed in `float64`; metrics `_unit_reference` and `_gain` accumulate in double precision; `dsh_phase` accumulates parallel transport in `float64`; `_dsh_fm_psd` computes real-beat support across all MIMO channels; `_whittle_fit` guards zero PSD bins.
30
+ - **Channel coding and CUDA wrappers**:
31
+ - `StaircaseCode` decoding rejects BCH row miscorrections that flip known-zero positions instead of injecting errors into the frame.
32
+ - `demapper_exit_curve` detects real constellations via `constellation.is_complex` (fixing a 3 dB noise-variance mismatch on complex BPSK); `decoder_exit_curve` handles infinite LLRs without `NaN` or zeroing mutual information.
33
+ - `PolarCode` encoding caches `info_positions` on the device via `_device_tables`.
34
+ - CUDA launch wrappers guard empty/zero grids and array dimensions and raise `ValueError` on invalid specializations; `GraphRunner` captures `end_capture()` failures with context and avoids masking exceptions in `__exit__`.
35
+ - **Plotting**:
36
+ - `_SIAxisFormatter` picks decimal precision from the scaled tick values instead of only the tick step, fixing duplicate/rounded labels on offset ticks (e.g. `[0.5, 1.5, 2.5] MHz`).
37
+ - `plot_frequency_offset_blockwise_result` reduces and decimates on-device (no full sample-rate GPU→CPU copy) and handles multi-channel estimates cleanly.
38
+ - `plot_llr_distribution` moves `bits` to `llrs`'s device; `plot_constellation(..., overlay_reference=True)` validates before opening a figure; `plot_channel_correction` titles the combined response `|W·H(f)|` and validates `nfft >= len(h)`; `plot_dsh_beat_psd` floors zero PSD bins; `plot_eye_diagram`, `plot_frequency_offset_spectrum`, `plot_psd`, `plot_time_domain`, `plot_filter_response`, `plot_pilot_tone_phase_estimate` and `plot_timing_correlation` tighten axis, legend and argument validation.
39
+
40
+ ### Development
41
+
42
+ - CI `kernel-coverage` `--include` list updated to cover all current Numba kernel modules (`coding/_numba_loops.py`, `mapping/_numba_llr.py`, `recovery/_numba_loops.py`, `equalization/_numba_loops.py`, `timing/_numba_loops.py`, `_numba_interpolation.py`, `_numba_frequency.py`; 99 % coverage).
43
+ - Strict mypy enabled for `commkit.timing.*`; `scripts/sanitize.sh` covers `test_linear_codes.py` and `test_gf2.py` and propagates non-zero exit codes; `benchmarks/conftest.py` fails on broken CuPy or missing CuPy under `--device=gpu`.
44
+
45
+ ## [3.10.0] - 2026-11-20
46
+
47
+ Plots for both backgrounds and for comparisons: `apply_default_theme(dark=False)` adds a light theme, and every plot takes its colors, color maps and sizes from the current style, so guides stay visible on white and under a style of your own. `relative=True` draws filter responses, spectra, spectrograms and eyes relative to their peaks, `annotations=True` adds -3 dB, half-symbol-rate, symbol-instant and final-value guides, and `plot_filter_response` draws an FIR filter as `fir_filter` applies it. The group delay of linear-phase filters is exact, so its plot is flat instead of spiking at the stopband zeros. Eight notebooks show the new features.
48
+
49
+ ### Changes that may need code updates
50
+
51
+ - The plot functions take every color, color map and size from `matplotlib.rcParams` instead of fixed values, so their guides and markers stay visible on a white background. Plots drawn without `apply_default_theme()` change look: density images (`plot_constellation`, `plot_eye_diagram`) and `plot_spectrogram` use the style's `image.cmap` (Matplotlib's default is viridis) where they used inferno and viridis; reference lines take the text color instead of white; ideal and reference points take the text color, edged in the background color, instead of lime; annotation colors are cycle colors (`C2`, `C3`, ...). Pass `cmap=` to keep a map. Empty cells of the density images are clear, showing the background. `apply_default_theme()` sets the `afmhot` map, so themed density images and spectrograms change from inferno and viridis to it.
52
+ - `plot_filter_response` draws an FIR filter as `fir_filter` applies it, aligned on tap `(L - 1) // 2`, in every panel: the phase and group delay are measured from that tap (zero group delay for a linear-phase filter of odd length, where they showed the causal delay of `(L - 1) / 2` samples), and the step response and an impulse response of explicit length start at `-(L - 1) // 2`. The impulse panel of an even-length filter moves by half a sample, to where `fir_filter` puts it. Pass `causal=True` for the former phase and group delay. IIR filters are unchanged.
53
+ - `plot_filter_response` counts samples and cycles per sample when neither `sps` nor `sampling_rate` is given (`sps` defaulted to 1 and labelled samples as symbol periods); with `sps` alone, frequency is in symbol rates, matching the time axis in symbol periods.
54
+ - `plot_eye_diagram` scales I and Q of a channel by one factor, the larger of their peaks, so an I/Q imbalance shows; each was scaled to its own peak.
55
+
56
+ ### Added
57
+
58
+ - `apply_default_theme(dark=False)`: dark text on white, with Matplotlib's `tab10` cycle and the `afmhot_r` color map; `dark=True`, the default, keeps the black theme, now with `afmhot`. The two maps are each other's reverse, and the low end of each matches its background, so the sparse edges of a density plot fade into it. A second call switches between the two variants.
59
+ - `plot_filter_response(relative=True)` removes the taps' scale for comparisons: the impulse response relative to its peak magnitude, and the step response and magnitude relative to the peak gain (0 dB at the maximum of `|H(f)|`, which also works for high-pass and band-pass filters). Phase and group delay do not depend on the gain and are unchanged.
60
+ - `plot_filter_response(annotations=True)` draws guides: a dashed line 3 dB below the magnitude's peak and, with `sps`, one at half the symbol rate; markers at the symbol instants of the impulse response, where a Nyquist pulse has its zero crossings; the final value of the step response. `causal=True` draws the causal convolution.
61
+ - `plot_psd(relative=True)` draws each spectrum relative to its peak, and `annotations=True` a line 3 dB below it. The vertical label reads `Power [dB]` for `scaling="spectrum"`.
62
+ - `plot_spectrogram(relative=True)` draws levels relative to the peak, and `dynamic_range_db=` clips the colors that many dB below it, so deep cells do not stretch the scale over the noise.
63
+ - `plot_eye_diagram(relative=False)` draws the samples' own amplitude, to compare levels between eyes.
64
+ - `plot_channel_correction(annotations=True)`, the default, draws the 0 dB target of ZF on the combined response of the direct paths.
65
+ - Reference lines and guides (the training start of equalizer and carrier-phase plots, ±π wrap boundaries, slope and intercept guides, the LLR consistency diagonal, the new guides above) share one style: a light red (a deeper shade on a light background), at full opacity and three quarters of the line width, with a long dash, also where a guide belongs to one curve (the -3 dB line of an unnormalized response, a step's final value). They were white or gray, as faint as the grid.
66
+
67
+ ### Fixed
68
+
69
+ - The group-delay panel of `plot_filter_response` drew a linear-phase FIR filter's constant delay as spikes next to its stopband zeros, with every tick reading the same value: the autoscaled axis spanned only the rounding of the computed delay (about 1e-7 relative where `|H|` is near 1e-6). `filter_response` now returns exactly `(L - 1) / 2` samples for conjugate-symmetric or antisymmetric taps wherever the delay is defined, and the plot's frequency panels span at least 0.1 dB, 0.01 rad and 0.01 samples, so any flat response draws flat.
70
+
71
+ ### Development
72
+
73
+ - Notebook 00 shows the light theme; notebook 02 the 3 dB guide on an RRC spectrum, spectra at different powers relative to their peaks, and a spectrogram's dynamic range; notebook 03 where the window method's cutoff lies (-6 dB) against the -3 dB point, aligned and causal group delay, and what `cutoff` means in each IIR family; notebook 04 the pulses on symbol-rate axes with the symbol-instant and half-symbol-rate guides; notebook 10 an I/Q imbalance in the eye diagram; notebook 16 the ZF target on the combined response; notebook 20 the aligned group delay of the dispersion compensator; notebook 22 eyes at three received powers on one absolute scale.
74
+ - `tests/plotting/test_plot_theme.py` scans the plot modules for literal colors, font sizes, line widths, marker sizes and color maps.
75
+
7
76
  ## [3.9.0] - 2026-11-20
8
77
 
9
78
  Your own Signal-aware functions: `commkit.core.SignalInput`, the helper behind every function that takes an array or a Signal, is public, with one typed method per property or default of the Signal. Value objects with array fields accept device arrays, `estimate_timing` on the GPU is twice as fast, and the rest is structure: shared helpers in place of copies, estimators that build their own result classes, and the words properties and defaults for what a Signal provides. Results are unchanged apart from the fixes below.
@@ -639,7 +708,9 @@ See the [GitHub release](https://github.com/lokgar/commkit/releases/tag/v1.1.0)
639
708
 
640
709
  First release. See the [GitHub release](https://github.com/lokgar/commkit/releases/tag/v1.0.0).
641
710
 
642
- [Unreleased]: https://github.com/lokgar/commkit/compare/v3.9.0...HEAD
711
+ [Unreleased]: https://github.com/lokgar/commkit/compare/v3.10.1...HEAD
712
+ [3.10.1]: https://github.com/lokgar/commkit/compare/v3.10.0...v3.10.1
713
+ [3.10.0]: https://github.com/lokgar/commkit/compare/v3.9.0...v3.10.0
643
714
  [3.9.0]: https://github.com/lokgar/commkit/compare/v3.8.0...v3.9.0
644
715
  [3.8.0]: https://github.com/lokgar/commkit/compare/v3.7.1...v3.8.0
645
716
  [3.7.1]: https://github.com/lokgar/commkit/compare/v3.7.0...v3.7.1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: commkit
3
- Version: 3.9.0
3
+ Version: 3.10.1
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
@@ -98,17 +98,24 @@ long = ck.filtering.fir_taps(sampling_rate=1e6, num_taps=101, cutoff=100e3)
98
98
  response = ck.filtering.filter_response(long, sampling_rate=1e6)
99
99
  print(response.frequencies, response.response, response.group_delay)
100
100
 
101
- ck.plotting.apply_default_theme()
101
+ ck.plotting.apply_default_theme() # dark=False for dark text on white
102
102
  _, ax = ck.plotting.plot_filter_response(
103
- short, sampling_rate=1e6, quantity="magnitude", label="21 taps"
103
+ short, sampling_rate=1e6, quantity="magnitude", label="21 taps",
104
+ relative=True, annotations=True,
104
105
  )
105
106
  ck.plotting.plot_filter_response(
106
107
  long, sampling_rate=1e6, quantity="magnitude", ax=ax,
107
- label="101 taps", legend=True, show=True,
108
+ label="101 taps", legend=True, relative=True, annotations=True, show=True,
108
109
  )
109
110
  ```
110
111
 
111
- See notebook 03 for filter and smoothing comparisons. The multi-panel
112
+ `relative=True` draws each magnitude relative to its peak, 0 dB, so taps of
113
+ any scaling compare, and `annotations=True` adds a dashed line at -3 dB. An FIR
114
+ filter is drawn as `fir_filter` applies it, aligned on its centre tap;
115
+ `causal=True` shows the causal convolution's delay. `plot_psd` and
116
+ `plot_spectrogram` take `relative=True` too, the spectrogram also
117
+ `dynamic_range_db=`. See notebook 03 for filter and smoothing comparisons
118
+ and notebook 04 for pulses on symbol-rate axes (`sps=`). The multi-panel
112
119
  equalizer, timing, recovery and coding diagnostics take `quantity=` in the
113
120
  same way: draw a second result on the returned axis with its own `label=`,
114
121
  and `annotations=False` to leave out repeated fits and guides.
@@ -202,7 +209,8 @@ With [`uv`](https://github.com/astral-sh/uv), use `uv pip install` in place of `
202
209
  git clone https://github.com/lokgar/commkit.git
203
210
  cd commkit
204
211
  uv sync --all-extras
205
- uv run nbstripout --install # once per clone: notebooks are committed without outputs
212
+ uv run nbstripout --install # once per clone: strip outputs and local kernel metadata on commit
213
+ git config filter.nbstripout.extrakeys "metadata.kernelspec metadata.language_info.version"
206
214
 
207
215
  uv run pytest # CPU and GPU tests
208
216
  uv run pytest --device=cpu # what CI runs
@@ -62,17 +62,24 @@ long = ck.filtering.fir_taps(sampling_rate=1e6, num_taps=101, cutoff=100e3)
62
62
  response = ck.filtering.filter_response(long, sampling_rate=1e6)
63
63
  print(response.frequencies, response.response, response.group_delay)
64
64
 
65
- ck.plotting.apply_default_theme()
65
+ ck.plotting.apply_default_theme() # dark=False for dark text on white
66
66
  _, ax = ck.plotting.plot_filter_response(
67
- short, sampling_rate=1e6, quantity="magnitude", label="21 taps"
67
+ short, sampling_rate=1e6, quantity="magnitude", label="21 taps",
68
+ relative=True, annotations=True,
68
69
  )
69
70
  ck.plotting.plot_filter_response(
70
71
  long, sampling_rate=1e6, quantity="magnitude", ax=ax,
71
- label="101 taps", legend=True, show=True,
72
+ label="101 taps", legend=True, relative=True, annotations=True, show=True,
72
73
  )
73
74
  ```
74
75
 
75
- See notebook 03 for filter and smoothing comparisons. The multi-panel
76
+ `relative=True` draws each magnitude relative to its peak, 0 dB, so taps of
77
+ any scaling compare, and `annotations=True` adds a dashed line at -3 dB. An FIR
78
+ filter is drawn as `fir_filter` applies it, aligned on its centre tap;
79
+ `causal=True` shows the causal convolution's delay. `plot_psd` and
80
+ `plot_spectrogram` take `relative=True` too, the spectrogram also
81
+ `dynamic_range_db=`. See notebook 03 for filter and smoothing comparisons
82
+ and notebook 04 for pulses on symbol-rate axes (`sps=`). The multi-panel
76
83
  equalizer, timing, recovery and coding diagnostics take `quantity=` in the
77
84
  same way: draw a second result on the returned axis with its own `label=`,
78
85
  and `annotations=False` to leave out repeated fits and guides.
@@ -166,7 +173,8 @@ With [`uv`](https://github.com/astral-sh/uv), use `uv pip install` in place of `
166
173
  git clone https://github.com/lokgar/commkit.git
167
174
  cd commkit
168
175
  uv sync --all-extras
169
- uv run nbstripout --install # once per clone: notebooks are committed without outputs
176
+ uv run nbstripout --install # once per clone: strip outputs and local kernel metadata on commit
177
+ git config filter.nbstripout.extrakeys "metadata.kernelspec metadata.language_info.version"
170
178
 
171
179
  uv run pytest # CPU and GPU tests
172
180
  uv run pytest --device=cpu # what CI runs
@@ -95,15 +95,18 @@ def _warm_numba_threads():
95
95
 
96
96
  @pytest.fixture
97
97
  def backend_device(request):
98
- """Current backend device name; skips GPU benches without functional CuPy."""
98
+ """Current backend device name; fails on explicit --device=gpu or broken CuPy."""
99
99
  device = request.param
100
+ device_opt = request.config.getoption("--device")
100
101
  if device == "gpu":
101
102
  if not _CUPY_AVAILABLE:
103
+ if device_opt == "gpu":
104
+ pytest.fail("--device=gpu was requested but CuPy is not installed")
102
105
  pytest.skip("CuPy not installed, skipping GPU benchmarks")
103
106
  try:
104
107
  cp.zeros(1)
105
108
  except Exception as e: # pragma: no cover - environment-dependent
106
- pytest.skip(f"CuPy installed but not functional: {e}")
109
+ pytest.fail(f"CuPy is installed but not functional: {e}")
107
110
  yield device
108
111
 
109
112
 
@@ -31,7 +31,7 @@ Matplotlib, change warning filters, or touch the GPU.
31
31
  import importlib as _importlib
32
32
  from typing import Any as _Any
33
33
 
34
- __version__ = "3.9.0"
34
+ __version__ = "3.10.1"
35
35
 
36
36
  from .backend import PrecisionWarning
37
37
  from .core import (
@@ -62,8 +62,9 @@ def validate_array(
62
62
  """
63
63
  # Coerce lists/tuples and scalars to NumPy; arrays from other frameworks
64
64
  # (JAX, PyTorch, ...) are rejected rather than silently copied.
65
- if not (isinstance(v, np.ndarray) or _is_cupy_array(v)):
65
+ if not (isinstance(v, np.ndarray | np.generic) or _is_cupy_array(v)):
66
66
  _reject_foreign_array(v)
67
+ if not (isinstance(v, np.ndarray) or _is_cupy_array(v)):
67
68
  try:
68
69
  v = np.asarray(v)
69
70
  except Exception as err:
@@ -66,17 +66,32 @@ def convolve_periodic(
66
66
  """
67
67
  x, xp, _ = dispatch(samples)
68
68
  n = x.shape[-1]
69
- kernel = circular_kernel(taps, n, center)
70
- real = not (xp.iscomplexobj(x) or np.iscomplexobj(kernel))
71
- # Kernel at the sample precision, so complex64 data is not promoted.
72
- precision = np.dtype(x.real.dtype)
73
- if np.iscomplexobj(kernel):
74
- precision = np.result_type(precision, np.complex64)
75
- kernel = kernel.astype(precision, copy=False)
69
+ h_raw = xp.asarray(taps)
70
+ real = not (xp.iscomplexobj(x) or xp.iscomplexobj(h_raw))
71
+ real_dtype = x.real.dtype if x.real.dtype.kind == "f" else np.dtype(np.float32)
72
+ out_dtype = real_dtype if real else np.result_type(real_dtype, np.complex64)
73
+ if n == 0:
74
+ return xp.empty(x.shape, dtype=out_dtype)
75
+ # Fold taps on the data's device (avoids a record-length H2D copy on GPU).
76
+ precision = (
77
+ np.result_type(real_dtype, np.complex64)
78
+ if xp.iscomplexobj(h_raw)
79
+ else real_dtype
80
+ )
81
+ h = h_raw.astype(precision, copy=False).ravel()
82
+ c = (h.size - 1) // 2 if center is None else center
83
+ kernel = xp.zeros(n, dtype=precision)
84
+ if h.size <= n:
85
+ kernel[: h.size] = h
86
+ if c:
87
+ kernel = xp.roll(kernel, -c)
88
+ else:
89
+ idx = (xp.arange(h.size) - c) % n
90
+ xp.add.at(kernel, idx, h)
76
91
  if real:
77
- h_f = _fft.rfft(xp.asarray(kernel))
92
+ h_f = _fft.rfft(kernel)
78
93
  out = _fft.irfft(_fft.rfft(x, axis=-1) * h_f, n=n, axis=-1)
79
94
  else:
80
- h_f = _fft.fft(xp.asarray(kernel))
95
+ h_f = _fft.fft(kernel)
81
96
  out = _fft.ifft(_fft.fft(x, axis=-1) * h_f, axis=-1)
82
- return out.astype(x.dtype, copy=False)
97
+ return out.astype(out_dtype, copy=False)
@@ -0,0 +1,9 @@
1
+ """Physical constants shared across the package (private).
2
+
3
+ Used by :mod:`commkit._dispersion`, :mod:`commkit.core.signal`,
4
+ :mod:`commkit.filtering.fiber.estimation`, :mod:`commkit.impairments.noise`
5
+ and :mod:`commkit.plotting.spectral`.
6
+ """
7
+
8
+ SPEED_OF_LIGHT = 299_792_458.0 # m/s, exact (SI definition)
9
+ ELEMENTARY_CHARGE = 1.602_176_634e-19 # C, exact (SI definition)
@@ -22,7 +22,10 @@ def _bps_min_d2_factory(mode: str = "table", return_argmin: bool = False) -> Cal
22
22
 
23
23
  from . import compiler
24
24
 
25
- mode_id = {"table": 0, "grid": 1}[mode]
25
+ modes = {"table": 0, "grid": 1}
26
+ if mode not in modes:
27
+ raise ValueError(f"bps_min_d2: mode must be 'table' or 'grid', got {mode!r}.")
28
+ mode_id = modes[mode]
26
29
  if mode_id == 1 and return_argmin:
27
30
  raise ValueError("return_argmin is only supported in TABLE mode")
28
31
  kern = compiler.get_raw_kernel(
@@ -144,7 +147,11 @@ def _cs_block_factory() -> Callable:
144
147
  ``max_block`` symbols.
145
148
  """
146
149
  C = cs_buf_ptr.shape[0] if cs_buf_ptr.ndim == 1 else -1
150
+ if C < 1:
151
+ raise ValueError(f"cs_block: expected at least 1 channel, got C={C}")
147
152
  cs_H = int(cs_H)
153
+ if cs_H < 1:
154
+ raise ValueError(f"cs_block: cs_H must be >= 1, got {cs_H}")
148
155
  compiler.check_arrays(
149
156
  ("cs_buf_y", cs_buf_y, cp.float64, (C, cs_H)),
150
157
  ("cs_buf_ptr", cs_buf_ptr, cp.int64, (C,)),
@@ -219,15 +226,17 @@ def _bps_anchor_factory() -> Callable:
219
226
  """Anchored phase ``(C, n)`` float64 and the new ``(C, K-1)`` history."""
220
227
  compiler.check_arrays(("y", y, cp.complex64, (None, None)))
221
228
  C, n = y.shape
229
+ if C < 1:
230
+ raise ValueError("y must have at least one channel")
222
231
  if n < 1:
223
232
  raise ValueError("y must have at least one training column")
224
- H = hist.shape[-1]
225
233
  compiler.check_arrays(
226
234
  ("d", d, cp.complex64, (C, n)),
227
- ("hist", hist, cp.complex64, (C, H)),
235
+ ("hist", hist, cp.complex64, (C, None)),
228
236
  ("offset4", offset4, cp.float64, (C,)),
229
237
  ("prev4", prev4, cp.float64, (C,)),
230
238
  )
239
+ H = hist.shape[-1]
231
240
  phi = cp.empty((C, n), dtype=cp.float64)
232
241
  hist_out = cp.empty((C, H), dtype=cp.complex64)
233
242
  total = cp.zeros(n if joint else 0, dtype=cp.complex64)
@@ -43,6 +43,11 @@ def _ldpc_layered_factory(sum_product: bool = False) -> Callable:
43
43
  ("layer_ptr", layer_ptr, cp.int32, (None,)),
44
44
  )
45
45
  B, N = app.shape
46
+ if row_ptr.size < 2 or layer_ptr.size < 2:
47
+ raise ValueError(
48
+ f"row_ptr and layer_ptr need at least 2 entries, got "
49
+ f"{row_ptr.size} and {layer_ptr.size}"
50
+ )
46
51
  m, E = row_ptr.size - 1, cols.size
47
52
  iters = cp.zeros(B, dtype=cp.int32)
48
53
  valid = cp.zeros(B, dtype=cp.uint8)
@@ -90,13 +95,22 @@ def _algebraic_correct_factory() -> Callable:
90
95
  binary: bool,
91
96
  ) -> Any:
92
97
  """Correct ``words`` ``(B, n m)`` int8 in place; ``valid`` ``(B,)``."""
98
+ if t < 1:
99
+ raise ValueError(f"t must be >= 1, got {t}")
100
+ if m < 1:
101
+ raise ValueError(f"m must be >= 1, got {m}")
102
+ compiler.check_arrays(
103
+ ("words", words, cp.int8, (None, None)),
104
+ ("locator_logs", locator_logs, cp.int64, (None,)),
105
+ ("exp", exp, cp.int64, (None,)),
106
+ ("log", log, cp.int64, (None,)),
107
+ )
93
108
  B = words.shape[0]
94
109
  n = locator_logs.size
110
+ if log.size < 2:
111
+ raise ValueError(f"log table must have at least 2 entries, got {log.size}")
95
112
  compiler.check_arrays(
96
113
  ("s", s, cp.int64, (B, 2 * t)),
97
- ("exp", exp, cp.int64, (None,)),
98
- ("log", log, cp.int64, (None,)),
99
- ("locator_logs", locator_logs, cp.int64, (None,)),
100
114
  ("words", words, cp.int8, (B, n * m)),
101
115
  )
102
116
  if exp.size != 2 * log.size:
@@ -82,7 +82,8 @@ class GraphRunner:
82
82
  def __exit__(self, *exc: object) -> None:
83
83
  if self._stream is not None:
84
84
  self._stream.__exit__(*exc)
85
- self._stream.synchronize()
85
+ if exc[0] is None:
86
+ self._stream.synchronize()
86
87
 
87
88
  def run(self, key: Hashable, body: Callable[[], Any]) -> Any:
88
89
  """Run ``body()`` for ``key``; ``None`` or ``False`` runs it eagerly.
@@ -100,6 +101,7 @@ class GraphRunner:
100
101
  self._stream.begin_capture()
101
102
  try:
102
103
  out = body()
104
+ graph = self._stream.end_capture()
103
105
  except BaseException as exc:
104
106
  with contextlib.suppress(Exception):
105
107
  self._stream.end_capture()
@@ -107,7 +109,6 @@ class GraphRunner:
107
109
  f"{self.name}: CUDA-graph capture failed; the captured body must "
108
110
  "only launch work on fixed buffers"
109
111
  ) from exc
110
- graph = self._stream.end_capture()
111
112
  self._graphs[key] = graph
112
113
  graph.launch()
113
114
  return out
@@ -60,11 +60,15 @@ def _llr_factory() -> Callable:
60
60
  """LLRs of the ``(n,)`` complex64 symbols ``x``, shape ``(n, k)``."""
61
61
  if not 1 <= k <= LLR_MAX_K:
62
62
  raise ValueError(f"bits per symbol must be in [1, {LLR_MAX_K}], got {k}")
63
+ compiler.check_arrays(
64
+ ("x", x, cp.complex64, (None,)),
65
+ ("points", points, cp.complex64, (None,)),
66
+ )
63
67
  n = x.shape[0]
64
68
  M = points.shape[0]
69
+ if M < 1:
70
+ raise ValueError(f"points must be non-empty, got M={M}")
65
71
  compiler.check_arrays(
66
- ("x", x, cp.complex64, (n,)),
67
- ("points", points, cp.complex64, (M,)),
68
72
  ("log_pmf", log_pmf, cp.float32, (M,)),
69
73
  ("labels", labels, cp.int32, (M,)),
70
74
  )
@@ -106,20 +110,25 @@ def _llr_separable_factory() -> Callable:
106
110
  ``re`` and ``im`` are each ``(levels, log_prior, labels, positions)``
107
111
  of one axis: float32, float32 and int32 ``(L,)``, int32 ``(k_axis,)``.
108
112
  """
113
+ compiler.check_arrays(("x", x, cp.complex64, (None,)))
109
114
  n = x.shape[0]
110
- checks = [("x", x, cp.complex64, (n,))]
115
+ checks: list[tuple[str, Any, Any, tuple[int, ...]]] = []
111
116
  axis_args: list[Any] = []
112
117
  for name, (lev, logp, lab, pos) in (("re", re), ("im", im)):
118
+ compiler.check_arrays(
119
+ (f"{name} levels", lev, cp.float32, (None,)),
120
+ (f"{name} positions", pos, cp.int32, (None,)),
121
+ )
113
122
  L, kb = lev.shape[0], pos.shape[0]
123
+ if L < 1:
124
+ raise ValueError(f"the {name} axis needs at least 1 level, got {L}")
114
125
  if not 1 <= kb <= LLR_MAX_K:
115
126
  raise ValueError(
116
127
  f"bits of the {name} axis must be in [1, {LLR_MAX_K}], got {kb}"
117
128
  )
118
129
  checks += [
119
- (f"{name} levels", lev, cp.float32, (L,)),
120
130
  (f"{name} log prior", logp, cp.float32, (L,)),
121
131
  (f"{name} labels", lab, cp.int32, (L,)),
122
- (f"{name} positions", pos, cp.int32, (kb,)),
123
132
  ]
124
133
  axis_args += [lev, logp, lab, pos, cp.int32(L), cp.int32(kb)]
125
134
  compiler.check_arrays(*checks)
@@ -164,12 +173,15 @@ def _llr_separable_maxlog_factory() -> Callable:
164
173
  one axis: float32 and int32 ``(L,)``, int32 ``(k_axis, L)`` twice,
165
174
  int32 ``(k_axis,)``; ``L >= 2`` equally spaced ascending levels.
166
175
  """
176
+ compiler.check_arrays(("x", x, cp.complex64, (None,)))
167
177
  n = x.shape[0]
168
- checks: list[tuple[str, Any, Any, tuple[int, ...]]] = [
169
- ("x", x, cp.complex64, (n,))
170
- ]
178
+ checks: list[tuple[str, Any, Any, tuple[int, ...]]] = []
171
179
  axis_args: list[Any] = []
172
180
  for name, (lev, lab, lo, hi, pos) in (("re", re), ("im", im)):
181
+ compiler.check_arrays(
182
+ (f"{name} levels", lev, cp.float32, (None,)),
183
+ (f"{name} positions", pos, cp.int32, (None,)),
184
+ )
173
185
  L, kb = lev.shape[0], pos.shape[0]
174
186
  if not 1 <= kb <= LLR_MAX_K:
175
187
  raise ValueError(
@@ -178,11 +190,9 @@ def _llr_separable_maxlog_factory() -> Callable:
178
190
  if L < 2:
179
191
  raise ValueError(f"the {name} axis needs at least 2 levels, got {L}")
180
192
  checks += [
181
- (f"{name} levels", lev, cp.float32, (L,)),
182
193
  (f"{name} labels", lab, cp.int32, (L,)),
183
194
  (f"{name} lo", lo, cp.int32, (kb, L)),
184
195
  (f"{name} hi", hi, cp.int32, (kb, L)),
185
- (f"{name} positions", pos, cp.int32, (kb,)),
186
196
  ]
187
197
  axis_args += [lev, lab, lo, hi, pos, cp.int32(L), cp.int32(kb)]
188
198
  compiler.check_arrays(*checks)
@@ -18,7 +18,12 @@ def _selftest_scale_factory(dtype: str = "float32") -> Callable:
18
18
 
19
19
  from . import compiler
20
20
 
21
- ctype = {"float32": "float", "float64": "double"}[dtype]
21
+ ctypes = {"float32": "float", "float64": "double"}
22
+ if dtype not in ctypes:
23
+ raise ValueError(
24
+ f"selftest_scale: dtype must be 'float32' or 'float64', got {dtype!r}."
25
+ )
26
+ ctype = ctypes[dtype]
22
27
  kern = compiler.get_raw_kernel("selftest", f"selftest_scale<{ctype}>")
23
28
  np_dtype = cp.dtype(dtype)
24
29
  block = 256
@@ -29,6 +34,8 @@ def _selftest_scale_factory(dtype: str = "float32") -> Callable:
29
34
  compiler.check_arrays(("x", x, np_dtype, (None,) * x.ndim))
30
35
  y = cp.empty_like(x)
31
36
  n = x.size
37
+ if n == 0:
38
+ return y
32
39
  grid = (n + block - 1) // block
33
40
  kern((grid,), (block,), (x, y, np_dtype.type(alpha), cp.int64(n)))
34
41
  return y
@@ -70,12 +70,14 @@ def interpolate_piecewise(x: ArrayType, knots: np.ndarray, sub: int) -> ArrayTyp
70
70
  interval, ``sub · (K - 1)`` per channel. Returns ``(C, sub · (K - 1))``."""
71
71
  x, xp, _ = dispatch(x)
72
72
  knots = np.ascontiguousarray(knots, dtype=np.float64)
73
+ n_out = sub * (knots.shape[1] - 1)
74
+ if n_out == 0 or x.shape[0] == 0:
75
+ return xp.empty((x.shape[0], n_out), dtype=x.dtype)
73
76
  if xp is np:
74
- out = np.empty((x.shape[0], sub * (knots.shape[1] - 1)), dtype=x.dtype)
75
- if out.size:
76
- kernels = _numba()
77
- re, im, write_imag = _parts(out)
78
- kernels.interp_piecewise(x, knots, sub, HALF_WIDTH, re, im, write_imag)
77
+ out = np.empty((x.shape[0], n_out), dtype=x.dtype)
78
+ kernels = _numba()
79
+ re, im, write_imag = _parts(out)
80
+ kernels.interp_piecewise(x, knots, sub, HALF_WIDTH, re, im, write_imag)
79
81
  return out
80
82
  launch = get_kernel("interpolate", half=HALF_WIDTH)
81
83
  return launch(xp.ascontiguousarray(x), knots=xp.asarray(knots), sub=sub)
@@ -26,6 +26,9 @@ def interp(x, c, p, half):
26
26
  n = x.shape[1]
27
27
  i = int(np.floor(p))
28
28
  mu = p - i
29
+ if mu >= 1.0:
30
+ i += 1
31
+ mu = 0.0
29
32
  if mu == 0.0:
30
33
  if 0 <= i < n:
31
34
  return float(x[c, i].real), float(x[c, i].imag)
@@ -53,6 +53,11 @@ def ols_apply(
53
53
  """
54
54
  _, xp, _ = dispatch(samples)
55
55
  num_ch, N = samples.shape
56
+ if N == 0:
57
+ out_dtype = (
58
+ samples.dtype if real else xp.result_type(samples.dtype, xp.complex64)
59
+ )
60
+ return xp.empty((num_ch, 0), dtype=out_dtype)
56
61
  discard = N_fft // 4 if guard is None else guard # symmetric guard
57
62
  B = N_fft - 2 * discard # hop
58
63
  num_blocks = (N + B - 1) // B