Repository navigation
Stream 3: Scroll window - #558
Conversation
Click and drag in the scroll window mark data again, an epoch click marks that epoch only, and Reject records eeg_eegrej or pop_rejepoch through pop_newset. Inspect/reject data by eye shows the instruction dialog first. Co-authored-by: Suraj Ranganath <[email protected]>
Co-authored-by: Suraj Ranganath <[email protected]>
56f7a66 to
92b69c4
Compare
The clean_rawdata sample dialog leaves its rejection browser open, so the next scroll-window test saw two windows. Close that browser, and use a Qt message box so macOS keeps the dialog title. Co-authored-by: Suraj Ranganath <[email protected]>
macOS leaves QMessageBox window titles empty, so the inspect-by-eye and epoch-reject prompts now use a dialog whose title stays set. Co-authored-by: Suraj Ranganath <[email protected]>
|
claude review this |
|
@claude review this |
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.
|
Claude finished @suraj-ranganath's task in 1m 44s —— View job Review of PR #558 (Stream 3: Scroll window)
Overall this looks good. The Bugs1. The epoch "reject?" question also appears when if reject and _epoch_reject_pending(EEG, winrej) and not _confirm_epoch_rejection():
returnNo current test covers this; a test for Parity: please check against EEGLAB2. The 3. There are now two different
This also removes the second Design / AGENTS.md4. 5. Stale comment. 6. Unexplained test change. Minor
Testing
This changes core ported code ( |
| options.setdefault("winrej", _initial_continuous_winrej(EEG, icacomp)) | ||
|
|
||
| def _accept(winrej: np.ndarray) -> None: | ||
| if _epoch_reject_pending(EEG, winrej) and not _confirm_epoch_rejection(): |
There was a problem hiding this comment.
Important: the confirmation also runs when reject=0. In mark-only mode ("Update Marks"), any marked epoch now triggers "Are you sure, you want to reject the labeled trials ?", and answering NO drops the mark update. qt.py::_open_rejection_browser calls pop_eegplot(..., reject=0) from the rejection dialogs' scroll buttons, so this path is reachable from the GUI. EEGLAB only asks from pop_rejepoch on the reject path.
| if _epoch_reject_pending(EEG, winrej) and not _confirm_epoch_rejection(): | |
| if int(bool(reject)) and _epoch_reject_pending(EEG, winrej) and not _confirm_epoch_rejection(): |
| return_com=True, | ||
| ) | ||
| if accept_callback is not None: | ||
| if accept_callback is not None and accept_command: |
There was a problem hiding this comment.
Important: with epoched reject=1 and every mark cleared, apply_eegplot_rejections now returns command == "". This guard then skips the callback, so the cleared EEG.reject.rejmanual computed by _store_epoch_marks is never stored. Repro: open Reject by inspection with existing manual marks, unmark them all, press Reject. The old marks are still there. EEGLAB's eeg_rejmacro writes rejmanual even when it rejects nothing.
Suggested fix: still call the callback with the updated dataset and an empty command, and have the menu callback store it in place without history.
|
Claude finished @suraj-ranganath's task in 1m 20s —— View job Code review: PR #558 (Stream 3: Scroll window), second pass
There are no new commits since the first review. The newest commit, Blocking1. The Important2. Clearing every epoch mark and pressing Reject does not save the cleared marks. See 3. The Nits
Test gaps
EEGLAB parity notes
I did not run tests or pre-commit in this pass. There are no new commits since the first review, which ran |
Ask before epoch rejection only when Reject removes trials, store cleared manual marks without a new history command, and record eeg_eegrej and pop_rejepoch with EEGLAB's reduced argument text. Co-authored-by: Suraj Ranganath <[email protected]>
|
Claude finished @suraj-ranganath's task in 1m 40s —— View job Code review: PR #558 (Stream 3: Scroll window), third pass
Earlier findings: all fixed in
|
| Earlier finding | Status |
|---|---|
The epoch question opened even with reject=0 |
Fixed. pop_eegplot.py:93 now checks reject first. |
Clearing every mark and pressing Reject lost the cleared rejmanual |
Fixed. The callback now always runs, and accept_eegplot stores an empty command in place with no history. |
eeg_eegrej history used the raw 7-column rows |
Fixed. The command is now built from the reduced regions that eeg_eegrej(..., return_regions=True) returns. |
Two pop_rejepoch history formats |
Fixed. apply_eegplot_rejections now uses the command that pop_rejepoch returns, and _history_command uses the line-101 format. |
_ask_dialog belonged in guifunc and had no parent |
Fixed. It is now guifunc/questdlg2.py. When no parent is passed it uses the visible EEGPrep main window (main_window.py:77). |
Stale cb_eegplotrej* comment |
Fixed (removed). |
Window-cleanup changes in test_sample_data_pop_functions.py |
Fixed (reverted). |
I traced _matlab_integer_row by hand against EEGLAB's contarray:
| Input | Output |
|---|---|
[1 2 3 4 7] |
1:4 7 |
[1 3 5 7] |
1:2:7 |
[1 2 4 5] |
1 2 4 5 |
[1 1 1 1] |
1 1 1 1 |
A row vector ends with a space and a matrix uses ; between rows. So a single region gives EEG = eeg_eegrej( EEG, [3 5] ); and an epoch reject gives EEG = pop_rejepoch( EEG, [2 4] ,0);. Both match the EEGLAB format.
Blocking
None.
Important
None.
Nits
- Unused parameter.
pop_rejepoch._history_command(indices, _confirm)ignores_confirm, because EEGLAB always records,0. AGENTS.md says to "remove imports, variables, functions … that your change made unused". Drop the parameter and update the two call sites atpop_rejepoch.py:38,41. - One-sample epochs.
eegbrowser.py_toggle_epoch:if epoch_end > epoch_startdoes nothing whenpnts == 1. Use>=so a click still marks a one-sample epoch. This is an edge case and not blocking.
Test gaps
None. The new tests cover:
reject=0storing marks with no question- clear-all with Reject
- NO, close and YES on the epoch question
- Cancel and close on the instruction dialog
- both history strings
EEGLAB parity notes
-
Closing a dialog with the window X does not continue, while EEGLAB continues unless the button pressed is
CancelorNO. This difference is intentional, documented and tested, so it is fine. -
This PR changes ported core code (
eeg_eegrej,pop_rejepochhistory,pop_eegplot). AGENTS.md requires one EEGLAB reference run before human approval: either theeeglab-reference.ymlworkflow or a local run with--eeglab-backend=matlab. The PR body should give:- the exact command or workflow run
- the pinned EEGLAB and
eeglab_testscommits - pass/fail/skip counts and runtime
The jamming numbers in the body don't say whether they came from that suite.
I did not run tests or pre-commit in this pass. The sandbox did not allow uv run, so the GUI interaction tests were not run here either.
A one-sample epoch click stores that epoch, and pop_rejepoch history no longer takes an unused confirm flag. Co-authored-by: Suraj Ranganath <[email protected]>
|
Claude finished @suraj-ranganath's task in 44s —— View job Code review: PR #558 (Stream 3: Scroll window), fourth pass
What changed since the last pass
I checked whether moving the
BlockingNone. ImportantNone. NitsNone. Test gapsNone. The new one-sample-epoch test locks the edge case. EEGLAB parity notes
I could not run tests in this pass because the sandbox needs approval for Checked for correctness bugs, EEGLAB parity, data structure compatibility, changed-behavior tests, and CLAUDE.md/AGENTS.md compliance. |
Keep both changelog entries after #558 and #563. Co-authored-by: Suraj Ranganath <[email protected]> # Conflicts: # docs/source/changelog.rst
Scroll-window marking, reject history, and the inspect-by-eye dialog now follow EEGLAB. Refs #547
EEGBrowserCanvas._event_scene_pointcalledmapToSceneon the viewport. The viewport is aQWidget. Qt swallowed theAttributeError, so no mark was stored.QGraphicsView.mapToScene(PySide 6.11takes aQPoint). Continuous drags mark 1-based samplesround(x * srate) + 1, matchingeegplot.mlines 2110-2144.test_gui_continuous_drag_marks_one_based_samples_and_click_clears;test_scroll_window_region_removed_by_eeg_eegrej_is_exactmapToScenecrash. After that, a click with no movement only calledtoggle_sample, which removes a mark and never adds one.eegplot.mlines 2130-2135), including a one-sample epoch. Reject asks thepop_rejepoch.mlines 78-84 question. NO or closing the dialog leaves the epochs. YES removes them.test_gui_epoch_click_marks_one_epoch_and_drag_does_not_spread;test_gui_one_sample_epoch_click_marks_that_epoch;test_gui_epoch_reject_no_and_close_keep_trials_yes_opens_pop_newset;test_apply_eegplot_rejections_epoch_command_matches_pop_rejepoch_historymapToScenepath. Component mode is still epoched data.test_gui_component_epoch_click_marks_that_epochpop_newsetand no historypop_eegplot(...), already recorded at open, so it was dropped.store_current(new=True)appended the dataset.EEG = eeg_eegrej( EEG, [start end] );from the reduced two-column regions. Epoch reject history isEEG = pop_rejepoch( EEG, [indices] ,0);. A shorter dataset from the GUI menu goes throughpop_newset. Cancel restores the original dataset and does not record the rejection. An empty mark records nothing.test_gui_reject_cancel_keeps_dataset_and_ok_records_eeg_eegrej_and_pop_newset;test_apply_eegplot_rejections_empty_continuous_reject_records_nothing;test_apply_eegplot_rejections_removes_continuous_regions_and_inserts_boundaryreject, so it never matchedpop_eegplot.mlines 180-186 (nargin < 4on continuous data).eeglab.mline 644 callspop_eegplot(EEG, 1).superposeandreject. The dialog text is thepop_eegplot.mlines 181-185 warning. Cancel does not open the browser. Plot > Channel data (scroll) still passesreject(eeglab.mline 683) and skips the dialog.test_gui_inspect_by_eye_cancel_and_close_do_not_open_browser;test_gui_channel_scroll_skips_instruction_dialog;test_show_false_omitted_reject_does_not_open_a_dialognormalize_eventssorts labels and_EVENT_COLORSis{r, [0 0.8 0], m, c, k, b, [0 0.8 0]}fromeegplot.mlines 1164-1171. On the tutorial types,rtis red andsquareis green.test_string_event_types_use_eegplot_unique_palette;test_gui_event_lines_keep_distinct_eegplot_colorsUpdate Marks (
reject=0) storesrejmanualand does not ask the epoch question. Clearing every epoch mark and pressing Reject storesrejmanualas all false and does not add a history command. Question dialogs go throughquestdlg2, parented to the EEGPrep window. Closing one still does not continue.This touches the Stream 11-owned
_run_pop_functionpop_eegplotbranch inmenu_actions.py. That edit is required for F63 and F52: Inspect/reject data by eye must callpop_eegplotwithoutsuperposeorrejectso the instruction dialog runs, and a GUI accept that shortens the dataset must go through_commit_processed_dataset_from_guisopop_newsetruns. An empty accept command stores the dataset in place and does not add history. A dispatch with no parent widget still appends withoutpop_newset, because that helper overwrites when the dialog is off. The interactive menu always passes the main window.console.pyis unchanged. Aneegprep-consolepop_eegplotaccept stores the returned dataset directly and does not openpop_newset. The command it stores is now theeeg_eegrejorpop_rejepochhistory string.Closing the instruction dialog or the epoch question does not continue. EEGLAB continues unless the button text is
CancelorNO(pop_eegplot.mline 186,pop_rejepoch.mlines 81-84). That difference is locked by the cancel/close tests.EEGLAB reference run on jamming at a645e0f:
uv run --no-sync pytest --eeglab-backend=matlab --eeglab-root=<pinned EEGLAB> --eeglab-suite-root=<pinned eeglab_tests> tests/test_eegplot.py tests/test_stream3_scroll_window.py tests/test_eeg_eegrej.py. This was the three named files (tests/test_eegplot.py,tests/test_stream3_scroll_window.py,tests/test_eeg_eegrej.py) run with--eeglab-backend=matlabat a645e0f. EEGLABd0963be9d81acc5b66e84f8d3d7c89e3ce127cc4. eeglab_testsfec88f9ffe7c225eb1de8924db8b6a3e0d53a4d9. 59 passed, 0 failed, 0 skipped, plus 15 subtests, in 13.58s. The history strings matched live EEGLAB character for character.An earlier full-suite MATLAB run on jamming was 1732 passed, 1 failed, 13 skipped; the one failure is the known R2025b
pop_rereffloat32 average-reference case.Refs #547