Repository navigation
Closed
Labels
phaseEpic implementation phase
Description
π€ Part of #207. This phase removes duplicated EEG rejection, ICA, and cleaning helper logic where duplicate copies can change scientific results or visual rejection state.
Summary
Unify the core EEG data helpers that affect rejection marks, component activations, ICA finalization, and clean_rawdata channel removal. These paths must remain numerically correct and EEGLAB-predictable because they influence what users reject or keep.
Scope
Covers remaining findings from #197/#205 including:
- Parallel
winrej/ rejection-family scaffolding in_eegplot_rejection.pyandpop_eegplot.py. - Duplicated epoched rejection scaffolds across
pop_rejkurt,pop_jointprob,pop_eegthresh,pop_rejspec, andpop_rejtrend. - Divergent
component_activationsimplementations in_rejection.pyand_plot_utils.py; decide and document whether rejection trusts storedicaactor recomputes. - Triplicated ICA post-processing (
sortcomps,posact) acrosseeg_runica.py,eeg_amica.py, andeeg_picard.py. - Divergent channel-removal and
clean_channel_maskupdate blocks inclean_flatlines.py,clean_channels.py, andclean_channels_nolocs.py.
Acceptance Criteria
- Shared rejection-family helpers produce the same browser marks and colors from every GUI/menu entry point.
- Rejection pop wrappers keep their existing public signatures, history strings, and GUI behavior while delegating common apply/display/reject logic to one tested helper.
- ICA post-processing is centralized and preserves
icaweights,icasphere,icawinv,icaact,icachansind, component ordering, and sign invariants across runica/amica/picard. - clean_rawdata channel removal updates
clean_channel_maskconsistently for zero, partial, and all-channel removal cases. - Tests include sample-data and synthetic EEG coverage; MATLAB parity is used for deterministic ICA/rejection semantics where feasible.
- GUI/console flows remain synchronized for browser/rejection actions.
References
AGENTS.md.agents/skills/eegprep-feature-development/SKILL.md.agents/skills/eeglab-gui-visual-parity/SKILL.mdfor browser/rejection GUI changes- EEGLAB references:
pop_eegplot.m,eeg_rejmacro.m, ICA wrappers, and clean_rawdata plugin references.
/goal Prompt
/goal Complete Fable 5 architecture closeout Phase 2 from issue #<THIS_ISSUE>: converge rejection browser helpers, epoched rejection wrappers, component activation access, ICA finalization, and clean_rawdata channel-removal masks into canonical tested helpers. Use #197/#205 and EEGLAB source as the behavior oracle, preserve EEGPrep standalone runtime behavior and existing public pop_* contracts, add regression/parity tests before behavior changes, verify GUI plus eegprep-console synchronization for user-facing paths, and run focused pytest plus ruff, format, ty, and pre-commit. Keep changes scoped to rejection/ICA/cleaning ownership.
Metadata
Metadata
Assignees
Labels
phaseEpic implementation phase
Activity
suraj-ranganath commentedon Jun 12, 2026
π€
Research
#209 is partially converged already: epoched browser state lives in
_eegplot_rejection.py, and rejection component scoring intentionally recomputes from weights/sphere instead of trusting cachedicaact. Remaining drift:pop_eegthresh,pop_rejspec, andpop_rejtrendstill duplicate the apply/display/reject scaffold, and clean_rawdata updatesclean_channel_maskwith three different variants. Duplicate-work preflight found no open PR for #209 scope; PR #190 is ICA GUI progress work and does not overlap final ICA field invariants.Relevant code
src/eegprep/functions/popfunc/_eegplot_rejection.py#L33-L100- shared rejection scaffoldsrc/eegprep/functions/popfunc/pop_eegthresh.py#L154-L208- duplicated threshold apply pathsrc/eegprep/functions/popfunc/_plot_utils.py#L98-L123- stored/recomputed activationssrc/eegprep/functions/popfunc/_ica_utils.py#L16-L55- shared ICA finalizationsrc/eegprep/plugins/clean_rawdata/clean_channels.py#L173-L179- mask update duplicateProposed Fix
Add a generic epoched rejection application helper for precomputed mark methods, route threshold/spectrum/trend through it, and keep jointprob/kurtosis on the stats-aware helper. Add a clean_rawdata private helper that updates
etc.clean_channel_maskusing the EEGLAB rule: update existing retained positions when mask cardinality matches current channels, otherwise create a current-channel mask. Harden ICA finalization tests around shared sort/posact invariants and leave rejection component scoring recompute-only, with tests documenting staleicaactis ignored for rejection.suraj-ranganath commentedon Jun 12, 2026
π€ Completed by merged phase PR #215 into feature/fable5-architecture-closeout.