Skip to content

Commit bf66a4b

Browse files
committed
Fixed #439 cuttoff parameter note used in motifs.py
1 parent 650a549 commit bf66a4b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

stumpy/aamp_motifs.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def _aamp_motifs(
1919
excl_zone,
2020
min_neighbors,
2121
max_distance,
22+
cutoff,
2223
max_matches,
2324
max_motifs,
2425
):
@@ -59,6 +60,10 @@ def _aamp_motifs(
5960
that accepts a single parameter, `D`, in its function signature, which is the
6061
distance profile between `Q` and `T`.
6162
63+
cutoff : float
64+
The largest matrix profile value (distance) that a candidate motif is allowed
65+
to have.
66+
6267
max_matches : int
6368
The maximum number of similar matches to be returned. The resulting
6469
matches are sorted by distance (starting with the most similar). Note that the
@@ -89,7 +94,7 @@ def _aamp_motifs(
8994
candidate_idx = np.argmin(P[-1])
9095
while len(motif_indices) < max_motifs:
9196
profile_value = P[-1, candidate_idx]
92-
if np.isinf(profile_value): # pragma: no cover
97+
if profile_value > cutoff: # pragma: no cover
9398
break
9499

95100
# If max_distance is a constant (independent of the distance profile D of Q
@@ -235,6 +240,7 @@ def aamp_motifs(
235240
excl_zone,
236241
min_neighbors,
237242
max_distance,
243+
cutoff,
238244
max_matches,
239245
max_motifs,
240246
)

stumpy/motifs.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def _motifs(
2020
excl_zone,
2121
min_neighbors,
2222
max_distance,
23+
cutoff,
2324
max_matches,
2425
max_motifs,
2526
):
@@ -58,6 +59,10 @@ def _motifs(
5859
that accepts a single parameter, `D`, in its function signature, which is the
5960
distance profile between `Q` and `T`.
6061
62+
cutoff : float
63+
The largest matrix profile value (distance) that a candidate motif is allowed
64+
to have.
65+
6166
max_matches : int
6267
The maximum number of similar matches to be returned. The resulting
6368
matches are sorted by distance (starting with the most similar). Note that
@@ -93,7 +98,7 @@ def _motifs(
9398
candidate_idx = np.argmin(P[-1])
9499
while len(motif_indices) < max_motifs:
95100
profile_value = P[-1, candidate_idx]
96-
if np.isinf(profile_value): # pragma: no cover
101+
if profile_value > cutoff: # pragma: no cover
97102
break
98103

99104
# If max_distance is a constant (independent of the distance profile D of Q
@@ -244,6 +249,7 @@ def motifs(
244249
excl_zone,
245250
min_neighbors,
246251
max_distance,
252+
cutoff,
247253
max_matches,
248254
max_motifs,
249255
)

0 commit comments

Comments
 (0)