diff --git a/nistats/hemodynamic_models.py b/nistats/hemodynamic_models.py index 85f75c63..e71a7042 100644 --- a/nistats/hemodynamic_models.py +++ b/nistats/hemodynamic_models.py @@ -281,7 +281,9 @@ def _sample_condition(exp_condition, frame_times, oversampling=50, tmax = len(hr_frame_times) regressor = np.zeros_like(hr_frame_times).astype(np.float) t_onset = np.minimum(np.searchsorted(hr_frame_times, onsets), tmax - 1) - regressor[t_onset] += values + for t, v in zip(t_onset, values): + regressor[t] += v + t_offset = np.minimum(np.searchsorted(hr_frame_times, onsets + durations), tmax - 1) @@ -290,7 +292,9 @@ def _sample_condition(exp_condition, frame_times, oversampling=50, if t < (tmax - 1) and t == t_onset[i]: t_offset[i] += 1 - regressor[t_offset] -= values + for t, v in zip(t_offset, values): + regressor[t] -= v + regressor = np.cumsum(regressor) return regressor, hr_frame_times