def solvedp_by_roomset(pssa,name_to_value,name, xname, xdomain=None): ''' pssa : PssAnalyzer name_to_value : function converts agent name to numerical value ''' pylab.axvline(ymin=0, ymax=100) if xdomain != None: pylab.axhline(xmin=xdomain[0],xmax=xdomain[1]) for roomset_name in rooomsets_names: #filtered pssa filtered_pssa = pssa.select(".*", roomset_pattern=roomset_name) # list [(agent name, percent),...] list = filtered_pssa.solved_percent() print_list(list) width_vs_solved = [(name_to_value(n), p) for n,p in list ] #print_list(width_vs_solved);exit() #table [(20,80%),(40,90%),...] #xmin= min(zip(*width_vs_solved)[0]) width_vs_solved_table = do_by_key(sorted, width_vs_solved, 1, reverse=True ) #vectors [[20,40,...],[80%,90%]] width_vs_solved_vectors = zip(*sorted(width_vs_solved)) x,y = width_vs_solved_vectors print width_vs_solved_vectors xplot.html.plot( ((xname, x),(' % solved', y)), title=name, label = roomset_name ) for row in width_vs_solved: pylab.axvline(row[0],0,row[1],linestyle='--',color='b' ) xplot.html.add_table(width_vs_solved_table, name + " " + roomset_name, header=[name,"%solved"]) # end fname = name + xname + ".png" xplot.html.add_img_plot(fname) pylab.figure()
def solved_percent(): pssa = analyzer.PssAnalyzer() folder = os.path.join(os.getcwd(),"run_files") folder = os.path.join(folder,"uniqes") pssa.appent_pattern(folder, ".*beam.*") for rsn in rooomsets_names: rp = pssa.select("A", roomset_pattern=rsn) sp = rp.solved_percent_ext() sp = do_by_key(sorted, sp, 1) print rsn table_report(sp)