13 def parse(path, config):
14 logger = logging.getLogger(
"mpsvalidate")
18 pedeDump = mpsv_classes.PedeDumpData()
25 with gzip.open(path)
as gzipFile:
26 dumpFile = [ l.decode()
for l
in gzipFile.readlines() ]
28 logger.error(
"PedeDump: {0} does not exist".
format(path))
31 for i, line
in enumerate(dumpFile):
33 if (
"Sum(Chi^2)/Sum(Ndf) =" in line):
35 number.append(list(
map(float, re.findall(
36 r"[-+]?\d*\.\d+", dumpFile[i]))))
37 number.append(list(
map(int, re.findall(
r"[-+]?\d+", dumpFile[i + 1]))))
38 number.append(list(
map(float, re.findall(
39 r"[-+]?\d*\.\d+", dumpFile[i + 2]))))
40 pedeDump.sumSteps =
"{0} / ( {1} - {2} )".
format(
41 number[0][0], number[1][0], number[1][1])
42 pedeDump.sumValue = number[2][0]
45 if (
"Sum(W*Chi^2)/Sum(Ndf)/<W> =" in line):
47 number.append(list(
map(float, re.findall(
48 r"[-+]?\d*\.\d+", dumpFile[i]))))
49 number.append(list(
map(int, re.findall(
r"[-+]?\d+", dumpFile[i + 1]))))
50 number.append(list(
map(float, re.findall(
51 r"[-+]?\d*\.\d+", dumpFile[i + 2]))))
52 number.append(list(
map(float, re.findall(
53 r"[-+]?\d*\.\d+", dumpFile[i + 3]))))
54 pedeDump.sumSteps =
"{0} / ( {1} - {2} ) / {3}".
format(
55 number[0][0], number[1][0], number[1][1], number[2][0])
56 pedeDump.sumWValue = number[3][0]
58 if (
"with correction for down-weighting" in line):
59 number = list(
map(float, re.findall(
r"[-+]?\d*\.\d+", dumpFile[i])))
60 pedeDump.correction = number[0]
63 if (
"Peak dynamic memory allocation:" in line):
64 number = list(
map(float, re.findall(
r"[-+]?\d*\.\d+", dumpFile[i])))
65 pedeDump.memory = number[0]
68 if (
"Iteration-end" in line):
69 number = list(
map(int, re.findall(
r"\d+", dumpFile[i + 1])))
70 pedeDump.time = number[:3]
73 if (
"WarningWarningWarningWarning" in line
and warningBool ==
False):
76 while (
"Warning" not in dumpFile[j]):
77 pedeDump.warning.append(dumpFile[j])
81 if (
" = number of records" in line):
82 number = list(
map(int, re.findall(
"\d+", dumpFile[i])))
83 pedeDump.nrec = number[0]
86 if (
" = total number of parameters" in line):
87 number = list(
map(int, re.findall(
"\d+", dumpFile[i])))
88 pedeDump.ntgb = number[0]
91 if (
" = number of variable parameters" in line):
92 number = list(
map(int, re.findall(
"\d+", dumpFile[i])))
93 pedeDump.nvgb = number[0]
96 vector< string > parse(string line, const string &delimiter)