CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
dumpparser Namespace Reference

Functions

def parse
 

Function Documentation

def dumpparser.parse (   path,
  config 
)

Definition at line 15 of file dumpparser.py.

Referenced by FWItemValueGetter.addEntry(), reco::parser.cutParser(), DDTokenize2(), cand::parser.decayParser(), reco::parser.expressionParser(), HcalChannelDataXml.init_data(), DBSApi_cff.loadXML(), mps_validate.main(), BeamSpotWorkflow.main(), helper::Parser.makeExpression(), helper::Parser.makeSelector(), createPayload.mkWorkflowdir(), FWGUIManager.open3DRegion(), DDLVector.parse_numbers(), DDLVector.parse_strings(), DDLMap.processElement(), loadConditions.readTagAndSince(), FWModelExpressionSelector.select(), FWExpressionEvaluator.setExpression(), FWModelFilter.setExpression(), and l1t.str2VecStr_().

15 
16 def parse(path, config):
17  logger = logging.getLogger("mpsvalidate")
18 
19  # parse pede.dump.gz
20 
21  pedeDump = PedeDumpData()
22 
23  # only recognize warning the first time
24  warningBool = False
25 
26  # save lines in list
27  try:
28  with gzip.open(path) as gzipFile:
29  dumpFile = gzipFile.readlines()
30  except IOError:
31  logger.error("PedeDump: {0} does not exist".format(path))
32  return
33 
34  for i, line in enumerate(dumpFile):
35  # Sum(Chi^2)/Sum(Ndf)
36  if ("Sum(Chi^2)/Sum(Ndf) =" in line):
37  number = []
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]
46 
47  # Sum(W*Chi^2)/Sum(Ndf)/<W>
48  if ("Sum(W*Chi^2)/Sum(Ndf)/<W> =" in line):
49  number = []
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]
60 
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]
64 
65  # Peak dynamic memory allocation
66  if ("Peak dynamic memory allocation:" in line):
67  number = map(float, re.findall(r"[-+]?\d*\.\d+", dumpFile[i]))
68  pedeDump.memory = number[0]
69 
70  # total time
71  if ("Iteration-end" in line):
72  number = map(int, re.findall(r"\d+", dumpFile[i + 1]))
73  pedeDump.time = number[:3]
74 
75  # warings
76  if ("WarningWarningWarningWarning" in line and warningBool == False):
77  warningBool = True
78  j = i + 8
79  while ("Warning" not in dumpFile[j]):
80  pedeDump.warning.append(dumpFile[j])
81  j += 1
82 
83  # nrec number of records
84  if (" = number of records" in line):
85  number = map(int, re.findall("\d+", dumpFile[i]))
86  pedeDump.nrec = number[0]
87 
88  # ntgb total number of parameters
89  if (" = total number of parameters" in line):
90  number = map(int, re.findall("\d+", dumpFile[i]))
91  pedeDump.ntgb = number[0]
92 
93  # nvgb number of variable parameters
94  if (" = number of variable parameters" in line):
95  number = map(int, re.findall("\d+", dumpFile[i]))
96  pedeDump.nvgb = number[0]
97 
98  return pedeDump