()
| 595 | |
| 596 | |
| 597 | def test_motifs(): |
| 598 | T = np.random.rand(64) |
| 599 | m = 3 |
| 600 | |
| 601 | max_motifs = 3 |
| 602 | max_matches = 4 |
| 603 | max_distance = np.inf |
| 604 | cutoff = np.inf |
| 605 | |
| 606 | # naive |
| 607 | # `max_distance` and `cutoff` are hard-coded, and set to np.inf. |
| 608 | ref_distances, ref_indices = naive_motifs(T, m, max_motifs, max_matches) |
| 609 | |
| 610 | # performant |
| 611 | mp = naive.stump(T, m, row_wise=True) |
| 612 | comp_distance, comp_indices = motifs( |
| 613 | T, |
| 614 | mp[:, 0].astype(np.float64), |
| 615 | min_neighbors=1, |
| 616 | max_distance=max_distance, |
| 617 | cutoff=cutoff, |
| 618 | max_matches=max_matches, |
| 619 | max_motifs=max_motifs, |
| 620 | ) |
| 621 | |
| 622 | npt.assert_almost_equal(ref_indices, comp_indices) |
| 623 | npt.assert_almost_equal(ref_distances, comp_distance) |
| 624 | |
| 625 | |
| 626 | def test_motifs_with_isconstant(): |
nothing calls this directly
no test coverage detected