Skip to content

Commit afc79f9

Browse files
committed
Fixed #501 Allow max_distance = np.inf in match
1 parent 80e1899 commit afc79f9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

stumpy/aamp_motifs.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,11 @@ def max_distance(D):
373373
matches = []
374374

375375
candidate_idx = np.argmin(D)
376-
while D[candidate_idx] <= atol + max_distance and len(matches) < max_matches:
376+
while (
377+
D[candidate_idx] <= atol + max_distance
378+
and np.isfinite(D[candidate_idx])
379+
and len(matches) < max_matches
380+
):
377381
matches.append([D[candidate_idx], candidate_idx])
378382
core.apply_exclusion_zone(D, candidate_idx, excl_zone)
379383
candidate_idx = np.argmin(D)

stumpy/motifs.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,11 @@ def max_distance(D):
414414
matches = []
415415

416416
candidate_idx = np.argmin(D)
417-
while D[candidate_idx] <= atol + max_distance and len(matches) < max_matches:
417+
while (
418+
D[candidate_idx] <= atol + max_distance
419+
and np.isfinite(D[candidate_idx])
420+
and len(matches) < max_matches
421+
):
418422
matches.append([D[candidate_idx], candidate_idx])
419423
core.apply_exclusion_zone(D, candidate_idx, excl_zone)
420424
candidate_idx = np.argmin(D)

0 commit comments

Comments
 (0)