Skip to content

Stream 3: Scroll window - #558

Merged
suraj-ranganath merged 6 commits into
developfrom
cursor/stream3-scroll-window-3dc0
Nov 6, 2026
Merged

suraj-ranganath merged 6 commits into
developfrom
cursor/stream3-scroll-window-3dc0

Conversation

@suraj-ranganath

@suraj-ranganath suraj-ranganath commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Scroll-window marking, reject history, and the inspect-by-eye dialog now follow EEGLAB. Refs #547

Finding Root cause Fix Test
F51 Click-drag crashes EEGBrowserCanvas._event_scene_point called mapToScene on the viewport. The viewport is a QWidget. Qt swallowed the AttributeError, so no mark was stored. Map the viewport point through QGraphicsView.mapToScene (PySide 6.11 takes a QPoint). Continuous drags mark 1-based samples round(x * srate) + 1, matching eegplot.m lines 2110-2144. test_gui_continuous_drag_marks_one_based_samples_and_click_clears; test_scroll_window_region_removed_by_eeg_eegrej_is_exact
F103 Epoch click crashes, and Reject has no confirmation Same mapToScene crash. After that, a click with no movement only called toggle_sample, which removes a mark and never adds one. On epoched button-down, mark or clear that whole epoch and do not drag across epochs (eegplot.m lines 2130-2135), including a one-sample epoch. Reject asks the pop_rejepoch.m lines 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_history
F106 ICA epoch click crashes Same viewport mapToScene path. Component mode is still epoched data. Same epoch click path. test_gui_component_epoch_click_marks_that_epoch
F52 Reject creates a dataset with no pop_newset and no history The accept command was pop_eegplot(...), already recorded at open, so it was dropped. store_current(new=True) appended the dataset. Continuous reject history is EEG = eeg_eegrej( EEG, [start end] ); from the reduced two-column regions. Epoch reject history is EEG = pop_rejepoch( EEG, [indices] ,0);. A shorter dataset from the GUI menu goes through pop_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_boundary
F63 No instruction dialog before Inspect/reject data by eye The menu always passed reject, so it never matched pop_eegplot.m lines 180-186 (nargin < 4 on continuous data). eeglab.m line 644 calls pop_eegplot(EEG, 1). Tools > Inspect/reject data by eye omits superpose and reject. The dialog text is the pop_eegplot.m lines 181-185 warning. Cancel does not open the browser. Plot > Channel data (scroll) still passes reject (eeglab.m line 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_dialog
F80 Event markers look like one colour Verified, not a bug for string event types. normalize_events sorts labels and _EVENT_COLORS is {r, [0 0.8 0], m, c, k, b, [0 0.8 0]} from eegplot.m lines 1164-1171. On the tutorial types, rt is red and square is green. No behavior change. Numeric event types are still sorted as strings; the audit screenshot uses string types, so that sort was left alone. test_string_event_types_use_eegplot_unique_palette; test_gui_event_lines_keep_distinct_eegplot_colors

Update Marks (reject=0) stores rejmanual and does not ask the epoch question. Clearing every epoch mark and pressing Reject stores rejmanual as all false and does not add a history command. Question dialogs go through questdlg2, parented to the EEGPrep window. Closing one still does not continue.

This touches the Stream 11-owned _run_pop_function pop_eegplot branch in menu_actions.py. That edit is required for F63 and F52: Inspect/reject data by eye must call pop_eegplot without superpose or reject so the instruction dialog runs, and a GUI accept that shortens the dataset must go through _commit_processed_dataset_from_gui so pop_newset runs. An empty accept command stores the dataset in place and does not add history. A dispatch with no parent widget still appends without pop_newset, because that helper overwrites when the dialog is off. The interactive menu always passes the main window.

console.py is unchanged. An eegprep-console pop_eegplot accept stores the returned dataset directly and does not open pop_newset. The command it stores is now the eeg_eegrej or pop_rejepoch history string.

Closing the instruction dialog or the epoch question does not continue. EEGLAB continues unless the button text is Cancel or NO (pop_eegplot.m line 186, pop_rejepoch.m lines 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=matlab at a645e0f. EEGLAB d0963be9d81acc5b66e84f8d3d7c89e3ce127cc4. eeglab_tests fec88f9ffe7c225eb1de8924db8b6a3e0d53a4d9. 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_reref float32 average-reference case.

Refs #547

Open in Web Open in Cursor 

cursoragent and others added 2 commits November 6, 2026 00:36
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]>
@cursor
cursor Bot force-pushed the cursor/stream3-scroll-window-3dc0 branch from 56f7a66 to 92b69c4 Compare November 6, 2026 00:37
cursoragent and others added 2 commits November 6, 2026 00:59
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]>

Copy link
Copy Markdown
Member Author

claude review this

@suraj-ranganath

Copy link
Copy Markdown
Member Author

@claude review this

@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 Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 1m 44s —— View job


Review of PR #558 (Stream 3: Scroll window)

  • Read diff
  • Check EEGLAB parity (eeg_eegrej, pop_eegplot, pop_rejepoch)
  • Check GUI/console flow
  • Ran tests
  • Post review

Overall this looks good. The mapToScene fix is the correct root cause for F51, F103 and F106. Routing a shortened dataset through _commit_processed_dataset_from_gui fixes F52. Using a sentinel for an omitted reject is a clean way to copy nargin < 4 for F63. I found one real bug, one likely parity gap in history, and some duplication.

Bugs

1. The epoch "reject?" question also appears when reject=0. pop_eegplot.py:92
_accept calls _epoch_reject_pending(EEG, winrej) without checking reject. On epoched data with reject=0 ("Update Marks" mode, e.g. console pop_eegplot(EEG, 1, 1, 0)), the user marks a trial and clicks Update Marks. They are then asked "Are you sure, you want to reject the labeled trials ?" even though nothing will be removed. If they answer NO, the marks are not saved to EEG.reject.rejmanual either. Suggested fix:

if reject and _epoch_reject_pending(EEG, winrej) and not _confirm_epoch_rejection():
    return

No current test covers this; a test for reject=0 with epoched marks would catch it.
Fix this →

Parity: please check against EEGLAB

2. The eeg_eegrej history string records the raw eegplot2event rows. pop_eegplot.py:166
The command is built from the 7-column eegplot2event output, so the test expects EEG = eeg_eegrej( EEG, [-1 1 3 5 0.7 1 0.9]);. As far as I remember, in eeg_eegrej.m com is built after regions = regions(:,3:4) and combineregions. That means EEGLAB records the merged 2-column [beg end] sample regions, e.g. [3 5]. The command still replays correctly, but ALLCOM and EEG.history would differ from EEGLAB and be hard to read. The vendored EEGLAB is not in this checkout, so I could not confirm line 194. If I'm right, build the command from the sorted, sliced and combined regions, ideally by having the eeg_eegrej port return its own com, as the PR description implies.

3. There are now two different pop_rejepoch history formats. pop_eegplot.py:182-193
apply_eegplot_rejections throws away the command returned by pop_rejepoch(..., return_com=True) and builds its own in _epoch_reject_command. The new one is pop_rejepoch( EEG, [..],0); the existing pop_rejepoch._history_command gives pop_rejepoch(EEG, [..], 1). Per AGENTS.md ("no parallel implementations of existing helpers"), it would be simpler to:

  • make pop_rejepoch._history_command produce the EEGLAB line-101 format, and
  • call pop_rejepoch(out, trial_marks, 0, return_com=True) and use its command.

This also removes the second np.flatnonzero(...) + 1 index conversion.

Design / AGENTS.md

4. _ask_dialog belongs in guifunc. pop_eegplot.py:218-250
This is a general Qt question dialog with a lazy PySide6 import inside a popfunc module. EEGLAB uses questdlg2 and warndlg2 from functions/guifunc/. guifunc/ already has errordlg2.py, inputdlg2.py and listdlg2.py, so a guifunc/questdlg2.py matches the repo map and can be reused. The dialog also has no parent. With ApplicationModal and no parent, it can open behind the main window on some window managers. Consider passing the browser or main window as the parent.

5. Stale comment. menu_actions.py:1931
The comment says cb_eegplotrej* omit optional args. Now only variant == "data" omits them; reject_data and reject_ica still pass superpose and reject. Behavior is the same, because the instruction dialog only shows on continuous data. Please update the comment so it doesn't mislead.

6. Unexplained test change. tests/test_sample_data_pop_functions.py
_close_eeg_browsers and the try/finally around pop_clean_rawdata look like cleanup for a window leak. The PR description doesn't explain why a pop_clean_rawdata test now leaves EEGBrowserWindows open, presumably from the vis_artifacts path. If the leak is new, fix the root cause. If it already existed, a shared fixture in tests/fixtures.py or conftest.py is better than a one-off helper with local imports. It's also out of scope for this PR.

Minor

  • eegbrowser.py:_toggle_epoch: if epoch_end > epoch_start silently does nothing when pnts == 1. This is an edge case, but >= would mark a 1-sample epoch.
  • eegbrowser.py:_event_scene_point: the hasattr(point, "toPoint") check is fine for Qt. Since PySide 6.11 is the target, you could call event.position().toPoint() directly. The existing hasattr(event, "position") style is already used there, though.
  • Changing the continuous-data history to eeg_eegrej / pop_rejepoch affects the console as well (PR body notes this). If tests/test_console_workspace.py checks the stored pop_eegplot command, it's worth a quick look.

Testing

uv run pytest tests/test_stream3_scroll_window.py tests/test_eegplot.py: 26 passed, 11 skipped. The skips are 9 GUI tests (no libEGL on this runner) plus 2 MATLAB tests. That means the new Qt interaction tests did not run here. Only the non-GUI logic and command-string tests were checked locally. I did not run pre-commit or the full suite, since this was a review-only request.

This changes core ported code (pop_eegplot, through eeg_eegrej and pop_rejepoch). Per AGENTS.md, it needs the eeglab-reference.yml run, with its results in the PR body, before human approval. The jamming run in the description covers eeg_eegrej regions but not the history strings in point 2.

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():

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: 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.

Suggested change
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:

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: 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.

@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 6, 2026 03:16
@claude

claude Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 1m 20s —— View job


Code review: PR #558 (Stream 3: Scroll window), second pass

  • Overall assessment: Needs changes. The mapToScene fix (F51/F103/F106), sending shortened datasets through pop_newset (F52), and using the _REJECT_OMITTED sentinel to copy EEGLAB's nargin < 4 check (F63) are all correct. The two regressions I raised in the first review are still in the code.
  • Highest-risk area: pop_eegplot._accept in mark-only (reject=0) and clear-all-marks flows.
  • Merge recommendation: Needs changes.

There are no new commits since the first review. The newest commit, e8d6899, was pushed at 01:17Z, before that review. So this pass re-checks those findings against the code. Two of them now have a concrete GUI path that reaches them.

Blocking

1. The pop_rejepoch question also opens in mark-only mode. See pop_eegplot.py:92.
_accept asks "Are you sure, you want to reject the labeled trials ?" without checking reject. This is reachable from the GUI: the Scroll button in the rejection dialogs, qt.py:1443-1449 _open_rejection_browser, calls pop_eegplot(..., reject=0). On epoched data, marking a trial and pressing Update Marks opens a "reject?" question even though nothing will be removed. If the user answers NO, the marks are not saved to rejmanual. EEGLAB only asks this on the pop_rejepoch reject path.
Fix: if reject and _epoch_reject_pending(EEG, winrej) and not _confirm_epoch_rejection():. Add a test that reject=0 on epoched data with a marked trial stores rejmanual without calling the dialog.

Important

2. Clearing every epoch mark and pressing Reject does not save the cleared marks. See pop_eegplot.py:102.
With epoched data, reject=1, and no marks, _epoch_reject_command returns "". The new and accept_command guard then drops the dataset, even though _store_epoch_marks already cleared rejmanual. Repro: open Reject data epochs by eye with existing manual marks, unmark them all, and press Reject. The old marks come back the next time the browser opens. Before this PR the callback always ran.
Fix: always call the callback. Have accept_eegplot in menu_actions.py store an empty command in place without adding history. It currently returns early on not command at line 1253, so that line needs to change too.

3. The eeg_eegrej history records the raw 7-column eegplot2event rows. See pop_eegplot.py:166.
The EEGPrep eeg_eegrej port slices regions[:, 2:4] and then calls _combine_regions before it removes data (eeg_eegrej.py:322-324). EEGLAB's eeg_eegrej.m builds com from those reduced regions. The result is [3 5], not [-1 1 3 5 0.7 1 0.9]. The command replays the same way, but ALLCOM and EEG.history will not match EEGLAB, and the colour columns make the history hard to read. The vendored EEGLAB is not in this checkout, so the MATLAB line still needs to be confirmed. The jamming MATLAB run checked the removed regions, not this string.
Fix: build the command from the reduced 2-column regions, ideally by returning them from the eeg_eegrej port. Then update test_eegplot.py:286.

Nits

  • Two pop_rejepoch history formats. See pop_eegplot.py:189.
    • _epoch_reject_command builds pop_rejepoch( EEG, [..],0), while pop_rejepoch._history_command builds pop_rejepoch(EEG, [..], 1).
    • The command returned by pop_rejepoch is thrown away as _reject_command.
    • Fix: switch _history_command to the EEGLAB format. Then call pop_rejepoch(out, trial_marks, 0, return_com=True) and use the command it returns. AGENTS.md says: "Parallel implementations of existing helpers."
  • Stale comment. menu_actions.py:1931 says cb_eegplotrej* omit optional arguments, but now only variant == "data" omits them.
  • _ask_dialog belongs in guifunc. See pop_eegplot.py:216.
    • It is a general question dialog, and its PySide6 import is inside the function in a popfunc module.
    • EEGLAB uses questdlg2 from guifunc, which already has errordlg2.py, inputdlg2.py and listdlg2.py.
    • The dialog has no parent, so with ApplicationModal it can open behind the main window.
  • Test helper with local imports. _close_eeg_browsers in tests/test_sample_data_pop_functions.py imports inside the function. If the vis_artifacts browser leak was already there, use a shared fixture in tests/fixtures.py or conftest.py. Otherwise this cleanup is out of scope for this PR.

Test gaps

  • reject=0 on epoched data with a marked trial: rejmanual is stored and the question dialog does not open (finding 1).
  • reject=1 on epoched data when previously stored manual marks have all been cleared: rejmanual ends up all false (finding 2).

EEGLAB parity notes

  • Closing the instruction dialog or the epoch question with the window X does not continue. EEGLAB only stops when the button text is Cancel or NO. This difference is intentional, documented, and covered by tests, so it's fine.
  • This changes core ported code (pop_eegplot → eeg_eegrej/pop_rejepoch history). AGENTS.md requires the eeglab-reference.yml run, or a local MATLAB-backend run, with its results in the PR body before human approval.

I did not run tests or pre-commit in this pass. There are no new commits since the first review, which ran tests/test_stream3_scroll_window.py and tests/test_eegplot.py: 26 passed and 11 skipped. The skips were the GUI tests (no libEGL on the runner) and the MATLAB tests. I did not repeat the inline comments for findings 1 and 2; they are already on the PR.

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]>
@suraj-ranganath
suraj-ranganath marked this pull request as draft November 6, 2026 04:22
@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 6, 2026 04:22
@claude

claude Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 1m 40s —— View job


Code review: PR #558 (Stream 3: Scroll window), third pass

  • Read diff against origin/develop at d1ee493

  • Re-check findings from the earlier reviews

  • Check correctness and EEGLAB parity

  • Post review

  • Overall assessment: Looks good. I checked the browser click and drag path, the confirmation gating, both reject history strings, the pop_newset routing, questdlg2, and the matlab_array2str port.

  • Highest-risk area: accept_eegplot in menu_actions.py. It has three branches: empty command, new dataset through pop_newset, and store in place.

  • Merge recommendation: Safe to merge after the EEGLAB reference run below. The two nits are optional.

Earlier findings: all fixed in d1ee493

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 at pop_rejepoch.py:38,41.
  • One-sample epochs. eegbrowser.py _toggle_epoch: if epoch_end > epoch_start does nothing when pnts == 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=0 storing 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 Cancel or NO. This difference is intentional, documented and tested, so it is fine.

  • This PR changes ported core code (eeg_eegrej, pop_rejepoch history, pop_eegplot). AGENTS.md requires one EEGLAB reference run before human approval: either the eeglab-reference.yml workflow or a local run with --eeglab-backend=matlab. The PR body should give:

    • the exact command or workflow run
    • the pinned EEGLAB and eeglab_tests commits
    • 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]>
@suraj-ranganath
suraj-ranganath marked this pull request as draft November 6, 2026 05:07
@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 6, 2026 05:07
@claude

claude Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 44s —— View job


Code review: PR #558 (Stream 3: Scroll window), fourth pass

  • Read changes since the third pass (d1ee493..a645e0f)

  • Re-check the browser click path and add_winrej_region reorder

  • Post review

  • Overall assessment: Looks good. The one new commit, a645e0f, fixes both nits from the third pass, and I found no new problems.

  • Highest-risk area: add_winrej_region in sigprocfunc/eegplot.py. Epoched data now always uses _add_epoched_winrej, even for a one-sample range.

  • Merge recommendation: Safe to merge once a maintainer approves it and the EEGLAB reference evidence in the PR body is complete (see below).

What changed since the last pass

Earlier nit Status
pop_rejepoch._history_command had an unused _confirm parameter Fixed. The parameter is gone and both call sites at pop_rejepoch.py:38,41 are updated.
A click did not mark a one-sample epoch Fixed. _toggle_epoch now uses >=. add_winrej_region now handles epoched data before the start == end toggle shortcut. Without that move the one-sample mark would have been toggled off again right away. test_gui_one_sample_epoch_click_marks_that_epoch covers it.

I checked whether moving the start == end toggle changes anything else:

  • Continuous data: behaves the same. The shortcut still runs before clamping.
  • Epoched click without setelectrode: goes through _toggle_epoch on mouse-down (eegbrowser.py:658-661). An already-marked epoch is still cleared through toggle_sample, so the reorder doesn't change it.
  • Epoched with setelectrode: the only remaining path to mark_samples(start == end) is a drag that moves the mouse but ends on the same sample. That now marks the epoch for that channel through _add_epoched_winrej, where it used to toggle. A real drag across one sample is unusual, and marking is the reasonable result, so I'm not flagging it.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None. The new one-sample-epoch test locks the edge case.

EEGLAB parity notes

  • This PR changes ported core code (eeg_eegrej, pop_rejepoch history, pop_eegplot). AGENTS.md requires one EEGLAB reference run, recorded in the PR body, before a maintainer approves it. The body has the jamming run at d1ee4934 with EEGLAB d0963be9: 58 passed and 15 subtests. Per AGENTS.md, it still needs:

    • the eeglab_tests commit
    • the skip count and the runtime
    • a note on whether this was the full --eeglab-backend=matlab suite or only the three files listed

    The changes since d1ee493 are small and don't affect the history strings, so I don't think the reference suite needs to be rerun. That call is up to the maintainer.

  • Closing a dialog with the window X does not continue, while EEGLAB continues unless the button is Cancel or NO. As noted in earlier passes, this difference is intentional and tested.

I could not run tests in this pass because the sandbox needs approval for uv run pytest. So the GUI interaction tests, including the new one-sample-epoch test, are reviewed but have not been run here.

Checked for correctness bugs, EEGLAB parity, data structure compatibility, changed-behavior tests, and CLAUDE.md/AGENTS.md compliance.

@suraj-ranganath
suraj-ranganath merged commit 5b0117d into develop Nov 6, 2026
12 checks passed
@cursor cursor Bot mentioned this pull request Nov 6, 2026
cursor Bot pushed a commit that referenced this pull request Nov 6, 2026
Keep both changelog entries after #558 and #563.

Co-authored-by: Suraj Ranganath <[email protected]>

# Conflicts:
#	docs/source/changelog.rst
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.

2 participants