diff tests/test_load_features.py @ 2:dfd984dbfaea branch-tests

started tests
author Maria Panteli <m.x.panteli@gmail.com>
date Fri, 01 Sep 2017 19:25:52 +0300
parents
children 230a0cf17de0
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test_load_features.py	Fri Sep 01 19:25:52 2017 +0300
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Fri Sep  1 19:11:52 2017
+
+@author: mariapanteli
+"""
+
+import pytest
+
+import numpy as np
+
+import load_features
+
+feat_loader = load_features.FeatureLoader(win2sec=8)
+
+def test_get_music_idx_from_bounds():
+    bounds = np.array([['0', '10.5', 'm'], 
+              ['10.5', '12.0', 's'],
+              ['12.0', '30.0', 'm']])
+    sr = feat_loader.framessr2
+    music_bounds = feat_loader.get_music_idx_from_bounds(bounds, sr=sr)
+    music_bounds_true = np.arange(np.round(sr * np.float(bounds[-1, 1])))
+    assert np.array_equal(music_bounds, music_bounds_true)
+    
+test_get_music_idx_from_bounds()
\ No newline at end of file