Beispiel #1
0
def plot_efficiency_data(efficiency_data):
	print("plotting efficiency curves ...", file=sys.stderr)

	# use the stock plotting routing in SimBurstUtils for the
	# efficiency contour plot

	fig = SimBurstUtils.plot_Efficiency_hrss_vs_freq(efficiency_data)
	#fig.gca().set_ylim((3e-17, 3e-10))

	# done

	#print >>sys.stderr, "writing lalapps_excesspowerfinal_efficiency.pdf ..."
	#fig.savefig("lalapps_excesspowerfinal_efficiency.pdf")
	print("writing lalapps_excesspowerfinal_efficiency.png ...", file=sys.stderr)
	fig.savefig("lalapps_excesspowerfinal_efficiency.png")
def plot_efficiency_data(efficiency_data):
	print >>sys.stderr, "plotting efficiency curves ..."

	# use the stock plotting routing in SimBurstUtils for the
	# efficiency contour plot

	fig = SimBurstUtils.plot_Efficiency_hrss_vs_freq(efficiency_data)
	#fig.gca().set_ylim((3e-17, 3e-10))

	# done

	#print >>sys.stderr, "writing lalapps_excesspowerfinal_efficiency.pdf ..."
	#fig.savefig("lalapps_excesspowerfinal_efficiency.pdf")
	print >>sys.stderr, "writing lalapps_excesspowerfinal_efficiency.png ..."
	fig.savefig("lalapps_excesspowerfinal_efficiency.png")

efficiencies = []
for instrument in plots:
	n = 0
	format = "%%s%s_%%0%dd.%%s" % (instrument, int(math.log10(max(options.plot) or 1)) + 1)
	while len(plots[instrument]):
		plot = plots[instrument].pop(0)
		filename = format % (options.base, options.plot[n], options.format)
		if options.verbose:
			print("finishing %s plot %d ..." % (instrument, options.plot[n]), file=sys.stderr)
		try:
			if isinstance(plot, SimBurstUtils.Efficiency_hrss_vs_freq):
				plot.finish(binning = binning)
				efficiencies.append(plot)
				fig = SimBurstUtils.plot_Efficiency_hrss_vs_freq(plot)
			else:
				plot.finish()
				fig = plot.fig
		except ValueError as e:
			print("can't finish %s plot %d: %s" % (instrument, options.plot[n], str(e)), file=sys.stderr)
		else:
			if options.verbose:
				print("writing %s ..." % filename, file=sys.stderr)
			fig.savefig(filename)
		n += 1


#
# finish and write coinc plots, deleting them as we go to save memory
#
efficiencies = []
for instrument in plots:
    n = 0
    format = "%%s%s_%%0%dd.%%s" % (instrument,
                                   int(math.log10(max(options.plot) or 1)) + 1)
    while len(plots[instrument]):
        plot = plots[instrument].pop(0)
        filename = format % (options.base, options.plot[n], options.format)
        if options.verbose:
            print("finishing %s plot %d ..." % (instrument, options.plot[n]),
                  file=sys.stderr)
        try:
            if isinstance(plot, SimBurstUtils.Efficiency_hrss_vs_freq):
                plot.finish(binning=binning)
                efficiencies.append(plot)
                fig = SimBurstUtils.plot_Efficiency_hrss_vs_freq(plot)
            else:
                plot.finish()
                fig = plot.fig
        except ValueError as e:
            print("can't finish %s plot %d: %s" %
                  (instrument, options.plot[n], str(e)),
                  file=sys.stderr)
        else:
            if options.verbose:
                print("writing %s ..." % filename, file=sys.stderr)
            fig.savefig(filename)
        n += 1

#
# finish and write coinc plots, deleting them as we go to save memory