mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 14:50:25 +01:00
linting...
This commit is contained in:
parent
f9fe5c7ec9
commit
3fdbc371b2
1 changed files with 48 additions and 40 deletions
|
@ -1025,12 +1025,14 @@ def read_ms5_xsf(path, prefix, qc, corr, sep = "r", **kwargs):
|
|||
struct.error
|
||||
If there is an error unpacking binary data.
|
||||
"""
|
||||
|
||||
found = []
|
||||
files = []
|
||||
names = []
|
||||
for (dirpath, dirnames, filenames) in os.walk(path + "/"):
|
||||
found.extend(filenames)
|
||||
break
|
||||
|
||||
for f in found:
|
||||
if fnmatch.fnmatch(f, prefix + "*.ms5_xsf_" + qc + ".dat"):
|
||||
files.append(f)
|
||||
|
@ -1064,8 +1066,7 @@ def read_ms5_xsf(path, prefix, qc, corr, sep = "r", **kwargs):
|
|||
t = fp.read(4)
|
||||
tmax = struct.unpack('i', t)[0]
|
||||
t = fp.read(4)
|
||||
bnd = struct.unpack('i', t)[0]
|
||||
|
||||
# bnd = struct.unpack('i', t)[0]
|
||||
|
||||
placesBI = ["gS", "gP",
|
||||
"gA", "gV",
|
||||
|
@ -1095,14 +1096,18 @@ def read_ms5_xsf(path, prefix, qc, corr, sep = "r", **kwargs):
|
|||
cnfg = asascii[0]
|
||||
cnfgs[repnum].append(cnfg)
|
||||
|
||||
if not corr in placesBB:
|
||||
if corr not in placesBB:
|
||||
tmpcorr = asascii[1 + 2 * tmax * placesBI.index(corr):1 + 2 * tmax * placesBI.index(corr) + 2 * tmax]
|
||||
else:
|
||||
tmpcorr = asascii[1 + 2 * tmax * len(placesBI) + 2 * placesBB.index(corr):1 + 2 * tmax * len(placesBI) + 2 * placesBB.index(corr) + 2]
|
||||
|
||||
corrres = [[], []]
|
||||
for i in range(len(tmpcorr)): corrres[i%2].append(tmpcorr[i])
|
||||
for t in range(int(len(tmpcorr)/2)): realsamples[repnum][t].append(corrres[0][t])
|
||||
for t in range(int(len(tmpcorr)/2)): imagsamples[repnum][t].append(corrres[1][t])
|
||||
for i in range(len(tmpcorr)):
|
||||
corrres[i % 2].append(tmpcorr[i])
|
||||
for t in range(int(len(tmpcorr) / 2)):
|
||||
realsamples[repnum][t].append(corrres[0][t])
|
||||
for t in range(int(len(tmpcorr) / 2)):
|
||||
imagsamples[repnum][t].append(corrres[1][t])
|
||||
repnum += 1
|
||||
|
||||
s = "Read correlator " + corr + " from " + str(repnum) + " replika with " + str(len(realsamples[0][t]))
|
||||
|
@ -1118,7 +1123,10 @@ def read_ms5_xsf(path, prefix, qc, corr, sep = "r", **kwargs):
|
|||
imagObs = []
|
||||
compObs = []
|
||||
|
||||
for t in range(int(len(tmpcorr)/2)): realObs.append(Obs([realsamples[rep][t] for rep in range(repnum)], names = names, idl = cnfgs))
|
||||
for t in range(int(len(tmpcorr)/2)): imagObs.append(Obs([imagsamples[rep][t] for rep in range(repnum)], names = names, idl = cnfgs))
|
||||
for t in range(int(len(tmpcorr)/2)): compObs.append(CObs(realObs[t], imagObs[t]))
|
||||
for t in range(int(len(tmpcorr) / 2)):
|
||||
realObs.append(Obs([realsamples[rep][t] for rep in range(repnum)], names=names, idl=cnfgs))
|
||||
for t in range(int(len(tmpcorr) / 2)):
|
||||
imagObs.append(Obs([imagsamples[rep][t] for rep in range(repnum)], names=names, idl=cnfgs))
|
||||
for t in range(int(len(tmpcorr) / 2)):
|
||||
compObs.append(CObs(realObs[t], imagObs[t]))
|
||||
return Corr(compObs)
|
Loading…
Add table
Reference in a new issue