def test_mmotifs_two_motif_pairs_max_motifs_2(T): motif_distances_ref = np.array( [[0.00000000e00, 1.11510080e-07], [1.68587394e-07, 2.58694429e-01]] ) motif_indices_ref = np.array([[2, 9], [6, 1]]) motif_subspaces_ref = [np.array([1]), np.array([2])] motif_mdls_ref = [ np.array([232.0, 250.57542476, 260.0, 271.3509059]), np.array([264.0, 280.0, 299.01955001, 310.51024953]), ] m = 4 excl_zone = int(np.ceil(m / config.STUMPY_EXCL_ZONE_DENOM)) P, I = naive.mstump(T, m, excl_zone) ( motif_distances_cmp, motif_indices_cmp, motif_subspaces_cmp, motif_mdls_cmp, ) = mmotifs( T, P, I, cutoffs=np.inf, max_motifs=2, max_distance=np.inf, max_matches=2 ) npt.assert_array_almost_equal(motif_distances_ref, motif_distances_cmp) npt.assert_array_almost_equal(motif_indices_ref, motif_indices_cmp) npt.assert_array_almost_equal(motif_subspaces_ref, motif_subspaces_cmp) npt.assert_array_almost_equal(motif_mdls_ref, motif_mdls_cmp)
def test_mmotifs_max_matches_none(T): motif_distances_ref = np.array([[0.0000000e00, 1.1151008e-07]]) motif_indices_ref = np.array([[2, 9]]) motif_subspaces_ref = [np.array([1])] motif_mdls_ref = [np.array([232.0, 250.57542476, 260.0, 271.3509059])] m = 4 excl_zone = int(np.ceil(m / config.STUMPY_EXCL_ZONE_DENOM)) P, I = naive.mstump(T, m, excl_zone) ( motif_distances_cmp, motif_indices_cmp, motif_subspaces_cmp, motif_mdls_cmp, ) = mmotifs(T, P, I, max_matches=None) npt.assert_array_almost_equal(motif_distances_ref, motif_distances_cmp) npt.assert_array_almost_equal(motif_indices_ref, motif_indices_cmp) npt.assert_array_almost_equal(motif_subspaces_ref, motif_subspaces_cmp) npt.assert_array_almost_equal(motif_mdls_ref, motif_mdls_cmp)
def test_mmotifs_max_matches_2_k_1(T): motif_distances_ref = np.array([[0.0, 0.20948156]]) motif_indices_ref = np.array([[2, 9]]) motif_subspaces_ref = [np.array([1, 3])] motif_mdls_ref = [np.array([232.0, 250.57542476, 260.0, 271.3509059])] m = 4 excl_zone = int(np.ceil(m / config.STUMPY_EXCL_ZONE_DENOM)) P, I = naive.mstump(T, m, excl_zone) ( motif_distances_cmp, motif_indices_cmp, motif_subspaces_cmp, motif_mdls_cmp, ) = mmotifs(T, P, I, max_distance=np.inf, max_matches=2, k=1) npt.assert_array_almost_equal(motif_distances_ref, motif_distances_cmp) npt.assert_array_almost_equal(motif_indices_ref, motif_indices_cmp) npt.assert_array_almost_equal(motif_subspaces_ref, motif_subspaces_cmp) npt.assert_array_almost_equal(motif_mdls_ref, motif_mdls_cmp)