Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -8,11 +8,8 @@ from tempfile import mkstemp · 7 unmodified lines | ||
| 8 | 8 | DEFAULT_SOUND = '22050Hz_5s_brownnoise.wav' |
| 9 | 9 | |
| 10 | 10 | def array_from_text_file(filename, dtype = 'float'): |
| 11 | − filename = os.path.join(os.path.dirname(__file__), filename) | |
| 12 | − with open(filename) as f: | |
| 13 | − lines = f.readlines() | |
| 14 | − return np.array([line.split() for line in lines], | |
| 15 | − dtype = dtype) | |
| 11 | + realpathname = os.path.join(os.path.dirname(__file__), filename) | |
| 12 | + return np.loadtxt(realpathname, dtype = dtype) | |
| 16 | 13 | |
| 17 | 14 | def list_all_sounds(rel_dir): |
| 18 | 15 | datadir = os.path.join(os.path.dirname(__file__), rel_dir) |