commkit 3.10.2__tar.gz → 3.11.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.
Files changed (352) hide show
  1. {commkit-3.10.2 → commkit-3.11.0}/AGENTS.md +13 -7
  2. {commkit-3.10.2 → commkit-3.11.0}/CHANGELOG.md +61 -1
  3. {commkit-3.10.2 → commkit-3.11.0}/PKG-INFO +4 -4
  4. {commkit-3.10.2 → commkit-3.11.0}/README.md +3 -3
  5. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/bench_fiber.py +1 -1
  6. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/bench_sync_misc.py +1 -1
  7. {commkit-3.10.2 → commkit-3.11.0}/commkit/__init__.py +1 -1
  8. {commkit-3.10.2 → commkit-3.11.0}/commkit/_array.py +51 -0
  9. {commkit-3.10.2 → commkit-3.11.0}/commkit/_constants.py +1 -1
  10. {commkit-3.10.2 → commkit-3.11.0}/commkit/_fiber.py +4 -11
  11. {commkit-3.10.2 → commkit-3.11.0}/commkit/_sequences.py +3 -2
  12. commkit-3.11.0/commkit/_value.py +122 -0
  13. {commkit-3.10.2 → commkit-3.11.0}/commkit/analysis/allan.py +27 -24
  14. {commkit-3.10.2 → commkit-3.11.0}/commkit/analysis/drift.py +22 -17
  15. {commkit-3.10.2 → commkit-3.11.0}/commkit/analysis/fm_noise.py +2 -1
  16. {commkit-3.10.2 → commkit-3.11.0}/commkit/analysis/linewidth/dsh.py +5 -9
  17. {commkit-3.10.2 → commkit-3.11.0}/commkit/analysis/linewidth/phase.py +12 -10
  18. {commkit-3.10.2 → commkit-3.11.0}/commkit/analysis/linewidth/result.py +6 -3
  19. {commkit-3.10.2 → commkit-3.11.0}/commkit/analysis/trajectory.py +11 -3
  20. {commkit-3.10.2 → commkit-3.11.0}/commkit/backend.py +9 -2
  21. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/algebraic.py +8 -19
  22. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/base.py +2 -42
  23. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/convolutional.py +5 -10
  24. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/crc.py +4 -10
  25. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/exit.py +7 -31
  26. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/interleaving.py +3 -5
  27. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/ldpc.py +7 -18
  28. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/linear.py +5 -9
  29. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/performance.py +5 -10
  30. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/polar.py +6 -11
  31. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/product.py +3 -4
  32. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/ratematch.py +2 -5
  33. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/shaping.py +3 -7
  34. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/turbo.py +3 -4
  35. {commkit-3.10.2 → commkit-3.11.0}/commkit/core/_signal_input.py +4 -0
  36. {commkit-3.10.2 → commkit-3.11.0}/commkit/core/frame.py +19 -21
  37. {commkit-3.10.2 → commkit-3.11.0}/commkit/core/generation.py +22 -18
  38. {commkit-3.10.2 → commkit-3.11.0}/commkit/core/preamble.py +5 -17
  39. {commkit-3.10.2 → commkit-3.11.0}/commkit/core/signal.py +7 -28
  40. commkit-3.11.0/commkit/equalization/__init__.py +119 -0
  41. {commkit-3.10.2 → commkit-3.11.0}/commkit/equalization/_block/_engine.py +2 -5
  42. {commkit-3.10.2/commkit/filtering → commkit-3.11.0/commkit/equalization}/fiber/__init__.py +2 -2
  43. {commkit-3.10.2/commkit/filtering → commkit-3.11.0/commkit/equalization}/fiber/compensation.py +14 -25
  44. {commkit-3.10.2/commkit/filtering → commkit-3.11.0/commkit/equalization}/fiber/estimation.py +10 -11
  45. commkit-3.11.0/commkit/equalization/iq.py +308 -0
  46. {commkit-3.10.2 → commkit-3.11.0}/commkit/equalization/linear.py +184 -25
  47. {commkit-3.10.2 → commkit-3.11.0}/commkit/equalization/pilots.py +2 -1
  48. {commkit-3.10.2 → commkit-3.11.0}/commkit/equalization/polarization.py +6 -5
  49. {commkit-3.10.2 → commkit-3.11.0}/commkit/equalization/result.py +3 -2
  50. {commkit-3.10.2 → commkit-3.11.0}/commkit/filtering/__init__.py +5 -35
  51. {commkit-3.10.2 → commkit-3.11.0}/commkit/filtering/pulses.py +3 -9
  52. {commkit-3.10.2 → commkit-3.11.0}/commkit/filtering/response.py +8 -13
  53. {commkit-3.10.2 → commkit-3.11.0}/commkit/frequency.py +50 -39
  54. {commkit-3.10.2 → commkit-3.11.0}/commkit/impairments/__init__.py +7 -13
  55. {commkit-3.10.2 → commkit-3.11.0}/commkit/impairments/fiber_channel.py +8 -10
  56. {commkit-3.10.2 → commkit-3.11.0}/commkit/impairments/frontend.py +17 -316
  57. {commkit-3.10.2 → commkit-3.11.0}/commkit/impairments/noise.py +18 -38
  58. {commkit-3.10.2 → commkit-3.11.0}/commkit/impairments/source.py +5 -11
  59. {commkit-3.10.2 → commkit-3.11.0}/commkit/logger.py +8 -1
  60. {commkit-3.10.2 → commkit-3.11.0}/commkit/mapping/_demap.py +3 -9
  61. {commkit-3.10.2 → commkit-3.11.0}/commkit/mapping/constellation.py +10 -9
  62. {commkit-3.10.2 → commkit-3.11.0}/commkit/mapping/gray.py +3 -4
  63. {commkit-3.10.2 → commkit-3.11.0}/commkit/mapping/shaping.py +4 -4
  64. {commkit-3.10.2 → commkit-3.11.0}/commkit/math.py +33 -1
  65. {commkit-3.10.2 → commkit-3.11.0}/commkit/metrics/__init__.py +8 -6
  66. {commkit-3.10.2 → commkit-3.11.0}/commkit/metrics/_common.py +4 -40
  67. {commkit-3.10.2 → commkit-3.11.0}/commkit/metrics/error_rates.py +2 -5
  68. {commkit-3.10.2 → commkit-3.11.0}/commkit/metrics/quality.py +66 -41
  69. {commkit-3.10.2 → commkit-3.11.0}/commkit/multirate.py +3 -7
  70. {commkit-3.10.2 → commkit-3.11.0}/commkit/plotting/__init__.py +10 -26
  71. {commkit-3.10.2 → commkit-3.11.0}/commkit/plotting/analysis.py +131 -53
  72. {commkit-3.10.2 → commkit-3.11.0}/commkit/plotting/filter_response.py +5 -8
  73. commkit-3.11.0/commkit/plotting/frequency.py +398 -0
  74. {commkit-3.10.2 → commkit-3.11.0}/commkit/plotting/recovery.py +227 -161
  75. {commkit-3.10.2 → commkit-3.11.0}/commkit/plotting/spectral.py +34 -7
  76. {commkit-3.10.2 → commkit-3.11.0}/commkit/plotting/timing.py +5 -5
  77. {commkit-3.10.2 → commkit-3.11.0}/commkit/recovery/bps.py +3 -4
  78. {commkit-3.10.2 → commkit-3.11.0}/commkit/recovery/corrections.py +42 -71
  79. {commkit-3.10.2 → commkit-3.11.0}/commkit/recovery/estimates.py +9 -1
  80. {commkit-3.10.2 → commkit-3.11.0}/commkit/recovery/pilots.py +18 -19
  81. {commkit-3.10.2 → commkit-3.11.0}/commkit/recovery/tikhonov.py +3 -8
  82. {commkit-3.10.2 → commkit-3.11.0}/commkit/smoothing.py +2 -8
  83. {commkit-3.10.2 → commkit-3.11.0}/commkit/spectral.py +15 -10
  84. {commkit-3.10.2 → commkit-3.11.0}/commkit/timing/clock_recovery.py +5 -4
  85. {commkit-3.10.2 → commkit-3.11.0}/commkit/timing/synchronization.py +10 -17
  86. {commkit-3.10.2 → commkit-3.11.0}/examples/10-front-end-impairments.ipynb +5 -5
  87. {commkit-3.10.2 → commkit-3.11.0}/examples/11-frame-synchronization-and-timing.ipynb +2 -2
  88. {commkit-3.10.2 → commkit-3.11.0}/examples/13-frequency-offset-estimation.ipynb +9 -11
  89. {commkit-3.10.2 → commkit-3.11.0}/examples/15-pilot-aided-carrier-recovery.ipynb +2 -5
  90. {commkit-3.10.2 → commkit-3.11.0}/examples/20-chromatic-dispersion.ipynb +14 -12
  91. {commkit-3.10.2 → commkit-3.11.0}/examples/21-nonlinear-fiber-and-backpropagation.ipynb +2 -2
  92. {commkit-3.10.2 → commkit-3.11.0}/examples/24-coherent-transceiver-end-to-end.ipynb +6 -5
  93. {commkit-3.10.2 → commkit-3.11.0}/examples/25-carrier-phase-characterization.ipynb +2 -3
  94. {commkit-3.10.2 → commkit-3.11.0}/examples/26-laser-linewidth-self-heterodyne.ipynb +2 -2
  95. {commkit-3.10.2 → commkit-3.11.0}/examples/27-laser-linewidth-short-delay-and-flicker.ipynb +1 -1
  96. {commkit-3.10.2 → commkit-3.11.0}/examples/28-laser-linewidth-self-homodyne-iq.ipynb +4 -9
  97. {commkit-3.10.2 → commkit-3.11.0}/examples/29-measurement-template-self-heterodyne.ipynb +1 -1
  98. {commkit-3.10.2 → commkit-3.11.0}/examples/30-measurement-template-self-homodyne-iq.ipynb +2 -2
  99. {commkit-3.10.2 → commkit-3.11.0}/pyproject.toml +2 -2
  100. {commkit-3.10.2 → commkit-3.11.0}/tests/analysis/test_allan.py +18 -1
  101. {commkit-3.10.2 → commkit-3.11.0}/tests/analysis/test_drift.py +1 -1
  102. {commkit-3.10.2 → commkit-3.11.0}/tests/analysis/test_linewidth.py +11 -8
  103. {commkit-3.10.2 → commkit-3.11.0}/tests/analysis/test_trajectory.py +3 -0
  104. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_coding_base.py +10 -10
  105. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_ldpc.py +1 -1
  106. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_performance.py +1 -1
  107. commkit-3.11.0/tests/common/transfers.py +150 -0
  108. {commkit-3.10.2 → commkit-3.11.0}/tests/core/test_generation.py +1 -1
  109. {commkit-3.10.2 → commkit-3.11.0}/tests/core/test_signal.py +1 -1
  110. {commkit-3.10.2 → commkit-3.11.0}/tests/equalization/test_blind.py +5 -3
  111. commkit-3.11.0/tests/equalization/test_fiber_compensation.py +572 -0
  112. commkit-3.11.0/tests/equalization/test_fiber_estimation.py +228 -0
  113. commkit-3.11.0/tests/equalization/test_iq.py +230 -0
  114. {commkit-3.10.2 → commkit-3.11.0}/tests/equalization/test_linear.py +105 -0
  115. {commkit-3.10.2 → commkit-3.11.0}/tests/equalization/test_polarization.py +1 -1
  116. {commkit-3.10.2 → commkit-3.11.0}/tests/impairments/test_fiber_channel_linear.py +2 -2
  117. {commkit-3.10.2 → commkit-3.11.0}/tests/impairments/test_frontend.py +3 -206
  118. {commkit-3.10.2 → commkit-3.11.0}/tests/impairments/test_noise.py +7 -2
  119. {commkit-3.10.2 → commkit-3.11.0}/tests/mapping/test_constellation.py +5 -3
  120. {commkit-3.10.2 → commkit-3.11.0}/tests/mapping/test_gray.py +2 -2
  121. {commkit-3.10.2 → commkit-3.11.0}/tests/metrics/test_error_rates.py +1 -1
  122. {commkit-3.10.2 → commkit-3.11.0}/tests/metrics/test_quality.py +24 -19
  123. {commkit-3.10.2 → commkit-3.11.0}/tests/plotting/test_plot_analysis.py +21 -27
  124. {commkit-3.10.2 → commkit-3.11.0}/tests/plotting/test_plot_filter_response.py +2 -2
  125. commkit-3.11.0/tests/plotting/test_plot_frequency.py +153 -0
  126. {commkit-3.10.2 → commkit-3.11.0}/tests/plotting/test_plot_recovery.py +47 -44
  127. {commkit-3.10.2 → commkit-3.11.0}/tests/plotting/test_plot_spectral.py +38 -0
  128. {commkit-3.10.2 → commkit-3.11.0}/tests/plotting/test_plot_theme.py +76 -74
  129. {commkit-3.10.2 → commkit-3.11.0}/tests/plotting/test_plot_timing.py +5 -5
  130. {commkit-3.10.2 → commkit-3.11.0}/tests/plugins/transfer_trace.py +22 -103
  131. {commkit-3.10.2 → commkit-3.11.0}/tests/recovery/test_corrections.py +2 -2
  132. {commkit-3.10.2 → commkit-3.11.0}/tests/test_api_contracts.py +73 -28
  133. {commkit-3.10.2 → commkit-3.11.0}/tests/test_array.py +42 -0
  134. {commkit-3.10.2 → commkit-3.11.0}/tests/test_dispersion.py +1 -1
  135. {commkit-3.10.2 → commkit-3.11.0}/tests/test_fiber.py +2 -2
  136. {commkit-3.10.2 → commkit-3.11.0}/tests/test_filter_response.py +3 -2
  137. commkit-3.11.0/tests/test_filtering.py +596 -0
  138. {commkit-3.10.2 → commkit-3.11.0}/tests/test_frequency.py +3 -1
  139. {commkit-3.10.2 → commkit-3.11.0}/tests/test_multirate.py +4 -2
  140. {commkit-3.10.2 → commkit-3.11.0}/tests/test_pulse_shaping.py +4 -1
  141. {commkit-3.10.2 → commkit-3.11.0}/tests/test_receiver_chain.py +1 -1
  142. {commkit-3.10.2 → commkit-3.11.0}/tests/test_spectral.py +8 -3
  143. commkit-3.11.0/tests/test_value.py +80 -0
  144. {commkit-3.10.2 → commkit-3.11.0}/tests/timing/test_synchronization.py +1 -1
  145. {commkit-3.10.2 → commkit-3.11.0}/uv.lock +1 -1
  146. commkit-3.10.2/commkit/equalization/__init__.py +0 -58
  147. commkit-3.10.2/commkit/plotting/frequency.py +0 -384
  148. commkit-3.10.2/tests/plotting/test_plot_frequency.py +0 -115
  149. commkit-3.10.2/tests/test_filtering.py +0 -1363
  150. {commkit-3.10.2 → commkit-3.11.0}/.gitattributes +0 -0
  151. {commkit-3.10.2 → commkit-3.11.0}/.github/icon.svg +0 -0
  152. {commkit-3.10.2 → commkit-3.11.0}/.github/logo.svg +0 -0
  153. {commkit-3.10.2 → commkit-3.11.0}/.github/workflows/ci.yml +0 -0
  154. {commkit-3.10.2 → commkit-3.11.0}/.github/workflows/publish.yml +0 -0
  155. {commkit-3.10.2 → commkit-3.11.0}/.gitignore +0 -0
  156. {commkit-3.10.2 → commkit-3.11.0}/.python-version +0 -0
  157. {commkit-3.10.2 → commkit-3.11.0}/LICENSE +0 -0
  158. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0002_pre_v2.json +0 -0
  159. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0003_v2_0.json +0 -0
  160. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0004_fiber_dbp.json +0 -0
  161. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0005_gpu_decoder_path.json +0 -0
  162. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0006_perf_cleanup.json +0 -0
  163. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0007_v3_0.json +0 -0
  164. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/baselines/Linux-CPython-3.14-64bit/0008_v3_1.json +0 -0
  165. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/bench_block_blind.py +0 -0
  166. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/bench_block_lms.py +0 -0
  167. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/bench_bps.py +0 -0
  168. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/bench_coding.py +0 -0
  169. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/bench_equalizers.py +0 -0
  170. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/bench_filters.py +0 -0
  171. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/bench_gardner.py +0 -0
  172. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/bench_import.py +0 -0
  173. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/bench_llr.py +0 -0
  174. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/bench_mapping.py +0 -0
  175. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/bench_signal_pipeline.py +0 -0
  176. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/benchutils.py +0 -0
  177. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/conftest.py +0 -0
  178. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/record_baseline.py +0 -0
  179. {commkit-3.10.2 → commkit-3.11.0}/benchmarks/workloads.py +0 -0
  180. {commkit-3.10.2 → commkit-3.11.0}/commkit/_bits.py +0 -0
  181. {commkit-3.10.2 → commkit-3.11.0}/commkit/_circular.py +0 -0
  182. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/__init__.py +0 -0
  183. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/bps.py +0 -0
  184. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/coding.py +0 -0
  185. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/compiler.py +0 -0
  186. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/filters.py +0 -0
  187. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/graphs.py +0 -0
  188. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/llr.py +0 -0
  189. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/selftest.py +0 -0
  190. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/src/algebraic.cu +0 -0
  191. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/src/bps_anchor.cu +0 -0
  192. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/src/bps_min_d2.cu +0 -0
  193. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/src/cs_block.cu +0 -0
  194. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/src/iir.cu +0 -0
  195. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/src/interpolate.cu +0 -0
  196. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/src/ldpc.cu +0 -0
  197. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/src/llr.cu +0 -0
  198. {commkit-3.10.2 → commkit-3.11.0}/commkit/_cuda/src/selftest.cu +0 -0
  199. {commkit-3.10.2 → commkit-3.11.0}/commkit/_dispersion.py +0 -0
  200. {commkit-3.10.2 → commkit-3.11.0}/commkit/_fft.py +0 -0
  201. {commkit-3.10.2 → commkit-3.11.0}/commkit/_interpolation.py +0 -0
  202. {commkit-3.10.2 → commkit-3.11.0}/commkit/_numba_frequency.py +0 -0
  203. {commkit-3.10.2 → commkit-3.11.0}/commkit/_numba_interpolation.py +0 -0
  204. {commkit-3.10.2 → commkit-3.11.0}/commkit/_overlap_save.py +0 -0
  205. {commkit-3.10.2 → commkit-3.11.0}/commkit/_peaks.py +0 -0
  206. {commkit-3.10.2 → commkit-3.11.0}/commkit/_random.py +0 -0
  207. {commkit-3.10.2 → commkit-3.11.0}/commkit/analysis/__init__.py +0 -0
  208. {commkit-3.10.2 → commkit-3.11.0}/commkit/analysis/_common.py +0 -0
  209. {commkit-3.10.2 → commkit-3.11.0}/commkit/analysis/interferometry.py +0 -0
  210. {commkit-3.10.2 → commkit-3.11.0}/commkit/analysis/linewidth/__init__.py +0 -0
  211. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/__init__.py +0 -0
  212. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/_galois.py +0 -0
  213. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/_gf2.py +0 -0
  214. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/_ldpc_tables.py +0 -0
  215. {commkit-3.10.2 → commkit-3.11.0}/commkit/coding/_numba_loops.py +0 -0
  216. {commkit-3.10.2 → commkit-3.11.0}/commkit/core/__init__.py +0 -0
  217. {commkit-3.10.2 → commkit-3.11.0}/commkit/equalization/_block/__init__.py +0 -0
  218. {commkit-3.10.2 → commkit-3.11.0}/commkit/equalization/_block/_blind.py +0 -0
  219. {commkit-3.10.2 → commkit-3.11.0}/commkit/equalization/_block/_dd.py +0 -0
  220. {commkit-3.10.2 → commkit-3.11.0}/commkit/equalization/_common.py +0 -0
  221. {commkit-3.10.2 → commkit-3.11.0}/commkit/equalization/_numba_loops.py +0 -0
  222. {commkit-3.10.2 → commkit-3.11.0}/commkit/equalization/_sequential/__init__.py +0 -0
  223. {commkit-3.10.2 → commkit-3.11.0}/commkit/equalization/_sequential/_blind.py +0 -0
  224. {commkit-3.10.2 → commkit-3.11.0}/commkit/equalization/_sequential/_dd.py +0 -0
  225. {commkit-3.10.2 → commkit-3.11.0}/commkit/equalization/_sequential/_setup.py +0 -0
  226. {commkit-3.10.2 → commkit-3.11.0}/commkit/filtering/linear.py +0 -0
  227. {commkit-3.10.2 → commkit-3.11.0}/commkit/io.py +0 -0
  228. {commkit-3.10.2 → commkit-3.11.0}/commkit/mapping/__init__.py +0 -0
  229. {commkit-3.10.2 → commkit-3.11.0}/commkit/mapping/_lattice.py +0 -0
  230. {commkit-3.10.2 → commkit-3.11.0}/commkit/mapping/_numba_llr.py +0 -0
  231. {commkit-3.10.2 → commkit-3.11.0}/commkit/mapping/bits.py +0 -0
  232. {commkit-3.10.2 → commkit-3.11.0}/commkit/mapping/llr.py +0 -0
  233. {commkit-3.10.2 → commkit-3.11.0}/commkit/metrics/awgn.py +0 -0
  234. {commkit-3.10.2 → commkit-3.11.0}/commkit/metrics/information.py +0 -0
  235. {commkit-3.10.2 → commkit-3.11.0}/commkit/plotting/coding.py +0 -0
  236. {commkit-3.10.2 → commkit-3.11.0}/commkit/plotting/constellation.py +0 -0
  237. {commkit-3.10.2 → commkit-3.11.0}/commkit/plotting/equalizer.py +0 -0
  238. {commkit-3.10.2 → commkit-3.11.0}/commkit/plotting/eye.py +0 -0
  239. {commkit-3.10.2 → commkit-3.11.0}/commkit/plotting/theme.py +0 -0
  240. {commkit-3.10.2 → commkit-3.11.0}/commkit/plotting/waveform.py +0 -0
  241. {commkit-3.10.2 → commkit-3.11.0}/commkit/py.typed +0 -0
  242. {commkit-3.10.2 → commkit-3.11.0}/commkit/recovery/__init__.py +0 -0
  243. {commkit-3.10.2 → commkit-3.11.0}/commkit/recovery/_common.py +0 -0
  244. {commkit-3.10.2 → commkit-3.11.0}/commkit/recovery/_numba_loops.py +0 -0
  245. {commkit-3.10.2 → commkit-3.11.0}/commkit/recovery/carrier_phase.py +0 -0
  246. {commkit-3.10.2 → commkit-3.11.0}/commkit/recovery/pll.py +0 -0
  247. {commkit-3.10.2 → commkit-3.11.0}/commkit/recovery/viterbi_viterbi.py +0 -0
  248. {commkit-3.10.2 → commkit-3.11.0}/commkit/timing/__init__.py +0 -0
  249. {commkit-3.10.2 → commkit-3.11.0}/commkit/timing/_numba_loops.py +0 -0
  250. {commkit-3.10.2 → commkit-3.11.0}/examples/00-getting-started.ipynb +0 -0
  251. {commkit-3.10.2 → commkit-3.11.0}/examples/01-constellations-and-bit-mapping.ipynb +0 -0
  252. {commkit-3.10.2 → commkit-3.11.0}/examples/02-spectral-analysis.ipynb +0 -0
  253. {commkit-3.10.2 → commkit-3.11.0}/examples/03-digital-filters.ipynb +0 -0
  254. {commkit-3.10.2 → commkit-3.11.0}/examples/04-pulse-shaping-and-matched-filtering.ipynb +0 -0
  255. {commkit-3.10.2 → commkit-3.11.0}/examples/05-multirate-and-resampling.ipynb +0 -0
  256. {commkit-3.10.2 → commkit-3.11.0}/examples/06-awgn-and-performance-metrics.ipynb +0 -0
  257. {commkit-3.10.2 → commkit-3.11.0}/examples/07-channel-coding.ipynb +0 -0
  258. {commkit-3.10.2 → commkit-3.11.0}/examples/08-probabilistic-shaping-and-coded-modulation.ipynb +0 -0
  259. {commkit-3.10.2 → commkit-3.11.0}/examples/09-laser-phase-noise.ipynb +0 -0
  260. {commkit-3.10.2 → commkit-3.11.0}/examples/12-sampling-clock-recovery.ipynb +0 -0
  261. {commkit-3.10.2 → commkit-3.11.0}/examples/14-blind-carrier-phase-recovery.ipynb +0 -0
  262. {commkit-3.10.2 → commkit-3.11.0}/examples/16-linear-channel-equalization.ipynb +0 -0
  263. {commkit-3.10.2 → commkit-3.11.0}/examples/17-adaptive-equalization.ipynb +0 -0
  264. {commkit-3.10.2 → commkit-3.11.0}/examples/18-blind-equalization.ipynb +0 -0
  265. {commkit-3.10.2 → commkit-3.11.0}/examples/19-polarization-multiplexing.ipynb +0 -0
  266. {commkit-3.10.2 → commkit-3.11.0}/examples/22-direct-and-self-coherent-detection.ipynb +0 -0
  267. {commkit-3.10.2 → commkit-3.11.0}/examples/23-fec-in-optical-standards.ipynb +0 -0
  268. {commkit-3.10.2 → commkit-3.11.0}/examples/README.md +0 -0
  269. {commkit-3.10.2 → commkit-3.11.0}/scripts/sanitize.sh +0 -0
  270. {commkit-3.10.2 → commkit-3.11.0}/tests/analysis/test_fm_noise.py +0 -0
  271. {commkit-3.10.2 → commkit-3.11.0}/tests/analysis/test_interferometry.py +0 -0
  272. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_algebraic.py +0 -0
  273. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_convolutional.py +0 -0
  274. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_crc.py +0 -0
  275. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_exit.py +0 -0
  276. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_gf2.py +0 -0
  277. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_interleaving.py +0 -0
  278. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_ldpc_exit.py +0 -0
  279. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_ldpc_kernel.py +0 -0
  280. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_ldpc_tables.py +0 -0
  281. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_linear_codes.py +0 -0
  282. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_polar.py +0 -0
  283. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_product.py +0 -0
  284. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_ratematch.py +0 -0
  285. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_shaping.py +0 -0
  286. {commkit-3.10.2 → commkit-3.11.0}/tests/coding/test_turbo.py +0 -0
  287. {commkit-3.10.2 → commkit-3.11.0}/tests/common/__init__.py +0 -0
  288. {commkit-3.10.2 → commkit-3.11.0}/tests/common/coding.py +0 -0
  289. {commkit-3.10.2 → commkit-3.11.0}/tests/common/conversions.py +0 -0
  290. {commkit-3.10.2 → commkit-3.11.0}/tests/common/kernel_utils.py +0 -0
  291. {commkit-3.10.2 → commkit-3.11.0}/tests/common/memory.py +0 -0
  292. {commkit-3.10.2 → commkit-3.11.0}/tests/common/metrics.py +0 -0
  293. {commkit-3.10.2 → commkit-3.11.0}/tests/common/periodic.py +0 -0
  294. {commkit-3.10.2 → commkit-3.11.0}/tests/common/reference_impl.py +0 -0
  295. {commkit-3.10.2 → commkit-3.11.0}/tests/common/scoring.py +0 -0
  296. {commkit-3.10.2 → commkit-3.11.0}/tests/common/signals.py +0 -0
  297. {commkit-3.10.2 → commkit-3.11.0}/tests/common/theory.py +0 -0
  298. {commkit-3.10.2 → commkit-3.11.0}/tests/common/user_block.py +0 -0
  299. {commkit-3.10.2 → commkit-3.11.0}/tests/conftest.py +0 -0
  300. {commkit-3.10.2 → commkit-3.11.0}/tests/core/test_frame.py +0 -0
  301. {commkit-3.10.2 → commkit-3.11.0}/tests/core/test_preamble.py +0 -0
  302. {commkit-3.10.2 → commkit-3.11.0}/tests/core/test_psqam.py +0 -0
  303. {commkit-3.10.2 → commkit-3.11.0}/tests/core/test_signal_input.py +0 -0
  304. {commkit-3.10.2 → commkit-3.11.0}/tests/core/test_signal_mimo.py +0 -0
  305. {commkit-3.10.2 → commkit-3.11.0}/tests/equalization/test_block.py +0 -0
  306. {commkit-3.10.2 → commkit-3.11.0}/tests/equalization/test_bps_kernel.py +0 -0
  307. {commkit-3.10.2 → commkit-3.11.0}/tests/equalization/test_cold_start.py +0 -0
  308. {commkit-3.10.2 → commkit-3.11.0}/tests/equalization/test_cpr.py +0 -0
  309. {commkit-3.10.2 → commkit-3.11.0}/tests/equalization/test_cs_kernel.py +0 -0
  310. {commkit-3.10.2 → commkit-3.11.0}/tests/equalization/test_equalizer_oracles.py +0 -0
  311. {commkit-3.10.2 → commkit-3.11.0}/tests/equalization/test_mimo.py +0 -0
  312. {commkit-3.10.2 → commkit-3.11.0}/tests/equalization/test_result.py +0 -0
  313. {commkit-3.10.2 → commkit-3.11.0}/tests/equalization/test_sequential.py +0 -0
  314. {commkit-3.10.2 → commkit-3.11.0}/tests/equalization/test_state.py +0 -0
  315. {commkit-3.10.2 → commkit-3.11.0}/tests/equalization/test_winit.py +0 -0
  316. {commkit-3.10.2 → commkit-3.11.0}/tests/impairments/test_fiber_channel_nonlinear.py +0 -0
  317. {commkit-3.10.2 → commkit-3.11.0}/tests/impairments/test_source.py +0 -0
  318. {commkit-3.10.2 → commkit-3.11.0}/tests/mapping/test_bits.py +0 -0
  319. {commkit-3.10.2 → commkit-3.11.0}/tests/mapping/test_lattice.py +0 -0
  320. {commkit-3.10.2 → commkit-3.11.0}/tests/mapping/test_llr.py +0 -0
  321. {commkit-3.10.2 → commkit-3.11.0}/tests/metrics/test_awgn.py +0 -0
  322. {commkit-3.10.2 → commkit-3.11.0}/tests/metrics/test_common.py +0 -0
  323. {commkit-3.10.2 → commkit-3.11.0}/tests/metrics/test_information.py +0 -0
  324. {commkit-3.10.2 → commkit-3.11.0}/tests/plotting/test_plot_coding.py +0 -0
  325. {commkit-3.10.2 → commkit-3.11.0}/tests/plotting/test_plot_constellation.py +0 -0
  326. {commkit-3.10.2 → commkit-3.11.0}/tests/plotting/test_plot_equalizer.py +0 -0
  327. {commkit-3.10.2 → commkit-3.11.0}/tests/plotting/test_plot_eye.py +0 -0
  328. {commkit-3.10.2 → commkit-3.11.0}/tests/plotting/test_plot_waveform.py +0 -0
  329. {commkit-3.10.2 → commkit-3.11.0}/tests/plugins/__init__.py +0 -0
  330. {commkit-3.10.2 → commkit-3.11.0}/tests/plugins/precision_trace.py +0 -0
  331. {commkit-3.10.2 → commkit-3.11.0}/tests/recovery/test_bps.py +0 -0
  332. {commkit-3.10.2 → commkit-3.11.0}/tests/recovery/test_carrier_phase.py +0 -0
  333. {commkit-3.10.2 → commkit-3.11.0}/tests/recovery/test_joint.py +0 -0
  334. {commkit-3.10.2 → commkit-3.11.0}/tests/recovery/test_pilots.py +0 -0
  335. {commkit-3.10.2 → commkit-3.11.0}/tests/recovery/test_pll.py +0 -0
  336. {commkit-3.10.2 → commkit-3.11.0}/tests/recovery/test_recovery_oracles.py +0 -0
  337. {commkit-3.10.2 → commkit-3.11.0}/tests/recovery/test_tikhonov.py +0 -0
  338. {commkit-3.10.2 → commkit-3.11.0}/tests/recovery/test_viterbi_viterbi.py +0 -0
  339. {commkit-3.10.2 → commkit-3.11.0}/tests/test_backend.py +0 -0
  340. {commkit-3.10.2 → commkit-3.11.0}/tests/test_bit_packing.py +0 -0
  341. {commkit-3.10.2 → commkit-3.11.0}/tests/test_cuda_infra.py +0 -0
  342. {commkit-3.10.2 → commkit-3.11.0}/tests/test_examples.py +0 -0
  343. {commkit-3.10.2 → commkit-3.11.0}/tests/test_import_hygiene.py +0 -0
  344. {commkit-3.10.2 → commkit-3.11.0}/tests/test_interpolation.py +0 -0
  345. {commkit-3.10.2 → commkit-3.11.0}/tests/test_io.py +0 -0
  346. {commkit-3.10.2 → commkit-3.11.0}/tests/test_logger.py +0 -0
  347. {commkit-3.10.2 → commkit-3.11.0}/tests/test_math.py +0 -0
  348. {commkit-3.10.2 → commkit-3.11.0}/tests/test_peaks.py +0 -0
  349. {commkit-3.10.2 → commkit-3.11.0}/tests/test_signal_pipeline.py +0 -0
  350. {commkit-3.10.2 → commkit-3.11.0}/tests/test_smoothing.py +0 -0
  351. {commkit-3.10.2 → commkit-3.11.0}/tests/test_working_memory.py +0 -0
  352. {commkit-3.10.2 → commkit-3.11.0}/tests/timing/test_clock_recovery.py +0 -0
@@ -77,13 +77,17 @@ Dependencies point downward only:
77
77
  | Layer | Modules | May import |
78
78
  | --- | --- | --- |
79
79
  | Infrastructure | `backend`, `logger`, `_cuda` | NumPy, CuPy |
80
- | Array and math helpers | `_array` (shape and validation), `_bits` (bit rows and integers), `_peaks` (sub-bin peak fits), `math` (power, normalization, dB, linear trend) | infrastructure |
80
+ | Array and math helpers | `_array` (shape and validation), `_value` (equality of the frozen dataclasses), `_bits` (bit rows and integers), `_peaks` (sub-bin peak fits), `math` (power, normalization, dB, linear trend, data-aided gain) | infrastructure |
81
81
  | Value objects | `mapping.Constellation`, pulse classes, `recovery` CPR configs, `coding` (code objects with their `encode` / `decode`; array-only, never imports `core`) | layers above |
82
82
  | Core | `core` (`Signal`, frames, generation), `io` | layers above |
83
83
  | DSP | `mapping`, `filtering`, `multirate`, `spectral`, `smoothing`, `impairments`, `timing`, `frequency`, `recovery`, `equalization`, `metrics`, `analysis` | layers above, and lower DSP modules |
84
84
  | Presentation | `plotting` | everything; **nothing imports plotting** (no `debug_plot`: plot functions consume results or recompute through public functions) |
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.
86
+ - **Placement by role.** Where a name lives follows from what it does, so a user finds the inverse of `apply_x` without searching:
87
+ - `impairments` holds the forward models only: every `apply_*` that degrades a signal, `generate_phase_noise` and the model objects (`Fiber`). No `estimate_*` or `correct_*`.
88
+ - Each quantity's `estimate_*` / `correct_*` / `resolve_*`, its method objects and its estimate classes live together in the receiver module of that quantity: `timing` (frame timing, sampling clock), `frequency` (carrier frequency offset), `recovery` (carrier phase, cycle slips, phase and channel ambiguities), `equalization` (the inverse of a channel or front-end response: linear channel, gain, polarization, chromatic dispersion, fiber propagation (DBP), IQ imbalance, and the adaptive equalizers).
89
+ - `filtering` holds generic filters (pulses, FIR and IIR design, responses, application), nothing tied to one impairment; `smoothing` display and estimation smoothers only; `spectral` spectra and spectral operations (`shift_frequency`, `add_pilot_tone`); `analysis` laser and phase characterization; `metrics` is the reporting layer.
90
+ - An operation both ends use stays with its domain, not in `impairments`: `timing.apply_delay`, `equalization.apply_taps`.
87
91
  - **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.
88
92
  - **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.
89
93
  - **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.
@@ -116,6 +120,7 @@ Dependencies point downward only:
116
120
  - **Properties versus defaults.** Properties of the samples (`sampling_rate`, `symbol_rate`, hence `sps`, `center_frequency`, `domain` and the optical carrier's wavelength) come from the Signal; a conflicting argument raises `ValueError`, an equal one is fine, and a missing property for array input raises. Defaults (decision `constellation`, `pulse`, the reference symbols) come from the Signal too; an explicit argument wins. Neither case warns. `SignalInput` resolves each through a method named after it (`inp.sampling_rate(sampling_rate)`, `inp.integer_sps(sps)`, `inp.constellation(constellation, required=True, purpose=" for its decisions")`, `inp.reference_symbols(reference)`); called without an argument, it returns the Signal's value. A function never reads these from `inp.signal`.
117
121
  - Integer-SPS algorithms validate with `inp.integer_sps()` (`require_integer_sps()` where there is no Signal input) before any cast; never truncate 1.5 SPS to 1.
118
122
  - **Shapes:** SISO is `(N,)`, MIMO `(C, N)`. Use `as_2d`, `restore_1d`, `broadcast_channels` and `require_channels`; never hand-roll the promote/squeeze idiom.
123
+ - **Equality.** Every frozen dataclass compares by value. One with arrays derives from a base in `_value`: `_Value` for descriptions and host-only results whose arrays are read-only host copies (codes, interleavers, algorithm objects with arrays, frame maps, EXIT and error-rate curves), equal and hashable by shape, dtype and bytes (`Constellation` keeps an equivalent of its own that ignores its `family` label and treats -0.0 as 0.0); `_Record` for data and results whose arrays may be on the GPU (`Signal`, `Reference`, every estimate and result), equal field by field (NaN equal to NaN, arrays on different devices unequal, no transfer) and unhashable. Never `eq=False` alone: identity equality makes two equal estimates compare unequal.
119
124
  - **Value objects are frozen dataclasses** with read-only NumPy arrays:
120
125
  - `Constellation`: `.qam(M)`, `.psk(M)`, `.pam(M, unipolar=)`, or arbitrary `points`; `.shaped(nu=|entropy=)` keeps unit power. Functions accept the object only, never strings.
121
126
  - Pulses: `RRC`, `RC`, `Gaussian`, `Rect`, `SmoothRect`. A raw taps array is accepted wherever a pulse is.
@@ -135,7 +140,7 @@ Dependencies point downward only:
135
140
  - **Metrics** (`evm`, `snr`, `noise_variance`, `ber`, `fer`, `ser`, `gmi`, `ngmi`, `mi`) and **analysis summaries** (`estimate_linewidth`, `allan_deviation`, the `frequency_drift` statistics, which fit plot-sized reductions) return host values: a `float` for 1-D input, `np.ndarray (C,)` for 2-D. Sample-rate outputs (trajectories, PSDs, `dsh_phase`) stay on the input device.
136
141
  - Metrics **raise** on empty selections, never return `None` or `0.0` for "nothing measured", and never silently align, rotate or permute against the reference.
137
142
  - **More than one value** is a frozen dataclass with named fields. No dicts, no tuples longer than two.
138
- - **Diagnostics that depend on the method** go in a subclass: the estimate class holds the fields every method gives (`value`, ...), and each method or family of methods returns a subclass with its own fields, none of them `None`. A subclass that one method returns is named after it (`MthPowerEstimate`, `PilotTonesEstimate`); one that several return is named after what they share (`BlockPhaseEstimate` for BPS, Viterbi-Viterbi and Tikhonov, `DispersionScanEstimate`). A method without fields of its own returns its family's class or the base. The verbs and plots take the base class.
143
+ - **Diagnostics that depend on the method** go in a subclass: the estimate class holds the fields every method gives (`value`, ...), and each method or family of methods returns a subclass with its own fields, none of them `None`. A subclass that one method returns is named after it (`MthPowerEstimate`, `PilotTonesEstimate`); one that several return is named after what they share (`BlockPhaseEstimate` for BPS, Viterbi-Viterbi and Tikhonov, `DispersionScanEstimate`). A method without fields of its own returns its family's class or the base. The verbs and plots take the base class: one `plot_<quantity>_estimate` per quantity draws the diagnostics of the estimate's class (`plot_carrier_phase_estimate`, `plot_frequency_offset_estimate`, `plot_linewidth_estimate`, `plot_timing_estimate`). An estimate carries what its plot needs (the sampling rate, the record length, the method), so nothing is passed twice.
139
144
  - **Equalizers** return `EqualizerResult`: `y_hat` is always an array, `signal` the 1-SPS Signal for Signal input, `state` the continuation state (`state=result.state`), and diagnostics as data.
140
145
 
141
146
  ### Naming
@@ -148,13 +153,13 @@ Dependencies point downward only:
148
153
  | `resolve_*` | pick among discrete candidates (π/2 rotation, channel permutation); nothing else |
149
154
  | `generate` | synthesis from parameters, takes `rng` |
150
155
  | `encode` / `decode` | information bits to a code's transmitted bits, and LLRs (or hard decisions) back to a `DecodeResult`; dispatched on the code object, the decoder chosen by a `method` object |
151
- | `plot_*` | every public plotting function (only `apply_default_theme` is exempt) |
156
+ | `plot_*` | every public plotting function (only `apply_default_theme` is exempt); `plot_<quantity>_estimate` for an estimate |
152
157
 
153
158
  - The algorithm is chosen by an object, never by the function name or a string: `estimate_carrier_phase(y, BPS())`, not `recover_carrier_phase_bps(y)`. The verb function dispatches on the object's type through a private table in its module. There is no `recover_*` or `compensate_*`.
154
159
  - Computations use plain nouns (`allan_deviation`).
155
160
  - **Glossary**, one name each:
156
161
  - `num_taps`, `step_size`, `sps`, `constellation`, `pulse`, `rng`, `num_symbols`, `num_channels` (never streams), `sampling_rate`, `symbol_rate`, `noise_var`, `nfft`, `regularization`, `max_iterations`.
157
- - Noise has three names, each with one meaning: `noise_var` is the variance E|n|² of the noise in the samples a function receives (measured by `noise_variance`); `snr_db` a power ratio in those samples (measured by `snr`); `esn0_db` the channel's textbook Es/N0, independent of the dtype (real samples carry the in-phase half of the noise, `N0/2`). A function taking `noise_var` for a demapping model (`compute_llr`, `mi`, `gmi`, `ngmi`) uses the likelihood of complex or real noise after the samples' dtype and also accepts `esn0_db`, so users never convert by hand.
162
+ - Noise has three names, each with one meaning: `noise_var` is the variance E|n|² of the noise in the samples a function receives (measured by `noise_variance` on the scale of a unit-power reference, where `correct_gain` puts the symbols); `snr_db` a power ratio in those samples (measured by `snr`); `esn0_db` the channel's textbook Es/N0, independent of the dtype (real samples carry the in-phase half of the noise, `N0/2`). A function taking `noise_var` for a demapping model (`compute_llr`, `mi`, `gmi`, `ngmi`) uses the likelihood of complex or real noise after the samples' dtype and also accepts `esn0_db`, so users never convert by hand.
158
163
  - 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.
159
164
  - A seeded part of a factory takes `<part>_rng` (`payload_rng`), with the semantics of `rng`.
160
165
  - `method=` strings name only a numerical flavor of one algorithm (`method="maxlog" | "exact"`); algorithms are objects.
@@ -176,7 +181,7 @@ Docstrings describe the code as it is; a change in behavior updates them in the
176
181
 
177
182
  ### Errors and logging
178
183
 
179
- - Wrong input raises, with a message naming the argument.
184
+ - Wrong input raises, with a message naming the argument: a wrong type (a float or `bool` for an integer, a string for a number) `TypeError`, a wrong value `ValueError`. Scalars are checked with `_array.require_int` and `require_finite`, never a hand-written `isinstance` chain; empty data raises naming the argument, before any library call fails on it.
180
185
  - **No fallbacks for a broken environment.** Code never catches a failure of CuPy, a CUDA kernel (compile, load, launch), a graph capture or another dependency to run a different implementation; the failure raises to the caller. A path kept "just in case" is code no test or user runs. (Dispatch on the *input* is allowed; see the kernel policy in [Performance](#6-performance).)
181
186
  - `logger` is for diagnostics only. Per-channel logging that needs a device-to-host transfer is wrapped in `if logger.isEnabledFor(logging.INFO):`.
182
187
  - **Levels:** `DEBUG` traces what a call is about to do (method, parameters, sizes). `INFO` is one summary per public call of what a user would print next (the values found, the parameters applied, an equalizer's exit MSE, a decoder's failed checks, what `generate` or `io` produced). `WARNING` flags a returned but suspect result (no convergence, a fit outside its valid range, near-zero power, a code with 4-cycles). Value objects and pure helpers do not log.
@@ -230,7 +235,8 @@ Docstrings describe the code as it is; a change in behavior updates them in the
230
235
  - Every FFT goes through `commkit._fft` (`fft`, `ifft`, `rfft`, `irfft`), never `np.fft` / `xp.fft` (frequency grids excepted): on the CPU it runs multi-threaded `scipy.fft` and keeps complex64 in single precision (NumPy 2 computes it in double); on the GPU it is `cupy.fft`.
231
236
  - Pass whole records to compiled code. No Python loops over symbols or small blocks, except inside a CUDA graph.
232
237
  - Repeated GPU work with fixed buffers (the block equalizers' blocks, the fiber solver's spans) is replayed from CUDA graphs through `_cuda.graphs.GraphRunner`: warm once, capture on the second run, replay; a failed capture raises. Per-replay offsets come from a device index the graph advances, so the host launches one graph per block. Its stream is reused per device and thread, because CuPy's pool caches freed blocks per stream.
233
- - **Audit with `tests/plugins/transfer_trace.py`** after touching a GPU path; the contract registry cannot see a silent round trip through the host. The plugin records every sample-rate host-device copy during a `--device=gpu` run and fails on a site missing from its documented list (the sequential recursions' round trip, equalizer continuation state, the reporting layer, explicit device moves, the transmitted payload, host values such as reference symbols or SciPy windows moved to the device). A new site is fixed or added to the list with its reason.
238
+ - **Plots reduce on the device** to what is drawn: traces to their min/max envelope (`max_points`), images to a fixed grid (density and eye grids, at most `max_rows` spectrogram rows), so the copy to the host is bounded by the drawing whatever the record length. `TestDeviceReduction` in `tests/plotting/test_plot_theme.py` draws each plot at two record lengths and bounds its largest copy.
239
+ - **Audit with `tests/plugins/transfer_trace.py`** after touching a GPU path; the contract registry cannot see a silent round trip through the host. The plugin records every sample-rate host-device copy during a `--device=gpu` run (traced at CuPy's level by `tests/common/transfers.py`, which tests use to bound one call's copies) and fails on a site missing from its documented list (the sequential recursions' round trip, equalizer continuation state, the reporting layer, explicit device moves, the transmitted payload, host values such as reference symbols or SciPy windows moved to the device). A new site is fixed or added to the list with its reason.
234
240
 
235
241
  **Kernel policy:**
236
242
 
@@ -4,10 +4,69 @@ Notable changes to CommKit, newest first. Performance figures are from the refer
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [3.11.0] - 2026-11-24
8
+
9
+ Placement by role, one plot per estimate, value equality for every result, a public data-aided gain, and the review fixes of 3.10.1 and 3.10.2.
10
+
11
+ ### Changes that may need code updates
12
+
13
+ - **Estimation and correction live with their quantity.** `impairments` now holds forward models only and `filtering` generic filters; the compensations moved to `commkit.equalization`, the inverses of channel and front-end responses. Change the import; the old names are gone.
14
+ - From `commkit.filtering`: `estimate_chromatic_dispersion`, `correct_chromatic_dispersion`, `dispersion_compensation_taps`, `correct_fiber_propagation`, `ClockToneScan`, `FourthMomentScan`, `QuadraticPhaseFit`, `ChromaticDispersionEstimate`, `DispersionScanEstimate`, `QuadraticPhaseFitEstimate`.
15
+ - From `commkit.impairments`: `estimate_iq_imbalance`, `correct_iq_imbalance`, `Lowdin`, `GramSchmidt`, `IQImbalanceEstimate`.
16
+ - **One plot per estimated quantity**, drawing the diagnostics of the estimate's class. The estimate carries the sampling rate, record length and method its axes need, so these arguments are gone:
17
+
18
+ | Before | Now |
19
+ | --- | --- |
20
+ | `plot_pilot_phase_estimate(est, sampling_rate=)` (PilotInterpolation) | `plot_carrier_phase_estimate(est)` |
21
+ | `plot_pilot_tone_phase_estimate(est, x, method=, sampling_rate=)` | `plot_carrier_phase_estimate(est, x)` |
22
+ | `plot_pilot_tones_phase_estimate(est)` | `plot_carrier_phase_estimate(est)` |
23
+ | `plot_carrier_phase_trajectory(est)` with an estimate | `plot_carrier_phase_estimate(est)`; the trajectory plot takes arrays |
24
+ | `plot_frequency_offset_spectrum(est, search_range=)` | `plot_frequency_offset_estimate(est)` |
25
+ | `plot_mm_autocorrelation(est, sampling_rate=)` | `plot_frequency_offset_estimate(est)` |
26
+ | `plot_frequency_offset_blockwise_result(est, num_samples=, sampling_rate=)` | `plot_frequency_offset_estimate(est)` |
27
+ | `plot_pilot_phase_estimate(est, sampling_rate=)` (PilotSlope) | `plot_frequency_offset_estimate(est)` |
28
+ | `plot_frequency_noise_psd`, `plot_increment_variance`, `plot_dsh_beat_psd` | `plot_linewidth_estimate(est)` |
29
+ | `plot_timing_correlation(est)` | `plot_timing_estimate(est)` |
30
+ | `plot_frequency_drift(drift, sampling_rate=)` | `plot_frequency_drift(drift)` |
31
+
32
+ - **New fields on estimates.** `FrequencyOffsetEstimate` and its subclasses hold `sampling_rate`, `BlockwiseFrequencyEstimate` also `num_samples`, `PilotToneEstimate` and `PilotTonesEstimate` `method` and `sampling_rate`, `FrequencyDrift` `sampling_rate`. Code building them by hand passes these.
33
+ - **Results compare by value.** `Signal`, `Reference` and every estimate and result compare field by field (arrays by value, NaN equal to NaN, arrays on different devices unequal) and are unhashable; 3.10.2 compared them by identity. Algorithm objects with arrays (`PilotSlope`, `PilotInterpolation`, `ConstantPhase`, `IncrementSubtract`, `QuadraticPhaseFit`, `EqualizerPilots`) and `FrameStructure` now compare and hash by value instead of identity.
34
+ - **`TypeError` for a wrong type.** An integer argument given a float (`2.0` included) or a `bool`, or a number given a string, raises `TypeError` instead of `ValueError`, across the library. `upsample` and the other rate changers no longer accept an integral float factor. The rest of the scalar checks (block sizes, test phases, `nfft`, bandwidths, responsivities, `noise_var`, ...) follow the same rule, and a non-string `device` or `set_log_level` level raises `TypeError` too.
35
+ - **`plot_spectrogram` averages long spectrograms** in groups of segments on the device, to at most `max_rows=1000` rows (in power; every k-th row for the phase modes). Pass `max_rows=0` to draw every segment.
36
+
37
+ ### Added
38
+
39
+ - `commkit.equalization.estimate_gain`, `correct_gain` and `GainEstimate`: the data-aided amplitude gain the metrics divide by, which puts symbols on the reference's scale before `compute_llr`. On 16-QAM at Es/N0 = 0 dB, LLRs of power-normalized symbols with `noise_variance` reach a GMI of 0.764 bit; after `correct_gain`, 0.866 bit, within 6e-4 bit of LLRs with the true gain and noise variance.
40
+
41
+ ### Fixed
42
+
43
+ - `evm`, `snr` and `noise_variance` measure the error relative to the reference's power whatever the scale of either input; the 1e-3 tolerance around unit reference power, and the normalization behind it, are gone.
44
+ - `carrier_phase_trajectory(channel_pairing="swap")` raises for a single channel instead of acting as `"identity"`.
45
+ - `allan_deviation` raises when none of `taus` fits the record instead of returning an empty result; its documentation no longer promises NaN for averaging times that do not fit (they are left out).
46
+ - `spectrogram` names `samples` when they are empty, instead of SciPy's message.
47
+ - `plot_frequency_offset_estimate` draws every channel of a blockwise estimate, on a time axis in seconds; it drew the first channel only, against the sample index.
48
+ - `cross_correlate` checks `mode` before computing the correlation.
49
+ - `plot_spectrogram` copies at most `max_rows` x `nfft` values to the host; it copied about 1.14 times the record.
50
+ - Raises sections added or completed for `correct_channel`, `welch_psd`, `spectrogram`, `smooth_phase`, `allan_deviation`, `frequency_drift` and `carrier_phase_trajectory`; `smooth_phase`'s messages name the function.
51
+ - Duplicated validation replaced by two helpers, so integer and finite-number checks agree everywhere (`edge_trim` accepted `2.0` in the linewidth methods and rejected it in `frequency_drift`; `BPS(block_size=2.5)`, `Tikhonov(block_size=2.5)` and `estimate_channel(nfft=64.5)` passed validation).
52
+
53
+ ### Development
54
+
55
+ - `tests/common/transfers.py` traces host-device copies at CuPy's level; the transfer audit and `TestDeviceReduction` share it. `TestDeviceReduction` no longer patches `to_device` (which hid its copies from the audit and missed direct `.get()` calls) and draws every plot at two record lengths, so a copy that grows with the record fails.
56
+ - The contract registry checks that each row's data-argument count equals the signature's positional parameters.
57
+ - Fiber and IQ compensation tests moved to `tests/equalization/test_fiber_compensation.py`, `test_fiber_estimation.py` and `test_iq.py`; the quality-metric test checks scale invariance against AWGN theory instead of the removed tolerance branch; the gain tests score against the true gain and oracle LLRs, each with a failing baseline.
58
+
7
59
  ## [3.10.2] - 2026-11-24
8
60
 
9
61
  Follow-up polish and fixes from the alignment review: unified value-object host copying and equality semantics, persistent BPS anchor state across sequential equalizer resumes, upfront composite-code validation, GPU IIR support beyond 16 sections, consistent real-input optical transforms, zero-copy frequency-offset framing, unbiased quality metrics, and stricter contract/theme/transfer audits. No public signatures changed.
10
62
 
63
+ ### Changes that may need code updates
64
+
65
+ - `welch_psd` raises `ValueError` for empty samples instead of returning an empty PSD.
66
+ - `smooth_phase` raises when `process_variance` is given together with `linewidth` or `sampling_rate`; it ignored them before.
67
+ - An invalid type in `Signal`, `Reference` or `SingleCarrierFrame` raises `TypeError` instead of `ValueError`.
68
+ - Estimates and results no longer raise on `==`; they compare by identity (replaced by value equality in the next release).
69
+
11
70
  ### Fixed
12
71
 
13
72
  - **Core, backend and value objects**:
@@ -738,7 +797,8 @@ See the [GitHub release](https://github.com/lokgar/commkit/releases/tag/v1.1.0)
738
797
 
739
798
  First release. See the [GitHub release](https://github.com/lokgar/commkit/releases/tag/v1.0.0).
740
799
 
741
- [Unreleased]: https://github.com/lokgar/commkit/compare/v3.10.2...HEAD
800
+ [Unreleased]: https://github.com/lokgar/commkit/compare/v3.11.0...HEAD
801
+ [3.11.0]: https://github.com/lokgar/commkit/compare/v3.10.2...v3.11.0
742
802
  [3.10.2]: https://github.com/lokgar/commkit/compare/v3.10.1...v3.10.2
743
803
  [3.10.1]: https://github.com/lokgar/commkit/compare/v3.10.0...v3.10.1
744
804
  [3.10.0]: https://github.com/lokgar/commkit/compare/v3.9.0...v3.10.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: commkit
3
- Version: 3.10.2
3
+ Version: 3.11.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
@@ -149,14 +149,14 @@ CommKit never picks a device for you: data stays where you put it, and each func
149
149
  | --- | --- |
150
150
  | [`commkit.core`](https://github.com/lokgar/commkit/tree/main/commkit/core) | `Signal`, `Reference`, `generate` (uniform, shaped through a distribution matcher, or coded with `code=`), `SingleCarrierFrame` and `Preamble` (pilots, guard intervals, MIMO channels), `extract_payload`. |
151
151
  | [`commkit.mapping`](https://github.com/lokgar/commkit/tree/main/commkit/mapping) | `Constellation` (QAM, PSK, PAM, arbitrary points; Gray labels; probabilistic shaping with `.shaped()`), bit mapping, hard demapping, max-log and exact LLRs. |
152
- | [`commkit.filtering`](https://github.com/lokgar/commkit/tree/main/commkit/filtering) | Pulses (`RRC`, `RC`, `Gaussian`, `Rect`, `SmoothRect`), FIR and IIR design (Butterworth, Chebyshev I/II, elliptic, Bessel), numerical filter responses, `fir_filter` (direct, FFT or overlap-save convolution after the sizes), `iir_filter`, `matched_filter`, chromatic-dispersion estimation and compensation and digital backpropagation (`correct_fiber_propagation`). |
152
+ | [`commkit.filtering`](https://github.com/lokgar/commkit/tree/main/commkit/filtering) | Pulses (`RRC`, `RC`, `Gaussian`, `Rect`, `SmoothRect`), FIR and IIR design (Butterworth, Chebyshev I/II, elliptic, Bessel), numerical filter responses, `fir_filter` (direct, FFT or overlap-save convolution after the sizes), `iir_filter`, `matched_filter`. Generic filters only: the compensation of an impairment is in `equalization`. |
153
153
  | [`commkit.multirate`](https://github.com/lokgar/commkit/blob/main/commkit/multirate.py) | `resample` (fractional), `decimate`, `upsample`, `decimate_to_symbol_rate`. |
154
154
  | [`commkit.spectral`](https://github.com/lokgar/commkit/blob/main/commkit/spectral.py) | Welch PSD, spectrograms, frequency shifting, pilot tones. |
155
- | [`commkit.impairments`](https://github.com/lokgar/commkit/tree/main/commkit/impairments) | AWGN at an Es/N0 (measured as energy per symbol) or of an absolute variance, ASE at an OSNR (`apply_ase`), phase noise, carrier frequency offset, IQ imbalance (blind estimate; Löwdin and Gram-Schmidt correction), sampling-clock offset and jitter, ADC quantization, photodetection, coherent detection and intensity noise, chromatic dispersion, PMD and polarization mixing, and nonlinear fiber propagation over amplified spans (split-step Kerr effect with dispersion, loss, PMD and ASE) of a `Fiber`. |
155
+ | [`commkit.impairments`](https://github.com/lokgar/commkit/tree/main/commkit/impairments) | AWGN at an Es/N0 (measured as energy per symbol) or of an absolute variance, ASE at an OSNR (`apply_ase`), phase noise, carrier frequency offset, IQ imbalance, sampling-clock offset and jitter, ADC quantization, photodetection, coherent detection and intensity noise, chromatic dispersion, PMD and polarization mixing, and nonlinear fiber propagation over amplified spans (split-step Kerr effect with dispersion, loss, PMD and ASE) of a `Fiber`. Forward models only: each effect's estimation and correction is in the receiver module of its quantity. |
156
156
  | [`commkit.timing`](https://github.com/lokgar/commkit/tree/main/commkit/timing) | Barker and Zadoff-Chu sequences, `estimate_timing` / `correct_timing`, `cross_correlate`, `peak_offset` and `apply_delay`, sampling-clock recovery (`estimate_sampling_clock_offset` / `correct_sampling_clock_offset` with `Gardner`). |
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
- | [`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); pilot-aided CMA and RDE from a frame's pilots (`EqualizerPilots`); polarization demultiplexing on pilot tones (`estimate_polarization(x, PolarizationTones(...))` / `correct_polarization`). |
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
160
  | [`commkit.metrics`](https://github.com/lokgar/commkit/blob/main/commkit/metrics.py) | `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. |
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. |
@@ -113,14 +113,14 @@ CommKit never picks a device for you: data stays where you put it, and each func
113
113
  | --- | --- |
114
114
  | [`commkit.core`](https://github.com/lokgar/commkit/tree/main/commkit/core) | `Signal`, `Reference`, `generate` (uniform, shaped through a distribution matcher, or coded with `code=`), `SingleCarrierFrame` and `Preamble` (pilots, guard intervals, MIMO channels), `extract_payload`. |
115
115
  | [`commkit.mapping`](https://github.com/lokgar/commkit/tree/main/commkit/mapping) | `Constellation` (QAM, PSK, PAM, arbitrary points; Gray labels; probabilistic shaping with `.shaped()`), bit mapping, hard demapping, max-log and exact LLRs. |
116
- | [`commkit.filtering`](https://github.com/lokgar/commkit/tree/main/commkit/filtering) | Pulses (`RRC`, `RC`, `Gaussian`, `Rect`, `SmoothRect`), FIR and IIR design (Butterworth, Chebyshev I/II, elliptic, Bessel), numerical filter responses, `fir_filter` (direct, FFT or overlap-save convolution after the sizes), `iir_filter`, `matched_filter`, chromatic-dispersion estimation and compensation and digital backpropagation (`correct_fiber_propagation`). |
116
+ | [`commkit.filtering`](https://github.com/lokgar/commkit/tree/main/commkit/filtering) | Pulses (`RRC`, `RC`, `Gaussian`, `Rect`, `SmoothRect`), FIR and IIR design (Butterworth, Chebyshev I/II, elliptic, Bessel), numerical filter responses, `fir_filter` (direct, FFT or overlap-save convolution after the sizes), `iir_filter`, `matched_filter`. Generic filters only: the compensation of an impairment is in `equalization`. |
117
117
  | [`commkit.multirate`](https://github.com/lokgar/commkit/blob/main/commkit/multirate.py) | `resample` (fractional), `decimate`, `upsample`, `decimate_to_symbol_rate`. |
118
118
  | [`commkit.spectral`](https://github.com/lokgar/commkit/blob/main/commkit/spectral.py) | Welch PSD, spectrograms, frequency shifting, pilot tones. |
119
- | [`commkit.impairments`](https://github.com/lokgar/commkit/tree/main/commkit/impairments) | AWGN at an Es/N0 (measured as energy per symbol) or of an absolute variance, ASE at an OSNR (`apply_ase`), phase noise, carrier frequency offset, IQ imbalance (blind estimate; Löwdin and Gram-Schmidt correction), sampling-clock offset and jitter, ADC quantization, photodetection, coherent detection and intensity noise, chromatic dispersion, PMD and polarization mixing, and nonlinear fiber propagation over amplified spans (split-step Kerr effect with dispersion, loss, PMD and ASE) of a `Fiber`. |
119
+ | [`commkit.impairments`](https://github.com/lokgar/commkit/tree/main/commkit/impairments) | AWGN at an Es/N0 (measured as energy per symbol) or of an absolute variance, ASE at an OSNR (`apply_ase`), phase noise, carrier frequency offset, IQ imbalance, sampling-clock offset and jitter, ADC quantization, photodetection, coherent detection and intensity noise, chromatic dispersion, PMD and polarization mixing, and nonlinear fiber propagation over amplified spans (split-step Kerr effect with dispersion, loss, PMD and ASE) of a `Fiber`. Forward models only: each effect's estimation and correction is in the receiver module of its quantity. |
120
120
  | [`commkit.timing`](https://github.com/lokgar/commkit/tree/main/commkit/timing) | Barker and Zadoff-Chu sequences, `estimate_timing` / `correct_timing`, `cross_correlate`, `peak_offset` and `apply_delay`, sampling-clock recovery (`estimate_sampling_clock_offset` / `correct_sampling_clock_offset` with `Gardner`). |
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
- | [`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); pilot-aided CMA and RDE from a frame's pilots (`EqualizerPilots`); polarization demultiplexing on pilot tones (`estimate_polarization(x, PolarizationTones(...))` / `correct_polarization`). |
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
124
  | [`commkit.metrics`](https://github.com/lokgar/commkit/blob/main/commkit/metrics.py) | `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. |
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. |
@@ -11,7 +11,7 @@ import pytest
11
11
  from workloads import fiber_workload
12
12
 
13
13
  from commkit import _fiber
14
- from commkit.filtering import correct_fiber_propagation
14
+ from commkit.equalization import correct_fiber_propagation
15
15
  from commkit.impairments import Fiber, apply_fiber_propagation
16
16
 
17
17
  ROUNDS = dict(rounds=3, warmup_rounds=1, iterations=1)
@@ -3,7 +3,7 @@
3
3
  from workloads import FS, bps_workload, iq_imbalance_workload, rotated_symbols_workload
4
4
 
5
5
  from commkit import frequency, recovery
6
- from commkit.impairments import Lowdin, correct_iq_imbalance
6
+ from commkit.equalization import Lowdin, correct_iq_imbalance
7
7
  from commkit.mapping import Constellation
8
8
  from commkit.metrics import evm
9
9
 
@@ -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.10.2"
34
+ __version__ = "3.11.0"
35
35
 
36
36
  from .backend import PrecisionWarning
37
37
  from .core import (
@@ -31,6 +31,57 @@ from .backend import (
31
31
  # ---------------------------------------------------------------------------
32
32
 
33
33
 
34
+ def require_int(
35
+ value: Any, name: str, *, low: int | None = None, high: int | None = None
36
+ ) -> int:
37
+ """``value`` as a Python ``int``, checked to lie in ``[low, high]``.
38
+
39
+ ``name`` labels the argument in the message, with its function where the
40
+ caller gives one (``"allan_deviation(): num_taus"``). A ``bool``, a
41
+ float (``2.0`` included) or any other non-integer raises ``TypeError``;
42
+ an integer outside the bounds (``None``: unbounded) raises
43
+ ``ValueError``.
44
+ """
45
+ if isinstance(value, bool) or not isinstance(value, int | np.integer):
46
+ raise TypeError(f"{name} must be an integer, got {value!r}.")
47
+ if (low is not None and value < low) or (high is not None and value > high):
48
+ if high is None:
49
+ bound = f">= {low}"
50
+ elif low is None:
51
+ bound = f"<= {high}"
52
+ else:
53
+ bound = f"in [{low}, {high}]"
54
+ raise ValueError(f"{name} must be an integer {bound}, got {value!r}.")
55
+ return int(value)
56
+
57
+
58
+ def require_finite(
59
+ value: Any, name: str, *, low: float | None = None, inclusive: bool = False
60
+ ) -> float:
61
+ """``value`` as a Python ``float``, checked to be finite and above ``low``.
62
+
63
+ ``low=None`` checks finiteness only; otherwise the value must exceed
64
+ ``low`` (``inclusive=True``: be at least ``low``). A ``bool`` or a
65
+ non-number raises ``TypeError``, a NaN, an infinity or a value out of
66
+ range ``ValueError``. A 0-d array is accepted.
67
+ """
68
+ scalar = not isinstance(value, bool) and isinstance(
69
+ value, int | float | np.integer | np.floating
70
+ )
71
+ array = (isinstance(value, np.ndarray) or _is_cupy_array(value)) and (
72
+ value.ndim == 0 and value.dtype.kind in "iuf"
73
+ )
74
+ if not (scalar or array):
75
+ raise TypeError(f"{name} must be a real number, got {value!r}.")
76
+ v = float(value)
77
+ if not np.isfinite(v):
78
+ raise ValueError(f"{name} must be finite, got {value!r}.")
79
+ if low is not None and (v < low if inclusive else v <= low):
80
+ bound = f">= {low:g}" if inclusive else f"> {low:g}"
81
+ raise ValueError(f"{name} must be {bound}, got {value!r}.")
82
+ return v
83
+
84
+
34
85
  def validate_array(
35
86
  v: Any, name: str = "array", complex_only: bool = False
36
87
  ) -> ArrayType:
@@ -1,7 +1,7 @@
1
1
  """Physical constants shared across the package (private).
2
2
 
3
3
  Used by :mod:`commkit._dispersion`, :mod:`commkit.core.signal`,
4
- :mod:`commkit.filtering.fiber.estimation`, :mod:`commkit.impairments.noise`
4
+ :mod:`commkit.equalization.fiber.estimation`, :mod:`commkit.impairments.noise`
5
5
  and :mod:`commkit.plotting.spectral`.
6
6
  """
7
7
 
@@ -74,7 +74,7 @@ from typing import Any
74
74
  import numpy as np
75
75
 
76
76
  from . import _fft
77
- from ._array import as_2d
77
+ from ._array import as_2d, require_finite, require_int
78
78
  from ._cuda.graphs import GraphRunner
79
79
  from ._dispersion import (
80
80
  _SPEED_OF_LIGHT,
@@ -190,13 +190,9 @@ def check_link(
190
190
  ("span_length_km", span_length_km),
191
191
  ("center_wavelength_nm", center_wavelength_nm),
192
192
  ):
193
- if not math.isfinite(value) or value <= 0:
194
- raise ValueError(f"{function_name}: {name} must be > 0, got {value!r}.")
193
+ require_finite(value, f"{function_name}: {name}", low=0.0)
195
194
  for name, value in (("num_spans", num_spans), ("steps_per_span", steps_per_span)):
196
- if not isinstance(value, int | np.integer) or value < 1:
197
- raise ValueError(
198
- f"{function_name}: {name} must be a positive integer, got {value!r}."
199
- )
195
+ require_int(value, f"{function_name}: {name}", low=1)
200
196
  return _Link(
201
197
  fiber,
202
198
  float(span_length_km),
@@ -216,10 +212,7 @@ def to_watts(
216
212
  ``launch_power_dbm``. Divide the result by ``scale`` to return to the
217
213
  input's units.
218
214
  """
219
- if not math.isfinite(launch_power_dbm):
220
- raise ValueError(
221
- f"{function_name}: launch_power_dbm must be finite, got {launch_power_dbm!r}."
222
- )
215
+ require_finite(launch_power_dbm, f"{function_name}: launch_power_dbm")
223
216
  x2, was_1d = as_2d(x, name="samples")
224
217
  if x2.shape[0] not in (1, 2):
225
218
  raise ValueError(
@@ -9,6 +9,7 @@ import math
9
9
 
10
10
  import numpy as np
11
11
 
12
+ from ._array import require_int
12
13
  from .logger import logger
13
14
 
14
15
  # Standard Barker codes
@@ -94,8 +95,8 @@ def zadoff_chu_sequence(num_symbols: int, *, root: int = 1) -> np.ndarray:
94
95
  - For odd lengths: x[n] = exp(-j * pi * u * n * (n + 1) / N_ZC)
95
96
  - For even lengths: x[n] = exp(-j * pi * u * n^2 / N_ZC)
96
97
  """
97
- if num_symbols < 1:
98
- raise ValueError(f"num_symbols must be positive, got {num_symbols}.")
98
+ num_symbols = require_int(num_symbols, "num_symbols", low=1)
99
+ root = require_int(root, "root")
99
100
  if root < 1 or root >= num_symbols:
100
101
  raise ValueError(f"Root must be in [1, {num_symbols - 1}].")
101
102
  if math.gcd(root, num_symbols) != 1:
@@ -0,0 +1,122 @@
1
+ """Equality of the frozen dataclasses that hold arrays (private).
2
+
3
+ Every frozen dataclass of the library compares by value. Those without
4
+ arrays use the dataclass's own ``__eq__`` and ``__hash__``; those with
5
+ arrays derive from one of two bases here:
6
+
7
+ - :class:`_Value`: descriptions and host-only results whose arrays are
8
+ read-only NumPy arrays (codes, interleavers, algorithm objects, frame
9
+ maps, EXIT and error-rate curves). Equal and hashable by their fields,
10
+ arrays by shape, dtype and bytes, so equal objects share cached device
11
+ tables (``backend._device_tables``).
12
+ - :class:`_Record`: data and results whose arrays may live on the GPU and
13
+ are not frozen (``Signal``, ``Reference``, the estimates and results).
14
+ Equal by their fields (arrays of one type, shape and dtype with equal
15
+ elements, NaN equal to NaN), and unhashable, as arrays are: a hash of
16
+ writable or device data could not stay consistent with equality.
17
+
18
+ Arrays on different devices never compare equal: equality makes no
19
+ transfer. Used by the value objects and result classes across the package.
20
+ """
21
+
22
+ from __future__ import annotations
23
+
24
+ import dataclasses
25
+ import numbers
26
+ from typing import Any, ClassVar
27
+
28
+ import numpy as np
29
+
30
+ from .backend import get_array_module
31
+
32
+
33
+ def _is_array(value: Any) -> bool:
34
+ return isinstance(value, np.ndarray) or (
35
+ type(value).__module__.startswith("cupy") and hasattr(value, "shape")
36
+ )
37
+
38
+
39
+ def _equal(a: Any, b: Any) -> bool:
40
+ """Value equality of two field values (arrays, sequences, scalars)."""
41
+ if a is b:
42
+ return True
43
+ if _is_array(a) or _is_array(b):
44
+ if type(a) is not type(b) or a.shape != b.shape or a.dtype != b.dtype:
45
+ return False
46
+ xp = get_array_module(a)
47
+ return bool(xp.array_equal(a, b, equal_nan=a.dtype.kind in "fc"))
48
+ if isinstance(a, tuple | list):
49
+ return (
50
+ type(a) is type(b)
51
+ and len(a) == len(b)
52
+ and all(_equal(x, y) for x, y in zip(a, b, strict=True))
53
+ )
54
+ if isinstance(a, numbers.Number) and isinstance(b, numbers.Number):
55
+ if a != a and b != b: # NaN equals NaN, as in the arrays
56
+ return True
57
+ result = a == b
58
+ return bool(result) if isinstance(result, bool | np.bool_) else result is True
59
+
60
+
61
+ def _compared(obj: Any) -> tuple[Any, ...]:
62
+ return tuple(getattr(obj, f.name) for f in dataclasses.fields(obj) if f.compare)
63
+
64
+
65
+ class _Value:
66
+ """Value equality and hashing of frozen dataclasses with host arrays.
67
+
68
+ Equality compares the fields (arrays by shape, dtype and bytes), so equal
69
+ objects share their cached device tables.
70
+ """
71
+
72
+ def _key(self) -> tuple[Any, ...]:
73
+ return tuple(
74
+ (v.shape, v.dtype.str, v.tobytes()) if isinstance(v, np.ndarray) else v
75
+ for v in _compared(self)
76
+ )
77
+
78
+ def __eq__(self, other: object) -> bool:
79
+ # The device-table cache compares an object with itself on every
80
+ # lookup (through a weak reference); _key() copies each array to bytes.
81
+ if self is other:
82
+ return True
83
+ if type(other) is not type(self):
84
+ return NotImplemented
85
+ return self._key() == other._key()
86
+
87
+ def __hash__(self) -> int:
88
+ # Cached: the device-table cache hashes the object on every call, and
89
+ # a large code's arrays are megabytes.
90
+ h: int | None = self.__dict__.get("_hash")
91
+ if h is None:
92
+ h = hash((type(self), self._key()))
93
+ self.__dict__["_hash"] = h
94
+ return h
95
+
96
+ def __getstate__(self) -> dict[str, Any]:
97
+ # Not the cached hash: hashes of bytes differ between processes.
98
+ state = self.__dict__.copy()
99
+ state.pop("_hash", None)
100
+ return state
101
+
102
+
103
+ class _Record:
104
+ """Value equality, without a hash, of frozen dataclasses with device arrays.
105
+
106
+ ``a == b`` holds for objects of one class whose compared fields are
107
+ equal: arrays of one type (NumPy or CuPy), shape and dtype with equal
108
+ elements (NaN equal to NaN), sequences element by element, nested
109
+ records and value objects by their own equality. Comparing device
110
+ arrays reads one boolean per array back to the host.
111
+ """
112
+
113
+ __hash__: ClassVar[None] = None # type: ignore[assignment]
114
+
115
+ def __eq__(self, other: object) -> bool:
116
+ if self is other:
117
+ return True
118
+ if type(other) is not type(self):
119
+ return NotImplemented
120
+ return all(
121
+ _equal(a, b) for a, b in zip(_compared(self), _compared(other), strict=True)
122
+ )
@@ -7,14 +7,15 @@ from dataclasses import dataclass
7
7
 
8
8
  import numpy as np
9
9
 
10
- from .._array import as_2d, restore_1d
10
+ from .._array import as_2d, require_finite, require_int, restore_1d
11
+ from .._value import _Record
11
12
  from ..backend import ArrayType, _to_host, dispatch, to_device
12
13
 
13
14
  __all__ = ["AllanDeviation", "allan_deviation"]
14
15
 
15
16
 
16
17
  @dataclass(frozen=True, eq=False)
17
- class AllanDeviation:
18
+ class AllanDeviation(_Record):
18
19
  """Overlapping Allan deviation of a frequency record.
19
20
 
20
21
  Attributes
@@ -22,8 +23,7 @@ class AllanDeviation:
22
23
  taus : numpy.ndarray
23
24
  Averaging times in seconds, ``(n_tau,)``.
24
25
  adev : numpy.ndarray
25
- Allan deviation in Hz, ``(n_tau,)`` or ``(C, n_tau)``; NaN where a
26
- ``tau`` does not fit the record.
26
+ Allan deviation in Hz, ``(n_tau,)`` or ``(C, n_tau)``.
27
27
  """
28
28
 
29
29
  taus: np.ndarray
@@ -51,8 +51,10 @@ def allan_deviation(
51
51
  sampling_rate : float
52
52
  Sampling rate of ``df`` in Hz (``τ_0 = 1/sampling_rate``).
53
53
  taus : array_like, optional
54
- Averaging times in seconds. Defaults to ``num_taus`` values spaced
55
- geometrically from ``τ_0`` to ``N//4·τ_0``.
54
+ Averaging times in seconds, rounded to whole multiples ``m·τ_0``;
55
+ those with ``m > N/2``, which the record cannot hold twice, are
56
+ left out. Defaults to ``num_taus`` values spaced geometrically from
57
+ ``τ_0`` to ``N//4·τ_0``.
56
58
  num_taus : int, default 30
57
59
  Number of averaging times when ``taus`` is ``None``.
58
60
 
@@ -62,6 +64,16 @@ def allan_deviation(
62
64
  ``taus`` and ``adev``, ``(n_tau,)`` (SISO) or ``(C, n_tau)`` (MIMO),
63
65
  host NumPy arrays.
64
66
 
67
+ Raises
68
+ ------
69
+ ValueError
70
+ If ``sampling_rate`` is not finite and ``> 0``, ``num_taus < 1``,
71
+ ``df`` has fewer than 2 samples, ``taus`` is not a non-empty 1-D
72
+ array of finite values ``> 0``, or none of ``taus`` fits the record.
73
+ TypeError
74
+ If ``sampling_rate`` is not a real number or ``num_taus`` not an
75
+ integer.
76
+
65
77
  Notes
66
78
  -----
67
79
  **Limitations.**
@@ -82,20 +94,8 @@ def allan_deviation(
82
94
  scalloped ADEV with nulls at ``τ = k·T_m``; those dips are not a lower
83
95
  noise floor.
84
96
  """
85
- fs = float(sampling_rate)
86
- if not (np.isfinite(fs) and fs > 0.0):
87
- raise ValueError(
88
- f"allan_deviation(): sampling_rate must be finite and > 0, got {sampling_rate!r}."
89
- )
90
- if (
91
- isinstance(num_taus, bool)
92
- or not isinstance(num_taus, int | np.integer)
93
- or int(num_taus) < 1
94
- ):
95
- raise ValueError(
96
- f"allan_deviation(): num_taus must be an integer >= 1, got {num_taus!r}."
97
- )
98
- num_taus = int(num_taus)
97
+ fs = require_finite(sampling_rate, "allan_deviation(): sampling_rate", low=0.0)
98
+ num_taus = require_int(num_taus, "allan_deviation(): num_taus", low=1)
99
99
  df_arr, xp, _ = dispatch(df)
100
100
  y2, was_1d = as_2d(df_arr, name="df")
101
101
  c, n = y2.shape
@@ -124,16 +124,19 @@ def allan_deviation(
124
124
  "values > 0."
125
125
  )
126
126
  ms = np.unique(np.maximum(1, np.round(taus_cpu / tau0).astype(int)))
127
- ms = ms[ms <= max(1, (x.shape[-1] - 1) // 2)]
127
+ ms = ms[ms <= n // 2]
128
+ if ms.size == 0:
129
+ raise ValueError(
130
+ f"allan_deviation(): no tau fits the record of {n} samples "
131
+ f"(the largest is {n // 2}/sampling_rate = {n // 2 * tau0:.3g} s)."
132
+ )
128
133
 
129
134
  taus = ms * tau0
130
- adev = xp.full((c, ms.size), xp.nan, dtype=xp.float64)
135
+ adev = xp.empty((c, ms.size), dtype=xp.float64)
131
136
  # One vectorized second-difference per τ across all channels (the C-loop
132
137
  # would launch C·n_tau tiny kernels on GPU for no benefit).
133
138
  for j, m in enumerate(ms):
134
139
  m = int(m)
135
- if x.shape[-1] - 2 * m < 1:
136
- continue
137
140
  d2 = x[:, 2 * m :] - 2.0 * x[:, m:-m] + x[:, : -2 * m]
138
141
  avar = xp.mean(d2**2, axis=-1) / (2.0 * (m * tau0) ** 2)
139
142
  adev[:, j] = xp.sqrt(avar)