@@ -53,25 +53,21 @@ def _run_interface(self, runtime):
53
53
voxel_timecourses [np .isnan (np .sum (voxel_timecourses , axis = 1 )), :] = 0
54
54
55
55
# from paper:
56
+ # "The constant and linear trends of the columns in the matrix M were
57
+ # removed [prior to ...]"
58
+ if self .inputs .use_regress_poly :
59
+ regressed = regress_poly (self .inputs .regress_poly_degree ,
60
+ voxel_timecourses )
61
+ regressed = regressed - np .mean (regressed , axis = 1 )[:,None ]
62
+
56
63
# "Voxel time series from the noise ROI (either anatomical or tSTD) were
57
64
# placed in a matrix M of size Nxm, with time along the row dimension
58
65
# and voxels along the column dimension."
59
- # voxel_timecourses.shape == [nvoxels, time]
60
-
61
- M = voxel_timecourses .T
66
+ M = regressed .T
62
67
numvols = M .shape [0 ]
63
68
numvoxels = M .shape [1 ]
64
69
65
- if self .inputs .use_regress_poly :
66
- # "The constant and linear trends of the columns in the matrix M were removed ..."
67
- regress_poly (self .inputs .regress_poly_degree , voxel_timecourses )
68
-
69
- timesteps = range (numvols )
70
- for voxel in range (numvoxels ):
71
- m , b , _ , _ , _ = stats .linregress (timesteps , M [:, voxel ])
72
- M [:, voxel ] = M [:, voxel ] - [m * t + b for t in timesteps ]
73
-
74
- # "... prior to column-wise variance normalization."
70
+ # "[... were removed] prior to column-wise variance normalization."
75
71
M = M / self ._compute_tSTD (M , 1. )
76
72
77
73
# "The covariance matrix C = MMT was constructed and decomposed into its
0 commit comments