Ensure dimensionality in reading/processing W-files

Former-commit-id: e7daf090afa430d87418091df2f10eaf5da943bf
This commit is contained in:
Marek Nečada 2019-07-05 14:23:31 +03:00
parent a5bff23b0e
commit 044dd9bdd7
1 changed files with 2 additions and 6 deletions

View File

@ -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])