comparison tests/test_map_and_average.py @ 62:4425a4918102 branch-tests

fixed indices for feature components
author Maria Panteli <m.x.panteli@gmail.com>
date Thu, 21 Sep 2017 17:35:07 +0100
parents e8084526f7e5
children
comparison
equal deleted inserted replaced
61:ac3fcd42e7bd 62:4425a4918102
34 features = np.array([[0, 1], [0,2], [0, 1], [1, 1], [2, 1]]) 34 features = np.array([[0, 1], [0,2], [0, 1], [1, 1], [2, 1]])
35 audiolabels = np.array(['a', 'a', 'b', 'b', 'b']) 35 audiolabels = np.array(['a', 'a', 'b', 'b', 'b'])
36 feat, audio, labels = map_and_average.averageframes(features, audiolabels, classlabels) 36 feat, audio, labels = map_and_average.averageframes(features, audiolabels, classlabels)
37 feat_true = np.array([[0, 1.5], [1, 1]]) 37 feat_true = np.array([[0, 1.5], [1, 1]])
38 assert np.array_equal(feat, feat_true) 38 assert np.array_equal(feat, feat_true)
39
40
41 def test_limit_to_n_seconds():
42 X = np.random.randn(10, 3)
43 Y = np.random.randn(10)
44 Yaudio = np.concatenate([np.repeat('a', 7), np.repeat('b', 3)])
45 Xn, Yn, Yaudion = map_and_average.limit_to_n_seconds([X, Y, Yaudio], n_sec=3.0, win_sec=0.5)
46 Yaudion_true = np.concatenate([np.repeat('a', 5), np.repeat('b', 3)])
47 assert np.array_equal(Yaudion_true, Yaudion) and len(Xn)==len(Yn) and len(Yn)==len(Yaudion)