Skip to content

Commit fe6e4d1

Browse files
committed
Method for computing the pop_mean_surr with les RAM requirements
1 parent bc458ae commit fe6e4d1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

frites/stats/stats_param.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,10 @@ def rfx_ttest(mi, mi_p, center=False, zscore=False, ttested=False):
102102
mi[k] = (mi[k] - _med) / _std
103103
mi_p[k] = (mi_p[k] - _med) / _std
104104

105-
# get the mean of surrogates
106-
_merge_perm = np.r_[tuple([mi_p[k].ravel() for k in range(n_roi)])]
107-
pop_mean_surr = np.mean(_merge_perm)
105+
# get the mean of surrogates (low ram method)
106+
n_element = np.sum([np.prod(k.shape) for k in mi_p])
107+
sum_all = np.sum([np.sum(k) for k in mi_p])
108+
pop_mean_surr = sum_all / n_element
108109

109110
"""sigma estimation
110111
Here, the data are organized into a list of length (roi,), which means

0 commit comments

Comments
 (0)