def makeScatteredPlot(chan,opts,distribution,list11=None,list12=None,list21=None,list22=None,list31=None,list32=None): p1 = None p2 = None p3 = None parameter = distribution.split('-')[0] pylab.figure() ax = pylab.subplot(111) ax.set_xscale('log') ax.set_yscale('log') if list11 and list12: p1 = pylab.plot(list11,list12,linestyle='None', marker='o',\ markerfacecolor='k', markeredgecolor='k',\ markersize=4, markeredgewidth=0) if list21 and list22: p2 = pylab.plot(list21,list22,linestyle='None', marker='v',\ markerfacecolor='r', markeredgecolor='r',\ markersize=4, markeredgewidth=0) if list31 and list32: p3 = pylab.plot(list31,list32,linestyle='None', marker='s',\ markerfacecolor='r', markeredgecolor='r',\ markersize=8, markeredgewidth=0) pylab.grid() pylab.xlabel('Z in ' + chan,size='x-large') pylab.ylabel('Z in ' + opts.ref_channel,size='x-large') pylab.title('Scattered plot of significance for channel: ' + chan) if p1 and p2 and p3: pylab.legend((p1,p2,p3),('background','foreground','candidate'),loc = 'upper right') lim = max(max(list11),max(list12),max(list21),max(list22),max(list31),max(list32)) if p1 and p2 and not p3: pylab.legend((p1,p2),('background','foreground'),loc = 'upper right') lim = max(max(list11),max(list12),max(list21),max(list22)) if p1 and not p2 and p3: pylab.legend((p1,p3),('background','candidate'),loc = 'upper right') lim = max(max(list11),max(list12),max(list31),max(list32)) if p1 and not p2 and not p3: # pylab.legend((p1),('background'),loc='upper right') lim = max(max(list11),max(list12)) ax.set_xlim(1e0, lim*2) ax.set_ylim(1e0, lim*2) figText = chan.split(':')[0] + '_' + chan.split(':')[1] + '_' + parameter + '_scat' figName = InspiralUtils.set_figure_name(opts,figText) InspiralUtils.savefig_pylal(figName) pylab.close() return figName
def makeScatteredPlot(chan,opts,distribution,list11=None,list12=None,list21=None,list22=None,list31=None,list32=None): p1 = None p2 = None p3 = None parameter = distribution.split('-')[0] pylab.figure() ax = pylab.subplot(111) ax.set_xscale('log') ax.set_yscale('log') if list11 and list12: p1 = pylab.plot(list11,list12,linestyle='None', marker='o',\ markerfacecolor='k', markeredgecolor='k',\ markersize=4, markeredgewidth=0) if list21 and list22: p2 = pylab.plot(list21,list22,linestyle='None', marker='v',\ markerfacecolor='r', markeredgecolor='r',\ markersize=4, markeredgewidth=0) if list31 and list32: p3 = pylab.plot(list31,list32,linestyle='None', marker='s',\ markerfacecolor='r', markeredgecolor='r',\ markersize=8, markeredgewidth=0) pylab.grid() pylab.xlabel('Z in ' + chan,size='x-large') pylab.ylabel('Z in ' + opts.ref_channel,size='x-large') pylab.title('Scattered plot of significance for channel: ' + chan) if p1 and p2 and p3: pylab.legend((p1,p2,p3),('background','foreground','candidate'),loc = 'upper right') lim = max(max(list11),max(list12),max(list21),max(list22),max(list31),max(list32)) if p1 and p2 and not p3: pylab.legend((p1,p2),('background','foreground'),loc = 'upper right') lim = max(max(list11),max(list12),max(list21),max(list22)) if p1 and not p2 and p3: pylab.legend((p1,p3),('background','candidate'),loc = 'upper right') lim = max(max(list11),max(list12),max(list31),max(list32)) if p1 and not p2 and not p3: # pylab.legend((p1),('background'),loc='upper right') lim = max(max(list11),max(list12)) ax.set_xlim(1e0, lim*2) ax.set_ylim(1e0, lim*2) figText = chan.split(':')[0] + '_' + chan.split(':')[1] + '_' + parameter + '_scat' figName = InspiralUtils.set_figure_name(opts,figText) InspiralUtils.savefig_pylal(figName) pylab.close() return figName
def plotHistogram(chan,opts,distribution,histoList,binList,percentiles=None,candidate=None,candidateRank=None): parameter = distribution.split('-')[0] step = binList[1] - binList[0] counter = sum(histoList) xlimInf = min(binList) if candidate and not parameter == 'dt': xlimSup = max(max(binList),candidate + 2.0) else: xlimSup = max(binList) pylab.figure() # semilogy(bins + step/2., z_dist+0.0001, 'r^',markerfacecolor="b",markersize=12) # plot(bins + step/2., z_dist) pylab.bar(binList[0:len(binList)-1], histoList, width=step, bottom=0) if percentiles: line1 = pylab.axvline(x=percentiles[0], ymin=0, ymax=max(histoList), color='g', label='50th percentile', linewidth=2, linestyle='--') line2 = pylab.axvline(x=percentiles[1], ymin=0, ymax=max(histoList), color='m', label='95th percentile', linewidth=2, linestyle='--') line3 = pylab.axvline(x=percentiles[2], ymin=0, ymax=max(histoList), color='r', label='99th percentile', linewidth=2, linestyle='--') if parameter == 'dt': pylab.axvline(x=-percentiles[0], ymin=0, ymax=max(histoList), color='g', label='50th percentile', linewidth=2, linestyle='--') pylab.axvline(x=-percentiles[1], ymin=0, ymax=max(histoList), color='m', label='95th percentile', linewidth=2, linestyle='--') pylab.axvline(x=-percentiles[2], ymin=0, ymax=max(histoList), color='r', label='99th percentile', linewidth=2, linestyle='--') if candidate: line0 = pylab.axvline(x=candidate, ymin=0, ymax=max(histoList), color='k', label='candidate value (%s percentile)' % (candidateRank), linewidth=2, linestyle='-') if percentiles and candidate: pylab.legend((line0,line1,line2,line3),('candidate','50%','95%','99%'),loc = 'upper right') if percentiles and not candidate: pylab.legend((line1,line2,line3),('50%','95%','99%'),loc = 'upper right') pylab.xlim(xlimInf,xlimSup) pylab.xlabel(parameter + ' value',size='large') # ylabel(r'#',size='x-large') pylab.grid() pylab.title("Histogram of the " + parameter + " value for " + chan + ', Statistics = ' + str(counter)) figText = chan.split(':')[0] + '_' + chan.split(':')[1] + '_' + parameter + '_dist' figFileName = InspiralUtils.set_figure_name(opts,figText) InspiralUtils.savefig_pylal(figFileName) pylab.close() return figFileName
def plotHistogram(chan,opts,distribution,histoList,binList,percentiles=None,candidate=None,candidateRank=None): parameter = distribution.split('-')[0] step = binList[1] - binList[0] counter = sum(histoList) xlimInf = min(binList) if candidate and not parameter == 'dt': xlimSup = max(max(binList),candidate + 2.0) else: xlimSup = max(binList) pylab.figure() # semilogy(bins + step/2., z_dist+0.0001, 'r^',markerfacecolor="b",markersize=12) # plot(bins + step/2., z_dist) pylab.bar(binList[0:len(binList)-1], histoList, width=step, bottom=0) if percentiles: line1 = pylab.axvline(x=percentiles[0], ymin=0, ymax=max(histoList), color='g', label='50th percentile', linewidth=2, linestyle='--') line2 = pylab.axvline(x=percentiles[1], ymin=0, ymax=max(histoList), color='m', label='95th percentile', linewidth=2, linestyle='--') line3 = pylab.axvline(x=percentiles[2], ymin=0, ymax=max(histoList), color='r', label='99th percentile', linewidth=2, linestyle='--') if parameter == 'dt': pylab.axvline(x=-percentiles[0], ymin=0, ymax=max(histoList), color='g', label='50th percentile', linewidth=2, linestyle='--') pylab.axvline(x=-percentiles[1], ymin=0, ymax=max(histoList), color='m', label='95th percentile', linewidth=2, linestyle='--') pylab.axvline(x=-percentiles[2], ymin=0, ymax=max(histoList), color='r', label='99th percentile', linewidth=2, linestyle='--') if candidate: line0 = pylab.axvline(x=candidate, ymin=0, ymax=max(histoList), color='k', label='candidate value (%s percentile)' % (candidateRank), linewidth=2, linestyle='-') if percentiles and candidate: pylab.legend((line0,line1,line2,line3),('candidate','50%','95%','99%'),loc = 'upper right') if percentiles and not candidate: pylab.legend((line1,line2,line3),('50%','95%','99%'),loc = 'upper right') pylab.xlim(xlimInf,xlimSup) pylab.xlabel(parameter + ' value',size='large') # ylabel(r'#',size='x-large') pylab.grid() pylab.title("Histogram of the " + parameter + " value for " + chan + ', Statistics = ' + str(counter)) figText = chan.split(':')[0] + '_' + chan.split(':')[1] + '_' + parameter + '_dist' figFileName = InspiralUtils.set_figure_name(opts,figText) InspiralUtils.savefig_pylal(figFileName) pylab.close() return figFileName
pylab.xlabel('False Alarm Probability') pylab.ylabel('Efficiency') pylab.xscale('log') pylab.yscale('log') pylab.xlim(10**-5, 10**0) pylab.ylim(10**-3.5, 10**0) pylab.title('Fig. '+str(fig_num)+': ROC Curves from total\_ranked\_data[]') l1 = pylab.legend(loc = 'lower right') pfile.close() if opts.diagnostic_plots: # save log-log figure name = '_ROC_log-log' fname = InspiralUtils.set_figure_name(opts, name) fname_thumb = InspiralUtils.savefig_pylal(filename=fname, doThumb=True, dpi_thumb=opts.figure_resolution) fnameList.append(fname) tagList.append(name) # save lin-lin figure fig_num +=1 pylab.title('Fig. '+str(fig_num)+': ROC Curves from total\_ranked\_data[]') pylab.legend(loc = 'lower right') pylab.yscale('linear') pylab.xscale('linear') pylab.xlim(0, 1) pylab.ylim(0, 1) name = '_ROC_lin-lin' fname = InspiralUtils.set_figure_name(opts, name) fname_thumb = InspiralUtils.savefig_pylal(filename=fname, doThumb=True, dpi_thumb=opts.figure_resolution) fnameList.append(fname)
def plotHistogram(chan, opts, distribution, histoList, binList, percentiles=None, candidate=None, candidateRank=None): parameter = distribution.split("-")[0] step = binList[1] - binList[0] counter = sum(histoList) xlimInf = min(binList) if candidate and not parameter == "dt": xlimSup = max(max(binList), candidate + 2.0) else: xlimSup = max(binList) pylab.figure() # semilogy(bins + step/2., z_dist+0.0001, 'r^',markerfacecolor="b",markersize=12) # plot(bins + step/2., z_dist) pylab.bar(binList[0 : len(binList) - 1], histoList, width=step, bottom=0) if percentiles: line1 = pylab.axvline( x=percentiles[0], ymin=0, ymax=max(histoList), color="g", label="50th percentile", linewidth=2, linestyle="--", ) line2 = pylab.axvline( x=percentiles[1], ymin=0, ymax=max(histoList), color="m", label="95th percentile", linewidth=2, linestyle="--", ) line3 = pylab.axvline( x=percentiles[2], ymin=0, ymax=max(histoList), color="r", label="99th percentile", linewidth=2, linestyle="--", ) if parameter == "dt": pylab.axvline( x=-percentiles[0], ymin=0, ymax=max(histoList), color="g", label="50th percentile", linewidth=2, linestyle="--", ) pylab.axvline( x=-percentiles[1], ymin=0, ymax=max(histoList), color="m", label="95th percentile", linewidth=2, linestyle="--", ) pylab.axvline( x=-percentiles[2], ymin=0, ymax=max(histoList), color="r", label="99th percentile", linewidth=2, linestyle="--", ) if candidate: line0 = pylab.axvline( x=candidate, ymin=0, ymax=max(histoList), color="k", label="candidate value (%s percentile)" % (candidateRank), linewidth=2, linestyle="-", ) if percentiles and candidate: pylab.legend((line0, line1, line2, line3), ("candidate", "50%", "95%", "99%"), loc="upper right") if percentiles and not candidate: pylab.legend((line1, line2, line3), ("50%", "95%", "99%"), loc="upper right") pylab.xlim(xlimInf, xlimSup) pylab.xlabel(parameter + " value", size="large") # ylabel(r'#',size='x-large') pylab.grid() pylab.title("Histogram of the " + parameter + " value for " + chan + ", Statistics = " + str(counter)) figText = chan.split(":")[0] + "_" + chan.split(":")[1] + "_" + parameter + "_dist" figFileName = InspiralUtils.set_figure_name(opts, figText) InspiralUtils.savefig_pylal(figFileName) pylab.close() return figFileName
def makeScatteredPlot( chan, opts, distribution, list11=None, list12=None, list21=None, list22=None, list31=None, list32=None ): p1 = None p2 = None p3 = None parameter = distribution.split("-")[0] pylab.figure() ax = pylab.subplot(111) ax.set_xscale("log") ax.set_yscale("log") if list11 and list12: p1 = pylab.plot( list11, list12, linestyle="None", marker="o", markerfacecolor="k", markeredgecolor="k", markersize=4, markeredgewidth=0, ) if list21 and list22: p2 = pylab.plot( list21, list22, linestyle="None", marker="v", markerfacecolor="r", markeredgecolor="r", markersize=4, markeredgewidth=0, ) if list31 and list32: p3 = pylab.plot( list31, list32, linestyle="None", marker="s", markerfacecolor="r", markeredgecolor="r", markersize=8, markeredgewidth=0, ) pylab.grid() pylab.xlabel("Z in " + chan, size="x-large") pylab.ylabel("Z in " + opts.ref_channel, size="x-large") pylab.title("Scattered plot of significance for channel: " + chan) if p1 and p2 and p3: pylab.legend((p1, p2, p3), ("background", "foreground", "candidate"), loc="upper right") lim = max(max(list11), max(list12), max(list21), max(list22), max(list31), max(list32)) if p1 and p2 and not p3: pylab.legend((p1, p2), ("background", "foreground"), loc="upper right") lim = max(max(list11), max(list12), max(list21), max(list22)) if p1 and not p2 and p3: pylab.legend((p1, p3), ("background", "candidate"), loc="upper right") lim = max(max(list11), max(list12), max(list31), max(list32)) if p1 and not p2 and not p3: # pylab.legend((p1),('background'),loc='upper right') lim = max(max(list11), max(list12)) ax.set_xlim(1e0, lim * 2) ax.set_ylim(1e0, lim * 2) figText = chan.split(":")[0] + "_" + chan.split(":")[1] + "_" + parameter + "_scat" figName = InspiralUtils.set_figure_name(opts, figText) InspiralUtils.savefig_pylal(figName) pylab.close() return figName
pylab.ylabel('Efficiency') pylab.xscale('log') pylab.yscale('log') pylab.xlim(10**-5, 10**0) pylab.ylim(10**-3.5, 10**0) pylab.title('Fig. ' + str(fig_num) + ': ROC Curves from total\_ranked\_data[]') l1 = pylab.legend(loc='lower right') pfile.close() if opts.diagnostic_plots: # save log-log figure name = '_ROC_log-log' fname = InspiralUtils.set_figure_name(opts, name) fname_thumb = InspiralUtils.savefig_pylal( filename=fname, doThumb=True, dpi_thumb=opts.figure_resolution) fnameList.append(fname) tagList.append(name) # save lin-lin figure fig_num += 1 pylab.title('Fig. ' + str(fig_num) + ': ROC Curves from total\_ranked\_data[]') pylab.legend(loc='lower right') pylab.yscale('linear') pylab.xscale('linear') pylab.xlim(0, 1) pylab.ylim(0, 1) name = '_ROC_lin-lin' fname = InspiralUtils.set_figure_name(opts, name) fname_thumb = InspiralUtils.savefig_pylal(