mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
new idea for reading ms5_xsf data
This commit is contained in:
parent
6ef081acef
commit
3399b72bfb
1 changed files with 56 additions and 22 deletions
|
@ -1001,6 +1001,7 @@ def read_ms5_xsf(path, prefix, qc, corr):
|
||||||
files = sorted(files)
|
files = sorted(files)
|
||||||
for file in files:
|
for file in files:
|
||||||
with open(path+"/"+file, "rb") as fp:
|
with open(path+"/"+file, "rb") as fp:
|
||||||
|
|
||||||
t = fp.read(8)
|
t = fp.read(8)
|
||||||
kappa = struct.unpack('d', t)[0]
|
kappa = struct.unpack('d', t)[0]
|
||||||
t = fp.read(8)
|
t = fp.read(8)
|
||||||
|
@ -1018,30 +1019,63 @@ def read_ms5_xsf(path, prefix, qc, corr):
|
||||||
bnd = struct.unpack('i', t)[0]
|
bnd = struct.unpack('i', t)[0]
|
||||||
|
|
||||||
print("T:", tmax)
|
print("T:", tmax)
|
||||||
t = fp.read(4)
|
|
||||||
cnfg = struct.unpack('i', t)[0]
|
|
||||||
print(cnfg)
|
|
||||||
placesBI = ["gS", "gP", "gA", "gV", "gVt", "lA", "lV", "lVt",
|
|
||||||
"lT", "lTt"]
|
|
||||||
placesBB = ["g1", "l1"]
|
|
||||||
if not corr in placesBB:
|
|
||||||
for i in range(placesBI.index(corr)):
|
|
||||||
t = fp.read(8*2*tmax)
|
|
||||||
|
|
||||||
t = fp.read(8*2*tmax)
|
placesBI = ["gS", "gP",
|
||||||
tmpcorr = struct.unpack('d'*2*tmax, t)
|
"gA", "gV",
|
||||||
corrres = [[],[]]
|
"gVt", "lA",
|
||||||
for i in range(len(tmpcorr)):
|
"lV", "lVt",
|
||||||
corrres[i%2].append(tmpcorr[i])
|
"lT", "lTt"]
|
||||||
else:
|
placesBB = ["g1", "l1"]
|
||||||
# boundary to boundary correlators
|
|
||||||
for i in range(len(placesBI)):
|
|
||||||
t = fp.read(8*2*tmax)
|
|
||||||
for i in range(placesBB.index(corr)):
|
|
||||||
t = fp.read(8*2)
|
|
||||||
t = fp.read(8*2)
|
|
||||||
corrres = list(struct.unpack('d'*2, t))
|
|
||||||
|
|
||||||
|
# bytes per config
|
||||||
|
# the chunks have the following structure:
|
||||||
|
# confignumber, 10x timedependent complex correlators, 2x timeindependent complex correlators
|
||||||
|
|
||||||
|
chunksize = 4 +( 8 *2*tmax*10)+( 8 *2*2)
|
||||||
|
print(chunksize)
|
||||||
|
packstr ='i'+('d'*2*tmax*10)+('d'*2*2)
|
||||||
|
while True:
|
||||||
|
cnfgt = fp.read(chunksize)
|
||||||
|
if not cnfgt:
|
||||||
|
break
|
||||||
|
asascii=struct.unpack(packstr, cnfgt)
|
||||||
|
cnfg = asascii[0]
|
||||||
|
#cnfg = struct.unpack('i', t)[0]
|
||||||
|
print(cnfg)
|
||||||
|
|
||||||
|
if not corr in placesBB:
|
||||||
|
#for i in range(placesBI.index(corr)):
|
||||||
|
# t = fp.read(8*2*tmax)
|
||||||
|
tmpcorr = asascii[1+2*tmax*placesBI.index(corr):1+2*tmax*placesBI.index(corr)+2*tmax]
|
||||||
|
#t = fp.read(8*2*tmax)
|
||||||
|
#tmpcorr = struct.unpack('d'*2*tmax, t)
|
||||||
|
corrres = [[],[]]
|
||||||
|
for i in range(len(tmpcorr)):
|
||||||
|
corrres[i%2].append(tmpcorr[i])
|
||||||
|
# jump to next config
|
||||||
|
#t = fp.read(chunksize-(4+placesBI.index(corr)*8*2*tmax+2*8*2))
|
||||||
|
else:
|
||||||
|
#for i in range(placesBI.index(corr)):
|
||||||
|
# t = fp.read(8*2*tmax)
|
||||||
|
tmpcorr = asascii[1+2*tmax*len(placesBI):1+2*tmax*len(placesBI)+2]
|
||||||
|
#t = fp.read(8*2*tmax)
|
||||||
|
#tmpcorr = struct.unpack('d'*2*tmax, t)
|
||||||
|
corrres = [[],[]]
|
||||||
|
for i in range(len(tmpcorr)):
|
||||||
|
corrres[i%2].append(tmpcorr[i])
|
||||||
|
# jump to next config
|
||||||
|
#t = fp.read(chunksize-(4+placesBI.index(corr)*8*2*tmax+2*8*2))
|
||||||
|
|
||||||
|
# boundary to boundary correlators
|
||||||
|
#for i in range(len(placesBI)):
|
||||||
|
# t = fp.read(8*2*tmax)
|
||||||
|
#for i in range(placesBB.index(corr)):
|
||||||
|
# t = fp.read(8*2)
|
||||||
|
#t = fp.read(8*2)
|
||||||
|
#corrres = list(struct.unpack('d'*2, t))
|
||||||
|
# jump to next config
|
||||||
|
#t = fp.read(chunksize-(4+len(placesBI)*8*2*tmax+(2-placesBB.index(corr))*8*2))
|
||||||
|
|
||||||
|
|
||||||
print(corrres)
|
print(corrres)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue