test+docs(morlet): zero-mean validation, citation cleanup, regenerate docs/html#262
Merged
Conversation
The zero-mean correction (the whole point of complete=True) was documented and implemented but not directly tested. Adds: * test_complete_wavelet_real_arm_integrates_to_zero (3 widths) — python_morlet_wavelet(complete=True).real integrates to ~0 (bounded by the finite-support truncation floor, ~1e-5 of peak); complete= False at width=4 has a clearly larger DC component, proving the correction does the work rather than being a no-op. * test_ptsa_morlet_power_rejects_DC_when_complete — feeding PTSA's filter a constant DC signal yields ~0 power on the interior with complete=True; complete=False leaves measurable DC leakage (>1000x larger). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The Tallon-Baudry & Bertrand citation introduced during the docs overhaul wasn't present in the pre-3.0.6 PTSA source. Remove all TB mentions from morlet.py, _python_reference.py, morlet.cpp, and morlet.rst (References sections + the inline phrasing). Software references (MNE, scipy, Heisenberg/Gabor) are left intact. Also add inline comments to both the Python reference implementation and the C++ kernel explaining the unit-energy derivation behind the inv_sq_a_c / inv_sq_a_s closed-form expressions: the three additive terms in inv_sq_a_c come from expanding (cos - offset)^2 = cos^2 - 2*offset*cos + offset^2 and integrating each against the Gaussian; inv_sq_a_s is the single closed form for sin^2 * Gaussian on the (offset-free) imaginary arm. The (1/freq_scale) prefactor falls out of the time-rescale change of variables. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Rebuild docs/html via 'PATH=ptsa_dev/bin:$PATH PYTHONPATH=$PWD PTSA_DOCS_BUILD_NOTEBOOKS=1 python maint/build_docs.py' so the published site reflects the source cleanup in the preceding commit (no more Tallon-Baudry citations). Notebook examples (getting_started, eeg) rendered via nbsphinx + pandoc. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Document the doc-build steps for developers: install sphinx + sphinx_rtd_theme + nbsphinx + pandoc, then 'PYTHONPATH=$PWD PTSA_DOCS_BUILD_NOTEBOOKS=1 python maint/build_docs.py'. Explains why each env var matters (autodoc's ptsa import; the pandoc-gated notebook rendering). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to the 3.0.6 docs cleanup. Four commits, in order:
test(morlet): assert complete=True zero-mean / DC-rejection—the whole point of
complete=True(zero-mean correction → DCrejection) was documented but not directly tested. Adds two
complementary tests: the Python reference wavelet integrates to ~0
(parameterized over widths) and PTSA's filter on a constant DC input
has ~0 power on the interior;
complete=Falseleaks measurablymore, proving the correction does the work.
docs(morlet): drop citations not in original PTSA; explain unit-energy— the Tallon-Baudry & Bertrand citation introducedduring the docs overhaul wasn't in the pre-3.0.6 PTSA source, so
remove all TB mentions from
morlet.py,_python_reference.py,morlet.cpp, andmorlet.rst. Software refs (MNE, scipy,Heisenberg/Gabor) are left intact. Also add inline comments to both
the Python reference and the C++ kernel explaining the unit-energy
derivation behind the
inv_sq_a_c/inv_sq_a_sclosed-formexpressions (the three additive terms in
inv_sq_a_ccome fromexpanding
(cos − offset)²and integrating each piece against theGaussian;
inv_sq_a_sis the single closed form forsin² · Gaussianon the offset-free imaginary arm).docs(html): regenerate GitHub Pages output— rebuilddocs/html/against the cleaned source viamaint/build_docs.py(ptsa_dev env + pandoc, withPTSA_DOCS_BUILD_NOTEBOOKS=1) so the live site reflects thecitation removal. Notebook examples (
getting_started,eeg)rendered via nbsphinx.
docs(README): 'Building the documentation' section— recordthe doc-build steps in the README so future developers don't have
to rediscover them.
Validation
NO_RHINO=1 pytest tests/ docs/(33 skips are the rhino-data tests,expected off-rhino; +4 vs prior count comes from the new
DC-rejection cases).
test_morlet_formula.py+test_morlet_correctness.py).remain in
docs/html/.Notes
morlet.cppdon't change the compiled output (
.sodoesn't need rebuilding).non-overlapping files.
🤖 Generated with Claude Code