From 044dd9bdd71daceb84e9d49f4aaef4ebbe8b6cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Fri, 5 Jul 2019 14:23:31 +0300 Subject: [PATCH] Ensure dimensionality in reading/processing W-files Former-commit-id: e7daf090afa430d87418091df2f10eaf5da943bf --- qpms/qpms_p.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/qpms/qpms_p.py b/qpms/qpms_p.py index 0faef91..ddc9296 100644 --- a/qpms/qpms_p.py +++ b/qpms/qpms_p.py @@ -805,9 +805,7 @@ def processWfiles_sameKs(freqfilenames, destfilename, nparticles = 2, lMax = Non #Check the first file to get the "constants" set filename = freqfilenames[0] - data = np.loadtxt(filename) - if len(data.shape) == 1: - data = np.reshape(data, (1,) + data.shape) + data = np.loadtxt(filename, ndmin = 2) nk_muster = data.shape[0] Wdata = data[...,5:] @@ -835,9 +833,7 @@ def processWfiles_sameKs(freqfilenames, destfilename, nparticles = 2, lMax = Non succread = 0 for filename in freqfilenames: - data = np.loadtxt(filename) - if len(data.shape) == 1: - data = np.reshape(data, (1,) + data.shape) + data = np.loadtxt(filename, ndmin=2) if data.shape[0] != nk_muster: raise ValueError("%s contains different number of lines than %s"%(filename, freqfilenames[0])) ks_current = np.array(data[:,3:5])