Repository navigation
Implement EEGBrowser Phase 2 UI shell - #104
Conversation
|
Claude finished @suraj-ranganath's task in 7m 43s —— View job Code review — EEGBrowser Phase 2 UI shell
BlockingNone. Important
Nits
Test gaps
EEGLAB parity notes
Checked: correctness/regression bugs in the diff, EEGLAB parity for menus/controls/keyboard, |
| has_events = variant in {"events", "labels"} | ||
| model = build_eegplot_model( | ||
| _demo_eegbrowser_eeg(epoched=epoched, events=has_events), | ||
| winlength=1.0 if epoched else 2.0, | ||
| dispchans=6, | ||
| spacing=1.2, | ||
| xgrid="on" if variant != "grid_off" else "off", | ||
| ygrid="on" if variant != "grid_off" else "off", | ||
| ) | ||
| if variant == "labels": | ||
| model.state.channel_label_mode = "labels" |
There was a problem hiding this comment.
Severity: important (EEGLAB visual parity)
_demo_eegbrowser_eeg always returns chanlocs with named labels, and BrowserState.channel_label_mode defaults to "labels" (see eegplot.py#L121). So all five capture variants render the channel axis as Fp1, Fp2, ….
But the MATLAB sides of eegbrowser_continuous/epoched/events/grid_off call eegplot(data, …) on a raw matrix with no eloc_file — EEGLAB's eegplot.m falls back to channel numbers in that case. Only eegbrowser_labels passes eloc_file = struct('labels', {...}).
Net effect: four of the five "parity" cases will systematically disagree with EEGLAB on the y-axis labels (named labels vs. numbers), undermining the visual evidence the PR is meant to produce.
The if variant == "labels": model.state.channel_label_mode = "labels" block on line 368-369 is also a no-op (it's the default) — looks like the inverse case was intended.
Concrete fix: force "numbers" for the non-labels variants so they match the MATLAB defaults:
| has_events = variant in {"events", "labels"} | |
| model = build_eegplot_model( | |
| _demo_eegbrowser_eeg(epoched=epoched, events=has_events), | |
| winlength=1.0 if epoched else 2.0, | |
| dispchans=6, | |
| spacing=1.2, | |
| xgrid="on" if variant != "grid_off" else "off", | |
| ygrid="on" if variant != "grid_off" else "off", | |
| ) | |
| if variant == "labels": | |
| model.state.channel_label_mode = "labels" | |
| has_events = variant in {"events", "labels"} | |
| model = build_eegplot_model( | |
| _demo_eegbrowser_eeg(epoched=epoched, events=has_events), | |
| winlength=1.0 if epoched else 2.0, | |
| dispchans=6, | |
| spacing=1.2, | |
| xgrid="on" if variant != "grid_off" else "off", | |
| ygrid="on" if variant != "grid_off" else "off", | |
| ) | |
| if variant != "labels": | |
| model.state.channel_label_mode = "numbers" |
Alternatively, drop chanlocs from _demo_eegbrowser_eeg and only inject them for the labels variant — that more faithfully mirrors what the MATLAB call sees.
| self.back_page_button = self._button("<<", lambda: browser.scroll_time(-0.9)) | ||
| self.back_step_button = self._button("<", lambda: browser.scroll_time(-0.2)) | ||
| self.forward_step_button = self._button(">", lambda: browser.scroll_time(0.2)) | ||
| self.forward_page_button = self._button(">>", lambda: browser.scroll_time(0.9)) |
There was a problem hiding this comment.
Severity: important (EEGLAB parity — please verify against eegplot.m)
< / > step by 0.2 * winlength and << / >> step by 0.9 * winlength. EEGLAB's eegplot.m single-arrow buttons advance by one full winlength and the double-arrow buttons by five winlengths (callback strings like eegplot('position', max(get(ED,'Value') - g.winlength, 0), …) and the equivalent 5 * g.winlength variant). 0.2/0.9 will feel like "scroll a fraction of the current window" rather than "next page / next 5 pages", and would be a noticeable behavioral regression for EEGLAB users.
The same fractions are also wired into keyboard shortcuts (line 202-205) and locked in by test_gui_navigation_buttons_and_position_field_update_visible_window, so this would become the contract once the PR lands.
Suggested fix (preserves the test by adjusting the input rather than the assertion):
| self.back_page_button = self._button("<<", lambda: browser.scroll_time(-0.9)) | |
| self.back_step_button = self._button("<", lambda: browser.scroll_time(-0.2)) | |
| self.forward_step_button = self._button(">", lambda: browser.scroll_time(0.2)) | |
| self.forward_page_button = self._button(">>", lambda: browser.scroll_time(0.9)) | |
| self.back_page_button = self._button("<<", lambda: browser.scroll_time(-5.0)) | |
| self.back_step_button = self._button("<", lambda: browser.scroll_time(-1.0)) | |
| self.forward_step_button = self._button(">", lambda: browser.scroll_time(1.0)) | |
| self.forward_page_button = self._button(">>", lambda: browser.scroll_time(5.0)) |
…and analogous updates to the keyboard shortcuts (Left/Right ≈ ±1.0, PageUp/PageDown ≈ ±5.0), plus update test_gui_navigation_buttons_and_position_field_update_visible_window and test_gui_keyboard_shortcuts_match_navigation_and_scale to reflect a 1 * winlength step. If you have a deliberate reason for the smaller fractions (e.g. matplotlib-style "small nudge"), please call it out in the PR description so it's an intentional deviation rather than a parity drift.
|
🤖 Confirmed the plot box issue and pushed a fix. Commit: What changed:
Checks:
Visual reports after the box fix:
EEGBrowser plot box parity v4
|
|
🤖 Fixed the missing Commit: What changed:
Checks:
Visual reports:
EEGBrowser event marker lines v5
|












Add the EEGLAB-style EEGBrowser shell with navigation controls, display/settings menus, scale and stack controls, event display, and visual parity capture cases. Align navigation and capture behavior with EEGLAB while leaving mark conversion and rejection mutation to the parallel Phase 3 work. Adds focused GUI and model tests.
Fixes #96