Skip to content

[GUI] Match the dataset ERP comparison and plot options - #1017

Merged
arnodelorme merged 4 commits into
developfrom
agent/issue-875-plot-comperp
Dec 1, 2026
Merged

arnodelorme merged 4 commits into
developfrom
agent/issue-875-plot-comperp

Conversation

@arnodelorme

@arnodelorme arnodelorme commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Match the dataset ERP comparison and plot options. The epoched window measured 352 px high in MATLAB, 524 px before the fix and 352 px afterward. Stack base is #1014.

Epoched

Displacement

Average erp

Across 1 native openings, the largest vertical control offset was 0.68 px (target 1 px). Numerical comparison of average erp: 2/2 measured cases within tolerance.

EEGLAB 5e0be870, EEGPrep after 8689167e, clean Linux checkouts. Part of #875.

Fixes #1018.

Full inventory report for the project team. pop_comperp (p. 47). PDF · Editable Word.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

@claude

claude Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @arnodelorme's task in 1m 5s —— View job


Code review

  • Overall assessment: Needs changes. The layout matches the EEGLAB uilist and geometry recorded in tools/gui_geometry/cases/pop_comperp.json (EEGLAB 5e0be870). The Help button wiring (show_help → pophelp("plottopo"), using the new plottopo.md) follows the same pattern as pop_newcrossf. The problem is the new Help text: it describes options the "Plottopo options" field does not apply.
  • Highest-risk area: The "Plottopo options" field and its new Help text.
  • Merge recommendation: Needs changes.

Blocking

None.

Important

  • src/eegprep/resources/help/plottopo.md: the Help text describes options this field ignores.
    • The text says "Use ylimits to set a common vertical scale". But _plot_comperp reads only ydir from tplotopt (pop_comperp.py:326). The y-limits come from the separate ylim option (pop_comperp.py:333). Typing 'ylimits', [-5 5] in this field gives no error and changes nothing.
    • From the GUI, the field is never read at all. _run_gui (pop_comperp.py:182-200) never copies result["tplotopt"] into options, so even 'ydir', 1 has no effect. That bug was already there, but this PR adds a Help button that points users at the field.
    • Suggested fix: pass "tplotopt": result.get("tplotopt", "") through _run_gui. Then either apply a ylimits/ylim key from the parsed tplotopt options, or remove the ylimits sentence from plottopo.md.
    • Fix this →

Nits

  • The import reordering at the top of pop_comperp.py only re-sorts the existing imports and has nothing to do with this change. It's harmless, but it adds noise to a GUI-parity diff.

Test gaps

  • Nothing checks that the dialog's "Plottopo options" value reaches the plot. Suggested test in tests/test_phase4_plot_wrappers.py: have the fake renderer return tplotopt="'ydir', 1", then assert that the y axis of the resulting figure is not inverted. That test would catch the dropped field described above.

EEGLAB parity notes

  • These match the recorded EEGLAB case:

    • the merged header row: (2.6, 0.95) with a single "avg. std. all ERPs" text
    • the []=all label
    • the (1.48, 0.25, 1.75) RMS row
    • pophelp('plottopo') on the Help button

    No change needed. I couldn't open pop_comperp.m itself because the EEGLAB checkout isn't in this runner, so I compared against the case JSON recorded from EEGLAB instead.

I checked correctness, EEGLAB parity, data structure compatibility, tests for the changed behavior, and AGENTS.md compliance. I also left an inline comment on plottopo.md. I couldn't post the standalone gh pr comment (writing to /tmp was blocked), so this comment is the review summary.

Comment thread src/eegprep/resources/help/plottopo.md Outdated
@@ -0,0 +1,3 @@
# Plottopo options

Plottopo draws one trace panel per selected channel. Set `ydir` to 1 to draw positive values upward or -1 to draw them downward. Use `ylimits` to set a common vertical scale across traces.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important: this Help text describes options the "Plottopo options" field doesn't apply.

  • _plot_comperp reads only ydir from tplotopt:
    regions = np.asarray(pvalues, dtype=float)[:, mask] < float(alpha)
    ydir = int(parse_plot_options_text(str(options.get("tplotopt") or "")).get("ydir", -1))
    return plottopo(
    data,
    times=plot_times,
    chanlocs=chanlocs,
    title=str(options.get("title") or "ERP grand average"),
    ydir=ydir,
    ylimits=options.get("ylim"),
    rect=rect or not chanlocs,
    . The y-limits come from the separate ylim option, so typing 'ylimits', [-5 5] here changes nothing.
  • On the GUI path the field is dropped entirely, because _run_gui never copies tplotopt into options:
    alpha = numeric_vector(result.get("alpha", []))
    return {
    "datadd": numeric_vector(result.get("datadd", []), dtype=int).tolist(),
    "datsub": numeric_vector(result.get("datsub", []), dtype=int).tolist(),
    "options": {
    "chans": numeric_vector(result.get("chans", []), dtype=int).tolist(),
    "mode": "rms" if bool(result.get("mode_rms", False)) else "ave",
    "lowpass": numeric_vector(result.get("lowpass", [])).tolist(),
    "alpha": float(alpha[0]) if alpha.size else [],
    "addavg": "on" if bool(result.get("addavg", True)) else "off",
    "addstd": "on" if bool(result.get("addstd", False)) else "off",
    "addall": "on" if bool(result.get("addall", False)) else "off",
    "subavg": "on" if bool(result.get("subavg", True)) else "off",
    "substd": "on" if bool(result.get("substd", False)) else "off",
    "suball": "on" if bool(result.get("suball", False)) else "off",
    "diffavg": "on" if bool(result.get("diffavg", True)) else "off",
    "diffstd": "on" if bool(result.get("diffstd", False)) else "off",
    "diffall": "on" if bool(result.get("diffall", False)) else "off",
    },
    }
    . Even 'ydir', 1 has no effect.

Suggested fix: pass "tplotopt": result.get("tplotopt", "") through _run_gui. Then either honor a ylimits key from the parsed options or remove the ylimits sentence here.

@arnodelorme arnodelorme left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review was written by an AI assistant during a nightly check, not by Arno.

Code review

  • Overall assessment: Safe to merge.
  • Highest-risk area: GUI option forwarding for tplotopt and plottopo help wiring in pop_comperp.
  • Merge recommendation: Safe to merge.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None.

EEGLAB parity notes

None. The supergui row weights, merged header text, []=all prompt, pophelp('plottopo') button callback, and tplotopt forwarding match functions/popfunc/pop_comperp.m and the recorded R2025b geometry case.

Checked correctness, EEGLAB parity (pop_comperp.m and plottopo.m), data structure compatibility, tplotopt console history replay, options_help dialog callback, documentation updates, and AGENTS.md compliance.

Tests run on detached worktree at 363d642e5e883b7d483159dea824e89520e29cd1:

  • pytest tests/test_gui_geometry.py tests/test_phase4_plot_wrappers.py tests/test_guifunc_pophelp_chansel.py: 216 passed, 85 skipped (Linux reference pixel checks and MATLAB engine tests), 5 deselected.
  • pytest tests/test_stream11_help_errors.py tests/test_popfunc_visual_eeglab_tests.py -k "comperp or help": 27 passed, 24 deselected.
  • ruff check and ruff format --check on changed Python files: passed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pop_comperp: Match the dataset ERP comparison and plot options

1 participant