def test_catch_all_visualize_invalid_structure(): data = {} with pytest.raises(Exception) as e: visualize(data) assert ( 'MatrixProfile, Pan-MatrixProfile or Statistics data structure expected!' == str(e.value))
def test_catch_all_visualize_mp_motifs(): ts = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) w = 4 profile = stomp(ts, w, n_jobs=1) profile['motifs'] = [{'motifs': [1, 1], 'neighbors': []}] figures = visualize(profile) assert (len(figures) == 3)
def test_catch_all_visualize_mp_discords(): ts = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) w = 4 profile = stomp(ts, w, n_jobs=1) profile['discords'] = [0, 1] figures = visualize(profile) assert (len(figures) == 2)
def test_catch_all_visualize_mp_av(): ts = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) w = 4 profile = stomp(ts, w, n_jobs=1) profile['av'] = np.arange(len(ts) - w + 1) figures = visualize(profile) assert (len(figures) == 2)
def test_catch_all_visualize_mp_only(): ts = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) w = 4 profile = stomp(ts, w, n_jobs=1) # expect only the matrix profile plot figures = visualize(profile) assert (len(figures) == 1)
def test_catch_all_visualize_pmp_discords(): ts = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) w = [4, 5, 6] profile = skimp(ts, w, n_jobs=1) profile['discords'] = [(0, 1), (0, 2)] figures = visualize(profile) assert (len(figures) == 3)
def test_catch_all_visualize_pmp_motifs_discords(): ts = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) w = [4, 5, 6] profile = skimp(ts, w, n_jobs=1) profile['discords'] = [(0, 1), (0, 2)] profile['motifs'] = [{'motifs': [(1, 1)], 'neighbors': []}] figures = visualize(profile) assert (len(figures) == 5)
def test_catch_all_stats(): profile = {'class': 'Statistics', 'ts': np.array([]), 'window_size': 100} figures = visualize(profile) assert (len(figures) == 1)