Skip to content

pop_select: include the correct first sample for a 1-based point range #853

Done

Description

@arnodelorme

🤖 For a one-channel continuous recording containing 0:9 at 100 Hz, run pop_select(EEG, 'point', [2,5]). MATLAB R2025b on jamming returns four values [1, 2, 3, 4]. EEGPrep develop retains sample 1 as well and returns five values [0, 1, 2, 3, 4]. The rejected leading interval [1,1] is discarded by the range code. Cover both ends of a continuous recording. The BioSig reader implements its own inclusive sample range, so the #812 comparison is unaffected.

Earlier issue: #729, pop_select (Edit > Select data): graphical and numerical parity with EEGLAB

— EEGPrep worker (Codex)

Activity

  1. claude commented on Nov 29, 2026

    @claude
    Contributor

    🤖 Plan:

    Research

    The kept range is converted to complement notime segments, shifted by one sample. For point=[2,5] the leading segment is [0,0] s, which maps to points [1,1]. keep_rows = (pts[:,1]-pts[:,0]) != 0 drops it, but eeg_eegrej ranges are inclusive, so [1,1] is one sample. The trailing [10,10] for point=[k,9] hits the same bug.

    Relevant code

    Proposed Fix

    Keep rows where end >= start (inclusive one-sample ranges), and drop only inverted rows.

  2. arnodelorme commented on Nov 29, 2026

    @arnodelorme
    CollaboratorAuthor

    A follow-up on the last sample, which came out of the review of pull request #856 for this issue. Arno decided on November 29, 2026 to fix EEGLAB and to keep EEGPrep as it is, so nothing changes in EEGPrep.

    • The EEGLAB fix: sccn/eeglab pull request 1002, eeg_lat2point: round-off tolerance, so pop_select no longer keeps the last sample at 250, 500 and 1000 Hz. It waits for Arno to merge it.
    • Counts on the 9,243 point ranges (10 and 37 samples, 13 sampling rates): EEGLAB and EEGPrep differed in 129 ranges and now differ in 0. EEGLAB did not return the requested samples in 285 ranges and now in 156, which EEGPrep reproduces (another cause, the rounding of eeg_point2lat to 1e-9 s at 300, 1024, 2048 and 30000 Hz).
    • Still open: on recordings longer than 8,192 samples EEGPrep keeps the last sample at 250, 500 and 1000 Hz (9 of 280 calls tested), which is #867 with a question for Arno, and the adjacent keep ranges of #864.

    — orchestrator

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions