16 def parse(path, config):
17 logger = logging.getLogger(
"mpsvalidate")
21 pedeDump = PedeDumpData()
28 with gzip.open(path)
as gzipFile:
29 dumpFile = gzipFile.readlines()
31 logger.error(
"PedeDump: {0} does not exist".
format(path))
34 for i, line
in enumerate(dumpFile):
36 if (
"Sum(Chi^2)/Sum(Ndf) =" in line):
38 number.append(map(float, re.findall(
39 r"[-+]?\d*\.\d+", dumpFile[i])))
40 number.append(map(int, re.findall(
r"[-+]?\d+", dumpFile[i + 1])))
41 number.append(map(float, re.findall(
42 r"[-+]?\d*\.\d+", dumpFile[i + 2])))
43 pedeDump.sumSteps =
"{0} / ( {1} - {2} )".
format(
44 number[0][0], number[1][0], number[1][1])
45 pedeDump.sumValue = number[2][0]
48 if (
"Sum(W*Chi^2)/Sum(Ndf)/<W> =" in line):
50 number.append(map(float, re.findall(
51 r"[-+]?\d*\.\d+", dumpFile[i])))
52 number.append(map(int, re.findall(
r"[-+]?\d+", dumpFile[i + 1])))
53 number.append(map(float, re.findall(
54 r"[-+]?\d*\.\d+", dumpFile[i + 2])))
55 number.append(map(float, re.findall(
56 r"[-+]?\d*\.\d+", dumpFile[i + 3])))
57 pedeDump.sumSteps =
"{0} / ( {1} - {2} ) / {3}".
format(
58 number[0][0], number[1][0], number[1][1], number[2][0])
59 pedeDump.sumWValue = number[3][0]
61 if (
"with correction for down-weighting" in line):
62 number = map(float, re.findall(
r"[-+]?\d*\.\d+", dumpFile[i]))
63 pedeDump.correction = number[0]
66 if (
"Peak dynamic memory allocation:" in line):
67 number = map(float, re.findall(
r"[-+]?\d*\.\d+", dumpFile[i]))
68 pedeDump.memory = number[0]
71 if (
"Iteration-end" in line):
72 number = map(int, re.findall(
r"\d+", dumpFile[i + 1]))
73 pedeDump.time = number[:3]
76 if (
"WarningWarningWarningWarning" in line
and warningBool ==
False):
79 while (
"Warning" not in dumpFile[j]):
80 pedeDump.warning.append(dumpFile[j])
84 if (
" = number of records" in line):
85 number = map(int, re.findall(
"\d+", dumpFile[i]))
86 pedeDump.nrec = number[0]
89 if (
" = total number of parameters" in line):
90 number = map(int, re.findall(
"\d+", dumpFile[i]))
91 pedeDump.ntgb = number[0]
94 if (
" = number of variable parameters" in line):
95 number = map(int, re.findall(
"\d+", dumpFile[i]))
96 pedeDump.nvgb = number[0]