mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 14:50:25 +01:00
read_rwms output cleaned up
This commit is contained in:
parent
caa1330ab8
commit
c0cf1bb4c0
1 changed files with 6 additions and 7 deletions
|
@ -300,9 +300,9 @@ def parse_array_openQCD2(d, n, size, wa, quadrupel=False):
|
||||||
return arr
|
return arr
|
||||||
|
|
||||||
|
|
||||||
# mimic the read_array routine of openQCD-2.0.
|
# mimic the read_array routine of openQCD-2.0.
|
||||||
# fp is the opened file handle
|
# fp is the opened file handle
|
||||||
# returns the dict array
|
# returns the dict array
|
||||||
# at this point we only parse a 2d array
|
# at this point we only parse a 2d array
|
||||||
# d = 2
|
# d = 2
|
||||||
# n = [nfct[irw], 2*nsrc[irw]]
|
# n = [nfct[irw], 2*nsrc[irw]]
|
||||||
|
@ -326,9 +326,8 @@ def read_array_openQCD2(fp):
|
||||||
m *= n[i]
|
m *= n[i]
|
||||||
|
|
||||||
t = fp.read(m*size)
|
t = fp.read(m*size)
|
||||||
#print("struct.calc tmp = "+str(struct.calcsize('%d%s' % (m, types))))
|
|
||||||
tmp = struct.unpack('%d%s' % (m, types), t)
|
tmp = struct.unpack('%d%s' % (m, types), t)
|
||||||
|
|
||||||
arr = parse_array_openQCD2(d, n, size, tmp, quadrupel=True)
|
arr = parse_array_openQCD2(d, n, size, tmp, quadrupel=True)
|
||||||
return {'d': d, 'n': n, 'size': size, 'arr': arr}
|
return {'d': d, 'n': n, 'size': size, 'arr': arr}
|
||||||
|
|
||||||
|
@ -350,11 +349,12 @@ def read_rwms(path, prefix, names=None, **kwargs):
|
||||||
if not (ver_str in known_oqcd_versions):
|
if not (ver_str in known_oqcd_versions):
|
||||||
raise Exception('Unknown openQCD version defined!')
|
raise Exception('Unknown openQCD version defined!')
|
||||||
else: #Set defaults for openQCD Version to be version 1.4, emulate the old behaviour of this method
|
else: #Set defaults for openQCD Version to be version 1.4, emulate the old behaviour of this method
|
||||||
|
# Deprecate this kwarg in version 2.0.
|
||||||
if 'new_format':
|
if 'new_format':
|
||||||
ver_str = '1.6'
|
ver_str = '1.6'
|
||||||
else:
|
else:
|
||||||
ver_str = '1.4'
|
ver_str = '1.4'
|
||||||
print("Working with oQCD version:" + ver_str)
|
print("Working with openQCD version " + ver_str)
|
||||||
if 'postfix' in kwargs:
|
if 'postfix' in kwargs:
|
||||||
postfix = kwargs.get('postfix')
|
postfix = kwargs.get('postfix')
|
||||||
else:
|
else:
|
||||||
|
@ -416,7 +416,7 @@ def read_rwms(path, prefix, names=None, **kwargs):
|
||||||
for k in range(nrw):
|
for k in range(nrw):
|
||||||
deltas.append([])
|
deltas.append([])
|
||||||
else:
|
else:
|
||||||
if ((nrw != struct.unpack('i', t)[0] and (not ver_str == '2.0')) or (nrw != struct.unpack('i', t)[0]/2 and ver_str == '2.0')):#little weird if-clause due to the /2 operation needed...
|
if ((nrw != struct.unpack('i', t)[0] and (not ver_str == '2.0')) or (nrw != struct.unpack('i', t)[0]/2 and ver_str == '2.0')):# little weird if-clause due to the /2 operation needed.
|
||||||
print('Error: different number of reweighting factors for replicum', rep)
|
print('Error: different number of reweighting factors for replicum', rep)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
@ -441,7 +441,6 @@ def read_rwms(path, prefix, names=None, **kwargs):
|
||||||
if (ver_str == '2.0'):
|
if (ver_str == '2.0'):
|
||||||
if not struct.unpack('i', fp.read(4))[0] == 0:
|
if not struct.unpack('i', fp.read(4))[0] == 0:
|
||||||
print('something is wrong!')
|
print('something is wrong!')
|
||||||
print('nfct:', nfct, 'nsrc:', nsrc)
|
|
||||||
|
|
||||||
#body
|
#body
|
||||||
while 0 < 1:
|
while 0 < 1:
|
||||||
|
|
Loading…
Add table
Reference in a new issue