Check that there are at least two events to compute min diff
@@ -56,9 +56,13 @@ class Convolve(Transformation):
# Minimum interval between event onsets/duration
# Used to compute oversampling factor to prevent information loss
- min_interval = min(np.ediff1d(np.unique(np.sort(df.onset))).min(),
+ unique_onsets = np.unique(np.sort(df.onset))
+ if len(unique_onsets) > 1:
+ min_interval = min(np.ediff1d(unique_onsets).min(),
df.duration.min())
oversampling = np.ceil(2*(1 / (min_interval * sampling_rate)))
+ else:
+ oversampling = 2
convolved = hrf.compute_regressor(
vals, model, resample_frames, fir_delays=fir_delays, min_onset=0,
oversampling=oversampling
