Enable processing one-line (single K) Wfiles; plots for hexlaser
supplementary Former-commit-id: 0f4027ecc7bcb7780c04fdd13bd7144eb7a1d3e9
This commit is contained in:
parent
156c54f4b3
commit
408685c606
|
@ -805,15 +805,18 @@ def processWfiles_sameKs(freqfilenames, destfilename, lMax = None, f='npz'):
|
||||||
#Check the first file to get the "constants" set
|
#Check the first file to get the "constants" set
|
||||||
filename = freqfilenames[0]
|
filename = freqfilenames[0]
|
||||||
data = np.loadtxt(filename)
|
data = np.loadtxt(filename)
|
||||||
|
if len(data.shape) == 1:
|
||||||
|
data = np.reshape(data, (1,) + data.shape)
|
||||||
nk_muster = data.shape[0]
|
nk_muster = data.shape[0]
|
||||||
Wdata = data[:,5:]
|
Wdata = data[...,5:]
|
||||||
|
|
||||||
if (lMax is None):
|
if (lMax is None):
|
||||||
nelem = int((Wdata.shape[1]/nparticles**2)**.5/2)
|
nelem = int((Wdata.shape[1]/nparticles**2)**.5/2)
|
||||||
lMax = nelem2lMax(nelem)
|
lMax = nelem2lMax(nelem)
|
||||||
else:
|
else:
|
||||||
nelem = lMax2nelem(lMax)
|
nelem = lMax2nelem(lMax)
|
||||||
ks_muster = np.array(data[:,3:5], copy=True)
|
ks_muster = np.array(data[...,3:5], copy=True)
|
||||||
|
|
||||||
if f == 'npz':
|
if f == 'npz':
|
||||||
allWs = np.empty((nfiles, nk_muster, nparticles, nparticles, 2, nelem, nelem,), dtype=complex)
|
allWs = np.empty((nfiles, nk_muster, nparticles, nparticles, 2, nelem, nelem,), dtype=complex)
|
||||||
elif f == 'd':
|
elif f == 'd':
|
||||||
|
@ -832,13 +835,15 @@ def processWfiles_sameKs(freqfilenames, destfilename, lMax = None, f='npz'):
|
||||||
|
|
||||||
for filename in freqfilenames:
|
for filename in freqfilenames:
|
||||||
data = np.loadtxt(filename)
|
data = np.loadtxt(filename)
|
||||||
|
if len(data.shape) == 1:
|
||||||
|
data = np.reshape(data, (1,) + data.shape)
|
||||||
if data.shape[0] != nk_muster:
|
if data.shape[0] != nk_muster:
|
||||||
raise ValueError("%s contains different number of lines than %s"%(filename, freqfilenames[0]))
|
raise ValueError("%s contains different number of lines than %s"%(filename, freqfilenames[0]))
|
||||||
ks_current = np.array(data[:,3:5])
|
ks_current = np.array(data[:,3:5])
|
||||||
if not np.all(ks_current == ks_muster):
|
if not np.all(ks_current == ks_muster):
|
||||||
raise ValueError("%s contains different k-vectors than %s"%(filename, freqfilenames[0]))
|
raise ValueError("%s contains different k-vectors than %s"%(filename, freqfilenames[0]))
|
||||||
curWdata = data[:,5:]
|
curWdata = data[...,5:]
|
||||||
curWs = curWdata[:,::2] + 1j*curWdata[:,1::2]
|
curWs = curWdata[...,::2] + 1j*curWdata[...,1::2]
|
||||||
curWs.shape = (nk_muster, nparticles, nparticles, 2, nelem, nelem)
|
curWs.shape = (nk_muster, nparticles, nparticles, 2, nelem, nelem)
|
||||||
allWs[succread] = curWs
|
allWs[succread] = curWs
|
||||||
cur_freqs_weirdunits = np.array(data[:,0])
|
cur_freqs_weirdunits = np.array(data[:,0])
|
||||||
|
|
Loading…
Reference in New Issue