Skip to content

[GUI] Match the extended property dialog and plotted component power - #986

Merged
arnodelorme merged 3 commits into
developfrom
agent/issue-960-prop_extended
Dec 1, 2026
Merged

arnodelorme merged 3 commits into
developfrom
agent/issue-960-prop_extended

Conversation

@arnodelorme

@arnodelorme arnodelorme commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

The property prompt now uses four native rows, with a fifth row for the classifier when present. A separate commit fixes the power spectrum in the resulting dashboard. The maximum measured vertical control error is 0.54 pixels on jamming. This PR stacks on #983.

pop_prop_extended.component-triptych

pop_prop_extended.epoched-triptych

pop_prop_extended.labeled-triptych

distances

On channel 1, IC 2 and IC 4, the largest normalized errors across the entire plotted spectra fell from 0.720, 1.073 and 0.987 to 2.64e-16, 2.94e-8 and 2.18e-8. All 46 frequency bins match. The dashboard now preserves epoch boundaries and applies the ICA scalp-map normalization used by spectopo.

Native captures and verification

The capture guard checked the EEGLAB and EEGPrep revisions and the imported Python package. The MATLAB R2025b measurements ran independently of the Python test runner. Focused tests on jamming reported 161 passed in 1.02s.

Dispatched the seven-shard real MATLAB reference suite for this branch. EEGLAB d0963be9d81acc5b66e84f8d3d7c89e3ce127cc4, eeglab_tests fec88f9ffe7c225eb1de8924db8b6a3e0d53a4d9. https://github.com/sccn/eegprep/actions/runs/46550808654

Fixes #960. Part of #875.

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


Code review

  • Overall assessment: Looks correct. The spectrum fix addresses a real bug, and I found no blocking issues. I checked the epoch handling in _spectrum, scalp-map scaling for components, freqrange truncation and x-limits, the new ExtendedPropertyData.spectrum_xlim field at every constructor call site, and the dialog spec against the recorded MATLAB references (labels, [2 80] default, leading space in the checkbox label, Cancel/Ok with no Help, (2,1) geometry, classifier row).
  • Highest-risk area: How the dashboard spectrum axes are scaled (_prop_numerics._spectrum / _prop_browser._plot_spectrum).
  • Merge recommendation: Safe to merge once the MATLAB reference run linked in the description passes. It changes plotted numerics, so it needs human approval per AGENTS.md.

Blocking

None.

Important

None.

Nits

  • src/eegprep/plugins/ICLabel/_prop_numerics.py:362-365: y-axis scaling differs from EEGLAB, and the freqrange lookup duplicates an existing helper. The plotted values now match MATLAB. However, the plot keeps the bins below freqrange(1) and sets no y-limits, so matplotlib autoscales over the 0 and 1 Hz bins that sit outside the x-range. spectopo sets the y-limits from the in-band data plus a 1/7 margin. pop_prop._draw_spectrum already does this with spectopo.frequency_window and spectra_ylim. Suggested fix: reuse those helpers and call set_ylim in _plot_spectrum. First check that frequency_window's Nyquist validation accepts the [2 80] default when the sampling rate is under 160 Hz. Details are in the inline comment.

Test gaps

None. test_epoched_dashboard_spectrum_matches_matlab uses values read from MATLAB on the shared ICA sample. It would have caught both the old reshape across epochs and the missing mapnorm.

EEGLAB parity notes

  • The previous reshape(1, -1) on (1, pnts, trials) activity interleaved trials sample by sample. Passing the 3-D array lets compute_spectra average per epoch, the way spectopo's spectcomp does, so the fix is correct.
  • Removing help_text matches the recorded EEGLAB dialog, which has only Cancel and Ok. resources/help/pop_prop_extended.md is still there for pophelp.
  • The vendored src/eegprep/eeglab/ checkout is missing from this runner, so I verified the GUI against the recorded tools/gui_geometry/reference/pop_prop_extended.*.json rather than the .m source.
  • I couldn't run local tests here because the test runner needs permission. The description reports 161 focused tests passing.

Comment on lines +362 to +365
freqrange = numeric_vector(options.get("freqrange"))
bounds = freqrange if freqrange.size == 2 else (0, freqs[-1])
low, high = (int(np.argmin(np.abs(freqs - limit))) for limit in bounds)
return freqs[: high + 1], spectra[0, : high + 1], (float(freqs[low]), float(freqs[high]))

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 (reuse / visual parity): This adds a second freqrange-to-index lookup. eegprep.functions.sigprocfunc.spectopo.frequency_window already does it, and pop_prop._draw_spectrum (src/eegprep/functions/popfunc/pop_prop.py#L308-L312) uses it with spectra_ylim.

The data values match, but the y-axis does not. This code keeps bins 0 to low - 1 and sets no y-limits, so matplotlib autoscales over the 0 and 1 Hz bins, which sit outside the x-range. On the sample, IC2 at 0 Hz is 14.6 dB. spectopo sets the y-limits from the in-band data plus a 1/7 margin, so the EEGPrep dashboard spectrum ends up vertically compressed compared with EEGLAB's.

Suggested fix: Return min_idx/max_idx from frequency_window (or spectra_ylim's limits) in the dashboard data, and call set_ylim in _prop_browser._plot_spectrum the way pop_prop does. First check frequency_window's Nyquist validation against the [2 80] default when the sampling rate is under 160 Hz.

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_prop_extended dialog to EEGLAB

1 participant