Skip to content

pop_select: keep point ranges in points on continuous data so the last sample is not kept at 300, 1024, 2048 and 30000 Hz #880

In review

Description

@arnodelorme

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").

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

  1. added
    function-parity
    on Nov 29, 2026
  2. claude commented on Nov 29, 2026

    @claude
    Contributor

    🤖 Plan:

    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 in pop_select.m.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    function-parity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions