Repository navigation
[pop_select] Keep continuous point ranges in points - #881
arnodelorme wants to merge 3 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.
|
Claude finished @arnodelorme's task in 1m 16s —— View job Code review
BlockingNone. The merge order above is a sequencing requirement, not a code defect. ImportantNone. Nits
Test gapsNone.
It covers all four affected sampling rates and both lengths. The existing EEGLAB parity notesI traced the new code against the
What I could not run: |
Code reviewIndependent review by Codex (OpenAI GPT-6.1 Terra), asked by the orchestrator. The first version of this change was written by Gemini 4 Carbon and the present version (commits 28db695 and 1830616) by Claude Fable 5.2, so the reviewer is from a third vendor. Codex read the diff against develop in a read-only sandbox and found nothing blocking. It could not run the tests there. The runs are in the description of the pull request. What Codex checked. The new branch gives what the time code gave in exact arithmetic, also for unsorted and overlapping rows and for ranges that touch either end. One remark, nothing to fix here. Adjacent keep ranges such as What I fixed before this review. The automatic review above asked for a changelog entry, which is now in The text of Codex, unchangedNo blocking correctness findings. I found no new correctness bug in the diff. In exact arithmetic, the new point branch follows the previous time path, including for unsorted and overlapping rows and for ranges touching either edge. One preexisting limitation remains: adjacent keep ranges such as The new tests target the reported rounding failure and the expected data and boundary values are plausible. I could not run them in the read-only environment because the project virtual environment was absent and the available Python lacked NumPy. — orchestrator |
Fixes #880. Part of #729.
Arno's approval (email of November 29, 2026, subject "Re: EEGLAB: pull request for eeg_lat2point, compared with EEGPrep"): "Yes, fix it now in two pull requests. 2b"
Merge only after the EEGLAB pull request sccn/eeglab#1008 is merged: before that, this pull request moves EEGPrep away from EEGLAB develop in 156 of 9,243 ranges.
On continuous data,
pop_select.pyconvertedpoint,nopointandrmpointto seconds witheeg_point2lat, which rounds to1e-9s, and back to points witheeg_lat2point, aspop_select.mdid. At 300, 1024, 2048 and 30000 Hz a limit came back1e-7sample after the end of the data, and the last sample was kept although it was not requested. This pull request makes the same change as sccn/eeglab pull request 1008: a range given in points stays in points on continuous data, and the regions to reject are built in points (58 added lines and 1 changed line inpop_select.py).Example (10 samples holding
0to9, compared with EEGLAB in MATLAB R2025b)e435f436)18306161)agent/issue-1007(b887b4c35)pop_select(EEG, point=[3, 9])at 300 Hz2..9), last sample kept2..8), as requested2..8)pop_select(EEG, nopoint=[10, 10])at 1024 HzValueError("does not overlap")0..8), sample 10 removed0..8)pop_select(EEG, point=[3, 10])at 300 Hz2..9)2..9)2..9)EEGLAB reference run made on my EEGLAB branch
agent/issue-1007(commitb887b4c35, MATLAB R2025b), not on EEGLAB developEvery point range
[a, b]witha < bon 10 and on 37 samples at 100, 128, 250, 256, 300, 500, 512, 600, 1000, 1024, 2048, 4900 and 30000 Hz (9,243 ranges), then the other sets.b887b4c35and this pull requeste435f436)5edd0e1a, applied in memory)time,notime,rmtime)nopointandrmpointregions that touch the start or the endValueErrorat 1024 Hz on 10 samples)xmax, boundary events, latencies,com)xmax2.0e-16)The last two lines are old differences that neither pull request touches. The 15 are keep ranges that overlap or are not in increasing order: EEGPrep sorts and merges them, EEGLAB does not (
point=[[4, 8], [1, 3]]returns0, 1, 4, 5, 6, 7here and an empty dataset in EEGLAB). The 12 are point ranges on epoched data, where EEGPrep keeps one more sample than EEGLAB (point=[2, 9]keeps 8 samples here and 7 in EEGLAB), andrmpoint=[9, 10], which EEGLAB refuses on epochs at 1024 and 2048 Hz. They are reported to Arno for a separate decision.The workflow "EEGLAB reference" runs on this branch at commit
18306161: https://github.com/sccn/eegprep/actions/runs/46294127395 . It compares with the EEGLAB of the submodule, which does not have the EEGLAB fix yet.The change, and what it does not touch
The conversion of the points to times stays where it was, and epoched data still uses it. Right after it, on continuous data, the point ranges are checked and clipped in points (
_reject_disjoint_point,_clip_time_matrixwith 1 andpnts) and the time matrices are emptied. A newelifbranch of the removal then builds the regions to reject in points, with the lines of the time code below it, sample 1, samplepntsand a step of one sample. This follows the new branch ofpop_select.m. The Python file keeps its own two habits there, which are older than this pull request: a range completely out of the data raisesValueErrorwhere EEGLAB clips it, and keep ranges are sorted and merged.eeg_lat2point.pyandeeg_point2lat.pyare not touched (#867 changeseeg_lat2point.pyonagent/issue-867). Adjacent keep ranges (#864,point=[[1, 3], [4, 8]]) still return0, 1, 4, 5, 6, 7, as EEGLAB does, andtest_adjacent_keep_ranges_match_eeglabis unchanged.300 calls with odd or wrong input (10 and 37 samples at 100, 300 and 1024 Hz, three events): 10 change in EEGPrep. 7 are the last sample at 300 Hz and
nopoint=[10, 11]at 1024 Hz, 2 are half sample limitspoint=[2.5, 7.5]at 1024 Hz (6 samples as at the other rates, not 5), and 1 ispoint=[[1, 5], [3, 9]]at 300 Hz. Between EEGLAB and EEGPrep, 53 of these 300 calls differed before and 37 differ after. The 37 are the two habits above (25 ranges out of the data, 12 unsorted or overlapping keep ranges). The 16 that no longer differ were wrong in EEGLAB:int32points (12), an event kept on a removed sample at 1024 Hz (3), andnopoint=[10, 11]at 1024 Hz (1).Tests
tests/test_pop_select.py,tests/test_gui_pop_select.py,tests/test_eeg_eegrej.py,tests/test_rejection_workflows.py,tests/test_gui_rejection_dialogs.pyandtests/test_sigproc_eegrej.pywithEEGPREP_SKIP_MATLAB=1: 127 passed, 2 skipped, 72 subtests passed. The 2 skipped tests need the MATLAB Engine for Python, which this Mac does not have. There is no test file forpop_rejcont.The new test
test_point_ranges_do_not_keep_last_sample_from_1e9_time_roundingruns on 10 and 37 samples at 300, 1024, 2048 and 30000 Hz. Its expected values (kept values,pnts,xmax, boundary events, the event on a removed sample) come from the EEGLAB run onb887b4c35. 14 of its subtests fail on develop.ruff check,ruff format --checkand./pre-commit.pypass, anddocs/source/changelog.rsthas the entry.The branch has three commits because a pushed branch is never rewritten: the first version (
99724109), the smaller version that leaves the checks in seconds for epoched data untouched and adds the branch only (28db6959), and the changelog (18306161).Related: #729, #853, #864, #867, sccn/eeglab issue 1007, sccn/eeglab_tests pull request 20.
— orchestrator