Skip to content

[GUI] Match component envelope options and ICA prerequisites - #1012

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

arnodelorme merged 3 commits into
developfrom
agent/issue-875-plot-envtopo

Conversation

@arnodelorme

@arnodelorme arnodelorme commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Match component envelope options and ICA prerequisites. The epoched window measured 273 px high in MATLAB, 406 px before the fix and 273 px afterward. Stack base is #1010.

Epoched

Displacement

Peak plotted envelope per time point

Across 1 native openings, the largest vertical control offset was 0.56 px (target 1 px). Numerical comparison of peak plotted envelope per time point: 2/2 measured cases within tolerance.

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

Fixes #1013.

Full inventory report for the project team. pop_envtopo (p. 42). 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 7s —— View job


Code review: PR #1012 (pop_envtopo dialog parity)

  • Gather context and check that the head commit matches (d6b3b854)
  • Review the diff against origin/agent/issue-875-plot-spectopo
  • Post the review

Assessment: the dialog changes look correct. The inputdlg2_geometry / supergui layout, the dialog_time_range defaults and the 'electrodes','off' default all match the recorded EEGLAB case in tools/gui_geometry/cases/pop_envtopo.json. The only real gap is that nothing tests the new check that stops the dialog when ICA is missing.

Highest-risk area: the new ICA check before the dialog opens (pop_envtopo.py:54-55).
Merge recommendation: safe to merge once a test covers that check (see Test gaps).

Blocking

None.

Important

None.

Nits

  • src/eegprep/functions/popfunc/pop_envtopo.py:55, error message. The new message says what is wrong but not how to fix it. The repo standard for error messages asks for the exact fix. Suggested text: "pop_envtopo: no ICA decomposition; run ICA first (Tools > Decompose data by ICA, or pop_runica(EEG)) before plotting component envelopes".
  • pop_envtopo.py:54, which fields the check reads. The new check looks only at icasphere, but _component_mean (pop_envtopo.py:240) rejects a dataset when either icaweights or icasphere is empty. If icaweights is empty and icasphere is set, the dialog still opens and the user only gets an error after pressing OK. Checking both fields here would make the two checks agree.

Test gaps

  • The PR's main behavior change is that a single dataset without ICA now raises before the dialog opens, where before it failed only after OK. No test covers this. Suggested test, placed next to test_pop_envtopo_blank_gui_subcomps_removes_none in tests/test_phase4_plot_wrappers.py:
    def test_pop_envtopo_gui_requires_ica_before_dialog(ica_epoch):
        class Renderer:
            def run(self, spec, initial_values=None):
                raise AssertionError("dialog must not open without ICA")
    
        eeg = deepcopy(ica_epoch)
        eeg["icasphere"] = np.array([])
        with pytest.raises(ValueError, match="pop_envtopo: .*ICA"):
            pop_envtopo(eeg, gui=True, renderer=Renderer())

EEGLAB parity notes

None. The recorded case matches the EEGPrep dialog spec: 7 rows with [1 0.6] geometry, the same labels, and time limits formatted with num2str. The vendored src/eegprep/eeglab/ checkout was empty in this run, so I could not compare pop_envtopo.m line by line. The comparison above relies on the MATLAB-recorded case files the PR adds.

The review covered correctness, EEGLAB parity, data structure compatibility, tests for the changed behavior, and AGENTS.md compliance.

Not done:

  • I did not run the tests, because running pytest in this environment needed approval.
  • I could not post this as a separate gh pr comment, because writing the body file needed approval. The review is in this comment instead.

@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: Looks good.
  • Highest-risk area: None identified.
  • Merge recommendation: Safe to merge.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None.

EEGLAB parity notes

None.

Checked for correctness bugs, EEGLAB parity (functions/popfunc/pop_envtopo.m lines 66 to 99 and functions/guifunc/inputdlg2.m lines 86 to 104, including single-dataset vs compare-mode ICA checks, inputdlg2_geometry with supergui layout, dialog_time_range defaults, and 'electrodes','off'), data structure compatibility, Sphinx documentation (docs/source/api/interactive_pop_workflows.rst), changed-behavior tests, and CLAUDE.md/AGENTS.md compliance.

Tests run on detached worktree at 26841d293d7b353004785942ff4f8b26ba4d6bcf:

  • pytest tests/test_gui_geometry.py tests/test_phase4_plot_wrappers.py tests/test_envtopo.py tests/test_stream7_plots.py: 218 passed, 82 skipped (Linux-only reference pixel checks on macOS and MATLAB-engine checks), 0 failed.
  • QT_QPA_PLATFORM=offscreen pytest tests/test_stream11_help_errors.py -k "test_f64_f81_no_ica_is_reported_before_opening_settings or pop_envtopo": 15 passed, 0 failed.
  • QT_QPA_PLATFORM=offscreen pytest tests/test_popfunc_visual_eeglab_tests.py -k pop_envtopo: 1 passed, 0 failed.
  • uv run --no-sync ruff check on changed Python files: passed.

@arnodelorme
arnodelorme changed the base branch from agent/issue-875-plot-spectopo to develop December 1, 2026 07:09
@arnodelorme
arnodelorme merged commit b8203e1 into develop Dec 1, 2026
3 checks 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_envtopo: Match component envelope options and ICA prerequisites

1 participant