Mercurial > hg > plosone_underreview
annotate 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 |
rev | line source |
---|---|
m@2 | 1 # -*- coding: utf-8 -*- |
m@2 | 2 """ |
m@2 | 3 Created on Fri Sep 1 19:11:52 2017 |
m@2 | 4 |
m@2 | 5 @author: mariapanteli |
m@2 | 6 """ |
m@2 | 7 |
m@2 | 8 import pytest |
m@2 | 9 |
m@2 | 10 import numpy as np |
m@2 | 11 |
m@2 | 12 import load_features |
m@2 | 13 |
m@2 | 14 feat_loader = load_features.FeatureLoader(win2sec=8) |
m@2 | 15 |
m@2 | 16 def test_get_music_idx_from_bounds(): |
m@2 | 17 bounds = np.array([['0', '10.5', 'm'], |
m@2 | 18 ['10.5', '12.0', 's'], |
m@2 | 19 ['12.0', '30.0', 'm']]) |
m@2 | 20 sr = feat_loader.framessr2 |
m@2 | 21 music_bounds = feat_loader.get_music_idx_from_bounds(bounds, sr=sr) |
m@2 | 22 music_bounds_true = np.arange(np.round(sr * np.float(bounds[-1, 1]))) |
m@2 | 23 assert np.array_equal(music_bounds, music_bounds_true) |
m@2 | 24 |
m@2 | 25 test_get_music_idx_from_bounds() |