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