14 def parse(path, config):
15 logger = logging.getLogger(
"mpsvalidate")
19 pedeDump = mpsv_classes.PedeDumpData()
26 with gzip.open(path)
as gzipFile:
27 dumpFile = [ l.decode()
for l
in gzipFile.readlines() ]
29 logger.error(
"PedeDump: {0} does not exist".
format(path))
32 for i, line
in enumerate(dumpFile):
34 if (
"Sum(Chi^2)/Sum(Ndf) =" in line):
36 number.append(list(map(float, re.findall(
37 r"[-+]?\d*\.\d+", dumpFile[i]))))
38 number.append(list(map(int, re.findall(
r"[-+]?\d+", dumpFile[i + 1]))))
39 number.append(list(map(float, re.findall(
40 r"[-+]?\d*\.\d+", dumpFile[i + 2]))))
41 pedeDump.sumSteps =
"{0} / ( {1} - {2} )".
format(
42 number[0][0], number[1][0], number[1][1])
43 pedeDump.sumValue = number[2][0]
46 if (
"Sum(W*Chi^2)/Sum(Ndf)/<W> =" in line):
48 number.append(list(map(float, re.findall(
49 r"[-+]?\d*\.\d+", dumpFile[i]))))
50 number.append(list(map(int, re.findall(
r"[-+]?\d+", dumpFile[i + 1]))))
51 number.append(list(map(float, re.findall(
52 r"[-+]?\d*\.\d+", dumpFile[i + 2]))))
53 number.append(list(map(float, re.findall(
54 r"[-+]?\d*\.\d+", dumpFile[i + 3]))))
55 pedeDump.sumSteps =
"{0} / ( {1} - {2} ) / {3}".
format(
56 number[0][0], number[1][0], number[1][1], number[2][0])
57 pedeDump.sumWValue = number[3][0]
59 if (
"with correction for down-weighting" in line):
60 number = list(map(float, re.findall(
r"[-+]?\d*\.\d+", dumpFile[i])))
61 pedeDump.correction = number[0]
64 if (
"Peak dynamic memory allocation:" in line):
65 number = list(map(float, re.findall(
r"[-+]?\d*\.\d+", dumpFile[i])))
66 pedeDump.memory = number[0]
69 if (
"Iteration-end" in line):
70 number = list(map(int, re.findall(
r"\d+", dumpFile[i + 1])))
71 pedeDump.time = number[:3]
74 if (
"WarningWarningWarningWarning" in line
and warningBool ==
False):
77 while (
"Warning" not in dumpFile[j]):
78 pedeDump.warning.append(dumpFile[j])
82 if (
" = number of records" in line):
83 number = list(map(int, re.findall(
"\d+", dumpFile[i])))
84 pedeDump.nrec = number[0]
87 if (
" = total number of parameters" in line):
88 number = list(map(int, re.findall(
"\d+", dumpFile[i])))
89 pedeDump.ntgb = number[0]
92 if (
" = number of variable parameters" in line):
93 number = list(map(int, re.findall(
"\d+", dumpFile[i])))
94 pedeDump.nvgb = number[0]