Repository navigation
Description
pop_select keeps the last sample of a continuous recording when a point range ends one sample before it, at sampling rates such as 300, 1024, 2048 and 30000 Hz, and refuses nopoint=[10, 10] on 10 samples at 1024 Hz. Arno approved fixing this now in EEGLAB and in EEGPrep together on November 29, 2026 ("Yes, fix it now in two pull requests. 2b").
- Where it stands. Across 9,243 short point ranges on 10 and on 37 samples at 13 sampling rates, 156 keep the last sample in both EEGLAB develop (
579a27d0d) and EEGPrep develop (e435f436), because both convert point ranges througheeg_point2lat(which rounds times to1e-9s) and back througheeg_lat2point. - What changes. Keep
point,nopointandrmpointin sample indices on continuous data (trials == 1) inpop_select.py, parallel to the matching change inpop_select.mfor sccn/eeglab issue 1007 (pop_selectkeeps the last sample at 300, 1024, 2048 and 30000 Hz fromeeg_point2latrounding), so both programs return the requested samples in all 9,243 short ranges and keep exact parity. - Order of merging. Merge the EEGPrep pull request only after the EEGLAB pull request for sccn/eeglab issue 1007 is merged, so EEGPrep never moves away from EEGLAB develop.
- Parent and related issues. Sub-issue of pop_select (Edit > Select data): graphical and numerical parity with EEGLAB #729,
pop_select(Edit > Select data): graphical and numerical parity with EEGLAB. Earlier issues: pop_select: include the correct first sample for a 1-based point range #853 (pop_select: keep one-sample edge rejections for point ranges), pop_select: two keep ranges that touch lose the two samples where they meet (EEGLAB too) #864 (pop_select: two keep ranges that touch lose the two samples where they meet), 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 (eeg_lat2point: the fixed tolerance of1e-12point is too small above 8,192 samples), and sccn/eeglab issue 1007.
Cause and 300 Hz / 1024 Hz examples
On 10 samples (0 to 9) at 300 Hz, pop_select(EEG, point=[3, 9]) converts [3, 9] with eeg_point2lat, which rounds [2/300, 8/300] s to [0.006666667, 0.026666667] s. Shifting the second rejection edge by 1/300 s gives 0.030000000333333336 s against xmax = 0.029999999999999999 s, which maps to point 10.0000001 in eeg_lat2point (flag = 1). pop_select then drops the [10, 10] region and returns 8 samples (2 to 9) instead of 7 (2 to 8).
On 10 samples at 1024 Hz (xmax = 0.0087890625 s), eeg_point2lat rounds sample 10 up to 0.008789063 s (> xmax), so _reject_disjoint_time raises ValueError on pop_select(EEG, nopoint=[10, 10]) and rmpoint=[10, 10].
Keeping point, nopoint and rmpoint in sample indices on continuous data removes the trip through 1e-9 s rounded times while leaving time, notime, rmtime, epoched data, eeg_point2lat.py and eeg_lat2point.py untouched. Adjacent keep ranges (point=[[1, 3], [4, 8]] in #864) still return 0, 1, 4, 5, 6, 7.
— orchestrator
Activity
claude commentedon Nov 29, 2026
🤖 Plan:
point/nopoint/rmpointgo througheeg_point2lat(1e-9 s rounding) theneeg_lat2pointinpop_select.py#L313-L325and#L500-L507; the rounded edge lands pastpnts, so theflagrule drops the[pnts, pnts]region or_reject_disjoint_timeraises._continuous_point_rejectionsbuilds the regions in samples (same complement + interior-edge shift as the time path); epoched data andtime/notimeunchanged[a, b]point/nopoint range on 10 and 37 samples at 13 rates (19,708 calls): 165 results change, all at 300/1024/2048/30000 Hz; 164 were wrong before and are right now.Still differs from the requested samples (same in EEGLAB): keeping only the first or last sample (
point=[1, 1],point=[pnts, pnts]) returns no data at every rate, because the complement[1, pnts]has no interior edge to shift. At 2048 Hz,point=[10, 10]used to return[9]only because of rounding; it now returns empty like the other rates. Fixing this needs a matching change inpop_select.m.