Skip to content

Commit dfe3f30

Browse files
authored
Merge pull request #63 from gshafiei/tempBranch
[FIX] Cleans up the code for func_consensus
2 parents 293c387 + 629e799 commit dfe3f30

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

netneurotools/networks.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ def func_consensus(data, n_boot=1000, ci=95, seed=None):
6868

6969
if isinstance(data, list):
7070
collapsed_data = np.hstack(data)
71+
nsample = int(collapsed_data.shape[-1] / len(data))
7172
else:
7273
collapsed_data = data.reshape((len(data), -1), order='F')
74+
nsample = data.shape[1]
7375

7476
consensus = np.corrcoef(collapsed_data)
7577

@@ -79,11 +81,6 @@ def func_consensus(data, n_boot=1000, ci=95, seed=None):
7981

8082
# generate `n_boot` bootstrap correlation matrices by sampling `t` time
8183
# points from the concatenated time series
82-
if isinstance(data, list):
83-
nsample = int(collapsed_data.shape[-1] / len(data))
84-
else:
85-
nsample = data.shape[1]
86-
8784
for boot in range(n_boot):
8885
inds = rs.randint(collapsed_data.shape[-1], size=nsample)
8986
bootstrapped_corrmat[..., boot] = \

0 commit comments

Comments
 (0)