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
88 DEFAULT_SOUND = '22050Hz_5s_brownnoise.wav'
99
1010 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)
1613
1714 def list_all_sounds(rel_dir):
1815 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