Skip to content

Commit 6a4cf46

Browse files
committed
fixed bug with glover_hrf function
1 parent efab67f commit 6a4cf46

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

nltools/external/hrf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,23 @@
4646
import numpy as np
4747

4848

49-
def _gamma_difference_hrf(tr, oversampling=16, time_length=32., onset=0.,
49+
def _gamma_difference_hrf(tr, oversampling=16, time_length=32, onset=0.,
5050
delay=6, undershoot=16., dispersion=1.,
5151
u_dispersion=1., ratio=0.167):
5252
""" Compute an hrf as the difference of two gamma functions
5353
Parameters
5454
----------
5555
tr: float, scan repeat time, in seconds
5656
oversampling: int, temporal oversampling factor, optional
57-
time_length: float, hrf kernel length, in seconds
57+
time_length: int, hrf kernel length, in seconds
5858
onset: float, onset of the hrf
5959
Returns
6060
-------
6161
hrf: array of shape(length / tr * oversampling, float),
6262
hrf sampling on the oversampled time grid
6363
"""
6464
dt = tr / oversampling
65-
time_stamps = np.linspace(0, time_length, float(time_length) / dt)
65+
time_stamps = np.linspace(0, time_length, int(time_length / dt))
6666
time_stamps -= onset / dt
6767
hrf = gamma.pdf(time_stamps, delay / dispersion, dt / dispersion) - \
6868
ratio * gamma.pdf(
@@ -89,13 +89,13 @@ def spm_hrf(tr, oversampling=16, time_length=32., onset=0.):
8989
return _gamma_difference_hrf(tr, oversampling, time_length, onset)
9090

9191

92-
def glover_hrf(tr, oversampling=16, time_length=32., onset=0.):
92+
def glover_hrf(tr, oversampling=16, time_length=32, onset=0.):
9393
""" Implementation of the Glover hrf model.
9494
9595
Args:
9696
tr: float, scan repeat time, in seconds
9797
oversampling: int, temporal oversampling factor, optional
98-
time_length: float, hrf kernel length, in seconds
98+
time_length: int, hrf kernel length, in seconds
9999
onset: float, onset of the response
100100
101101
Returns:

0 commit comments

Comments
 (0)