History

[tests] use np.loadtxt in utils

Paul Brossier committed 8 years ago

Commit 0bae15a1 parent bb63c191 file · +2 −5Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/tests/utils.py+2−5
@@ -8,11 +8,8 @@ from tempfile import mkstemp · 7 unmodified lines
8DEFAULT_SOUND = '22050Hz_5s_brownnoise.wav'8DEFAULT_SOUND = '22050Hz_5s_brownnoise.wav'
9 9
10def array_from_text_file(filename, dtype = 'float'):10def 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
17def list_all_sounds(rel_dir):14def 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)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t