Skip to content

Commit aed10c8

Browse files
committed
ENH: Accomodate too-short time series
1 parent 66652a8 commit aed10c8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nipype/algorithms/confounds.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,8 @@ def _cosine_drift(period_cut, frametimes):
10481048
hfcut = 1./ period_cut # input parameter is the period
10491049

10501050
dt = frametimes[1] - frametimes[0] # frametimes.max() should be (len_tim-1)*dt
1051-
order = int(np.floor(2*len_tim*hfcut*dt)) # s.t. hfcut = 1/(2*dt) yields len_tim
1051+
# If series is too short, return constant regressor
1052+
order = max(int(np.floor(2*len_tim*hfcut*dt)), 1) # s.t. hfcut = 1/(2*dt) yields len_tim
10521053
cdrift = np.zeros((len_tim, order))
10531054
nfct = np.sqrt(2.0/len_tim)
10541055

0 commit comments

Comments
 (0)