comparison test/test_collect.py @ 88:7228921e8425

Some way to implementing collect()
author Chris Cannam
date Wed, 21 Jan 2015 15:13:00 +0000
parents 78844c4b329c
children 18b412a9c4d5
comparison
equal deleted inserted replaced
87:dd56716714e0 88:7228921e8425
18 def input_data(n): 18 def input_data(n):
19 # start at 1, not 0 so that all elts are non-zero 19 # start at 1, not 0 so that all elts are non-zero
20 return np.arange(n) + 1 20 return np.arange(n) + 1
21 21
22 def test_collect_runs_at_all(): 22 def test_collect_runs_at_all():
23 buf = input_data(blocksize) 23 buf = input_data(blocksize * 10)
24 results = vamp.collect(buf, rate, plugin_key, "input-summary") 24 results = list(vamp.collect(buf, rate, plugin_key, "input-timestamp"))
25 assert type(results) == dict 25 assert results != []
26
27 def test_collect_one_sample_per_step():
28 buf = input_data(blocksize * 10)
29 results = list(vamp.collect(buf, rate, plugin_key, "input-timestamp"))
30 assert len(results) == 10
31 for r in results:
32 assert r["timestamp"] == vamp.vampyhost.frame_to_realtime(r["values"][0], rate)
33