Repository navigation
Closed
Labels
phaseEpic implementation phase
Description
🤖 Part of #207. This phase resolves duplicated STUDY, clustering, time-frequency, and statistical behavior that can otherwise give different scientific answers depending on entry point.
Summary
Consolidate STUDY measure/cache helpers, robust clustering dispatch, time-frequency bootstrap/FDR code, and empirical p-value conventions. This phase is behavior-changing where current code diverges from EEGLAB or from EEGPrep’s own canonical helpers, so every change needs a failing or characterization test.
Scope
Covers remaining findings from #197/#205 including:
pop_clustfinite-outlier path dispatching torobust_kmeansand recording EEGLAB-compatible algorithm provenance.pop_chanplotduplicatingstd_readdata/std_measureplotmeasure reading and plotting behavior.- Shared STUDY helpers:
_trial_rows, factor-level matching, cached measure axes, default plot targets, range masks, measure field maps, andstd_clustplothistory construction. - Time-frequency duplicates: bootstrap thresholding, threshold vectors, bootstrap index/resampling helpers,
newtimefFDR path, and remaining numeric-vector parsing after Phase 1. - Empirical p-value convention audit across PAC, bootstat, and statistics helpers; either converge or document intentionally distinct scientific definitions.
Acceptance Criteria
- STUDY design/measure helpers have one owner and callers agree on trialinfo, measure axes, range masks, and default targets.
pop_clustfinite-outlier behavior is EEGLAB-compatible or the divergence is explicitly justified with tests and docs.- Time-frequency significance behavior uses canonical helpers for FDR/bootstrap where equivalent; any intentionally different p-value convention is documented in code/docs and tested.
- History emitted by STUDY plotting remains valid Python and round-trips in
eegprep-console. - Tests cover multi-dataset STUDY fixtures, sample data where relevant, deterministic numerical parity, and invalid bounds/factor inputs.
References
AGENTS.md.agents/skills/eegprep-feature-development/SKILL.md- EEGLAB references under
functions/studyfunc,functions/timefreqfunc, andfunctions/statistics.
/goal Prompt
/goal Complete Fable 5 architecture closeout Phase 3 from issue #<THIS_ISSUE>: consolidate STUDY helper ownership, robust clustering dispatch, time-frequency bootstrap/FDR plumbing, and empirical p-value conventions from #197/#205. Use EEGLAB source and existing EEGPrep tests as the oracle, make behavior changes only with explicit tests and documented rationale, preserve console history and STUDY/session synchronization, run MATLAB parity where deterministic, and verify with focused pytest plus ruff, format, ty, and pre-commit.
Metadata
Metadata
Assignees
Labels
phaseEpic implementation phase
Activity
suraj-ranganath commentedon Jun 12, 2026
🤖
Research
pop_cluststill runs plain k-means for finiteoutliers, then hand-marks label0rows and records['Kmeans', clus_num]; EEGLAB dispatches that path torobust_kmeans(..., STD, 5, algorithm)and records{'robust_kmeans', clus_num}.pop_chanplotstill reads and plots cached channel/component measures through local_data/_axis/_cached_channel_groupshelpers whilestd_readdataand_std_measureplotalready own those contracts; shared STUDY trialinfo rows, factor matching, cached axes, range masks, andstd_clustplothistory still have forked implementations. Time-frequency has Phase 1 value parsing plus canonicalbootstrap_threshold/fdr, but bootstrap index/resampling helpers remain split; PAC,bootstat, andstatisticsp-value conventions are intentionally distinct and need executable audit coverage.Relevant code
src/eegprep/functions/studyfunc/pop_clust.py#L67-L77- finite-outlier pathsrc/eegprep/functions/studyfunc/pop_chanplot.py#L192-L381- local measure reads/plotssrc/eegprep/functions/studyfunc/std_readdata.py#L226-L397- canonical axes/rangessrc/eegprep/functions/studyfunc/std_limodesign.py#L78-L224- trialinfo/factor matching copysrc/eegprep/functions/timefreqfunc/newtimef.py#L423-L539- bootstrap helper copiesDuplicate-work preflight: no open PRs for #210,
pop_clust,pop_chanplot,std_readdata,std_measureplot,newtimef, orbootstat; issue #208 is adjacent shared-contract work already merged into the target base and does not overlap this phase.Proposed Fix
Add characterization tests first for finite-outlier
pop_clustprovenance,pop_chanplotcached channel/component parity withstd_readdata/measure plotting, shared trialinfo/factor/range/axis behavior, validstd_clustplothistory, time-frequency bootstrap helper equivalence, and the intentionally distinct empirical p-value definitions. Then routepop_clustfinite outliers throughrobust_kmeans; move shared STUDY contracts into_study_utils/std_readdataand import them from callers; makepop_chanplotdelegate cached measure reading/plotting instead of owning parallel copies; add a smalltimefreqfunc/_bootstrap.pyfor baseboot, threshold-vector, and resampling helpers used bynewtimef/newcrossf/bootstat. Keep PAC's bias-corrected one-sided p-value,bootstat's exact two-sided surrogate p-values, andstatistics.stat_surrogate_pvals' EEGLAB last-axis tail folding as distinct definitions, with tests and docs explaining why they do not collapse.suraj-ranganath commentedon Jun 12, 2026
🤖 Completed by merged phase PR #217 into feature/fable5-architecture-closeout.