MCPcopy Index your code
hub / github.com/stumpy-dev/stumpy / naive_aamp_match

Function naive_aamp_match

tests/test_aamp_motifs.py:22–43  ·  view source on GitHub ↗
(Q, T, p, excl_zone, max_distance)

Source from the content-addressed store, hash-verified

20
21
22def naive_aamp_match(Q, T, p, excl_zone, max_distance):
23 m = Q.shape[0]
24 D = naive.aamp_distance_profile(Q, T, m, p)
25
26 # Finds all indices that have a lower distance profile value `D`
27 # than `atol + rtol * D`
28 matches = []
29 for i in range(D.size):
30 dist = D[i]
31 if dist <= max_distance:
32 matches.append(i)
33
34 # Removes indices that are inside the exclusion zone of some occurrence with
35 # a smaller distance to the query
36 matches.sort(key=lambda x: D[x])
37 result = []
38 while len(matches) > 0:
39 o = matches[0]
40 result.append([D[o], o])
41 matches = [x for x in matches if x < o - excl_zone or x > o + excl_zone]
42
43 return np.array(result, dtype=object)
44
45
46def test_aamp_motifs_one_motif():

Calls

no outgoing calls

Tested by

no test coverage detected