Repository navigation
Fix Raw.crop with reset_first_samp=True misaligning annotations and data - #14439
Merged
Merged
Conversation
mscheltienne
force-pushed
the
fix-crop-reset-first-samp
branch
from
October 21, 2026 12:12
46581e8 to
2108cf3
Compare
mscheltienne
marked this pull request as ready for review
October 21, 2026 12:13
mscheltienne
requested review from
agramfort,
drammock and
larsoner
as code owners
October 21, 2026 12:13
drammock
approved these changes
Oct 21, 2026
drammock
enabled auto-merge (squash)
October 21, 2026 22:11
larsoner
added a commit
to sonoAESS/mne-python
that referenced
this pull request
Oct 22, 2026
* upstream/main: FIX: Put split before desc in BIDS split file names (mne-tools#14434) Fix Raw.crop with reset_first_samp=True misaligning annotations and data (mne-tools#14439) Bump Python version for `ty` runs (mne-tools#14443) BUG: Explicitly import defusedxml.ElementTree and ipympl.backend_nbagg (mne-tools#14430) Add CircleCI scheduled-workflow issue opener [ci skip] (mne-tools#14441)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Raw.crop(..., reset_first_samp=True)filtered the annotations whilefirst_sampstill held the cropped offset and never shifted their onsets, so they ended up late byfirst_time + tmin. The onsets are now shifted byfirst_timeand_cropped_sampis reset beforeset_annotations._first_samps/_last_sampsare left untouched since they index the files, which also fixes reading wrong data from non-preloaded files and the wrongfirst_sampon concatenated raws.Reproduction
AI disclosure: Claude (Opus 5.5) implemented the fix and the test and produced the figure; I reviewed the changes.