Skip to content

Phase 3: ICA, component, rejection, ICLabel, and DIPFIT workflows #63

Closed

Description

@suraj-ranganath

🤖 Phase issue for the EEGLAB completion epic.

Goal

Complete parity for ICA-adjacent component workflows, automated rejection workflows, ICLabel/viewprops, and bundled DIPFIT menu surfaces.

Target branch and PR flow

  • Create the phase branch from feature/eeglab-completion.
  • Open the phase PR back into feature/eeglab-completion.
  • The phase PR should close this issue.

Parallelization

Can run in parallel with Phases 1 and 4. Final DIPFIT/component plotting checks depend on Phase 4 plot primitives.

In scope

  • Component selection/removal and component metadata updates.
  • ICLabel flagging and viewprops-style user workflows.
  • Automated channel/epoch/ICA rejection methods that do not require EEGBrowser.
  • Rejection mark superposition and ICA threshold/statistical rejection.
  • Bundled DIPFIT source-localization menu workflows represented in the vendored EEGLAB tree.
  • pop_runica parity hardening, including numerical stability and history replay.

Out of scope

  • Browser-only visual scrolling rejection.
  • External source-localization/plugin packages not vendored or packageable in EEGPrep.

Acceptance criteria

  • Rejection and component workflows match EEGLAB for data/component modes, including marked epochs/components and history strings.
  • pop_runica variants remain numerically stable and parity-tested; AMICA/Picard paths are handled according to existing EEGPrep support.
  • Browser-only visual scrolling rejection stays excluded rather than half-implemented.
  • ICLabel and DIPFIT menu actions either perform real workflows or show a deliberately scoped missing-dependency message only where EEGLAB requires unavailable external assets.
  • GUI and console flows support mixed use: GUI action, inspect EEG/LASTCOM, then console action and GUI refresh.
  • Required lint/type/test commands pass.

/goal prompt

/goal Complete EEGPrep parity for ICA-adjacent component workflows, automated rejection, ICLabel/viewprops, and bundled DIPFIT menus, excluding EEGBrowser scrolling viewers. Verify against EEGLAB source and MATLAB outputs, add unit/integration/visual/console tests with sample_data, preserve numerical stability and history replay, run required lint/type/test commands, and repeat review/fix cycles until the phase is mergeable into the epic branch.

Activity

  1. added
    phase
    on May 27, 2026
  2. claude commented on May 27, 2026

    @claude
    Contributor

    🤖 # Research

    Phase 3 is a multi-subsystem epic spanning ~20 user-facing actions across popfunc, plugins/ICLabel, and plugins/dipfit. Current EEGPrep coverage is partial for ICA/ICLabel, near-zero for automated rejection, and empty for DIPFIT. Most Phase 3 menu actions are declared in the EEGLAB menu tree but routed through the placeholder registry; they show but do not execute.

    Existing coverage:

    • src/eegprep/functions/popfunc/pop_runica.py (572 lines) and eeg_runica.py, eeg_amica.py, eeg_picard.py are in place with tests (test_runica.py, test_eeg_runica.py, test_eeg_amica.py, test_eeg_picard.py, test_runamica.py, test_gui_pop_runica.py). Phase work is parity hardening, not a port.
    • src/eegprep/functions/popfunc/pop_subcomp.py (118 lines) implements component removal using EEG['reject']['gcompreject'].
    • src/eegprep/plugins/ICLabel/pop_iclabel.py (79 lines) and eeg_icflag.py (87 lines) handle classification + the underlying flag write into EEG['reject']['gcompreject'].

    Missing / placeholder (declared in src/eegprep/functions/guifunc/menu_placeholders.py):

    • Component workflows: pop_selectcomps, pop_prop, pop_icflag (wrapper around existing eeg_icflag), pop_viewprops.
    • Automated rejection: pop_rejchan, pop_rejcont, pop_eegthresh, pop_jointprob, pop_rejkurt, pop_rejtrend, pop_rejspec, eeg_rejsuperpose, pop_rejmenu, pop_rejepoch, pop_autorej, pop_signalstat.
    • DIPFIT: entire src/eegprep/plugins/dipfit/ is a stub (__init__.py is one line; only a menu.py exists). All actions (pop_dipfit_settings, pop_dipfit_headmodel, pop_dipfit_gridsearch, pop_dipfit_nonlinear, pop_dipplot, pop_multifit, pop_leadfield, pop_dipfit_loreta) need ports.

    Relevant code

    Note: src/eegprep/eeglab/ is empty in this checkout. Parity work needs the EEGLAB submodule populated (or upstream sccn/eeglab consulted) before each PR.

    Proposed Approach

    This phase is far too large for a single PR (estimated several thousand LOC across 4+ subsystems). It should be decomposed into independent PRs that each merge into feature/eeglab-completion. Recommended ordering, sized to <500 LOC where practical:

    1. pop_runica parity hardening — numerical-stability regressions, history replay, AMICA/Picard branch parity. Scoped to existing files; smallest first.
    2. ICLabel-facing wrappers — pop_icflag (thin wrapper over existing eeg_icflag), pop_viewprops:components, pop_viewprops:channels. Reuses existing ICLabel infrastructure.
    3. Component inspection/selection — pop_selectcomps (interactive component map grid) and pop_prop (single-component property viewer). GUI-heavy; uses eeglab-gui-visual-parity skill.
    4. Channel rejection — pop_rejchan (statistics-based) and pop_rejcont (continuous-data segment rejection). Both are algorithmic, light GUI.
    5. Epoch-rejection primitives — pop_eegthresh, pop_jointprob, pop_rejkurt, pop_rejtrend, pop_rejspec, plus eeg_rejsuperpose. These share the EEG.reject.* schema and can ship together (~one PR) since they are small, parallel implementations sharing tests.
    6. Rejection orchestration — pop_rejmenu, pop_rejepoch, pop_autorej. Depends on (5).
    7. DIPFIT settings + head model — pop_dipfit_settings, pop_dipfit_headmodel. Bootstraps the plugin and bundled MNI/BEM resources.
    8. DIPFIT fitting — pop_dipfit_gridsearch, pop_dipfit_nonlinear, pop_multifit. Depends on (7).
    9. DIPFIT plotting/source — pop_dipplot, pop_leadfield, pop_dipfit_loreta. Depends on Phase 4 plot primitives per the issue.
    10. Phase aggregator PR — empty integration PR into feature/eeglab-completion once 1–9 land, with side-by-side GUI parity attachments.

    Open questions for the issue owner before implementation begins:

    • Is the planned PR-per-subphase decomposition acceptable, or should the phase land as one mega-PR against feature/eeglab-completion?
    • DIPFIT requires bundled head-model assets (MNI/BEM .mat files, ~MB). Should those go into src/eegprep/resources/ (package data) or be downloaded on demand?
    • pop_selectcomps in EEGLAB renders an N×M grid of clickable topo maps. Should the EEGPrep port match that exactly via the visual-parity loop, or use a simpler list+detail Qt layout?
    • The vendored EEGLAB tree at src/eegprep/eeglab/ is empty in this checkout — please confirm parity work will run against a populated submodule or against upstream sccn/eeglab clones.

    Not opening a PR until these decisions land; the work is too large and design-sensitive to guess at intent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

phase

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions