1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 from __future__ import division
16 import os
17 import math
18 import logging
19 import re
20 import xml.dom.minidom as minidom
21
22 logger = logging.getLogger('madevent.stdout')
23
24 pjoin = os.path.join
25 try:
26 import madgraph
27 except ImportError:
28 import internal.cluster as cluster
29 import internal.misc as misc
30 from internal import MadGraph5Error
31 else:
32 import madgraph.various.cluster as cluster
33 import madgraph.various.misc as misc
34 from madgraph import MadGraph5Error
35
37 """ A class to store statistics about a MadEvent run. """
38
40 """ Initialize the run dictionary. For now, the same as a regular
41 dictionary, except that we specify some default statistics. """
42
43 madloop_statistics = {
44 'unknown_stability' : 0,
45 'stable_points' : 0,
46 'unstable_points' : 0,
47 'exceptional_points' : 0,
48 'DP_usage' : 0,
49 'QP_usage' : 0,
50 'DP_init_usage' : 0,
51 'QP_init_usage' : 0,
52 'CutTools_DP_usage' : 0,
53 'CutTools_QP_usage' : 0,
54 'PJFry_usage' : 0,
55 'Golem_usage' : 0,
56 'IREGI_usage' : 0,
57 'Samurai_usage' : 0,
58 'Ninja_usage' : 0,
59 'Ninja_QP_usage' : 0,
60 'COLLIER_usage' : 0,
61 'max_precision' : 1.0e99,
62 'min_precision' : 0.0,
63 'averaged_timing' : 0.0,
64 'n_madloop_calls' : 0,
65 'cumulative_timing' : 0.0,
66 'skipped_subchannel' : 0
67
68 }
69
70 for key, value in madloop_statistics.items():
71 self[key] = value
72
73 super(dict,self).__init__(*args, **opts)
74
76 """ Update the current statitistics with the new_stats specified."""
77
78 if isinstance(new_stats,RunStatistics):
79 new_stats = [new_stats, ]
80 elif isinstance(new_stats,list):
81 if any(not isinstance(_,RunStatistics) for _ in new_stats):
82 raise MadGraph5Error, "The 'new_stats' argument of the function "+\
83 "'updtate_statistics' must be a (possibly list of) "+\
84 "RunStatistics instance."
85
86 keys = set([])
87 for stat in [self,]+new_stats:
88 keys |= set(stat.keys())
89
90 new_stats = new_stats+[self,]
91 for key in keys:
92
93 if key=='max_precision':
94
95 self[key] = min( _[key] for _ in new_stats if key in _)
96 elif key=='min_precision':
97
98 self[key] = max( _[key] for _ in new_stats if key in _)
99 elif key=='averaged_timing':
100 n_madloop_calls = sum(_['n_madloop_calls'] for _ in new_stats if
101 'n_madloop_calls' in _)
102 if n_madloop_calls > 0 :
103 self[key] = sum(_[key]*_['n_madloop_calls'] for _ in
104 new_stats if (key in _ and 'n_madloop_calls' in _) )/n_madloop_calls
105 else:
106
107 self[key] = sum(_[key] for _ in new_stats if key in _)
108
110 """ Load the statistics from an xml node. """
111
112 def getData(Node):
113 return Node.childNodes[0].data
114
115 u_return_code = xml_node.getElementsByTagName('u_return_code')
116 u_codes = [int(_) for _ in getData(u_return_code[0]).split(',')]
117 self['CutTools_DP_usage'] = u_codes[1]
118 self['PJFry_usage'] = u_codes[2]
119 self['IREGI_usage'] = u_codes[3]
120 self['Golem_usage'] = u_codes[4]
121 self['Samurai_usage'] = u_codes[5]
122 self['Ninja_usage'] = u_codes[6]
123 self['COLLIER_usage'] = u_codes[7]
124 self['Ninja_QP_usage'] = u_codes[8]
125 self['CutTools_QP_usage'] = u_codes[9]
126 t_return_code = xml_node.getElementsByTagName('t_return_code')
127 t_codes = [int(_) for _ in getData(t_return_code[0]).split(',')]
128 self['DP_usage'] = t_codes[1]
129 self['QP_usage'] = t_codes[2]
130 self['DP_init_usage'] = t_codes[3]
131 self['DP_init_usage'] = t_codes[4]
132 h_return_code = xml_node.getElementsByTagName('h_return_code')
133 h_codes = [int(_) for _ in getData(h_return_code[0]).split(',')]
134 self['unknown_stability'] = h_codes[1]
135 self['stable_points'] = h_codes[2]
136 self['unstable_points'] = h_codes[3]
137 self['exceptional_points'] = h_codes[4]
138 average_time = xml_node.getElementsByTagName('average_time')
139 avg_time = float(getData(average_time[0]))
140 self['averaged_timing'] = avg_time
141 cumulated_time = xml_node.getElementsByTagName('cumulated_time')
142 cumul_time = float(getData(cumulated_time[0]))
143 self['cumulative_timing'] = cumul_time
144 max_prec = xml_node.getElementsByTagName('max_prec')
145 max_prec = float(getData(max_prec[0]))
146
147 self['min_precision'] = max_prec
148 min_prec = xml_node.getElementsByTagName('min_prec')
149 min_prec = float(getData(min_prec[0]))
150
151 self['max_precision'] = min_prec
152 n_evals = xml_node.getElementsByTagName('n_evals')
153 n_evals = int(getData(n_evals[0]))
154 self['n_madloop_calls'] = n_evals
155
157 """Returns a one-line string summarizing the run statistics
158 gathered for the channel G."""
159
160
161
162 if self['n_madloop_calls']==0:
163 return ''
164
165 stability = [
166 ('tot#',self['n_madloop_calls']),
167 ('unkwn#',self['unknown_stability']),
168 ('UPS%',float(self['unstable_points'])/self['n_madloop_calls']),
169 ('EPS#',self['exceptional_points'])]
170
171 stability = [_ for _ in stability if _[1] > 0 or _[0] in ['UPS%','EPS#']]
172 stability = [(_[0],'%i'%_[1]) if isinstance(_[1], int) else
173 (_[0],'%.3g'%(100.0*_[1])) for _ in stability]
174
175 tools_used = [
176 ('CT_DP',float(self['CutTools_DP_usage'])/self['n_madloop_calls']),
177 ('CT_QP',float(self['CutTools_QP_usage'])/self['n_madloop_calls']),
178 ('PJFry',float(self['PJFry_usage'])/self['n_madloop_calls']),
179 ('Golem',float(self['Golem_usage'])/self['n_madloop_calls']),
180 ('IREGI',float(self['IREGI_usage'])/self['n_madloop_calls']),
181 ('Samurai',float(self['Samurai_usage'])/self['n_madloop_calls']),
182 ('COLLIER',float(self['COLLIER_usage'])/self['n_madloop_calls']),
183 ('Ninja_DP',float(self['Ninja_usage'])/self['n_madloop_calls']),
184 ('Ninja_QP',float(self['Ninja_QP_usage'])/self['n_madloop_calls'])]
185
186 tools_used = [(_[0],'%.3g'%(100.0*_[1])) for _ in tools_used if _[1] > 0.0 ]
187
188 to_print = [('%s statistics:'%(G if isinstance(G,str) else
189 str(os.path.join(list(G))))\
190 +(' %s,'%misc.format_time(int(self['cumulative_timing'])) if
191 int(self['cumulative_timing']) > 0 else '')
192 +((' Avg. ML timing = %i ms'%int(1.0e3*self['averaged_timing'])) if
193 self['averaged_timing'] > 0.001 else
194 (' Avg. ML timing = %i mus'%int(1.0e6*self['averaged_timing']))) \
195 +', Min precision = %.2e'%self['min_precision'])
196 ,' -> Stability %s'%dict(stability)
197 ,' -> Red. tools usage in %% %s'%dict(tools_used)
198
199
200
201
202
203 ]
204
205 if self['skipped_subchannel'] > 0 and not no_warning:
206 to_print.append("WARNING: Some event with large weight have been "+\
207 "discarded. This happened %s times." % self['skipped_subchannel'])
208
209 return ('\n'.join(to_print)).replace("'"," ")
210
212 """return if any stat needs to be reported as a warning
213 When this is True, the print_warning doit retourner un warning
214 """
215
216 if self['n_madloop_calls'] > 0:
217 fraction = self['exceptional_points']/float(self['n_madloop_calls'])
218 else:
219 fraction = 0.0
220
221 if self['skipped_subchannel'] > 0:
222 return True
223 elif fraction > 1.0e-4:
224 return True
225 else:
226 return False
227
229 """get a string with all the identified warning"""
230
231 to_print = []
232 if self['skipped_subchannel'] > 0:
233 to_print.append("Some event with large weight have been discarded."+\
234 " This happens %s times." % self['skipped_subchannel'])
235 if self['n_madloop_calls'] > 0:
236 fraction = self['exceptional_points']/float(self['n_madloop_calls'])
237 if fraction > 1.0e-4:
238 to_print.append("Some PS with numerical instability have been set "+\
239 "to a zero matrix-element (%.3g%%)" % (100.0*fraction))
240
241 return ('\n'.join(to_print)).replace("'"," ")
242
244
246 """Initialize all data """
247
248 self.run_statistics = RunStatistics()
249 self.name = name
250 self.parent_name = ''
251 self.axsec = 0
252 self.xsec = 0
253 self.xerru = 0
254 self.xerrc = 0
255 self.nevents = 0
256 self.nw = 0
257 self.maxit = 0
258 self.nunwgt = 0
259 self.luminosity = 0
260 self.mfactor = 1
261 self.ysec_iter = []
262 self.yerr_iter = []
263 self.yasec_iter = []
264 self.eff_iter = []
265 self.maxwgt_iter = []
266 self.maxwgt = 0
267 self.th_maxwgt= 0
268
269 self.th_nunwgt = 0
270
271
272 return
273
274
276 """read results.dat and fullfill information"""
277
278 if isinstance(filepath, str):
279 finput = open(filepath)
280 elif isinstance(filepath, file):
281 finput = filepath
282 else:
283 raise Exception, "filepath should be a path or a file descriptor"
284
285 i=0
286 found_xsec_line = False
287 for line in finput:
288
289
290 if '<' in line:
291 break
292 i+=1
293 if i == 1:
294 def secure_float(d):
295 try:
296 return float(d)
297 except ValueError:
298 m=re.search(r'''([+-]?[\d.]*)([+-]\d*)''', d)
299 if m:
300 return float(m.group(1))*10**(float(m.group(2)))
301 return
302
303 data = [secure_float(d) for d in line.split()]
304 self.axsec, self.xerru, self.xerrc, self.nevents, self.nw,\
305 self.maxit, self.nunwgt, self.luminosity, self.wgt, \
306 self.xsec = data[:10]
307 if len(data) > 10:
308 self.maxwgt = data[10]
309 if len(data) >12:
310 self.th_maxwgt, self.th_nunwgt = data[11:13]
311 if self.mfactor > 1:
312 self.luminosity /= self.mfactor
313 continue
314 try:
315 l, sec, err, eff, maxwgt, asec = line.split()
316 found_xsec_line = True
317 except:
318 break
319 self.ysec_iter.append(secure_float(sec))
320 self.yerr_iter.append(secure_float(err))
321 self.yasec_iter.append(secure_float(asec))
322 self.eff_iter.append(secure_float(eff))
323 self.maxwgt_iter.append(secure_float(maxwgt))
324
325 finput.seek(0)
326 xml = []
327 for line in finput:
328 if re.match('^.*<.*>',line):
329 xml.append(line)
330 break
331 for line in finput:
332 xml.append(line)
333
334 if xml:
335 self.parse_xml_results('\n'.join(xml))
336
337
338 if self.nevents == 0 and self.nunwgt == 0 and isinstance(filepath, str) and \
339 os.path.exists(pjoin(os.path.split(filepath)[0], 'nevts')):
340 nevts = int(open(pjoin(os.path.split(filepath)[0], 'nevts')).read())
341 self.nevents = nevts
342 self.nunwgt = nevts
343
345 """ Parse the xml part of the results.dat file."""
346
347 dom = minidom.parseString(xml)
348
349 statistics_node = dom.getElementsByTagName("run_statistics")
350
351 if statistics_node:
352 try:
353 self.run_statistics.load_statistics(statistics_node[0])
354 except ValueError, IndexError:
355 logger.warning('Fail to read run statistics from results.dat')
356
358 self.mfactor = int(value)
359
361 """Change the number of iterations for this process"""
362
363 if len(self.ysec_iter) <= nb_iter:
364 return
365
366
367 nb_to_rm = len(self.ysec_iter) - nb_iter
368 ysec = [0]
369 yerr = [0]
370 for i in range(nb_to_rm):
371 ysec[0] += self.ysec_iter[i]
372 yerr[0] += self.yerr_iter[i]**2
373 ysec[0] /= (nb_to_rm+1)
374 yerr[0] = math.sqrt(yerr[0]) / (nb_to_rm + 1)
375
376 for i in range(1, nb_iter):
377 ysec[i] = self.ysec_iter[nb_to_rm + i]
378 yerr[i] = self.yerr_iter[nb_to_rm + i]
379
380 self.ysec_iter = ysec
381 self.yerr_iter = yerr
382
383 - def get(self, name):
384
385 if name in ['xsec', 'xerru','xerrc']:
386 return getattr(self, name) * self.mfactor
387 elif name in ['luminosity']:
388
389
390 return getattr(self, name)
391 elif (name == 'eff'):
392 return self.xerr*math.sqrt(self.nevents/(self.xsec+1e-99))
393 elif name == 'xerr':
394 return math.sqrt(self.xerru**2+self.xerrc**2)
395 elif name == 'name':
396 return pjoin(self.parent_name, self.name)
397 else:
398 return getattr(self, name)
399
401
406
408 """read the data in the file"""
409 try:
410 oneresult = OneResult(name)
411 oneresult.set_mfactor(mfactor)
412 oneresult.read_results(filepath)
413 oneresult.parent_name = self.name
414 self.append(oneresult)
415 return oneresult
416 except Exception:
417 logger.critical("Error when reading %s" % filepath)
418 raise
419
420
422 """compute the value associate to this combination"""
423
424 self.compute_iterations()
425 self.axsec = sum([one.axsec for one in self])
426 self.xsec = sum([one.xsec for one in self])
427 self.xerrc = sum([one.xerrc for one in self])
428 self.xerru = math.sqrt(sum([one.xerru**2 for one in self]))
429
430 self.nevents = sum([one.nevents for one in self])
431 self.nw = sum([one.nw for one in self])
432 self.maxit = len(self.yerr_iter)
433 self.nunwgt = sum([one.nunwgt for one in self])
434 self.wgt = 0
435 self.luminosity = min([0]+[one.luminosity for one in self])
436 if update_statistics:
437 self.run_statistics.aggregate_statistics([_.run_statistics for _ in self])
438
440 """compute the value associate to this combination"""
441
442 nbjobs = len(self)
443 if not nbjobs:
444 return
445 self.axsec = sum([one.axsec for one in self]) / nbjobs
446 self.xsec = sum([one.xsec for one in self]) /nbjobs
447 self.xerrc = sum([one.xerrc for one in self]) /nbjobs
448 self.xerru = math.sqrt(sum([one.xerru**2 for one in self])) /nbjobs
449
450 self.nevents = sum([one.nevents for one in self])
451 self.nw = 0
452 self.maxit = 0
453 self.nunwgt = sum([one.nunwgt for one in self])
454 self.wgt = 0
455 self.luminosity = sum([one.luminosity for one in self])
456 self.ysec_iter = []
457 self.yerr_iter = []
458 self.th_maxwgt = 0.0
459 self.th_nunwgt = 0
460 for result in self:
461 self.ysec_iter+=result.ysec_iter
462 self.yerr_iter+=result.yerr_iter
463 self.yasec_iter += result.yasec_iter
464 self.eff_iter += result.eff_iter
465 self.maxwgt_iter += result.maxwgt_iter
466
467
468
470 """Compute iterations to have a chi-square on the stability of the
471 integral"""
472
473 nb_iter = min([len(a.ysec_iter) for a in self], 0)
474
475 for oneresult in self:
476 oneresult.change_iterations_number(nb_iter)
477
478
479 for i in range(nb_iter):
480 value = [one.ysec_iter[i] for one in self]
481 error = [one.yerr_iter[i]**2 for one in self]
482
483
484 self.ysec_iter.append(sum(value))
485 self.yerr_iter.append(math.sqrt(sum(error)))
486
487
488 template_file = \
489 """
490 %(diagram_link)s
491 <BR>
492 <b>s= %(cross).5g ± %(error).3g (%(unit)s)</b><br><br>
493 <table class="sortable" id='tablesort'>
494 <tr><th>Graph</th>
495 <th> %(result_type)s</th>
496 <th>Error</th>
497 <th>Events (K)</th>
498 <th>Unwgt</th>
499 <th>Luminosity</th>
500 </tr>
501 %(table_lines)s
502 </table>
503 </center>
504 <br><br><br>
505 """
506 table_line_template = \
507 """
508 <tr><td align=right>%(P_title)s</td>
509 <td align=right><a id="%(P_link)s" href=%(P_link)s onClick="check_link('%(P_link)s','%(mod_P_link)s','%(P_link)s')"> %(cross)s </a> </td>
510 <td align=right> %(error)s</td>
511 <td align=right> %(events)s</td>
512 <td align=right> %(unweighted)s</td>
513 <td align=right> %(luminosity)s</td>
514 </tr>
515 """
516
517 - def get_html(self,run, unit, me_dir = []):
518 """write html output"""
519
520
521 P_grouping = {}
522
523 tables_line = ''
524 for oneresult in self:
525 if oneresult.name.startswith('P'):
526 title = '<a href=../../SubProcesses/%(P)s/diagrams.html>%(P)s</a>' \
527 % {'P':oneresult.name}
528 P = oneresult.name.split('_',1)[0]
529 if P in P_grouping:
530 P_grouping[P] += float(oneresult.xsec)
531 else:
532 P_grouping[P] = float(oneresult.xsec)
533 else:
534 title = oneresult.name
535
536 if not isinstance(oneresult, Combine_results):
537
538 if os.path.exists(pjoin(me_dir, 'Events', run, 'alllogs_1.html')):
539 link = '../../Events/%(R)s/alllogs_1.html#/%(P)s/%(G)s' % \
540 {'P': self.name,
541 'G': oneresult.name,
542 'R': run}
543 mod_link = link
544 elif os.path.exists(pjoin(me_dir, 'Events', run, 'alllogs_0.html')):
545 link = '../../Events/%(R)s/alllogs_0.html#/%(P)s/%(G)s' % \
546 {'P': self.name,
547 'G': oneresult.name,
548 'R': run}
549 mod_link = link
550 else:
551
552 link = '../../SubProcesses/%(P)s/%(G)s/%(R)s_log.txt' % \
553 {'P': self.name,
554 'G': oneresult.name,
555 'R': run}
556 mod_link = '../../SubProcesses/%(P)s/%(G)s/log.txt' % \
557 {'P': self.name,
558 'G': oneresult.name}
559 else:
560 link = '#%s' % oneresult.name
561 mod_link = link
562
563 dico = {'P_title': title,
564 'P_link': link,
565 'mod_P_link': mod_link,
566 'cross': '%.4g' % oneresult.xsec,
567 'error': '%.3g' % oneresult.xerru,
568 'events': oneresult.nevents/1000.0,
569 'unweighted': oneresult.nunwgt,
570 'luminosity': '%.3g' % oneresult.luminosity
571 }
572
573 tables_line += self.table_line_template % dico
574
575 for P_name, cross in P_grouping.items():
576 dico = {'P_title': '%s sum' % P_name,
577 'P_link': './results.html',
578 'mod_P_link':'',
579 'cross': cross,
580 'error': '',
581 'events': '',
582 'unweighted': '',
583 'luminosity': ''
584 }
585 tables_line += self.table_line_template % dico
586
587 if self.name.startswith('P'):
588 title = '<dt><a name=%(P)s href=../../SubProcesses/%(P)s/diagrams.html>%(P)s</a></dt><dd>' \
589 % {'P':self.name}
590 else:
591 title = ''
592
593 dico = {'cross': self.xsec,
594 'abscross': self.axsec,
595 'error': self.xerru,
596 'unit': unit,
597 'result_type': 'Cross-Section',
598 'table_lines': tables_line,
599 'diagram_link': title
600 }
601
602 html_text = self.template_file % dico
603 return html_text
604
606 """write a correctly formatted results.dat"""
607
608 def fstr(nb):
609 data = '%E' % nb
610 if data == 'NAN':
611 nb, power = 0,0
612 else:
613 nb, power = data.split('E')
614 nb = float(nb) /10
615 power = int(power) + 1
616 return '%.5fE%+03i' %(nb,power)
617
618 line = '%s %s %s %i %i %i %i %s %s %s %s %s %i\n' % (fstr(self.axsec), fstr(self.xerru),
619 fstr(self.xerrc), self.nevents, self.nw, self.maxit, self.nunwgt,
620 fstr(self.luminosity), fstr(self.wgt), fstr(self.xsec), fstr(self.maxwgt),
621 fstr(self.th_maxwgt), self.th_nunwgt)
622 fsock = open(output_path,'w')
623 fsock.writelines(line)
624 for i in range(len(self.ysec_iter)):
625 line = '%s %s %s %s %s %s\n' % (i+1, self.ysec_iter[i], self.yerr_iter[i],
626 self.eff_iter[i], self.maxwgt_iter[i], self.yasec_iter[i])
627 fsock.writelines(line)
628
629
630
631 results_header = """
632 <head>
633 <title>Process results</title>
634 <script type="text/javascript" src="../sortable.js"></script>
635 <link rel=stylesheet href="../mgstyle.css" type="text/css">
636 </head>
637 <body>
638 <script type="text/javascript">
639 function UrlExists(url) {
640 var http = new XMLHttpRequest();
641 http.open('HEAD', url, false);
642 try{
643 http.send()
644 }
645 catch(err){
646 return 1==2;
647 }
648 return http.status!=404;
649 }
650 function check_link(url,alt, id){
651 var obj = document.getElementById(id);
652 if ( ! UrlExists(url)){
653 if ( ! UrlExists(alt)){
654 obj.href = alt;
655 return true;
656 }
657 obj.href = alt;
658 return false;
659 }
660 obj.href = url;
661 return 1==1;
662 }
663 </script>
664 """
665
667 """ """
668
669 run = cmd.results.current['run_name']
670 all = Combine_results(run)
671
672 for Pdir in open(pjoin(cmd.me_dir, 'SubProcesses','subproc.mg')):
673 Pdir = Pdir.strip()
674 P_comb = Combine_results(Pdir)
675
676 P_path = pjoin(cmd.me_dir, 'SubProcesses', Pdir)
677 G_dir = [G for G in os.listdir(P_path) if G.startswith('G') and
678 os.path.isdir(pjoin(P_path,G))]
679
680 try:
681 for line in open(pjoin(P_path, 'symfact.dat')):
682 name, mfactor = line.split()
683 if float(mfactor) < 0:
684 continue
685 if os.path.exists(pjoin(P_path, 'ajob.no_ps.log')):
686 continue
687
688 if not folder_names and not jobs:
689 name = 'G' + name
690 P_comb.add_results(name, pjoin(P_path,name,'results.dat'), mfactor)
691 elif not jobs:
692 for folder in folder_names:
693 if 'G' in folder:
694 dir = folder.replace('*', name)
695 else:
696 dir = folder.replace('*', '_G' + name)
697 P_comb.add_results(dir, pjoin(P_path,dir,'results.dat'), mfactor)
698 if jobs:
699 for job in filter(lambda j: j['p_dir'] == Pdir, jobs):
700 P_comb.add_results(os.path.basename(job['dirname']),\
701 pjoin(job['dirname'],'results.dat'))
702 except IOError:
703 continue
704 P_comb.compute_values()
705 all.append(P_comb)
706 all.compute_values()
707 return all
708
709
711 """ folder_names and jobs have been added for the amcatnlo runs """
712 run = cmd.results.current['run_name']
713 if not os.path.exists(pjoin(cmd.me_dir, 'HTML', run)):
714 os.mkdir(pjoin(cmd.me_dir, 'HTML', run))
715
716 unit = cmd.results.unit
717 P_text = ""
718 Presults = collect_result(cmd, folder_names=folder_names, jobs=jobs)
719
720
721 for P_comb in Presults:
722 P_text += P_comb.get_html(run, unit, cmd.me_dir)
723 P_comb.compute_values()
724 if cmd.proc_characteristics['ninitial'] == 1:
725 P_comb.write_results_dat(pjoin(cmd.me_dir, 'SubProcesses', P_comb.name,
726 '%s_results.dat' % run))
727
728
729 Presults.write_results_dat(pjoin(cmd.me_dir,'SubProcesses', 'results.dat'))
730
731 fsock = open(pjoin(cmd.me_dir, 'HTML', run, 'results.html'),'w')
732 fsock.write(results_header)
733 fsock.write('%s <dl>' % Presults.get_html(run, unit, cmd.me_dir))
734 fsock.write('%s </dl></body>' % P_text)
735
736 return Presults.xsec, Presults.xerru
737