Mercurial > hg > vampy-host
changeset 97:06c4afba4fc5
Fix matrix return
author | Chris Cannam |
---|---|
date | Tue, 03 Feb 2015 10:29:21 +0000 |
parents | f0e005248b9a |
children | f0c18ba7b54e |
files | test/test_collect.py vamp/collect.py |
diffstat | 2 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/test/test_collect.py Mon Feb 02 17:31:30 2015 +0000 +++ b/test/test_collect.py Tue Feb 03 10:29:21 2015 +0000 @@ -71,6 +71,5 @@ assert abs(float(step) - (1024.0 / rate)) < eps assert len(results) == 10 for i in range(len(results)): - expected = [] - actual = results[i] - assert actual == expected + expected = np.array([ (j + i + 2.0) / 30.0 for j in range(0, 10) ]) + assert (abs(results[i] - expected) < eps).all()
--- a/vamp/collect.py Mon Feb 02 17:31:30 2015 +0000 +++ b/vamp/collect.py Tue Feb 03 10:29:21 2015 +0000 @@ -71,10 +71,9 @@ rv = ( out_step, np.array([r[output]["values"][0] for r in results], np.float32) ) elif shape == "matrix": - rv = ( out_step, - np.array( - [[r[output]["values"][i] for r in results] - for i in range(0, output_desc["bin_count"])], np.float32) ) + #!!! todo: check that each feature has the right number of bins? + outseq = [r[output]["values"] for r in results] + rv = ( out_step, np.array(outseq, np.float32) ) else: rv = list(fill_timestamps(results, sample_rate, step_size, output_desc))