Skip to content

[GUI] ICA decomposition dialog - #1044

Merged
arnodelorme merged 5 commits into
developfrom
agent/issue-1005-runica-dialog
Dec 1, 2026
Merged

arnodelorme merged 5 commits into
developfrom
agent/issue-1005-runica-dialog

Conversation

@arnodelorme

@arnodelorme arnodelorme commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

ICA decomposition dialog · #1005, part of #875. Stack base PR #1028.

Continuous

Epoched

Vertical control alignment

Matched ICA activations

Across 2 native openings, maximum vertical control displacement was 0.55 px. The largest difference in overall width was 0.74 px. Of 3 output comparisons, 0 met tolerance. Same 2,048 recorded samples; four, five, or six channels; standard infomax, fixed stream, at most 128 steps. Matched components by maximum absolute correlation, centered and scaled channels to unit RMS, and aligned signs before comparing activations. The worst matched absolute correlation was 0.999851. The cause of the remaining waveform differences is unverified. The reporting threshold is 1e−5. Raw outputs, commands and checks are in tools-extra/numeric-inputs/.

EEGPrep lists the ICA backends it can run. In three recorded-data decompositions the aligned components correlated at least 0.99985, while peak relative waveform differences of 0.00398 to 0.00452 exceeded the 0.00001 tolerance.

Clean Linux checkouts on jamming. EEGLAB 5e0be87059098662dc9b50fb378f9002b0ef173a, EEGPrep 2c3b624b15bcf6a842ca1ece109576001dd35f7b. Fixes #1005.

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


Code review

  • Overall assessment: Good to merge once the docs fix below is made; the rest are small fixes. I checked the dialog spec change (layout="supergui", the trailing \n label, the removed fixed size and dataset stylesheet), the recorded pop_runica cases against the Python controls, the relaxed backend-list assertion in test_gui_geometry.py, and the new record_geometry.m entries.
  • Highest-risk area: the user-facing docs sentence, and the always-enabled ... types button on datasets that have no channel types.
  • Merge recommendation: Needs changes (minor).

Blocking

None.

Important

  • docs/source/api/ica_and_components.rst:55 says the dialog "uses the installed EEGPrep backends". It does not. _ALGORITHMS (pop_runica.py:25-33) is a fixed tuple. The list always shows AMICA and Picard, whatever is installed. "The channel type and label selectors are alongside their input" is also a layout note, not user guidance. Replace it with a sentence that describes what the user sees, for example the fixed algorithm list, the default options filled in on selection, and the type/label pickers. I left a suggestion inline.

Nits

  • ... types with no channel types (pop_runica.py:144-153). Dropping enabled=bool(types) matches the recorded EEGLAB uilist. But when types == [], _select_channels (qt.py:1918-1928) opens a free-text box titled "Select channel / Channel index or label". That is the wrong prompt for a type selector. EEGLAB's pop_chansel returns on empty input without opening a picker. The fix is to add "no_channels_message": "No channel types are defined for this dataset." to the callback params, which the handler already supports. I couldn't post this inline because lines 148-152 sit outside the diff hunk.
  • Inaccurate test comment (tests/test_gui_geometry.py:251). The comment says the list "depends on the installed ICA implementations". The real reason it differs from EEGLAB is that EEGPrep ships a different, fixed backend set: it adds AMICA and Picard and has no acsobiro or "Executable runica" entries.
  • Unrelated import reordering (tests/test_gui_geometry.py:9-57). About 30 lines of imports are reordered, and a blank line is removed in pop_runica.py:24. Ruff only selects E4/E7/E9/F, with no isort rule, so neither change is required. AGENTS.md asks to avoid "broad formatting-only diffs mixed with behavior changes". Consider limiting the diff to the two new imports.

Test gaps

  • Only the single-dataset dialog is recorded (pop_runica / pop_runica.continuous). This PR also removes the fixed 404 px height and the 50 px QListWidget#dataset stylesheet used by the multi-dataset dialog (dataset list plus the two concatenate rows), and nothing now covers that layout. A pop_runica.multi case recorded with pop_runica(ALLEEG) on two datasets would catch a regression in how tall the dataset list is drawn.

EEGLAB parity notes

  • The vendored src/eegprep/eeglab/functions/popfunc/pop_runica.m isn't in this checkout. I took parity from tools/gui_geometry/cases/pop_runica.json, recorded at EEGLAB 5e0be87. Control order, labels, geometry [(2,1.5),(2,1.5),(1,),(2,1,1,1)], geomvert [3,1,1,1] and the trailing \n on the first label all match.
  • The algorithm list differs from EEGLAB on purpose, since EEGPrep ships different backends. The test now checks only that the shared entries keep EEGLAB's order and that Extended Infomax is the default. That is a reasonable way to relax the check.
  • No numerical code changed. The ICA waveform differences in the PR body (worst correlation 0.99985; peak relative difference 0.0040–0.0045, above the 1e-5 threshold) come from the existing backend, not this dialog change. Track them separately rather than in this GUI PR.

Comment thread tests/test_gui_geometry.py Outdated
described = [_described(control) for control in spec.controls]
expected = [_described(control) for control in recorded.controls]
if name.split(".")[0] == "pop_runica":
# The list of backends depends on the installed ICA implementations.

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.

Nit: This comment is inaccurate. _ALGORITHMS in pop_runica.py is a static tuple, so the list never depends on which ICA implementations are installed. The list differs from the reference because EEGPrep ships a different backend set: it adds AMICA and Picard, and has no acsobiro/"Executable runica" entries. Suggested wording: # EEGPrep offers a different ICA backend set than EEGLAB; compare only the shared entries.

Comment thread docs/source/api/ica_and_components.rst Outdated
Select the anatomical T1 MRI in the file chooser. The head-model prompt displays the BIDS sidecar indicator, when available, in its
read-only fiducial fields. MRI segmentation requires a separate FieldTrip workflow.

The ICA decomposition window sizes the algorithm list to three rows and uses the installed EEGPrep backends. The channel type and label selectors are alongside their input.

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 (docs accuracy): The dialog does not detect "installed" backends. It always lists the seven fixed _ALGORITHMS entries (

_ALGORITHMS = (
("runica", "Extended Infomax (runica.m; default)", "'extended', 1"),
("runica", "Robust Extended Infomax (runica.m; slow)", "'extended', 1, 'lrate', 1e-5, 'maxsteps', 2000"),
("runamica15", "AMICA (slowest; best)", "'maxiter', 2000"),
("picard", "Infomax picard.m", "'maxiter', 500, 'mode', 'standard'"),
("picard", "FastICA picard.m (fastest)", "'maxiter', 500"),
("sobi", "SOBI (sobi.m function)", ""),
("jader", "Jade (jader.m function)", ""),
)
logger = logging.getLogger(__name__)
), including AMICA, whether or not its binary is present. "The channel type and label selectors are alongside their input" also reads like layout notes rather than user guidance. Suggested replacement:

Suggested change
The ICA decomposition window sizes the algorithm list to three rows and uses the installed EEGPrep backends. The channel type and label selectors are alongside their input.
The ICA decomposition dialog lists the algorithms EEGPrep supports (Extended Infomax, AMICA, Picard, SOBI and JADE) in a three-row list. Choosing an algorithm fills in its default command-line options. The **... types** and **... channels** buttons next to the channel field pick channels by type or by label.

@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: Needs changes for the multi-dataset list box height. Single-dataset dialog geometry, first-item list box width measurement, empty channel-type warning, and Sphinx docs match the intended behavior.
  • Highest-risk area: Multi-dataset dataset list box height in pop_runica_dialog_spec after switching to layout="supergui".
  • Merge recommendation: Needs changes.

Blocking

None.

Important

  • Multi-dataset dataset list box shrinks to one edit-box line (src/eegprep/functions/popfunc/pop_runica.py lines 174 to 201). Switching pop_runica_dialog_spec to layout="supergui" and removing extra_stylesheet (min-height: 50px and max-height: 50px on QListWidget#dataset) makes _FigureLayout size every row strictly from geomvert. Because geomvert.extend([1, 1, 1]) gives the dataset list box row a weight of 1, the multi-select QListWidget renders at single-line edit height (24 px on Linux and 36 px on macOS, where the second item's bottom sits at 37 px and is clipped). Suggested fix: change geomvert.extend([1, 1, 1]) to geomvert.extend([2, 1, 1]) (about 50 px on Linux, matching the removed stylesheet) or geomvert.extend([3, 1, 1]) if EEGPrep keeps its dataset selector row, or drop the dataset row if strict parity with EEGLAB pop_runica.m lines 228 to 238 is preferred.

Nits

  • Unused QDialog#pop_runica QListWidget stylesheet rule (src/eegprep/functions/guifunc/qt.py lines 1027 to 1035). Now that pop_runica_dialog_spec (the only DialogSpec with function_name="pop_runica") uses layout="supergui", _apply_eeglab_style replaces row_layout_sizes before applying the stylesheet, making lines 1027 to 1030 unreachable (AGENTS.md asks to remove code made unused by the change). Suggested fix: delete the QDialog#pop_runica QListWidget block from row_layout_sizes.

Test gaps

  • tests/test_gui_geometry.py covers single-dataset pop_runica and pop_runica.continuous, while test_qt_renderer_defaults_to_all_selected_dataset_rows in tests/test_gui_pop_runica.py lines 284 to 294 checks only selected indices. Adding an assertion that widgets["dataset"].height() fits at least two rows when pop_runica_dialog_spec([first, second]) is built would guard the multi-dataset layout.

EEGLAB parity notes

  • Verified in MATLAB R2025b that uicontrol('Style', 'listbox') reports Extent from item 1 regardless of Value ([0, 0, 29.33, 18.67] on {'short', 'much longer second item'} for both Value = 1 and Value = 2), matching _text_extent in src/eegprep/functions/guifunc/qt.py lines 1189 to 1196 and test_runica_width_follows_first_visible_algorithm_only.
  • Checked against EEGLAB functions/popfunc/pop_runica.m at 5e0be87059098662dc9b50fb378f9002b0ef173a (lines 189 to 238): single-dataset control order, trailing newline on the first prompt label, geometry, geomvert, shared algorithm order, and keeping ... types enabled with a warning when no channel types exist all match EEGLAB. For length(ALLEEG) > 1, EEGLAB adds only the two concatenate checkbox rows (geomvert = [geomvert 1 1]), whereas EEGPrep adds a dataset list box row above them.
  • Tests run in a detached worktree at 9833fbde58c0645bfe5946dc0a30a41028f6e40a on macOS: pytest tests/test_gui_geometry.py tests/test_gui_pop_runica.py (133 passed, 54 Linux pixel-reference cases skipped), pytest tests/test_guifunc_primitives.py tests/test_gui_long_task.py (17 passed, 1 deselected), and ruff check plus ruff format --check on the four modified Python files (all passed).

@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. Checked single-dataset and multi-dataset supergui geometry, first-item QListWidget text extent measurement, empty channel-type warning handling, Sphinx documentation, and GUI tests.
  • Highest-risk area: None identified.
  • Merge recommendation: Safe to merge.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None.

EEGLAB parity notes

  • Single-dataset control order, trailing newline on the first prompt label, geometry, geomvert, shared algorithm order, first-item list box Extent width measurement in _text_extent, and keeping ... types enabled with a warning dialog when no channel types exist all match EEGLAB functions/popfunc/pop_runica.m (lines 189 to 238 and 269 to 271).
  • For multiple datasets (dataset_count > 1), EEGLAB adds only the two concatenate checkbox rows (geomvert = [geomvert 1 1]), whereas EEGPrep adds a dataset selector list box above them. Setting geomvert.extend([2, 1, 1]) sizes QListWidget#dataset to 76 px high on macOS (19 px per item row) and about 51 px on Linux, fitting multiple dataset rows cleanly.
  • Tests run in a detached worktree at 16ba9128bc3468a152eb01ffa67272ccfd058504 on macOS: pytest tests/test_gui_geometry.py tests/test_gui_pop_runica.py (134 passed, 54 Linux pixel-reference cases skipped), pytest tests/test_guifunc_primitives.py (14 passed, 1 deselected), ruff check and ruff format --check on the four modified Python files (passed), ty check on the modified package modules (passed), and pre-commit.py on all 10 changed files (passed).

@arnodelorme
arnodelorme changed the base branch from agent/issue-998-dipfit_headmodel to develop December 1, 2026 17:43
Keep develop's PUBLIC_CALLS table and add the two pop_runica cases,
keep both documentation paragraphs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@arnodelorme
arnodelorme merged commit ccaa5fd into develop Dec 1, 2026
5 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.

[GUI] Match the pop_runica dialog to EEGLAB

1 participant