@@ -573,19 +573,19 @@ def _gen_regress(self, i_onsets, i_durations, i_amplitudes, nscans):
573
573
SCANONSET = np .round (self .inputs .scan_onset * 1000 )
574
574
total_time = TR * (nscans - nvol )/ nvol + TA * nvol + SCANONSET
575
575
SILENCE = TR - TA * nvol
576
- dt = TA / 10. ;
576
+ dt = TA / 10.0
577
577
durations = np .round (np .array (i_durations )* 1000 )
578
578
if len (durations ) == 1 :
579
579
durations = durations * np .ones ((len (i_onsets )))
580
580
onsets = np .round (np .array (i_onsets )* 1000 )
581
581
dttemp = gcd (TA , gcd (SILENCE , TR ))
582
582
if dt < dttemp :
583
583
if dttemp % dt != 0 :
584
- dt = gcd (dttemp , dt )
584
+ dt = float ( gcd (dttemp , dt ) )
585
585
if dt < 1 :
586
586
raise Exception ("Time multiple less than 1 ms" )
587
587
iflogger .info ("Setting dt = %d ms\n " % dt )
588
- npts = int (total_time / dt )
588
+ npts = int (np . ceil ( total_time / dt ) )
589
589
times = np .arange (0 , total_time , dt )* 1e-3
590
590
timeline = np .zeros ((npts ))
591
591
timeline2 = np .zeros ((npts ))
@@ -605,7 +605,7 @@ def _gen_regress(self, i_onsets, i_durations, i_amplitudes, nscans):
605
605
iflogger .info ('response sum: %.4f max: %.4f' % (response .sum (), response .max ()))
606
606
iflogger .info ('reg_scale: %.4f' % reg_scale )
607
607
for i , t in enumerate (onsets ):
608
- idx = int (t / dt )
608
+ idx = int (np . round ( t / dt ) )
609
609
if i_amplitudes :
610
610
if len (i_amplitudes )> 1 :
611
611
timeline2 [idx ] = i_amplitudes [i ]
0 commit comments