Mercurial > hg > plosone_underreview
diff 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 |
line wrap: on
line diff
--- a/tests/test_map_and_average.py Thu Sep 21 15:25:20 2017 +0100 +++ b/tests/test_map_and_average.py Thu Sep 21 17:35:07 2017 +0100 @@ -35,4 +35,13 @@ audiolabels = np.array(['a', 'a', 'b', 'b', 'b']) feat, audio, labels = map_and_average.averageframes(features, audiolabels, classlabels) feat_true = np.array([[0, 1.5], [1, 1]]) - assert np.array_equal(feat, feat_true) \ No newline at end of file + assert np.array_equal(feat, feat_true) + + +def test_limit_to_n_seconds(): + X = np.random.randn(10, 3) + Y = np.random.randn(10) + Yaudio = np.concatenate([np.repeat('a', 7), np.repeat('b', 3)]) + Xn, Yn, Yaudion = map_and_average.limit_to_n_seconds([X, Y, Yaudio], n_sec=3.0, win_sec=0.5) + Yaudion_true = np.concatenate([np.repeat('a', 5), np.repeat('b', 3)]) + assert np.array_equal(Yaudion_true, Yaudion) and len(Xn)==len(Yn) and len(Yn)==len(Yaudion) \ No newline at end of file