f, ax = p.subplots(2, sharex=True) p.title(method) ax[0].hist(r1, bins=100) ax[1].hist(r2, bins=100) p.savefig(dir_name + '/' + method + '_hist.png') '''''p.plot(x,y1,label='known planets') p.plot(x,y2,label='candidate light curves') p.xlim(0,1) #p.ylim(0,1) p.legend() p.xlabel('Threashold') p.ylabel('Fraction classified as planets')''' multiplot(x, y1, y2) p.title(method) p.savefig(dir_name + '/' + method + '_curve.png') compare[method] = [y2, y1] p.figure() for method in compare.keys(): x, y = compare[method] p.plot(x, y, label=method) p.title('Comparison') p.ylabel('Fraction of known planets recovered') p.xlabel('Number of new candidates') p.ylim(0, 1) p.legend(loc='lower right') p.savefig(dir_name + '/comparison.png') print 'Total running time: %s' % hms(time.time() - beginning) settings.close_all() p.show() print 'done'
compare={} for method in results.keys(): print 'plotting the %s method' %method x,y1,y2,r1,r2=get_plot(results[method],compare_labels) f,ax=p.subplots(2,sharex=True) p.title(method) ax[0].hist(r1,bins=100) ax[1].hist(r2,bins=100) p.savefig(dir_name+'/'+method+'_hist.png') multiplot(x,y1,y2) p.title(method) p.savefig(dir_name+'/'+method+'_curve.png') compare[method]=[y2,y1] p.figure() for method in compare.keys(): x,y=compare[method] auc=calc_auc(x,y) p.plot(x,y,label=method+': AUC=%.3f' %auc) #p.plot(x,y,label=method) p.title('Comparison') p.ylabel('Fraction of known planets recovered') p.xlabel('Number of new candidates') p.ylim(0,1) p.legend(loc='lower right') p.savefig(dir_name+'/comparison.png') print 'Total running time: %s' %hms(time.time()-beginning) settings.close_all() p.show() print 'done'