Skip to content

[GUI] Ask pop_eegplot epoch options before Reject by inspection - #803

Merged
arnodelorme merged 6 commits into
developfrom
agent/20261128-fix-793
Nov 28, 2026
Merged

arnodelorme merged 6 commits into
developfrom
agent/20261128-fix-793

Conversation

@claude

@claude claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

EEGPrep after: the two questions before the browser opens, for data epochs and for ICA

EEGLAB and EEGPrep before (Linux, jamming, November 28 run)

pop_eegplot: EEGLAB asks two questions, EEGPrep before opened the browser at once

On epoched data with events, pop_eegplot(EEG, icacomp) called without superpose and reject now asks EEGLAB's two questions before the browser opens: "Add to previously marked rejections? (checked=yes)", checked by default, and "Reject marked trials? (checked=yes)", unchecked by default. Cancel opens no browser and records no command. The answers become superpose and reject, and the history reads pop_eegplot(EEG, icacomp, superpose, reject). The dialog lives in pop_eegplot itself, as in pop_eegplot.m, so the three menu entries that call pop_eegplot(EEG, 1) or pop_eegplot(EEG, 0) (Tools > Inspect/reject data by eye, and both Reject by inspection entries) and a call typed in eegprep-console behave the same.

Details and tests

The dialog is skipped, as in EEGLAB, when superpose or reject is given (Plot > Channel data (scroll), Plot > Component activations (scroll), pop_rejmenu), on continuous data, when the dataset has no events, and with show=False. Tests cover the menu cancel path, mark-only with earlier marks kept, ICA rejection, a console-path cancel, and a dataset without events. Docs, help and changelog are updated.

Fixes #793

🤖 Generated with Claude Code

Both Reject by inspection entries now ask whether to add to previously
marked rejections and whether to reject marked trials before the browser
opens, as pop_eegplot.m does. Cancel opens no browser.

Fixes #793

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor Author

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 Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Claude finished @claude[bot]'s task in 1m 2s —— View job


Code review

  • Overall assessment: Needs changes. In the GUI, the dialog's text, defaults (add to previous marks checked, reject unchecked), titles, cancel path, and history command all match EEGLAB's pop_eegplot.m. The dialog is in the wrong layer, though, so the console path still differs from EEGLAB.
  • Highest-risk area: MenuActionDispatcher pop_eegplot branch (menu_actions.py:1440-1446) and pop_eegplot().
  • Merge recommendation: Needs changes.

Blocking

None.

Important

  • The epoch options dialog is in the menu dispatcher instead of pop_eegplot (src/eegprep/functions/guifunc/menu_actions.py:1440-1446). In EEGLAB, pop_eegplot.m asks the two questions itself whenever it is called with fewer than 3 arguments on epoched data. The menu just calls pop_eegplot(EEG, icacomp).
    • With this PR, pop_eegplot(EEG, 1) typed in eegprep-console on epoched data still opens the browser silently in Reject mode with prior marks hidden (superpose=0, reject=1). The same call in EEGLAB asks first.
    • That breaks the AGENTS.md rule that GUI and console are "one user experience". It is also inconsistent with the continuous-data instruction dialog, which already lives in pop_eegplot and keys off reject_omitted.
    • Fix: move the call to pop_eegplot_epoch_options(icacomp) into pop_eegplot, under show and reject_omitted and trials > 1 (cancel returns (None, "")). Then drop the explicit superpose/reject for the reject_data/reject_ica variants in the dispatcher. Details are in the inline comment.

Nits

None.

Test gaps

  • If the dialog moves into pop_eegplot, add one console-path test: call pop_eegplot(epoched_eeg, 1, return_com=True, command_callback=...), cancel the dialog, and assert that no browser opens and the command is empty.
  • The three new GUI tests (cancel, mark-only with prior marks kept, ICA reject) and the updated reject=True drivers in the existing test already cover the menu path well.

EEGLAB parity notes

  • I checked the following against EEGLAB functions/popfunc/pop_eegplot.m (the nargin < 3 && EEG.trials > 1 block). They match:
    • Labels: "Add to previously marked rejections? (checked=yes)" and "Reject marked trials? (checked=yes)".
    • Geometry: [2 0.2] ×2.
    • Defaults: 1 and 0.
    • Titles: "Manual component rejection" for ICA and "Reject epochs by visual inspection" for data.
    • Cancel returns without opening the browser.
    • History: pop_eegplot(EEG, icacomp, superpose, reject).
  • The no-ICA precondition in dispatch() still runs before the new dialog, so test_f64_f81_no_ica_is_reported_before_opening_settings[pop_eegplot:reject_ica] is unaffected.
  • The docs, changelog, and resources/help/pop_eegplot.md are updated consistently.

Checked for correctness bugs, EEGLAB parity, data structure compatibility, changed-behavior tests, and CLAUDE.md/AGENTS.md compliance. I did not run the tests in this job.

Comment on lines +1440 to +1446
# eeglab.m calls pop_eegplot(EEG, icacomp) for both Reject by inspection entries,
# so pop_eegplot.m asks how to apply marks before the browser opens.
if variant in {"reject_data", "reject_ica"} and parent is not None:
epoch_options = pop_eegplot_epoch_options(icacomp)
if epoch_options is None:
return
superpose, reject = epoch_options

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Important (EEGLAB parity / GUI–console consistency): The options dialog is added in the menu dispatcher, but in EEGLAB it belongs to pop_eegplot.m itself. It runs when nargin < 3 && EEG.trials > 1. Because the comment here says "eeglab.m calls pop_eegplot(EEG, icacomp)", the prompt comes from the pop function, not from the menu.

As written, the menu asks the questions. A console user who types pop_eegplot(EEG, 1) on epoched data does not get them: the browser opens with superpose=0, reject=1 (Reject mode, prior marks hidden). In EEGLAB, the same call asks first. The continuous-data instruction dialog already lives inside pop_eegplot (reject_omitted at

)
if show and reject_omitted and reject and trials <= 1 and not _confirm_continuous_reject_instructions():
return (None, "") if return_com else None
), so the epoch dialog belongs next to it.

Suggested fix:

  • In pop_eegplot, when show and reject_omitted and trials > 1, call pop_eegplot_epoch_options(icacomp). Return (None, "") / None on cancel, and otherwise set superpose, reject from the result.
  • Here, stop passing superpose/reject for the reject_data/reject_ica variants and remove this block. The history command then still comes out as pop_eegplot(EEG, icacomp, superpose, reject).
  • Add one console-path test: pop_eegplot(epoched_eeg, 1, return_com=True, command_callback=...) with the dialog cancelled opens no browser.

@arnodelorme
arnodelorme merged commit b9ad81c into develop Nov 28, 2026
11 of 12 checks passed
@arnodelorme

Copy link
Copy Markdown
Collaborator

Follow-up to the review, after #776 was merged.

The dialog is now inside pop_eegplot, as in pop_eegplot.m, not in the menu dispatcher. On epoched data with events, a call without superpose and reject asks the two questions first, whether it comes from the menu or from eegprep-console. The dispatcher no longer passes superpose and reject for the Reject by inspection entries. A console-path test checks that Cancel opens no browser and returns no command.

A second review found one EEGLAB condition missing: pop_eegplot.m asks only when EEG.event is not empty. That condition is added, with a test. The two rows of eegbrowser.rst now show pop_eegplot(EEG, 1) and pop_eegplot(EEG, 0). Tools > Inspect/reject data by eye on epoched data also asks now, which matches eeglab.m (it calls pop_eegplot(EEG, 1) too).

Captures are at the top of the description. Develop was merged into the branch twice (no force push). The only failing CI check is the Windows test test_window_without_a_height_is_as_high_as_its_rows that came with #776 and fails on every branch.

The review is now clean and every other check passes, so I merged it with a squash, as Arno asked. After #804, #690 and #830 were merged their changelog entries conflicted with this one, so develop was merged in once more (changelog only); the pop_eegplot and menu tests, lint and docs build passed again before the merge.

— orchestrator

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_eegplot (Reject by inspection, data epochs and ICA): graphical and numerical parity with EEGLAB

1 participant