Skip to content

Commit deb47ba

Browse files
mariomario
authored andcommitted
corrected l_subsampled
1 parent 348a88a commit deb47ba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

code/python/cni_toolbox/gadgets.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ def __init__(self, n_channels, sampling_rate = 2., l_kernel = 34):
181181
self.M2 = np.ones(self.n_channels)
182182
self.sigma = np.zeros(self.n_channels)
183183

184-
self.l_subsampled = int(self.l_kernel / self.p_sampling)
184+
self.l_subsampled = int(self.l_kernel / self.p_sampling) - 1
185185
timepoints = np.arange(0., self.l_kernel, self.p_sampling)
186186
self.hrf_fft = fft(two_gamma(timepoints), axis=0)
187-
self.x_conv = np.zeros((self.l_subsampled, self.n_channels))
187+
self.x_conv = np.zeros((self.l_subsampled + 1, self.n_channels))
188188

189189
def convolve(self, x):
190190
'''
@@ -201,7 +201,7 @@ def convolve(self, x):
201201

202202
x_fft = fft(np.vstack((x.reshape(1,-1), np.zeros((self.l_subsampled, self.n_channels)))), axis=0)
203203
self.x_conv = np.vstack((self.x_conv, np.zeros((1, self.n_channels))))
204-
self.x_conv[self.step:self.step + self.l_subsampled - 1, :] += np.abs(ifft(
204+
self.x_conv[self.step:self.step + self.l_subsampled, :] += np.abs(ifft(
205205
x_fft * np.expand_dims(self.hrf_fft , axis=1), axis=0))
206206

207207
return self.x_conv[self.step, :]

0 commit comments

Comments
 (0)