12 from Alignment.MillePedeAlignmentAlgorithm.mpsvalidate.classes
import PedeDumpData
16 logger = logging.getLogger(
"mpsvalidate")
20 pedeDump = PedeDumpData()
27 with gzip.open(path)
as gzipFile:
28 dumpFile = gzipFile.readlines()
30 logger.error(
"PedeDump: {0} does not exist".
format(path))
33 for i, line
in enumerate(dumpFile):
35 if (
"Sum(Chi^2)/Sum(Ndf) =" in line):
37 number.append(map(float, re.findall(
38 r"[-+]?\d*\.\d+", dumpFile[i])))
39 number.append(map(int, re.findall(
r"[-+]?\d+", dumpFile[i + 1])))
40 number.append(map(float, re.findall(
41 r"[-+]?\d*\.\d+", dumpFile[i + 2])))
42 pedeDump.sumSteps =
"{0} / ( {1} - {2} )".
format(
43 number[0][0], number[1][0], number[1][1])
44 pedeDump.sumValue = number[2][0]
47 if (
"Sum(W*Chi^2)/Sum(Ndf)/<W> =" in line):
49 number.append(map(float, re.findall(
50 r"[-+]?\d*\.\d+", dumpFile[i])))
51 number.append(map(int, re.findall(
r"[-+]?\d+", dumpFile[i + 1])))
52 number.append(map(float, re.findall(
53 r"[-+]?\d*\.\d+", dumpFile[i + 2])))
54 number.append(map(float, re.findall(
55 r"[-+]?\d*\.\d+", dumpFile[i + 3])))
56 pedeDump.sumSteps =
"{0} / ( {1} - {2} ) / {3}".
format(
57 number[0][0], number[1][0], number[1][1], number[2][0])
58 pedeDump.sumWValue = number[3][0]
60 if (
"with correction for down-weighting" in line):
61 number = map(float, re.findall(
r"[-+]?\d*\.\d+", dumpFile[i]))
62 pedeDump.correction = number[0]
65 if (
"Peak dynamic memory allocation:" in line):
66 number = map(float, re.findall(
r"[-+]?\d*\.\d+", dumpFile[i]))
67 pedeDump.memory = number[0]
70 if (
"Iteration-end" in line):
71 number = map(int, re.findall(
r"\d+", dumpFile[i + 1]))
72 pedeDump.time = number[:3]
75 if (
"WarningWarningWarningWarning" in line
and warningBool ==
False):
78 while (
"Warning" not in dumpFile[j]):
79 pedeDump.warning.append(dumpFile[j])
83 if (
" = number of records" in line):
84 number = map(int, re.findall(
"\d+", dumpFile[i]))
85 pedeDump.nrec = number[0]
88 if (
" = total number of parameters" in line):
89 number = map(int, re.findall(
"\d+", dumpFile[i]))
90 pedeDump.ntgb = number[0]
93 if (
" = number of variable parameters" in line):
94 number = map(int, re.findall(
"\d+", dumpFile[i]))
95 pedeDump.nvgb = number[0]