Skip to content

Commit 1526086

Browse files
committed
Avoid use of unnecessary variables
1 parent 4e54dc6 commit 1526086

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

connPFM/connectivity/connectivity_utils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,16 @@ def calculate_hist_threshold(hist, bins, percentile=95):
140140

141141
def sum_histograms(
142142
hist_list,
143-
numrand,
144-
nbins,
145143
):
146144
"""
147145
Get histograms of all surrogates and sum them to
148146
obtain a single histogram that summarizes the data.
149147
"""
150148

151-
all_hists = np.zeros((numrand, nbins))
149+
# Initialize matrix to store surrogate histograms
150+
all_hists = np.zeros((len(hist_list), hist_list[0][3].shape[0] - 1))
152151

153-
for rand_idx in range(numrand):
152+
for rand_idx in range(len(hist_list)):
154153
all_hists[rand_idx, :] = hist_list[rand_idx][2]
155154

156155
ets_hist_sum = np.sum(all_hists, axis=0)

connPFM/connectivity/ev.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ def event_detection(
115115
LGR.info("Reading AUC of surrogates to perform the thresholding step...")
116116
hist_sum = connectivity_utils.sum_histograms(
117117
surrogate_events,
118-
numrand=nsur,
119-
nbins=nbins,
120118
)
121119
thr = connectivity_utils.calculate_hist_threshold(
122120
hist_sum, surrogate_events[0][3][:-1], percentile=95

0 commit comments

Comments
 (0)