Skip to content

[Fable 5] Decompose statistics and ICLabel closeout modules - #219

Merged
suraj-ranganath merged 1 commit into
feature/fable5-architecture-closeoutfrom
phase/213-statistics-iclabel-closeout
Jun 12, 2026
Merged

suraj-ranganath merged 1 commit into
feature/fable5-architecture-closeoutfrom
phase/213-statistics-iclabel-closeout

Conversation

@suraj-ranganath

Copy link
Copy Markdown
Member

Split statistics implementations into focused same-name modules and separate ICLabel property-browser pop glue, numerics, and Matplotlib rendering ownership. Preserve public imports, command strings, GUI behavior, and close out the remaining #197/#205 mapping for the final architecture phase.

Closes #213

@suraj-ranganath

Copy link
Copy Markdown
Member Author

🤖 Specification for the >500 LOC closeout diff.

Problem: functions/statistics/_core.py owned every statistics implementation behind thin same-name shims, so public modules did not own their behavior and package exports needed an import-order workaround. plugins/ICLabel/pop_prop_extended.py mixed pop/history/dialog glue, classifier and DIPFIT/PVAF numerics, activity data assembly, Matplotlib rendering, navigation, and rejection controls in one module. Issue #213 also required a final accounting of the remaining #197/#205 architecture items.

Approach: statistics implementations now live in their existing same-name modules. _shared.py owns only reusable array/grid helpers and two-way ANOVA containers, and _core.py remains as a small compatibility re-export facade. ICLabel property handling is split into pop_prop_extended.py for public pop/dialog/history glue, _prop_numerics.py for classifier, DIPFIT, PVAF, spectra, and dashboard data assembly, and _prop_browser.py for Matplotlib rendering and control callbacks. .notes/implementation-notes.html maps the remaining #197/#205 items to PRs #214-#218, this PR, or an explicit non-goal rationale.

Key code: pop_prop_extended now delegates rendering through build_navigable_dashboard while preserving the same history_command construction. statistics.init imports same-name modules first and then binds package callables from the modules so importing eegprep.functions.statistics.fdr does not replace statistics.fdr with the submodule object. _core.py re-exports the same symbols for older internal imports without owning implementations.

Tests: focused statistics coverage verifies behavior, package callable exports after submodule imports, and _core compatibility. Focused ICLabel/viewprops coverage verifies facade helper imports, classifier/DIPFIT parsing, dashboard data assembly, GUI dashboard rendering, navigation, rejection controls, packaged help, and pop_viewprops delegation. Verification run locally: focused pytest, ruff check, ruff format --check, ty check, staged and PR-scope pre-commit, and EEGPREP_SKIP_MATLAB=1 pytest -m "not slow".

@claude

claude Bot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 3m 0s —— View job


Code review

  • Overall assessment: Safe to merge — clean, well-scoped decomposition with public API preserved.
  • Highest-risk area: Import-order shadowing in statistics/__init__.py (handled correctly and covered by a new test).
  • Merge recommendation: Safe to merge.

What I checked

Statistics decomposition

  • __init__.py imports the same-name thin modules first, then rebinds package callables from them — this prevents a later import eegprep.functions.statistics.fdr from replacing statistics.fdr with the submodule object. The new test test_statistics_package_exports_remain_functions_after_submodule_imports exercises exactly this (tests/test_statistics_package.py:271).
  • Symbol identity is consistent: TwoWayAnovaResult/TwoWayEffects are single-sourced in _shared.py, and both anova2_cell/statcond re-export them, so the __init__ binding (from anova2_cell/statcond) and _core binding (from _shared) resolve to the same objects.
  • _core.py is now a pure re-export facade; its __all__ matches the package __all__.
  • All 13 statistics submodules pull helpers from _shared (condition_grid, paired_flag, two_way_stack, etc.). No code anywhere imports those private helpers from _core, so dropping them from the facade is safe.

ICLabel decomposition

  • pop_prop_extended.py __all__ is byte-for-byte identical to the pre-PR public __all__ (verified against origin/feature/fable5-architecture-closeout) — full public-API preservation.
  • pop/dialog/history glue stays in pop_prop_extended.py; the old private _build_navigable_dashboard is promoted to build_navigable_dashboard in _prop_browser.py for cross-module use, and history_command construction is unchanged.
  • _prop_numerics.py (classifier/DIPFIT/PVAF/spectra/data assembly) and _prop_browser.py (Matplotlib rendering + nav/rejection callbacks) are straight extractions; figure-state keys, rejection commit flow, and callback wiring are preserved.
  • ActivityTraceData is an internal browser detail and was never in the old public __all__; no external code references it.

Blocking

None.

Important

None.

Nits

  • _core.py and pop_prop_extended.py each carry a hand-maintained __all__ / re-export list that must be kept in sync with the source-of-truth modules. Acceptable for a compatibility facade, but a future drift risk if a symbol is added to _prop_numerics/statcond and not mirrored here.

Test gaps

None blocking. The new coverage targets the two real risks of this refactor (import-order export stability and facade/delegation identity). Note: _core now appears to be referenced only by the compatibility test — if no internal code still imports from statistics._core, the facade exists purely for that test, which is fine as a deliberate compatibility guard.

EEGLAB parity notes

None — this is a pure internal module split. Command strings, dialog specs (pop_prop_extended_dialog_spec), and the navigable-dashboard behavior are unchanged.


Note: I could not execute pytest / pre-commit in this review sandbox (command approval unavailable), so the runtime confirmations above are from static verification of imports, __all__ sets, and symbol identities. The author reports green local runs of focused pytest, ruff, ty, and PR-scope pre-commit.

@suraj-ranganath
suraj-ranganath merged commit 323331f into feature/fable5-architecture-closeout Jun 12, 2026
1 check passed
suraj-ranganath added a commit that referenced this pull request Jun 12, 2026
[Fable 5] Decompose statistics and ICLabel closeout modules
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.

1 participant