Skip to content

Commit

Permalink
FIX ContinuousEpoch
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbrodbeck committed Sep 16, 2021
1 parent 2499f32 commit 370c561
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions eelbrain/_experiment/mne_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2233,12 +2233,12 @@ def load_epochs(

if isinstance(epoch, ContinuousEpoch):
# find splitting points
diff = ds['T'].diff(to_begin=epoch.split+1)
onsets = np.flatnonzero(diff >= epoch.split)
split_threshold = epoch.split + (epoch.pad_end + epoch.pad_start)
diff = ds['T'].diff(to_begin=-split_threshold-1)
onsets = np.flatnonzero(diff >= split_threshold)
# make sure we are not messing up user events
illegal = ', '.join(k for k in ('T_relative', 'events', 'tmax') if k in ds)
if illegal:
raise RuntimeError(f"Events contain variables with reserved names: {illegal}")
if illegal := {'T_relative', 'events', 'tmax'}.intersection(ds):
raise RuntimeError(f"Events contain variables with reserved names: {', '.join(illegal)}")
# split events
events = [ds[i1:i2] for i1, i2 in intervals(chain(onsets, [None]))]
# update event times
Expand Down

0 comments on commit 370c561

Please sign in to comment.