File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -130,8 +130,7 @@ def calculate_hist(
130130
131131def calculate_hist_threshold (hist , bins , percentile = 95 ):
132132 """Calculate histogram threshold."""
133- ets_hist_sum = np .sum (hist , axis = 0 )
134- cumsum_percentile = np .cumsum (ets_hist_sum ) / np .sum (ets_hist_sum ) * 100
133+ cumsum_percentile = np .cumsum (hist ) / np .sum (hist ) * 100
135134 thr = bins [len (cumsum_percentile [cumsum_percentile <= percentile ])]
136135
137136 return thr
@@ -163,7 +162,9 @@ def surrogates_histogram(
163162
164163 bin_edges = hist [0 ][1 ]
165164
165+ ets_hist_sum = np .sum (ets_hist , axis = 0 )
166+
166167 # calculate histogram threshold
167- thr = calculate_hist_threshold (ets_hist , bin_edges , percentile )
168+ thr = calculate_hist_threshold (ets_hist_sum , bin_edges , percentile )
168169
169170 return thr
Original file line number Diff line number Diff line change @@ -108,7 +108,9 @@ def event_detection(
108108 idxpeak = idx
109109
110110 # get co-fluctuation at peaks
111- etspeaks = connectivity_utils .threshold_ets_matrix (ets , thr = 0 , selected_idxs = idxpeak )
111+ etspeaks = connectivity_utils .threshold_ets_matrix (
112+ ets .copy (), thr = 0 , selected_idxs = idxpeak
113+ )
112114
113115 # Make selection of points with edge time-series matrix
114116 elif "ets" in peak_detection :
@@ -145,7 +147,7 @@ def event_detection(
145147 )
146148
147149 # Apply threshold on edge time-series matrix
148- etspeaks = connectivity_utils .threshold_ets_matrix (ets , thr )
150+ etspeaks = connectivity_utils .threshold_ets_matrix (ets . copy () , thr )
149151 idxpeak = np .where (etspeaks != 0 )[0 ]
150152 rss = np .sqrt (np .sum (np .square (etspeaks ), axis = 1 ))
151153 # calculate mean co-fluctuation (edge time series) across all peaks
You can’t perform that action at this time.
0 commit comments