Skip to content

Phase 4: pop_eegplot menu workflows and session-console integration #98

Closed

Description

@suraj-ranganath

🤖 Phase 4 for the EEGBrowser epic. Target branch: feature/eegbrowser-completion.

Dependency

Start after Phases 2 and 3 merge.

Goal

Replace current pop_eegplot placeholders with working menu, API, GUI, history, and console workflows.

Implementation scope

  • Implement pop_eegplot(EEG, icacomp=1, superpose=0, reject=1, ...).
  • Wire Tools > Inspect/reject data by eye.
  • Wire Plot > Channel data (scroll).
  • Wire Plot > Component activations (scroll).
  • Wire Reject by inspection data/ICA menu paths.
  • Support return_com=True, valid Python console echo, GUI command echo, EEGPrepSession updates, ALLCOM/LASTCOM, and eegprep-console mixed use.
  • Remove pop_eegplot from browser exclusion metadata only once all menu variants work.

Acceptance criteria

  • Every pop_eegplot:* menu action opens the correct browser mode and enabled state.
  • Continuous reject creates a new/updated dataset like EEGLAB’s pop_eegplot flow.
  • Epoched mark/update and reject flows update EEG.reject fields or remove epochs as EEGLAB does.
  • Component mode requires ICA and shows clear user-facing errors when ICA is missing.
  • Console and GUI stay synchronized after accept, reject, cancel, and failed action.
  • No runtime code depends on src/eegprep/eeglab.

Tests and evidence

  • Tests for all menu action variants and enabled states.
  • tests/test_console_workspace.py coverage for GUI action then console inspection and console action then GUI refresh/history.
  • Sample-data GUI flows.
  • MATLAB parity where deterministic.
  • Visual parity screenshots attached to the phase PR as GitHub user attachments.
  • uv run --no-sync ruff check .
  • uv run --no-sync ruff format --check .
  • uv run --no-sync ty check
  • Focused pytest for changed tests.

/goal prompt

/goal Implement pop_eegplot and all main-window menu paths from this issue. Preserve EEGLAB command/history behavior while integrating with EEGPrepSession and eegprep-console. Remove placeholder/exclusion metadata only when all menu variants work. Verify with sample_data GUI flows, console workspace tests, MATLAB parity where deterministic, visual parity screenshots, ruff/format/ty, and focused pytest.

Required references for every phase

  • AGENTS.md
  • .agents/skills/eegprep-feature-development/SKILL.md
  • .agents/skills/eeglab-gui-visual-parity/SKILL.md for GUI features
  • .agents/skills/gui-agent-flow-qa/SKILL.md for end-user flow QA
  • EEGLAB reference under src/eegprep/eeglab, used only as development/parity input.

Core EEGLAB references

  • src/eegprep/eeglab/functions/sigprocfunc/eegplot.m
  • src/eegprep/eeglab/functions/sigprocfunc/eegplotlegacy.m
  • src/eegprep/eeglab/functions/sigprocfunc/eegplot2event.m
  • src/eegprep/eeglab/functions/sigprocfunc/eegplot2trial.m
  • src/eegprep/eeglab/functions/sigprocfunc/trial2eegplot.m
  • src/eegprep/eeglab/functions/popfunc/pop_eegplot.m
  • src/eegprep/eeglab/functions/popfunc/eeg_rejmacro.m
  • src/eegprep/eeglab/functions/popfunc/eeg_multieegplot.m

Activity

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

    @claude
    Contributor

    🤖 Plan:

    • Read AGENTS.md and fix-issue/pull-request skills
    • Check actionability and scope
    • Duplicate-work preflight (open PRs/issues)
    • Map current eegplot surface in repo
    • Post analysis (no PR — out of scope for an agent fix)

    Research

    Phase 4 of epic #94. Issue explicitly states "Start after Phases 2 and 3 merge." Phases 1 (#95), 2 (#96), 3 (#97) are still open issues with no PRs, so this phase is blocked on its prerequisites: shared browser state/rendering/eegplot API (Phase 1), browser UI shell and menus (Phase 2), and winrej/rejection-conversion semantics (Phase 3). Implementing Phase 4 before they land would force ad-hoc redefinition of all three contracts.

    Scope is also well over the 100-line agent-fix threshold: pop_eegplot with 5 menu variants, continuous reject vs. epoched mark/update/reject, ICA-mode gating, history+ALLCOM/LASTCOM echo, EEGPrepSession sync, plus MATLAB parity, console-workspace tests, sample-data GUI flows, and visual parity captures.

    Current placeholder surface

    Proposed approach (for human review — no PR)

    This is design-level work that should not start until prerequisite PRs land. Recommended path:

    1. Block until Phases 1–3 merge. Phase 4 depends on the eegplot API surface, dialog shell, and winrej semantics defined by those phases. Starting now means re-inventing those contracts and then re-doing the integration once they land.

    2. When unblocked, implement in src/eegprep/functions/popfunc/pop_eegplot.py as the dispatch entry point that mirrors EEGLAB's pop_eegplot.m flow:

      • pop_eegplot(EEG, icacomp=1, superpose=0, reject=1, *, topcommand=None, return_com=False, **eegplot_kwargs) matching the MATLAB signature.
      • Branch on icacomp (1=data, 0=ICA) and on reject/dataset epoching to choose continuous-reject vs. epoched mark/update flows.
      • Build the EEGLAB eeg_rejmacro-equivalent callback in Python that converts winrej (from Phase 3) into either pop_select-based continuous rejection or EEG.reject.rej* updates / epoch removal for epoched data.
      • Return (EEG, com) where com is a valid Python echo (pop_eegplot(EEG, 1, 0, 1, ...)), consumed by eegprep-console auto-store and LASTCOM/ALLCOM.
    3. Menu wiring in eeglab_menu.py. Replace the five placeholder actions with handlers that:

      • pop_eegplot:data → pop_eegplot(EEG, icacomp=1, reject=0) (Plot › Channel data scroll, no reject UI).
      • pop_eegplot:channels → same dispatch but launched from Plot menu (parity with EEGLAB's two entry points).
      • pop_eegplot:components → pop_eegplot(EEG, icacomp=0, reject=0), ICA-gated.
      • Tools › Inspect/reject by eye → pop_eegplot(EEG, icacomp=1, reject=1).
      • :reject_data / :reject_ica → epoched reject-by-inspection paths (icacomp 1/0, reject=1).
      • ICA-required actions must raise a clear EEGLAB-style error via the same dialog the rest of the GUI uses when EEG.icaweights is empty.
    4. Session/console sync. Use EEGPrepSession.store_current, add_history, and notify_changed for any path that mutates EEG (continuous reject, epoch removal, EEG.reject updates). Tests must cover both directions: GUI action → console namespace; console call → GUI refresh.

    5. Remove the eegbrowser exclusion in menu_placeholders.py only after every variant works end-to-end and tests pass. Update the placeholder map in tests/conftest.py if marker categorization changes.

    6. Tests (tests/test_pop_eegplot.py new; extend tests/test_console_workspace.py):

      • Each menu variant opens the correct browser mode and enabled state.
      • Continuous reject produces the same channel/sample mask as EEGLAB given a fixed winrej (MATLAB parity, deterministic).
      • Epoched mark/update writes the expected EEG.reject.rejmanual and friends; epoched reject removes the right trials.
      • ICA-missing path raises the documented error.
      • Console: pop_eegplot(EEG, 1, 0, 1, ...) auto-stores and updates LASTCOM/ALLCOM; GUI refresh after console mutation.
      • Visual parity captures via .agents/skills/eeglab-gui-visual-parity attached as PR user attachments (not committed).
      • GUI flow QA via .agents/skills/gui-agent-flow-qa for the five menu paths.

    Why no PR now: (a) prerequisite phases are unmerged and unimplemented; (b) the change is multi-module, well beyond the 100-line agent-fix threshold; (c) this issue's acceptance criteria require Phase 3's winrej semantics and Phase 1/2's browser shell, neither of which exists yet.

    Recommended next step for a human: drive Phases 1–3 to PR first, then re-open this issue for Phase 4 implementation (or run the /goal prompt against an interactive session once prerequisites land).

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