Definition at line 62 of file dirstructure.py.
def dirstructure::Directory::__init__ | ( | self, | |
name, | |||
mother_dir = "" , |
|||
meta = CompInfo() , |
|||
draw_success = False , |
|||
do_pngs = False |
|||
) |
Definition at line 63 of file dirstructure.py.
00064 : 00065 self.mother_dir=mother_dir 00066 self.meta=meta 00067 self.subdirs=[] 00068 self.comparisons=[] 00069 self.n_fails=0 00070 self.n_successes=0 00071 self.n_nulls=0 00072 self.n_skiped = 0 00073 self.n_comp_skiped = 0 00074 self.n_comp_fails=0 00075 self.n_comp_successes=0 00076 self.n_comp_nulls=0 00077 self.weight=0 00078 self.stats_calculated=False 00079 Weighted.__init__(self,name) 00080 self.draw_success=draw_success 00081 self.do_pngs=do_pngs 00082 self.rank_histo=TH1I("rh%s"%name,"",50,-0.01,1.001) 00083 self.rank_histo.SetDirectory(0) 00084 self.different_histograms = {} 00085 self.different_histograms['file1']= {} 00086 self.different_histograms['file2']= {} 00087 self.filename1 = "" 00088 self.filename2 = "" 00089 self.n_missing_objs = 0 00090 self.full_path = ""
def dirstructure::Directory::__create_on_disk | ( | self | ) | [private] |
Definition at line 226 of file dirstructure.py.
def dirstructure::Directory::__create_pie_image | ( | self | ) | [private] |
Definition at line 236 of file dirstructure.py.
00237 : 00238 self.__create_on_disk() 00239 vals=[] 00240 colors=[] 00241 for n,col in zip((self.n_fails,self.n_nulls,self.n_successes,self.n_skiped),(kRed,kYellow,kGreen,kBlue)): 00242 if n!=0: 00243 vals.append(n) 00244 colors.append(col) 00245 valsa=array('f',vals) 00246 colorsa=array('i',colors) 00247 can = TCanvas("cpie","TPie test",100,100); 00248 try: 00249 pie = TPie("ThePie",self.name,len(vals),valsa,colorsa); 00250 label_n=0 00251 if self.n_fails!=0: 00252 pie.SetEntryLabel(label_n, "Fail: %.1f(%i)" %(self.get_fail_rate(),self.n_fails) ); 00253 label_n+=1 00254 if self.n_nulls!=0: 00255 pie.SetEntryLabel(label_n, "Null: %.1f(%i)" %(self.get_null_rate(),self.n_nulls) ); 00256 label_n+=1 00257 if self.n_successes!=0: 00258 pie.SetEntryLabel(label_n, "Success: %.1f(%i)" %(self.get_success_rate(),self.n_successes) ); 00259 if self.n_skiped!=0: 00260 pie.SetEntryLabel(label_n, "Skipped: %.1f(%i)" %(self.get_skiped_rate(),self.n_skiped)); 00261 pie.SetY(.52); 00262 pie.SetAngularOffset(0.); 00263 pie.SetLabelsOffset(-.3); 00264 #pie.SetLabelFormat("#splitline{%val (%perc)}{%txt}"); 00265 pie.Draw("3d nol"); 00266 can.Print(self.get_summary_chart_name()); 00267 except: 00268 print "self.name = %s" %self.name 00269 print "len(vals) = %s (vals=%s)" %(len(vals),vals) 00270 print "valsa = %s" %valsa 00271 print "colorsa = %s" %colorsa
def dirstructure::Directory::__get_full_path | ( | self | ) | [private] |
Definition at line 220 of file dirstructure.py.
def dirstructure::Directory::__repr__ | ( | self | ) |
Definition at line 316 of file dirstructure.py.
00317 : 00318 if self.is_empty(): 00319 return "%s seems to be empty. Please check!" %self.name 00320 content="%s , Rates: Success %.2f%%(%s) - Fail %.2f%%(%s) - Null %.2f%%(%s)\n" %(self.name,self.get_success_rate(),self.n_successes,self.get_fail_rate(),self.n_fails,self.get_null_rate(),self.n_nulls) 00321 for subdir in self.subdirs: 00322 content+=" %s\n" % subdir 00323 for comp in self.comparisons: 00324 content+=" %s\n" % comp 00325 return content 00326 #-------------------------------------------------------------------------------
def dirstructure::Directory::calcStats | ( | self, | |
make_pie = True |
|||
) |
Walk all subdirs and calculate weight,fails and successes. Moreove propagate the sample and releases names.
Definition at line 96 of file dirstructure.py.
00097 : 00098 '''Walk all subdirs and calculate weight,fails and successes. 00099 Moreove propagate the sample and releases names. 00100 ''' 00101 if self.stats_calculated: 00102 return 0 00103 00104 self.n_fails=0 00105 self.n_successes=0 00106 self.n_nulls=0 00107 self.n_comp_fails=0 00108 self.n_comp_successes=0 00109 self.n_comp_nulls=0 00110 self.weight=0 00111 00112 self.n_skiped = 0 00113 self.n_comp_skiped = 0 00114 self.n_missing_objs = len(self.different_histograms['file1'].keys())+len(self.different_histograms['file2'].keys()) 00115 if self.n_missing_objs != 0: 00116 print " [*] Missing in %s: %s" %(self.filename1, self.different_histograms['file1']) 00117 print " [*] Missing in %s: %s" %(self.filename2, self.different_histograms['file2']) 00118 # clean from empty dirs 00119 self.subdirs = filter(lambda subdir: not subdir.is_empty(),self.subdirs) 00120 00121 for comp in self.comparisons: 00122 if comp.status == SKIPED: #in case its in black list & skiped 00123 self.n_skiped += 1 00124 self.n_comp_skiped += 1 00125 self.weight+=1 00126 else: #else original code -> to check for Fails and Successes 00127 self.rank_histo.Fill(comp.rank) 00128 self.weight+=1 00129 if comp.status == FAIL: 00130 self.n_fails+=1 00131 self.n_comp_fails+=1 00132 elif comp.status == SUCCESS: 00133 self.n_successes+=1 00134 self.n_comp_successes+=1 00135 else: 00136 self.n_nulls+=1 00137 self.n_comp_nulls+=1 00138 00139 for subdir in self.subdirs: 00140 subdir.mother_dir=join(self.mother_dir,self.name) 00141 subdir.full_path = join(self.mother_dir,self.name).replace("/Run summary","") 00142 subdir.calcStats(make_pie) 00143 subdir.meta=self.meta 00144 self.weight+=subdir.weight 00145 self.n_fails+=subdir.n_fails 00146 self.n_successes+=subdir.n_successes 00147 self.n_nulls+=subdir.n_nulls 00148 00149 self.n_skiped+=subdir.n_skiped 00150 self.n_missing_objs += subdir.n_missing_objs 00151 00152 self.rank_histo.Add(subdir.rank_histo) 00153 00154 self.stats_calculated=True 00155 self.full_path = join(self.mother_dir,self.name).replace("/Run summary","") 00156 #if make_pie: 00157 #self.__create_pie_image()
def dirstructure::Directory::get_fail_rate | ( | self | ) |
Definition at line 208 of file dirstructure.py.
def dirstructure::Directory::get_null_rate | ( | self | ) |
Definition at line 216 of file dirstructure.py.
def dirstructure::Directory::get_skiped_rate | ( | self | ) |
Definition at line 205 of file dirstructure.py.
def dirstructure::Directory::get_subdirs_dict | ( | self | ) |
Definition at line 158 of file dirstructure.py.
def dirstructure::Directory::get_subdirs_names | ( | self | ) |
Definition at line 164 of file dirstructure.py.
def dirstructure::Directory::get_success_rate | ( | self | ) |
Definition at line 212 of file dirstructure.py.
def dirstructure::Directory::get_summary_chart_ajax | ( | self, | |
w = 400 , |
|||
h = 300 |
|||
) |
Emit the ajax to build a pie chart using google apis...
Definition at line 170 of file dirstructure.py.
00171 : 00172 """Emit the ajax to build a pie chart using google apis... 00173 """ 00174 url = "https://chart.googleapis.com/chart?" 00175 url+= "cht=p3" # Select the 3d chart 00176 #url+= "&chl=Success|Null|Fail" # give labels 00177 url+= "&chco=00FF00|FFFF00|FF0000|7A7A7A" # give colours to labels 00178 url+= "&chs=%sx%s" %(w,h) 00179 #url+= "&chtt=%s" %self.name 00180 url+= "&chd=t:%.2f,%.2f,%.2f,%.2f"%(self.get_success_rate(),self.get_null_rate(),self.get_fail_rate(),self.get_skiped_rate()) 00181 00182 return url
def dirstructure::Directory::get_summary_chart_name | ( | self | ) |
Definition at line 233 of file dirstructure.py.
def dirstructure::Directory::is_empty | ( | self | ) |
Definition at line 91 of file dirstructure.py.
def dirstructure::Directory::print_report | ( | self, | |
indent = "" , |
|||
verbose = False |
|||
) |
Definition at line 183 of file dirstructure.py.
00184 : 00185 if len(indent)==0: 00186 self.calcStats(make_pie=False) 00187 # print small failure report 00188 if verbose: 00189 fail_comps=filter(lambda comp:comp.status==FAIL,self.comparisons) 00190 fail_comps=sorted(fail_comps,key=lambda comp:comp.name ) 00191 if len(fail_comps)>0: 00192 print indent+"* %s/%s:" %(self.mother_dir,self.name) 00193 for comp in fail_comps: 00194 print indent+" - %s: %s Test Failed (pval = %s) " %(comp.name,comp.test_name,comp.rank) 00195 for subdir in self.subdirs: 00196 subdir.print_report(indent+" ",verbose) 00197 00198 if len(indent)==0: 00199 print "\n%s - summary of %s tests:" %(self.name,self.weight) 00200 print " o Failiures: %.2f%% (%s/%s)" %(self.get_fail_rate(),self.n_fails,self.weight) 00201 print " o Nulls: %.2f%% (%s/%s) " %(self.get_null_rate(),self.n_nulls,self.weight) 00202 print " o Successes: %.2f%% (%s/%s) " %(self.get_success_rate(),self.n_successes,self.weight) 00203 print " o Skipped: %.2f%% (%s/%s) " %(self.get_skiped_rate(),self.n_skiped,self.weight) 00204 print " o Missing objects: %s" %(self.n_missing_objs)
def dirstructure::Directory::prune | ( | self, | |
expandable_dir | |||
) |
Eliminate from the tree the directory the expandable ones.
Definition at line 272 of file dirstructure.py.
00273 : 00274 """Eliminate from the tree the directory the expandable ones. 00275 """ 00276 #print "pruning %s" %self.name 00277 exp_index=-1 00278 counter=0 00279 for subdir in self.subdirs: 00280 # Eliminate any trace of the expandable path in the mother directories 00281 # for depths higher than 1 00282 subdir.mother_dir=subdir.mother_dir.replace("/"+expandable_dir,"") 00283 if subdir.name==expandable_dir: 00284 exp_index=counter 00285 counter+=1 00286 00287 # Did we find an expandable? 00288 if exp_index>=0: 00289 exp_dir=self.subdirs[exp_index] 00290 for subsubdir in exp_dir.subdirs: 00291 #print "*******",subsubdir.mother_dir, 00292 subsubdir.mother_dir=subsubdir.mother_dir.replace("/"+expandable_dir,"") 00293 while "//" in subsubdir.mother_dir: 00294 print subsubdir.mother_dir 00295 subsubdir.mother_dir=subsubdir.mother_dir.replace("//","/") 00296 #print "*******",subsubdir.mother_dir 00297 self.subdirs.append(subsubdir) 00298 00299 for comp in exp_dir.comparisons: 00300 comp.mother_dir=comp.mother_dir.replace("/"+expandable_dir,"") 00301 while "//" in comp.mother_dir: 00302 comp.mother_dir 00303 comp.mother_dir=comp.mother_dir.replace("/") 00304 if not comp in self.comparisons: #in case not to append same comparisons few times 00305 self.comparisons.append(comp) # add a comparison 00306 self.n_comp_fails = exp_dir.n_comp_fails #copy to-be removed directory 00307 self.n_comp_nulls = exp_dir.n_comp_nulls # numbers to parent directory 00308 self.n_comp_successes = exp_dir.n_comp_successes 00309 self.n_comp_skiped = exp_dir.n_comp_skiped 00310 00311 del self.subdirs[exp_index] 00312 self.prune(expandable_dir) 00313 00314 for subdir in self.subdirs: 00315 subdir.prune(expandable_dir)
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Definition at line 63 of file dirstructure.py.
Reimplemented from dirstructure::Weighted.
Definition at line 63 of file dirstructure.py.