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 | DEFAULT_SOUND = '22050Hz_5s_brownnoise.wav' | 8 | DEFAULT_SOUND = '22050Hz_5s_brownnoise.wav' |
| 9 | 9 | ||
| 10 | def array_from_text_file(filename, dtype = 'float'): | 10 | def array_from_text_file(filename, dtype = 'float'): |
| 11 | filename = os.path.join(os.path.dirname(__file__), filename) | 11 | realpathname = os.path.join(os.path.dirname(__file__), filename) |
| 12 | with open(filename) as f: | 12 | return np.loadtxt(realpathname, dtype = dtype) |
| 13 | lines = f.readlines() | ||
| 14 | return np.array([line.split() for line in lines], | ||
| 15 | dtype = dtype) | ||
| 16 | 13 | ||
| 17 | def list_all_sounds(rel_dir): | 14 | def list_all_sounds(rel_dir): |
| 18 | datadir = os.path.join(os.path.dirname(__file__), rel_dir) | 15 | datadir = os.path.join(os.path.dirname(__file__), rel_dir) |