diff 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
line wrap: on
line diff
--- a/tests/test_PitchBihist.py	Thu Sep 14 15:21:52 2017 +0100
+++ b/tests/test_PitchBihist.py	Thu Sep 14 16:30:41 2017 +0100
@@ -42,6 +42,19 @@
     assert np.array_equal(melody_matrix[45, :], np.ones(n_frames))
 
 
+def test_second_frame_decomposition():
+    norigframes = 100
+    nframes, win2, hop2 = pbi.second_frame_decomposition(norigframes)
+    assert nframes == 1
+
+
+def test_second_frame_decomposition():
+    norigframes = np.ceil(pbi.melody_sr * 16.)
+    nframes, win2, hop2 = pbi.second_frame_decomposition(norigframes)
+    # for 16-sec segment with .5 hop size expect ~16 frames round up
+    assert nframes == 17
+
+
 def test_bihist_from_melodia():
     melodia_file = 'data/sample_dataset/Melodia/mel_1_2_1.csv'
     bihist = pbi.bihist_from_melodia(melodia_file, secondframedecomp=False)