Repository navigation
[GUI] Display the channel reference and original index as read-only fields - #944
arnodelorme wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
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.
arnodelorme
left a comment
There was a problem hiding this comment.
This review was written by an AI assistant during a nightly check, not by Arno.
Code review
- Overall assessment: needs changes
- Highest-risk area: channel navigation state and coordinate display in
pop_chanedit(src/eegprep/functions/guifunc/qt.py,src/eegprep/functions/popfunc/pop_chanedit.py) - Merge recommendation: needs changes
Blocking
None.
Important
-
Returning to channel 1 leaves
field_urchanblank instead of showing"1"(src/eegprep/functions/guifunc/qt.py,_store_displayed_fields,, andeegprep/src/eegprep/functions/guifunc/qt.py
Lines 1833 to 1844 in d4aae6b
src/eegprep/functions/popfunc/pop_chanedit.py,pop_chanedit_dialog_spec,)eegprep/src/eegprep/functions/popfunc/pop_chanedit.py
Lines 99 to 134 in d4aae6b
- Why it matters:
pop_chanedit_dialog_specinitializes thefield_urchancontrol on channel 1 withvalue=""(matchingpop_chanedit.mlines 347 to 349) while storing"1"infield_displays[0]["field_urchan"]. Becausefield_urchannow renders as aQLabel(display_as_text=True), clicking>runs_store_displayed_fields(widgets, displays[0]), which readsQLabel.text()("") via_read_widgetand overwritesdisplays[0]["field_urchan"]with"". Clicking<to return from channel 2 to channel 1 then shows""instead of"1"for the rest of the session, contradicting both EEGLAB (pop_chanedit.mlines 509 to 511 and 1064 to 1073, which fillsnum2str(chans(1).urchan)on cursor movement) and the new documentation indocs/source/api/interactive_pop_workflows.rst("Moving between channels shows the original channel index using one-based numbering"). - Suggested fix: Skip read-only
QLabelwidgets in_store_displayed_fields(if widget is None or _qt_isinstance(widget, "QLabel"): continue) so navigation only snapshots user-editable controls and preservesdisplays[0]["field_urchan"] == "1".
- Why it matters:
-
_display_channel_valueoverwrites stored non-blank polar and spherical coordinates fromX,Y,Z(src/eegprep/functions/popfunc/pop_chanedit.py,_display_channel_value,)eegprep/src/eegprep/functions/popfunc/pop_chanedit.py
Lines 609 to 620 in d4aae6b
- Why it matters: Adding
or _is_blank(chan.get(field))inverted the guard in_display_channel_value. Whenchan.get(field)is blank, line 615 now returns""immediately. Whenchan.get(field)is non-blank, execution falls through to lines 616 to 619 and runs_cart_to_all(converted)wheneverX,Y, andZare present, replacing the stored field value on screen. For example, afteredited = pop_chanedit(eeg, "changefield", [1, "radius", 0.65])oneeglab_data.set(or after typing0.65infield_radiusand clicking Set reference), EEGLABpop_chanedit.m(lines 350 and 1069) shows"0.65", whereaspop_chanedit_dialog_specshows"0.50669"recomputed fromX,Y,Z. Because_store_form_edits(line 272) also compares form text against_display_channel_value(current, field), a user cannot even reset that field back to"0.50669"on Ok. - Suggested fix: Return
_display_value(chan.get(field, ""))directly for every field other than"urchan"in_display_channel_value(matchingpop_chanedit.mlines 350 and 1069, which never recompute coordinates during field display) and remove the unused_cart_to_allhelper. If coordinate completion on rawX/Y/Zchannel dicts withoutthetaorsph_thetais needed when opening the dialog, runeeg_checkchanlocsonce at dialog initialization aspop_chanedit.mline 268 does.
- Why it matters: Adding
Nits
None.
Test gaps
- In
test_pop_chanedit_protects_reference_and_backup_index_in_gui(tests/test_phase1b_file_edit_pop_functions.py,), clickeegprep/tests/test_phase1b_file_edit_pop_functions.py
Lines 558 to 561 in d4aae6b
widgets["back1"]afterwidgets["next1"]and assertwidgets["field_urchan"].text() == "1". - Add an assertion that opening
pop_chanedit_dialog_specafterpop_chanedit(eeg, "changefield", [1, "radius", 0.65])displays"0.65"infield_radiusrather than recomputing"0.50669"fromX,Y,Z.
EEGLAB parity notes
- Rendering
field_refandfield_urchanas centeredQLabelwidgets while measuring them as"edit"controls insupergui(display_as_text=True) matches EEGLABpop_chanedit.mlines 354 to 356 and 421 to 422 (comevalswitchingchanediturchanandchaneditreffromedittotextaftersuperguilayout). - Starting channel 1
field_urchanas""matchespop_chanedit.mline 347 (~isfield(chans, 'urchans')), allowingSHOWN_VALUESintests/test_gui_geometry.pyto be removed cleanly. Addressing the two items above will align subsequent channel navigation and coordinate display withpop_chanedit.mas well.
Tests run
PYTHONPATH=<worktree>/src:<worktree> .venv/bin/python -m pytest <worktree>/tests/test_gui_geometry.py <worktree>/tests/test_phase1b_file_edit_pop_functions.py: 170 passed, 33 skipped (32 Linux-only MATLAB reference pixel checks, 1 MATLAB engine check), 10 deselected in 12.34s.PYTHONPATH=<worktree>/src:<worktree> .venv/bin/python -m pytest <worktree>/tests/test_phase2_file_channel_location.py: 15 passed, 25 deselected in 1.51s..venv/bin/ruff checkand.venv/bin/ruff format --checkon the 5 modified Python files: all passed.
Display the channel reference and original index as read-only fields. The continuous window measured 671 px high in MATLAB, 671 px before the fix and 671 px afterward. Stack base is #929.
Across 2 native openings, the largest vertical control offset was 0.69 px (target 1 px). Numerical comparison of retained eeg samples and channel labels: 2/2 measured cases within tolerance. The channel reference and original index now render as static text. The Set reference action and one-based navigation remain available.
EEGLAB
5e0be870, EEGPrep afterd4aae6b3, clean Linux checkouts. Part of #875.Fixes #947.
Full inventory report for the project team. pop_chanedit (p. 5). PDF · Editable Word.