Mercurial > hg > plosone_underreview
comparison tests/test_PitchBihist.py @ 39:0e70021f251e branch-tests
some tests on OPmellin
author | Maria Panteli |
---|---|
date | Thu, 14 Sep 2017 16:30:41 +0100 |
parents | 2cc444441f42 |
children | 9b2beffa5fdd |
comparison
equal
deleted
inserted
replaced
38:e5e8e8a96948 | 39:0e70021f251e |
---|---|
40 melody_matrix = pbi.get_melody_matrix(melody) | 40 melody_matrix = pbi.get_melody_matrix(melody) |
41 n_frames = melody_matrix.shape[1] | 41 n_frames = melody_matrix.shape[1] |
42 assert np.array_equal(melody_matrix[45, :], np.ones(n_frames)) | 42 assert np.array_equal(melody_matrix[45, :], np.ones(n_frames)) |
43 | 43 |
44 | 44 |
45 def test_second_frame_decomposition(): | |
46 norigframes = 100 | |
47 nframes, win2, hop2 = pbi.second_frame_decomposition(norigframes) | |
48 assert nframes == 1 | |
49 | |
50 | |
51 def test_second_frame_decomposition(): | |
52 norigframes = np.ceil(pbi.melody_sr * 16.) | |
53 nframes, win2, hop2 = pbi.second_frame_decomposition(norigframes) | |
54 # for 16-sec segment with .5 hop size expect ~16 frames round up | |
55 assert nframes == 17 | |
56 | |
57 | |
45 def test_bihist_from_melodia(): | 58 def test_bihist_from_melodia(): |
46 melodia_file = 'data/sample_dataset/Melodia/mel_1_2_1.csv' | 59 melodia_file = 'data/sample_dataset/Melodia/mel_1_2_1.csv' |
47 bihist = pbi.bihist_from_melodia(melodia_file, secondframedecomp=False) | 60 bihist = pbi.bihist_from_melodia(melodia_file, secondframedecomp=False) |
48 assert bihist.shape == (60, 60) | 61 assert bihist.shape == (60, 60) |
49 | 62 |