Skip to content

Phase 6: STUDY and group-level depth #137

Closed

Description

@suraj-ranganath

🤖

Phase 6: STUDY And Group-Level Depth

Summary

Deepen EEGPrep STUDY and group-level workflow parity using the statistics and time-frequency helpers from earlier phases. This phase should improve real multi-dataset research workflows without pretending external-only LIMO behavior is available.

Starts after Phases 1, 3, and 4. Can overlap with Phase 5 if interfaces are stable.

Scope

Prioritize:

  • design and variable helpers used by real STUDY workflows
  • measure readers/writers for ERP/ERSP/ITC/spec/topo/PAC where backed by EEGPrep data
  • plotting helpers that consume Phase 3 and Phase 4 outputs
  • deterministic clustering helpers
  • file consistency checks and dataset/session synchronization

LIMO and external-toolbox paths must be real standalone EEGPrep behavior or clear user-facing limitations. Do not silently fake them.

Acceptance Criteria

  • STUDY, CURRENTSTUDY, ALLEEG, and CURRENTSET stay synchronized in GUI and console.
  • Multi-dataset sample fixtures exercise design, precompute/read/write, plotting, and clustering basics.
  • MATLAB parity covers deterministic STUDY structures, design metadata, and measures where feasible.
  • GUI flows include visual parity and GUI Agent mixed-flow QA.
  • Documentation and help resources explain supported STUDY behavior and limitations.
  • Matrix rows touched by this phase are updated.

Verification

Run focused STUDY tests, multi-dataset sample workflows, MATLAB parity where deterministic, GUI visual parity for dialogs, GUI Agent mixed GUI/console QA, then:

  • uv run --no-sync ruff check .
  • uv run --no-sync ruff format --check .
  • uv run --no-sync ty check
  • broader tests as risk requires

/goal Prompt

/goal Complete the useful remaining STUDY/group-level EEGLAB parity depth. Build standalone design, measure, plotting, clustering, consistency, and session synchronization workflows using Phase 3/4 helpers, with MATLAB parity, multi-dataset sample fixtures, GUI visual parity, console tests, clear handling of external-only LIMO behavior, and parity matrix updates.

Activity

  1. added
    phase
    on Jun 5, 2026
  2. claude commented on Jun 5, 2026

    @claude
    Contributor

    🤖 Plan:

    Scope check

    This is a phase-epic scope item (multi-module, >100 LOC, design work) per .agents/skills/fix-issue/SKILL.md. No PR will be opened. Posting research + proposed approach for human review.

    Also: prerequisite phases #132 (Phase 1), #134 (Phase 3), #135 (Phase 4) are all still OPEN, and the epic branch feature/eeglab-core-parity-completion has no Phase 1/3/4 merges yet (git log shows only extension-completion and session-history work). Per #131 the recommended order is 1 -> 2+3+4 -> 5+6 -> 7 -> 8. Phase 6 cannot land usefully until Phases 1, 3, 4 expose their stable APIs.

    Research

    EEGPrep already ships 32 studyfunc modules covering core design, precompute/read, clustering, and basic plotting; EEGLAB has ~133. The audit (.notes/eeglab-migration-gap-audit.md#L146-L164) classifies the remaining surface into five buckets: LIMO/stats, design/variable helpers, measure readers, plotting, clustering details, and consistency/file checks. STUDY/CURRENTSTUDY are already wired into the shared EEGPrepSession namespace and console workspace.

    Relevant code

    • src/eegprep/functions/studyfunc/ — 32 ported modules incl. std_makedesign, std_precomp, std_readdata, pop_clust, pop_clustedit, std_*plot
    • src/eegprep/functions/adminfunc/console.py#L26 — WORKSPACE_NAMES already includes STUDY/CURRENTSTUDY
    • src/eegprep/functions/adminfunc/console.py#L332-L388 — bidirectional STUDY sync between session and namespace
    • tests/test_study_metadata.py, tests/test_study_measures.py, tests/test_study_clustering.py, tests/test_study_end_to_end.py, tests/test_gui_pop_study.py — 58 existing STUDY tests total
    • .notes/eeglab-migration-gap-audit.md#L146-L164 — explicit Phase 6 target list; #L517-L544 — full studyfunc gap inventory

    Gaps with no current port: std_readerp/ersp/itc/spec/topo/pac, std_savedat, pop_addindepvar, pop_importgroupvar, pop_listfactors, std_builddesignmat, std_rebuilddesign, std_findgroupvars, std_saveindvar, std_plot/plotcurve/plottf/topoplot/chantopo/propplot, std_apcluster, std_centroid, std_dipoleclusters, std_findoutlierclust, optimal_kmeans, robust_kmeans, std_checkfiles, std_checkdatasession, std_uniformfiles, std_uniformsetinds, plus the LIMO surface (pop_limo, pop_limoresults, std_limo*, std_readfilelimo).

    No multi-dataset STUDY fixture exists under sample_data/ (only single-subject eeglab_data*.set).

    Proposed Approach

    Split Phase 6 across 4–5 sub-PRs against feature/eeglab-core-parity-completion, sequenced after Phases 1/3/4 land. Each sub-PR is independently mergeable, ~300–800 LOC, with its own help markdown, tests, and visual-parity artifacts where GUI-touching.

    1. 6a — Multi-dataset STUDY fixture + design/variable helpers. Add a small 2–3 subject synthetic STUDY (in tests/fixtures.py or sample_data/). Port pop_addindepvar, pop_importgroupvar, pop_listfactors, std_builddesignmat, std_rebuilddesign, std_findgroupvars, std_saveindvar, std_addvarlevel. Extends tests/test_study_metadata.py with MATLAB parity for deterministic design metadata.

    2. 6b — Measure readers/writers. Port std_readerp, std_readersp, std_readitc, std_readspec, std_readtopo, std_readpac, std_savedat. Consumes Phase 3 (statistics) and Phase 4 (timefreq) outputs — this is the hard dependency on prerequisite phases. Extends tests/test_study_measures.py.

    3. 6c — STUDY plotting helpers. Port std_plot, std_plotcurve, std_plottf, std_topoplot, std_chantopo, std_erpimageplot, std_propplot. Each adds a visual-parity case under tools/visual_parity/ per .agents/skills/eeglab-gui-visual-parity/SKILL.md.

    4. 6d — Clustering + consistency checks. Port std_apcluster, std_centroid, std_dipoleclusters, std_findoutlierclust, optimal_kmeans, robust_kmeans, std_checkfiles, std_checkdatasession, std_uniformfiles, std_uniformsetinds. Extends tests/test_study_clustering.py with deterministic seeds.

    5. 6e — LIMO classification + GUI/console mixed-flow QA. Per Phase 6: STUDY and group-level depth #137 "do not silently fake LIMO": classify the LIMO surface (pop_limo, pop_limoresults, std_limo*, std_readfilelimo) as either real standalone ports or explicit user-facing not-supported messages with help markdown under src/eegprep/resources/help/. Run gui-agent-flow-qa over the full GUI+console STUDY workflow. Update .notes/eeglab-migration-gap-audit.md matrix rows touched by Phase 6.

    Questions for the issue author

    1. LIMO direction: for 6e, do you want a real standalone port (large effort, requires a Python LIMO equivalent) or explicit not-supported stubs with classification rationale? Issue body says "real or clear user-facing limitations" — confirming not-supported stubs are acceptable for the first pass.
    2. Multi-dataset fixture: synthesized in-memory in tests/fixtures.py (smaller repo footprint) or a checked-in sample_data/study_3subj/ (closer to EEGLAB tutorial parity)?
    3. Sub-PR sequencing: is the 6a–6e split acceptable, or do you want a single phase branch with multiple commits (matches the existing Harden extension closeout coverage #126 / extension-closeout pattern)?
    4. Phase 1 dependency: the parity matrix from Phase 1: Parity matrix, staleness triage, and porting contracts #132 is referenced in Phase 6: STUDY and group-level depth #137 acceptance criteria ("Matrix rows touched by this phase are updated"). Should this wait for Phase 1: Parity matrix, staleness triage, and porting contracts #132 to land, or update the matrix inline?

    Will pause for human/issue-author direction before opening any sub-PR.

  3. suraj-ranganath commented on Jun 7, 2026

    @suraj-ranganath
    MemberAuthor

    🤖 Resolved by the work now included in PR #152. Closing this constituent phase/follow-up issue now; parent epic #131 remains open until the epic PR merges.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    phase

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions