Showing the changes to python/tests/utils.py (1 of 3 files). Show all
Unified · Split
| @@ -1,9 +1,13 @@ | |||
| 1 | #! /usr/bin/env python | 1 | #! /usr/bin/env python |
| 2 | 2 | ||
| 3 | def array_from_text_file(filename, dtype = 'float'): | 3 | def array_from_text_file(filename, dtype = 'float'): |
| 4 | import os.path | 4 | import os.path |
| 5 | from numpy import array | 5 | from numpy import array |
| 6 | filename = os.path.join(os.path.dirname(__file__), filename) | 6 | filename = os.path.join(os.path.dirname(__file__), filename) |
| 7 | return array([line.split() for line in open(filename).readlines()], | 7 | return array([line.split() for line in open(filename).readlines()], |
| 8 | dtype = dtype) | 8 | dtype = dtype) |
| 9 | 9 | ||
| 10 | def list_all_sounds(rel_dir): | ||
| 11 | import os.path, glob | ||
| 12 | datadir = os.path.join(os.path.dirname(__file__), rel_dir) | ||
| 13 | return glob.glob(os.path.join(datadir,'*.*')) | ||