Skip to content

Audit the 91 docstrings against their code, and hold every tutorial to one writing doctrine - #42

Merged
vincentchoqueuse merged 6 commits into
mainfrom
claude/comnumpy-v1-architecture-5dtrz3
Aug 14, 2026
Merged

vincentchoqueuse merged 6 commits into
mainfrom
claude/comnumpy-v1-architecture-5dtrz3

Conversation

@vincentchoqueuse

Copy link
Copy Markdown
Owner

Six commits, two threads: the docstring audit, and the tutorial writing doctrine.

The 91 Processor docstrings audited against their code

Five parallel reviewers read every docstring against its forward() — equations re-derived, Axes lines checked against the batch registers, parameter lists against the dataclass fields, doctests executed. 62 findings fixed, four of them code bugs the prose exposed: Resampler resampled axis 0 (scipy's default) while promising the last axis; SelectiveMIMOChannel validated its input against N_r instead of N_t, rejecting every non-square channel's correct frames; BlindCFOCompensator.history stored 16× the offset (now history_, D23, storing the ω₀ iterates it documents); Laser drew its "random" initial phase from a Gaussian of std 2π instead of uniformly on [−π, π). The rest is prose catching up: seven phantom pre-D46 parameters on FiberLink/DBP, the inert norm field of FrequencyDomainEqualizer removed, wrong equations straightened (BWFilter mask, AmplitudeDemapper decision, the Rice path), stale 1-D-only Axes lines, S_ (D23) on the detectors, the CMA equalizer written W.

Every tutorial script held to one writing doctrine

Now encoded in the tutorial skill, applied to the whole set:

  • One Sequential per technique, written out — no factories. A def get_chain(kind) survives only when the structure genuinely varies (the GN-model's Gaussian-vs-mapped source, the two DBP scripts — the one sanctioned chain split, for the Monte-Carlo cost of re-propagating the fibre).
  • A fixed stack of channel draws, the same at every SNR point (rayleigh_channel(size=K), one draw = one batch row), handed to the channel block and the detector at construction. SpaceTimeDecoder accepts a stacked H to make it possible.
  • One explicit monte_carlo call per technique — no simulation loop, the noise variance zipped into the detectors that weight by it (MMSE, OSIC). A loop earns its place at ten iterations, not at two.
  • On the MIMO page, each technique is one unit: equations, chain, sweep, quoted together.
  • No analysis codas: interpolation readings of closed forms, diversity polyfits, ratio tables, mermaid dumps and stray plt.show are gone (the shaping page keeps its interpolation — it reads its own computed capacity curves — and the getting-started pages keep the one to_mermaid feature demo each).
  • The LDPC study varies n_iter by set_params on one chain; the AWGN order study reconfigures one chain the same way.

Rewritten and re-pasted from real runs: Alamouti (210→164 lines, 4.2 s), MIMO detectors (interleaved, 8.9 s), PAPR (the 20-batch loop is one call — Serial2Parallel already stacks symbols on the leading axis), OFDM, coding, AWGN, GN model, shaping. All page ranges re-checked by the two docs ratchets.

Full suite green: 939 tests + 1225 subtests, example smoke tests, ruff, pyright strict (0 errors), sphinx -W.

🤖 Generated with Claude Code


Generated by Claude Code

claude added 6 commits August 13, 2026 23:18
Five parallel reviewers read every docstring against its forward() --
equations re-derived, Axes lines checked against the batch registers,
parameter lists against the dataclass fields, doctests executed. Four
findings were code bugs the prose exposed. Resampler resampled axis 0,
scipy's default, while promising the last axis. SelectiveMIMOChannel
validated its input against N_r instead of N_t and rejected every
non-square channel's correct frames. BlindCFOCompensator's history
stored 16 times the frequency offset; it now stores the omega_0
iterates it documents, renamed history_ (D23). Laser drew its "random"
initial phase from a Gaussian of std 2 pi instead of uniformly.

The rest is prose catching up with code. Equations straightened:
BWFilter's mask was off by 2 against its own parameters section,
AmplitudeDemapper decides on |Re y| per quadrature lane rather than
|y|, the Rice path of TappedDelayLineChannel now carries the gamma_0
scaling the code applies, and the optical alpha_dB conversion is
typeset unambiguously. Stale claims deleted: seven phantom pre-D46
parameters on FiberLink and DBP replaced by one fiber: FiberSpec entry,
the inert norm field of FrequencyDomainEqualizer removed, 1-D-only Axes
lines on broadcasting blocks rewritten, "multiplied" for a division,
a "time" method that never existed. The MIMO detectors' stored
decisions are S_ (D23), the CMA equalizer is written W since H is the
channel everywhere else, BPS gained the Attributes section phase_
deserved, and PtsPaprReductor validates its (T, F) layout in prepare()
instead of dying on a bare IndexError. The batch registers were
corrected on the way: DelayRemover and BlindPhaseTracker verified
BROADCAST, Normalizer moved to EXEMPT with its pooling documented.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…echnique

Both pages carried simulation scaffolding that drowned the reader: a
factory building chains behind a kind flag, draw counts that grew with
the SNR, zipped channel sweeps, an interpolation coda reading numbers
off a closed form, mermaid dumps at the end of the scripts. They are
rewritten on one doctrine, now encoded in the tutorial skill.

The page opens on ONE chain, one channel draw, no batch: the problem
shown plainly. The simulation then draws a FIXED stack of channels once
-- rayleigh_channel(size=K), the same K draws at every SNR point, so
the reader compares curves rather than draw counts -- builds one
Sequential per technique, written out in full with the stack on the
channel block and on the detector, and runs one monte_carlo per
technique sweeping the noise variance, zipped into the detector when it
weights by it (MMSE, OSIC). No simulation loop at all. On the MIMO page
each technique is one unit, interleaved: its idea and equations, then
its chain and its sweep quoted together.

To make it possible SpaceTimeDecoder accepts a stacked H -- channel k
decodes frame k, locked in tests/mimo/test_stacked_channel.py -- and
both Alamouti blocks join the BROADCAST register of the batch contract.
The Alamouti script drops from 210 to 164 lines and runs in 4.2 s; the
MIMO script from 190 to 216 lines but with every technique contiguous,
in 8.9 s; both pages re-paste their runs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The PAPR page loses its transmitter factory: one Sequential for the
illustration, a second for the other subcarrier count -- two chains,
written out. The 20-batch accumulation loop becomes one call, because
Serial2Parallel already stacks the OFDM symbols on the leading axis:
20000 symbols are one batch, and compute_papr(axis=-1) reads one value
per row. The models-against-measurement coda is deleted and the
level-crossing model shrinks to one sentence; the page keeps the one
number an amplifier is sized on.

one_shot_ofdm drops its two-iteration loops. The SER sweep is two
explicit monte_carlo calls, one per chain, same seeds so the pasted
table is unchanged; the runtime study is one loop over the swept
lengths with both chains timed explicitly in the body, and its
volatile numbers are re-pasted from a single fresh run. The tutorial
skill now states the rule: a loop earns its place at ten iterations,
not at two -- no loop over the techniques, dict literals for two
curves, one call per chain.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…rams

Three chains, written out -- uncoded, hard, soft -- and three explicit
monte_carlo calls in place of a factory pair and a three-iteration
loop; the per-curve timing prints and the hand-rolled aligned lines
become two print_data tables, the second confronting the soft
measurement with the union bound where the page discusses it. The LDPC
study builds ONE chain and reconfigures its decoder between the two
sweeps with set_params(decoder__n_iter=25) instead of rebuilding the
Sequential inside a loop. The mermaid dump and the stray plt.show are
gone, the page re-pastes its tables from one run, and the measured
values are unchanged -- same seeds, same draws.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The conventions sweep over every page-backed script. monte_carlo_awgn
loses its chain factory -- one Sequential written inline, and the
constellation-order study reconfigures it with set_params instead of
rebuilding -- and its mermaid export; the awgn page drops the diagram
section, whose feature demo lives in the getting-started page. The
one_shot_mimo cost study unrolls its two-technique loop into one sweep
loop timing both chains explicitly, and its metric dict is a literal.
The PAPR page's theory references become a dict literal. The shaping
script keeps its interpolation -- it reads the page's own computed
capacity curves, not a closed form -- and loses only the mermaid dump.
All four pages remapped and range-checked.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The GN-model script drops its mermaid dump and plt.show, and its page
drops the diagram and the include that quoted the dump; the factory
stays, because its source genuinely changes structure -- a Gaussian
stimulus against a mapped constellation. The profiling script keeps its
mermaid export -- the getting-started page it backs presents chain
introspection as the content -- and loses only the trailing plt.show.
The two DBP scripts keep their factories: that is the one sanctioned
chain split, for the Monte-Carlo cost of re-propagating the fibre. The
CHANGELOG now records the whole doctrine sweep, including the entry the
container rollback ate.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vincentchoqueuse
vincentchoqueuse merged commit 76a93b2 into main Aug 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants