CMS 3D CMS Logo

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

Functions

def parse
 

Function Documentation

def dumpparser.parse (   path,
  config 
)

Definition at line 13 of file dumpparser.py.

Referenced by FWItemValueGetter.addEntry(), BoostedJetONNXJetTagsProducer.BoostedJetONNXJetTagsProducer(), reco::parser.cutParser(), DDTokenize2(), cand::parser.decayParser(), reco::parser.expressionParser(), DBSApi_cff.loadXML(), BeamSpotWorkflow.main(), helper::Parser.makeExpression(), helper::Parser.makeSelector(), createPayload.mkWorkflowdir(), FWGUIManager.open3DRegion(), DDLVector.parse_numbers(), DDLVector.parse_strings(), DDLMap.processElement(), cms::DDDetector.processXML(), loadConditions.readTagAndSince(), FWModelExpressionSelector.select(), FWModelFilter.setExpression(), FWExpressionEvaluator.setExpression(), and BeamSpotDipServer.tkStatus().

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