Skip to content

[MAINT] ASR: defensive hardening and docstring fixes - #117

Merged
nbara merged 1 commit into
nbara:masterfrom
sappelhoff:fix/asr-defensive-docs
Jul 18, 2026
Merged

nbara merged 1 commit into
nbara:masterfrom
sappelhoff:fix/asr-defensive-docs

Conversation

@sappelhoff

Copy link
Copy Markdown
Collaborator

A group of small defensive and documentation fixes in the ASR module (no behavior change on the common paths):

  • asr_process: read state by key (state["M"], state["T"], state["R"]) instead of state.values(), removing the reliance on dict insertion order.
  • fit_eeg_distribution: nudge the descending gridsearch arange stop endpoint so min_width is not dropped by floating-point error (mirrors the existing cols grid nudge).
  • ASR: expose max_bad_chans as a constructor parameter (default 0.3, preserving current behavior) and document it.
  • clean_windows: build the window-start offsets from the non-truncated win_len * sfreq to avoid ~1-sample phase drift for non-integer products (byte-identical when the product is integer, including all existing tests); fix the win_len docstring default (0.5, not 1); document the meegkit-specific flat-window removal criterion.

Testing

Adds tests for the max_bad_chans parameter, state key-order independence, and the offset spacing. Full tests/test_asr.py passes; ruff clean.

@codecov

codecov Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.10%. Comparing base (1fcfbfd) to head (389a184).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #117   +/-   ##
=======================================
  Coverage   83.10%   83.10%           
=======================================
  Files          25       25           
  Lines        2817     2818    +1     
=======================================
+ Hits         2341     2342    +1     
  Misses        476      476           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sappelhoff

Copy link
Copy Markdown
Collaborator Author

Note: includes the nonlinear_eigenspace reproducibility fix from #118. test_asr_class[*-riemann] compares incremental-vs-bulk output with a loose tolerance and is flaky on CI because that path used an unseeded RNG; this can trip on any PR regardless of what it changes. #118 is the root fix — once it merges first, this commit drops out on rebase.

@sappelhoff sappelhoff mentioned this pull request Jul 14, 2026
@nbara
nbara force-pushed the fix/asr-defensive-docs branch from c488586 to 4fa3875 Compare July 16, 2026 07:09
- asr_process: read state by key instead of relying on dict order
- fit_eeg_distribution: nudge gridsearch arange endpoint (mirror cols grid)
- clean_windows: build window offsets from non-truncated N (phase drift)
- ASR: expose max_bad_chans as a constructor parameter (default 0.3)
- docs: fix clean_windows win_len default (0.5); document the mask3 term
@nbara
nbara force-pushed the fix/asr-defensive-docs branch from 4fa3875 to 389a184 Compare July 16, 2026 07:15
@nbara
nbara merged commit d2f4494 into nbara:master Jul 18, 2026
7 checks passed
@sappelhoff
sappelhoff deleted the fix/asr-defensive-docs branch July 19, 2026 09:06
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