30
30
iflogger = logging .getLogger ("nipype.interface" )
31
31
32
32
33
- def gcd (a , b ):
34
- """
35
- Return the greatest common divisor of two integers (uses Euclid's algorithm).
36
-
37
- Examples
38
- --------
39
- >>> gcd(4, 5)
40
- 1
41
- >>> gcd(4, 8)
42
- 4
43
- >>> gcd(22, 55)
44
- 11
45
-
46
- """
47
- while b > 0 :
48
- a , b = b , a % b
49
- return a
50
-
51
-
52
33
def spm_hrf (RT , P = None , fMRI_T = 16 ):
53
34
"""
54
35
python implementation of spm_hrf
@@ -799,9 +780,9 @@ def _gen_regress(self, i_onsets, i_durations, i_amplitudes, nscans):
799
780
matplotlib .use (config .get ("execution" , "matplotlib_backend" ))
800
781
import matplotlib .pyplot as plt
801
782
802
- TR = np .round (self .inputs .time_repetition * 1000 ) # in ms
783
+ TR = int ( np .round (self .inputs .time_repetition * 1000 ) ) # in ms
803
784
if self .inputs .time_acquisition :
804
- TA = np .round (self .inputs .time_acquisition * 1000 ) # in ms
785
+ TA = int ( np .round (self .inputs .time_acquisition * 1000 ) ) # in ms
805
786
else :
806
787
TA = TR # in ms
807
788
nvol = self .inputs .volumes_in_cluster
@@ -813,10 +794,10 @@ def _gen_regress(self, i_onsets, i_durations, i_amplitudes, nscans):
813
794
if len (durations ) == 1 :
814
795
durations = durations * np .ones ((len (i_onsets )))
815
796
onsets = np .round (np .array (i_onsets ) * 1000 )
816
- dttemp = gcd (TA , gcd (SILENCE , TR ))
797
+ dttemp = math . gcd (TA , math . gcd (SILENCE , TR ))
817
798
if dt < dttemp :
818
799
if dttemp % dt != 0 :
819
- dt = float (gcd (dttemp , dt ))
800
+ dt = float (math . gcd (dttemp , int ( dt ) ))
820
801
821
802
if dt < 1 :
822
803
raise Exception ("Time multiple less than 1 ms" )
0 commit comments