11 from array
import array
12 from copy
import deepcopy
13 from os
import chdir,getcwd,listdir,makedirs,rmdir
14 from os.path
import exists,join
21 from definitions
import *
22 from utils
import setTDRStyle
35 if msg_level>=_log_level:
36 print "[%s] %s" %(asctime(),message)
48 def __init__(self,sample1="",sample2="",release1="",release2="",run1="",run2="",tier1=0,tier2=0):
60 def __init__(self,name,mother_dir="",meta=CompInfo(),draw_success=
False,do_pngs=
False):
75 Weighted.__init__(self,name)
79 self.rank_histo.SetDirectory(0)
94 '''Walk all subdirs and calculate weight,fails and successes.
95 Moreove propagate the sample and releases names.
118 if comp.status == SKIPED:
123 self.rank_histo.Fill(comp.rank)
125 if comp.status == FAIL:
128 elif comp.status == SUCCESS:
138 subdir.calcStats(make_pie)
139 subdir.meta=self.
meta
140 self.
weight+=subdir.weight
148 self.rank_histo.Add(subdir.rank_histo)
158 subdirdict[subdir.name]=subdir
164 subdirnames.append(subdir.name)
168 """Emit the ajax to build a pie chart using google apis...
170 url =
"https://chart.googleapis.com/chart?"
173 url+=
"&chco=00FF00|FFFF00|FF0000|7A7A7A"
174 url+=
"&chs=%sx%s" %(w,h)
186 fail_comps=sorted(fail_comps,key=
lambda comp:comp.name )
187 if len(fail_comps)>0:
189 for comp
in fail_comps:
190 print indent+
" - %s: %s Test Failed (pval = %s) " %(comp.name,comp.test_name,comp.rank)
192 subdir.print_report(indent+
" ",verbose)
195 print "\n%s - summary of %s tests:" %(self.
name,self.
weight)
203 if self.
weight == 0:
return 0
206 if self.
weight == 0:
return 0
210 if self.
weight == 0:
return 1
214 if self.
weight == 0:
return 0
227 if not exists(full_path)
and len(full_path)>0:
241 valsa=
array(
'f',vals)
242 colorsa=
array(
'i',colors)
243 can = TCanvas(
"cpie",
"TPie test",100,100);
245 pie = TPie(
"ThePie",self.
name,len(vals),valsa,colorsa);
258 pie.SetAngularOffset(0.);
259 pie.SetLabelsOffset(-.3);
264 print "self.name = %s" %self.
name
265 print "len(vals) = %s (vals=%s)" %(len(vals),vals)
266 print "valsa = %s" %valsa
267 print "colorsa = %s" %colorsa
270 """Eliminate from the tree the directory the expandable ones.
278 subdir.mother_dir=subdir.mother_dir.replace(
"/"+expandable_dir,
"")
279 if subdir.name==expandable_dir:
285 exp_dir=self.
subdirs[exp_index]
286 for subsubdir
in exp_dir.subdirs:
288 subsubdir.mother_dir=subsubdir.mother_dir.replace(
"/"+expandable_dir,
"")
289 while "//" in subsubdir.mother_dir:
290 print subsubdir.mother_dir
291 subsubdir.mother_dir=subsubdir.mother_dir.replace(
"//",
"/")
293 self.subdirs.append(subsubdir)
295 for comp
in exp_dir.comparisons:
296 comp.mother_dir=comp.mother_dir.replace(
"/"+expandable_dir,
"")
297 while "//" in comp.mother_dir:
299 comp.mother_dir=comp.mother_dir.replace(
"/")
301 self.comparisons.append(comp)
308 self.
prune(expandable_dir)
311 subdir.prune(expandable_dir)
315 return "%s seems to be empty. Please check!" %self.
name
318 content+=
" %s\n" % subdir
320 content+=
" %s\n" % comp
324 from multiprocessing
import Process
326 canvas.Print(img_name)
328 tcanvas_print_processes=[]
334 def __init__(self,name,mother_dir,h1,h2,stat_test,draw_success=False,do_pngs=False, skip=False):
340 Weighted.__init__(self,name)
342 stat_test.set_operands(h1,h2)
350 self.
status=stat_test.get_status()
351 self.
rank=stat_test.get_rank()
368 self.
img_name=self.img_name.replace(
"Run summary",
"")
369 self.
img_name=self.img_name.replace(
"/",
"_")
370 self.
img_name=self.img_name.strip(
"_")
379 p = Process(target=print_multi_threaded, args=(canvas,self.
img_name))
381 tcanvas_print_processes.append(p)
382 n_proc=len(tcanvas_print_processes)
385 for iprocess
in xrange(0,n_proc):
386 p=tcanvas_print_processes[iprocess]
388 p_to_remove.append(iprocess)
391 for iprocess
in p_to_remove:
392 tcanvas_print_processes.pop(iprocess-adjustment)
400 canvas=TCanvas(self.
name,self.
name,Comparison.canvas_xsize,Comparison.canvas_ysize)
404 obj1.SetTitle(self.
name)
406 if obj1.GetNbinsY()!=0
and not "2" in obj1.ClassName() :
407 obj1 .SetLineWidth(2)
408 obj2 .SetLineWidth(2)
410 obj1.SetMarkerStyle(8)
411 obj1.SetMarkerSize(.8)
413 obj2.SetMarkerStyle(8)
414 obj2.SetMarkerSize(.8)
416 obj1.SetMarkerColor(kBlue)
417 obj1.SetLineColor(kBlue)
419 obj2.SetMarkerColor(kRed)
420 obj2.SetLineColor(kRed)
424 obj2.Draw(
"HistSames")
448 print "This comparison failed %f" %self.
rank
455 lat_text=
"#scale[.7]{#color[%s]{%s: %2.2f}}" %(color,self.
test_name,self.
rank)
456 lat=TLatex(.1,.91,lat_text)
472 lat_text1=
"#scale[.7]{#color[%s]{Entries: %s}}" %(obj1.GetLineColor(),n1)
473 lat1=TLatex(.3,.91,lat_text1)
478 lat_text2=
"#scale[.7]{#color[%s]{Entries: %s}}" %(obj2.GetLineColor(),n2)
479 lat2=TLatex(.6,.91,lat_text2)
def get_summary_chart_ajax
static std::string join(char **cmd)
def get_summary_chart_name