Public Member Functions | |
def | __init__ |
def | __repr__ |
def | calcStats |
def | get_fail_rate |
def | get_null_rate |
def | get_subdirs_dict |
def | get_subdirs_names |
def | get_success_rate |
def | get_summary_chart_ajax |
def | get_summary_chart_name |
def | is_empty |
def | print_report |
def | prune |
Public Attributes | |
comparisons | |
do_pngs | |
draw_success | |
meta | |
mother_dir | |
n_comp_fails | |
n_comp_nulls | |
n_comp_successes | |
n_fails | |
n_nulls | |
n_successes | |
rank_histo | |
stats_calculated | |
subdirs | |
weight | |
Private Member Functions | |
def | __create_on_disk |
def | __create_pie_image |
def | __get_full_path |
Definition at line 61 of file dirstructure.py.
def dirstructure::Directory::__init__ | ( | self, | |
name, | |||
mother_dir = "" , |
|||
meta = CompInfo() , |
|||
draw_success = False , |
|||
do_pngs = False |
|||
) |
Definition at line 62 of file dirstructure.py.
00063 : 00064 self.mother_dir=mother_dir 00065 self.meta=meta 00066 self.subdirs=[] 00067 self.comparisons=[] 00068 self.n_fails=0 00069 self.n_successes=0 00070 self.n_nulls=0 00071 self.n_comp_fails=0 00072 self.n_comp_successes=0 00073 self.n_comp_nulls=0 00074 self.weight=0 00075 self.stats_calculated=False 00076 Weighted.__init__(self,name) 00077 self.draw_success=draw_success 00078 self.do_pngs=do_pngs 00079 self.rank_histo=TH1I("rh%s"%name,"",50,-0.01,1.001) 00080 self.rank_histo.SetDirectory(0)
def dirstructure::Directory::__create_on_disk | ( | self | ) | [private] |
Definition at line 194 of file dirstructure.py.
def dirstructure::Directory::__create_pie_image | ( | self | ) | [private] |
Definition at line 204 of file dirstructure.py.
00205 : 00206 self.__create_on_disk() 00207 vals=[] 00208 colors=[] 00209 for n,col in zip((self.n_fails,self.n_nulls,self.n_successes),(kRed,kYellow,kGreen)): 00210 if n!=0: 00211 vals.append(n) 00212 colors.append(col) 00213 valsa=array('f',vals) 00214 colorsa=array('i',colors) 00215 can = TCanvas("cpie","TPie test",100,100); 00216 try: 00217 pie = TPie("ThePie",self.name,len(vals),valsa,colorsa); 00218 label_n=0 00219 if self.n_fails!=0: 00220 pie.SetEntryLabel(label_n, "Fail: %.1f(%i)" %(self.get_fail_rate(),self.n_fails) ); 00221 label_n+=1 00222 if self.n_nulls!=0: 00223 pie.SetEntryLabel(label_n, "Null: %.1f(%i)" %(self.get_null_rate(),self.n_nulls) ); 00224 label_n+=1 00225 if self.n_successes!=0: 00226 pie.SetEntryLabel(label_n, "Success: %.1f(%i)" %(self.get_success_rate(),self.n_successes) ); 00227 pie.SetY(.52); 00228 pie.SetAngularOffset(0.); 00229 pie.SetLabelsOffset(-.3); 00230 #pie.SetLabelFormat("#splitline{%val (%perc)}{%txt}"); 00231 pie.Draw("3d nol"); 00232 can.Print(self.get_summary_chart_name()); 00233 except: 00234 print "self.name = %s" %self.name 00235 print "len(vals) = %s (vals=%s)" %(len(vals),vals) 00236 print "valsa = %s" %valsa 00237 print "colorsa = %s" %colorsa
def dirstructure::Directory::__get_full_path | ( | self | ) | [private] |
Definition at line 188 of file dirstructure.py.
def dirstructure::Directory::__repr__ | ( | self | ) |
Definition at line 277 of file dirstructure.py.
00278 : 00279 if self.is_empty(): 00280 return "%s seems to be empty. Please check!" %self.name 00281 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) 00282 for subdir in self.subdirs: 00283 content+=" %s\n" % subdir 00284 for comp in self.comparisons: 00285 content+=" %s\n" % comp 00286 return content 00287 #-------------------------------------------------------------------------------
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 86 of file dirstructure.py.
00087 : 00088 '''Walk all subdirs and calculate weight,fails and successes. 00089 Moreove propagate the sample and releases names. 00090 ''' 00091 if self.stats_calculated: 00092 return 0 00093 00094 self.n_fails=0 00095 self.n_successes=0 00096 self.n_nulls=0 00097 self.n_comp_fails=0 00098 self.n_comp_successes=0 00099 self.n_comp_nulls=0 00100 self.weight=0 00101 00102 # clean from empty dirs 00103 self.subdirs = filter(lambda subdir: not subdir.is_empty(),self.subdirs) 00104 00105 for comp in self.comparisons: 00106 self.rank_histo.Fill(comp.rank) 00107 self.weight+=1 00108 if comp.status == FAIL: 00109 self.n_fails+=1 00110 self.n_comp_fails+=1 00111 elif comp.status == SUCCESS: 00112 self.n_successes+=1 00113 self.n_comp_successes+=1 00114 else: 00115 self.n_nulls+=1 00116 self.n_comp_nulls+=1 00117 00118 for subdir in self.subdirs: 00119 subdir.mother_dir=join(self.mother_dir,self.name) 00120 subdir.calcStats(make_pie) 00121 subdir.meta=self.meta 00122 self.weight+=subdir.weight 00123 self.n_fails+=subdir.n_fails 00124 self.n_successes+=subdir.n_successes 00125 self.n_nulls+=subdir.n_nulls 00126 self.rank_histo.Add(subdir.rank_histo) 00127 00128 self.stats_calculated=True 00129 #if make_pie: 00130 #self.__create_pie_image()
def dirstructure::Directory::get_fail_rate | ( | self | ) |
Definition at line 176 of file dirstructure.py.
def dirstructure::Directory::get_null_rate | ( | self | ) |
Definition at line 184 of file dirstructure.py.
def dirstructure::Directory::get_subdirs_dict | ( | self | ) |
Definition at line 131 of file dirstructure.py.
def dirstructure::Directory::get_subdirs_names | ( | self | ) |
Definition at line 137 of file dirstructure.py.
def dirstructure::Directory::get_success_rate | ( | self | ) |
Definition at line 180 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 143 of file dirstructure.py.
00144 : 00145 """Emit the ajax to build a pie chart using google apis... 00146 """ 00147 url = "https://chart.googleapis.com/chart?" 00148 url+= "cht=p3" # Select the 3d chart 00149 #url+= "&chl=Success|Null|Fail" # give labels 00150 url+= "&chco=00FF00|FFFF00|FF0000" # give colours to labels 00151 url+= "&chs=%sx%s" %(w,h) 00152 #url+= "&chtt=%s" %self.name 00153 url+= "&chd=t:%.2f,%.2f,%.2f"%(self.get_success_rate(),self.get_null_rate(),self.get_fail_rate()) 00154 00155 return url
def dirstructure::Directory::get_summary_chart_name | ( | self | ) |
Definition at line 201 of file dirstructure.py.
def dirstructure::Directory::is_empty | ( | self | ) |
Definition at line 81 of file dirstructure.py.
def dirstructure::Directory::print_report | ( | self, | |
indent = "" , |
|||
verbose = False |
|||
) |
Definition at line 156 of file dirstructure.py.
00157 : 00158 if len(indent)==0: 00159 self.calcStats(make_pie=False) 00160 # print small failure report 00161 if verbose: 00162 fail_comps=filter(lambda comp:comp.status==FAIL,self.comparisons) 00163 fail_comps=sorted(fail_comps,key=lambda comp:comp.name ) 00164 if len(fail_comps)>0: 00165 print indent+"* %s/%s:" %(self.mother_dir,self.name) 00166 for comp in fail_comps: 00167 print indent+" - %s: %s Test Failed (pval = %s) " %(comp.name,comp.test_name,comp.rank) 00168 for subdir in self.subdirs: 00169 subdir.print_report(indent+" ",verbose) 00170 00171 if len(indent)==0: 00172 print "\n%s - summary of %s tests:" %(self.name,self.weight) 00173 print " o Failiures: %.2f%% (%s/%s)" %(self.get_fail_rate(),self.n_fails,self.weight) 00174 print " o Nulls: %.2f%% (%s/%s) " %(self.get_null_rate(),self.n_nulls,self.weight) 00175 print " o Successes: %.2f%% (%s/%s) " %(self.get_success_rate(),self.n_successes,self.weight)
def dirstructure::Directory::prune | ( | self, | |
expandable_dir | |||
) |
Eliminate from the tree the directory the expandable ones.
Definition at line 238 of file dirstructure.py.
00239 : 00240 """Eliminate from the tree the directory the expandable ones. 00241 """ 00242 #print "pruning %s" %self.name 00243 exp_index=-1 00244 counter=0 00245 for subdir in self.subdirs: 00246 # Eliminate any trace of the expandable path in the mother directories 00247 # for depths higher than 1 00248 subdir.mother_dir=subdir.mother_dir.replace("/"+expandable_dir,"") 00249 if subdir.name==expandable_dir: 00250 exp_index=counter 00251 counter+=1 00252 00253 # Did we find an expandable? 00254 if exp_index>=0: 00255 exp_dir=self.subdirs[exp_index] 00256 for subsubdir in exp_dir.subdirs: 00257 #print "*******",subsubdir.mother_dir, 00258 subsubdir.mother_dir=subsubdir.mother_dir.replace("/"+expandable_dir,"") 00259 while "//" in subsubdir.mother_dir: 00260 print subsubdir.mother_dir 00261 subsubdir.mother_dir=subsubdir.mother_dir.replace("//","/") 00262 #print "*******",subsubdir.mother_dir 00263 self.subdirs.append(subsubdir) 00264 00265 for comp in exp_dir.comparisons: 00266 comp.mother_dir=comp.mother_dir.replace("/"+expandable_dir,"") 00267 while "//" in comp.mother_dir: 00268 comp.mother_dir 00269 comp.mother_dir=comp.mother_dir.replace("/") 00270 self.comparisons.append(comp) 00271 00272 del self.subdirs[exp_index] 00273 self.prune(expandable_dir) 00274 00275 for subdir in self.subdirs: 00276 subdir.prune(expandable_dir)
Definition at line 62 of file dirstructure.py.
Definition at line 62 of file dirstructure.py.
Definition at line 62 of file dirstructure.py.
Definition at line 62 of file dirstructure.py.
Definition at line 62 of file dirstructure.py.
Definition at line 62 of file dirstructure.py.
Definition at line 62 of file dirstructure.py.
Definition at line 62 of file dirstructure.py.
Definition at line 62 of file dirstructure.py.
Definition at line 62 of file dirstructure.py.
Definition at line 62 of file dirstructure.py.
Definition at line 62 of file dirstructure.py.
Definition at line 62 of file dirstructure.py.
Definition at line 62 of file dirstructure.py.
Reimplemented from dirstructure::Weighted.
Definition at line 62 of file dirstructure.py.