Skip to content

Commit

Permalink
Fix off-by-one sample
Browse files Browse the repository at this point in the history
  • Loading branch information
hoechenberger committed Oct 24, 2023
1 parent 56063ec commit bdc9b9f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mne/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2933,10 +2933,14 @@ def _ensure_list(x):
window_stop_sample = row_event.sample
elif next_events.loc[next_events["id"] == row_event.id, :].size > 0:
# There's still an event of the same type appearing after the
# current event.
window_stop_sample = next_events.loc[
next_events["id"] == row_event.id, :
].iloc[0]["sample"]
# current event. Stop one sample short, we don't want to include that
# last event here, but in the next iteration.
window_stop_sample = (
next_events.loc[next_events["id"] == row_event.id, :].iloc[0][
"sample"
]
- 1
)
else:
# There are still events after the current one, but not of the
# same type.
Expand Down

0 comments on commit bdc9b9f

Please sign in to comment.