Skip to content

Phase 4: Plotting, topographies, time-frequency, and statistics #64

Closed

Description

@suraj-ranganath

🤖 Phase issue for the EEGLAB completion epic.

Goal

Complete Plot-menu parity plus missing low-level plotting, topography, time-frequency, cross-coherence, and statistics functions.

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 2. Component-specific plot integration should coordinate with Phase 3.

In scope

  • Topoplot wrappers and channel/component property views.
  • Channel/component spectra and maps.
  • ERP images, ERPs, scalp arrays, map series, and related plotting wrappers.
  • Time-frequency transforms and cross-coherence.
  • Event, channel, and component statistics.
  • Supporting signal/stat/time-frequency helpers needed for these workflows.
  • Headless-safe plotting tests where feasible.

Out of scope

  • EEGBrowser/eegplot scrolling viewers.

Acceptance criteria

  • Plot menu actions produce usable matplotlib/Qt outputs with EEGLAB-compatible inputs, labels, defaults, and history.
  • Time-frequency/statistical outputs have MATLAB parity tests for deterministic numerical pieces and documented tolerances for known floating-point differences.
  • GUI visual parity exists for each interactive plotting/options dialog.
  • Plotting functions work headlessly in CI where possible and degrade clearly when a display is required.
  • Browser/scrolling plot actions remain excluded if they require EEGBrowser.
  • Required lint/type/test commands pass.

/goal prompt

/goal Complete EEGPrep parity for Plot-menu, topography, ERP, spectra, time-frequency, cross-coherence, and statistics workflows, excluding EEGBrowser scrolling viewers. Use EEGLAB source and sample_data to define behavior, implement standalone Python outputs, add MATLAB parity and headless plotting tests, add visual parity for dialogs, verify console/GUI history behavior, and keep ruff/format/ty plus relevant pytest suites green.

Activity

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

    @claude
    Contributor

    🤖 Plan:

    • Read issue and skills, run duplicate-work preflight (no open PRs/issues overlap)
    • Scope check: epic phase ticket spanning 15+ pop functions, low-level helpers, GUI dialogs, MATLAB parity, headless tests, help docs — too large for a single PR
    • Inventory current state vs. Plot menu wiring
    • Post research + proposed approach for human review
    • Await scoping decision before opening implementation PR(s)

    Research

    Phase 4 is an epic umbrella ticket. The Plot menu in src/eegprep/functions/guifunc/eeglab_menu.py#L218-L307 already wires every action, but every Phase 4 pop_* is a NotImplementedError placeholder in src/eegprep/functions/guifunc/menu_placeholders.py#L13-L72 (pop_chanplot, pop_comperp, pop_envtopo, pop_erpimage, pop_eventstat, pop_headplot, pop_newcrossf, pop_newtimef, pop_plotdata, pop_plottopo, pop_prop, pop_signalstat, pop_spectopo, pop_timtopo, pop_topoplot). Low-level support is similarly thin: src/eegprep/functions/sigprocfunc/ contains only topoplot.py, cart2topo.py, epoch.py, eegrej.py, reref.py, runica.py, runamica.py — no spectopo, timef, crossf, erpimage, signalstat, eventstat helpers. No timefreqfunc/ or statistics/ directories exist. Vendored EEGLAB reference dir at src/eegprep/eeglab/ is empty in the worktree so parity work needs it populated locally first.

    Relevant code

    • src/eegprep/functions/guifunc/eeglab_menu.py#L218-L307 — Plot menu wiring; actions ready, handlers missing
    • src/eegprep/functions/guifunc/menu_placeholders.py#L13-L72 — every Phase 4 pop is a coming-soon stub
    • src/eegprep/functions/sigprocfunc/ — only topoplot/cart2topo present; no spectopo/timef/crossf/erpimage
    • src/eegprep/resources/help/ — no help markdown yet for any Phase 4 function
    • src/eegprep/eeglab/ — vendored reference dir empty; parity work needs it populated locally

    Proposed Approach

    Epic-scoped design change; one PR violates the >100-line guidance and AGENTS.md "smallest change that solves the request." Recommend splitting into ~8 component PRs against feature/eeglab-completion, each scoped to one pop wrapper + low-level helper(s) + tests + help md, sized 200–600 LOC. Suggested ordering and bundling:

    1. pop_topoplot + pop_headplot — 2-D/3-D map series; reuses sigprocfunc/topoplot.py; add headplot.py.
    2. pop_spectopo — channel/component spectra+maps; ports sigprocfunc/spectopo and pwelch plumbing.
    3. pop_erpimage — ERP image; ports sigprocfunc/erpimage core plus sort/align utilities.
    4. pop_timtopo + pop_plottopo + pop_plotdata — channel ERPs with maps / array / rect.
    5. pop_envtopo + pop_comperp — component ERP envelopes and ERP comparisons.
    6. pop_newtimef + pop_newcrossf — new functions/timefreqfunc/ (timef, crossf, newtimef, newcrossf, timewarp helpers); deterministic-numerics MATLAB parity with documented tolerances.
    7. pop_signalstat + pop_eventstat — functions/statistics/ (signalstat, eventstat); MATLAB parity for moments/distributions.
    8. pop_prop + pop_chanplot — properties dialog (reuses topoplot+spectopo+erpimage) and STUDY channel measures plot.

    Each component PR follows the eeglab-gui-visual-parity skill for the dialog, the eegprep-feature-development skill end-to-end, adds resources/help/<name>.md, replaces the matching entry in menu_placeholders.py, and adds headless plotting tests (Agg backend) plus MATLAB parity tests for deterministic numerical pieces.

    Open questions before implementation

    1. Confirm 8-component breakdown above, or prefer finer/coarser grouping (e.g. one PR per pop_*)?
    2. Acceptable tolerance for time-frequency parity (newtimef/newcrossf inherit FFT/wavelet windowing differences vs MATLAB)? Suggest 1e-6 absolute on power, 1e-4 on phase, documented per test.
    3. Should pop_headplot ship without the MATLAB MESH/SPLINE bundled head model, or is fetching/regenerating that mesh in-scope for Phase 4?
    4. Browser/scrolling viewers (pop_eegplot) are out of scope — confirm pop_erpimage interactive features that rely on eegplot callbacks (e.g. trial scroll) can render statically without those callbacks?
    5. STUDY-dependent pop_chanplot — does this depend on Phase 5 STUDY workflows, or is the standalone channel-measure plot path in-scope here?
    6. Visual parity baseline images — generate against the vendored MATLAB EEGLAB build per skill, or accept screenshots from the EEGLAB sccn build the maintainers run?

    Awaiting decisions on Q1–Q6 before opening the first component PR.

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