Skip to content

Commit 8aae46d

Browse files
Fixed #750 Clean scrump and scraamp (#887)
* Clean code * Clean code
1 parent f349385 commit 8aae46d

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

stumpy/scraamp.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ def _compute_PI(
175175
core._apply_exclusion_zone(p_norm_profile, i, excl_zone, np.inf)
176176

177177
nn_i = np.argmin(p_norm_profile)
178+
if p_norm_profile[nn_i] == np.inf:
179+
continue
180+
178181
if (
179182
p_norm_profile[nn_i] < P_NORM[thread_idx, i, -1]
180183
and nn_i not in I[thread_idx, i]
@@ -189,11 +192,6 @@ def _compute_PI(
189192
)
190193
core._shift_insert_at_index(I[thread_idx, i], idx, nn_i)
191194

192-
# this if is not needed as it is probably never executed
193-
if P_NORM[thread_idx, i, 0] == np.inf: # pragma: no cover
194-
I[thread_idx, i, 0] = -1
195-
continue
196-
197195
j = nn_i
198196
p_norm_j = P_NORM[thread_idx, i, 0]
199197
p_norm_j_prime = p_norm_j

stumpy/scrump.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ def _compute_PI(
251251
core._apply_exclusion_zone(squared_distance_profile, i, excl_zone, np.inf)
252252

253253
nn_i = np.argmin(squared_distance_profile)
254+
if squared_distance_profile[nn_i] == np.inf:
255+
continue
256+
254257
if (
255258
squared_distance_profile[nn_i] < P_squared[thread_idx, i, -1]
256259
and nn_i not in I[thread_idx, i]
@@ -265,10 +268,6 @@ def _compute_PI(
265268
)
266269
core._shift_insert_at_index(I[thread_idx, i], idx, nn_i)
267270

268-
if P_squared[thread_idx, i, 0] == np.inf: # pragma: no cover
269-
I[thread_idx, i, 0] = -1
270-
continue
271-
272271
j = nn_i
273272
QT_j = QT[j]
274273
QT_j_prime = QT_j

0 commit comments

Comments
 (0)