File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -1535,21 +1535,22 @@ def _cosine_drift(period_cut, frametimes):
15351535 Ref: http://en.wikipedia.org/wiki/Discrete_cosine_transform DCT-II
15361536 """
15371537 len_tim = len (frametimes )
1538- n_times = np .arange (len_tim )
15391538 hfcut = 1.0 / period_cut # input parameter is the period
15401539
15411540 # frametimes.max() should be (len_tim-1)*dt
15421541 dt = frametimes [1 ] - frametimes [0 ]
15431542 # hfcut = 1/(2*dt) yields len_time
15441543 # If series is too short, return constant regressor
15451544 order = max (int (np .floor (2 * len_tim * hfcut * dt )), 1 )
1546- cdrift = np .zeros ((len_tim , order ))
1547- nfct = np .sqrt (2.0 / len_tim )
1545+ cdrift = np .ones ((len_tim , order ))
15481546
1549- for k in range (1 , order ):
1550- cdrift [:, k ] = nfct * np .cos ((np .pi / len_tim ) * (n_times + 0.5 ) * k )
1547+ if order > 1 :
1548+ nfct = np .sqrt (2.0 / len_tim )
1549+ support = (np .pi / len_tim ) * (np .arange (len_tim ) + 0.5 )
1550+
1551+ for k in range (1 , order ):
1552+ cdrift [:, k ] = nfct * np .cos (support * k )
15511553
1552- cdrift [:, 0 ] = 1.0 # or 1./sqrt(len_tim) to normalize
15531554 return cdrift
15541555
15551556
You can’t perform that action at this time.
0 commit comments