From: Paul Brossier Date: Thu, 1 Nov 2018 21:13:11 +0000 (+0100) Subject: [tests] use np.loadtxt in utils X-Git-Tag: 0.4.9~71^2~48 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=0bae15ac90f75f9da469356239bc59c928a60837;p=aubio.git [tests] use np.loadtxt in utils --- diff --git a/python/tests/utils.py b/python/tests/utils.py index b0963fc4..b374fe5f 100644 --- a/python/tests/utils.py +++ b/python/tests/utils.py @@ -8,11 +8,8 @@ from tempfile import mkstemp DEFAULT_SOUND = '22050Hz_5s_brownnoise.wav' def array_from_text_file(filename, dtype = 'float'): - filename = os.path.join(os.path.dirname(__file__), filename) - with open(filename) as f: - lines = f.readlines() - return np.array([line.split() for line in lines], - dtype = dtype) + realpathname = os.path.join(os.path.dirname(__file__), filename) + return np.loadtxt(realpathname, dtype = dtype) def list_all_sounds(rel_dir): datadir = os.path.join(os.path.dirname(__file__), rel_dir)