Example #1
0
def test_mpdist_snippets_percentage(T, m, k, percentage):
    (
        ref_snippets,
        ref_indices,
        ref_profiles,
        ref_fractions,
        ref_areas,
        ref_regimes,
    ) = naive.mpdist_snippets(T, m, k, percentage=percentage)
    (
        cmp_snippets,
        cmp_indices,
        cmp_profiles,
        cmp_fractions,
        cmp_areas,
        cmp_regimes,
    ) = snippets(T, m, k, percentage=percentage)

    npt.assert_almost_equal(ref_snippets,
                            cmp_snippets,
                            decimal=config.STUMPY_TEST_PRECISION)
    npt.assert_almost_equal(ref_indices,
                            cmp_indices,
                            decimal=config.STUMPY_TEST_PRECISION)
    npt.assert_almost_equal(ref_profiles,
                            cmp_profiles,
                            decimal=config.STUMPY_TEST_PRECISION)
    npt.assert_almost_equal(ref_fractions,
                            cmp_fractions,
                            decimal=config.STUMPY_TEST_PRECISION)
    npt.assert_almost_equal(ref_areas,
                            cmp_areas,
                            decimal=config.STUMPY_TEST_PRECISION)
    npt.assert_almost_equal(ref_regimes, cmp_regimes)
Example #2
0
def test_mpdist_snippets(T, m, k):
    (
        ref_snippets,
        ref_indices,
        ref_profiles,
        ref_fractions,
        ref_areas,
    ) = naive.mpdist_snippets(T, m, k)
    cmp_snippets, cmp_indices, cmp_profiles, cmp_fractions, cmp_areas = snippets(
        T, m, k
    )

    npt.assert_almost_equal(
        ref_snippets, cmp_snippets, decimal=config.STUMPY_TEST_PRECISION
    )
    npt.assert_almost_equal(
        ref_indices, cmp_indices, decimal=config.STUMPY_TEST_PRECISION
    )
    npt.assert_almost_equal(
        ref_profiles, cmp_profiles, decimal=config.STUMPY_TEST_PRECISION
    )
    npt.assert_almost_equal(
        ref_fractions, cmp_fractions, decimal=config.STUMPY_TEST_PRECISION
    )
    npt.assert_almost_equal(ref_areas, cmp_areas, decimal=config.STUMPY_TEST_PRECISION)
def test_snippets():
    T = np.random.rand(64)
    m = 10
    k = 2

    (
        ref_snippets,
        ref_indices,
        ref_profiles,
        ref_fractions,
        ref_areas,
    ) = stumpy.aampdist_snippets(T, m, k)
    (
        cmp_snippets,
        cmp_indices,
        cmp_profiles,
        cmp_fractions,
        cmp_areas,
    ) = stumpy.snippets(T, m, k, normalize=False)
    npt.assert_almost_equal(ref_snippets, cmp_snippets)