You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
eeg_lat2point: the fixed tolerance of 1e-12 point is too small above 8,192 samples (last sample kept at 250, 500 and 1000 Hz) #867
The tolerance of eeg_lat2point.py on develop was a fixed 1e-12 point, which is smaller than one eps once a recording has more than 8,192 samples. On longer recordings at 250, 500, and 1000 Hz, EEGPrep therefore kept the last sample when a point range ended one sample before the end, just as EEGLAB did before sccn/eeglab pull request 1002.
Example: on 100,000 samples at 250 Hz, pop_select(EEG, point=[2, 99999]) returned 99,999 samples on develop (e435f436) and now returns 99,998 samples, matching EEGLAB develop (579a27d0d).
Numbers: compared with EEGLAB develop (579a27d0d) in MATLAB R2025b, pull request 879 differs in 0 of 9,243 short ranges (0 before), 0 of 280 long calls (9 before), 0 of 75 extra-long and offset calls up to 10,000,000 samples (21 before), and 0 of 6,740 direct eeg_lat2point calls (max_ulp_diff = 0).
The question Arno answered with "1a" on November 29, 2026: (a) put the same tolerance in EEGPrep in one small pull request after merging EEGLAB pull request 1002, or (b) leave EEGPrep as it is.
eeg_lat2point.py line 71 flagged a point as out of range when it exceeded max_valid by more than 1e-12 point. At 250, 500, and 1000 Hz the last sample evaluates one eps above max_valid, and one eps of 8,192 is 1.8e-12, larger than 1e-12. pop_select.py then dropped the last rejection region and kept the last sample. Pull request 879 ports the merged EEGLAB eeg_lat2point.m test (min(16 * eps(max(max_valid, max(abs(timewin_sec)) * srate)), 0.5)), clamps points within the tolerance to max_valid without setting flag, and matches MATLAB max/minNaN behavior.
Another 156 of the 9,243 short ranges keep the last sample in both EEGLAB 579a27d0d and EEGPrep, at 300, 1024, 2048, and 30000 Hz, because eeg_point2lat rounds times to 1e-9 s. That separate pop_select cause is tracked on its own issue and pull requests.
Status: blocked, no PR opened. This changes numerical output relative to EEGLAB, which AGENTS.md requires Arno's explicit approval for, and the issue records his current decision as "keep EEGPrep like this". Option 1a is also conditioned on sccn/eeglab#1002 being merged; it is still open (checked 2026-11-29).
Needed to proceed: (1) Arno's answer "1a", and (2) sccn/eeglab#1002 merged.
Proposed fix once unblocked (one line): src/eegprep/functions/popfunc/eeg_lat2point.py#L71 replace max_valid + 1e-12 with max_valid + 16 * np.spacing(max(max_valid, np.max(np.abs(timewin_sec)) * srate)), plus a regression test in tests/test_pop_select.py for point=[2, 99999] on 100,000 samples at 250 Hz expecting 99,998 samples, and a MATLAB reference run against an EEGLAB checkout containing #1002.
Arno's answer (email, November 29, 2026 at 08:58): "Yes, put the same tolerance in EEGPrep 1a". This is his approval of the numerical change that AGENTS.md asks for.
Next step: one small pull request on the branch agent/issue-867 puts the tolerance of the merged EEGLAB fix in eeg_lat2point.py, with the comparison against EEGLAB develop on the 9,243 short ranges and the 280 long calls. It will wait for his merge.
The other question of the same email: he also chose to fix now the 156 ranges that keep the last sample at 300, 1024, 2048 and 30000 Hz ("Yes, fix it now in two pull requests. 2b"). That is a change of pop_select in EEGLAB and in EEGPrep, on its own issues and pull requests, not here.
Done: Merged pull request 879 ([eeg_lat2point] Scale the out-of-range tolerance as EEGLAB does) into develop at commit 487ce5d after resolving the changelog conflict with pull request 797.
Activity
claude commentedon Nov 29, 2026
🤖 Plan:
Status: blocked, no PR opened. This changes numerical output relative to EEGLAB, which AGENTS.md requires Arno's explicit approval for, and the issue records his current decision as "keep EEGPrep like this". Option 1a is also conditioned on sccn/eeglab#1002 being merged; it is still open (checked 2026-11-29).
Needed to proceed: (1) Arno's answer "1a", and (2) sccn/eeglab#1002 merged.
Proposed fix once unblocked (one line):
src/eegprep/functions/popfunc/eeg_lat2point.py#L71replacemax_valid + 1e-12withmax_valid + 16 * np.spacing(max(max_valid, np.max(np.abs(timewin_sec)) * srate)), plus a regression test intests/test_pop_select.pyforpoint=[2, 99999]on 100,000 samples at 250 Hz expecting 99,998 samples, and a MATLAB reference run against an EEGLAB checkout containing #1002.arnodelorme commentedon Nov 29, 2026
agent/issue-867puts the tolerance of the merged EEGLAB fix ineeg_lat2point.py, with the comparison against EEGLAB develop on the 9,243 short ranges and the 280 long calls. It will wait for his merge.pop_selectin EEGLAB and in EEGPrep, on its own issues and pull requests, not here.— orchestrator
arnodelorme commentedon Nov 29, 2026
Done: Opened pull request 879 scaling the eeg_lat2point round-off tolerance to match EEGLAB develop 579a27d0d; it waits for Arno's merge
Pull request: #879
— orchestrator, reported with orch done
arnodelorme commentedon Nov 29, 2026
Done: Merged pull request 879 ([eeg_lat2point] Scale the out-of-range tolerance as EEGLAB does) into develop at commit 487ce5d after resolving the changelog conflict with pull request 797.
Pull request: #879
— orchestrator, reported with orch done