Skip to content

[pop_select] Keep continuous point ranges in samples - #882

Open
claude[bot] wants to merge 1 commit into
developfrom
agent/20261129-fix-880
Open

claude[bot] wants to merge 1 commit into
developfrom
agent/20261129-fix-880

Conversation

@claude

@claude claude Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Build continuous point, nopoint and rmpoint rejection regions directly in samples instead of converting through eeg_point2lat, whose 1e-9 s rounding kept the last sample at 300, 1024, 2048 and 30000 Hz and refused nopoint=[10, 10] at 1024 Hz. Epoched data and time ranges are unchanged. Merge only after the sccn/eeglab#1007 pull request lands; needs the MATLAB reference run before merging.

Fixes #880

🤖 Generated with Claude Code

Build the rejection regions for point, nopoint and rmpoint on continuous
data directly in samples instead of round-tripping through eeg_point2lat,
whose 1e-9 s rounding kept the last sample at 300, 1024, 2048 and 30000 Hz
and refused nopoint=[10, 10] at 1024 Hz.

Fixes #880

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

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

claude Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Claude finished @claude[bot]'s task in 1m 54s —— View job


Code review

Blocking

None.

Important

None.

Nits

  • Two copies of the keep-range logic in _continuous_point_rejections (pop_select.py:61-92) and the continuous time branch (pop_select.py:~518-538). Both build the complement of the keep ranges and apply the EEGLAB one-sample shift to interior edges. That shift is the quirk that test_adjacent_keep_ranges_match_eeglab locks in, and pop_select: two keep ranges that touch lose the two samples where they meet (EEGLAB too) #864 plans to fix it "in EEGLAB and EEGPrep together". After this PR, that fix has to change both copies the same way or point and time will start to disagree. Suggestion: move the complement-and-shift step into one helper, e.g. _keep_to_reject(mat, lo, hi, step). The time branch would call it with (xmin, xmax, 1/srate) and the point branch with (1, pnts, 1). This can wait for a follow-up.

Test gaps

None. The new subtests reproduce #880 for point at 300 Hz and for nopoint/rmpoint at 1024 Hz. The existing 100 Hz and 2048 Hz continuous tests, including the adjacent-ranges quirk, now run through the new path too.

EEGLAB parity notes

  • I couldn't compare against pop_select.m directly because src/eegprep/eeglab/ is empty in this checkout. My parity reasoning relies on the existing MATLAB-derived tests and on the old Python time path, which already mirrored pop_select.m:592-594.
  • Until pop_select keeps the last sample at 300, 1024, 2048 and 30000 Hz from eeg_point2lat rounding eeglab#1007 lands, this is an undocumented deviation: at 1024 Hz, released EEGLAB still refuses nopoint=[10 10] and keeps the last sample for point ranges at 300, 1024, 2048 and 30000 Hz. If pop_erpimage: Match the ERP image form and its default time limits #1007 stalls, either document the difference (the help Markdown or docs troubleshooting) or hold this PR.
  • Some behavior is unchanged and still follows EEGLAB, but you might not expect it:
    • point=[[1,1], …] cannot keep sample 1 by itself, because the start edge is never shifted.
    • epoched = trials > 1, so a single-trial epoched dataset takes the continuous path.
  • One small improvement: point ranges that miss the data now raise an error in samples ([1 pnts]) rather than in seconds.

Verification

  • I didn't run anything. Running pytest and an old-vs-new behavior sweep script were both blocked by this job's permissions, so everything above comes from reading the code.
  • I checked how eeg_eegrej handles fractional regions (it rounds half away from zero, then sorts each row and the rows). That is why reversed rows such as [4,3] from adjacent ranges give the same result as before.
  • I also checked that the stale locals pnts/xmin/xmax/data are never read after the new eeg_eegrej call.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

0 participants