def background_livetime_nonring_by_slide(connection, seglists, veto_segments=None, coinc_segments=None, verbose=False): # get the segment lists and live time # FIXME veto segments not handled yet seglists = seglists.copy() if veto_segments is not None: seglists -= veto_segments zero_lag_time_slides, background_time_slides = SnglBurstUtils.get_time_slides( connection) instruments = frozenset(seglists.keys()) background_livetime = {} for on_inst, off_inst in detector_combos(list(instruments)): on_inst = frozenset(on_inst) off_inst = frozenset(off_inst) key = on_inst old_offsets = seglists.offsets.copy() background_livetime.setdefault(key, {}) for id, time_slide in background_time_slides.items(): seglists.offsets.update(time_slide) segs = seglists.intersection(list(on_inst)) - seglists.union( list(off_inst)) if coinc_segments is not None: segs &= coinc_segments tskey = frozenset(time_slide.items()) background_livetime[key].setdefault(tskey, 0) background_livetime[key][tskey] += float(abs(segs)) seglists.offsets.update(old_offsets) return background_livetime
def background_livetime_nonring_by_slide(connection, seglists, veto_segments=None, coinc_segments=None, verbose = False): # get the segment lists and live time # FIXME veto segments not handled yet seglists = seglists.copy() if veto_segments is not None: seglists -= veto_segments zero_lag_time_slides, background_time_slides = SnglBurstUtils.get_time_slides(connection) instruments = frozenset(seglists.keys()) background_livetime = {} for on_inst, off_inst in detector_combos(list(instruments)): on_inst = frozenset(on_inst) off_inst = frozenset(off_inst) key = on_inst old_offsets = seglists.offsets.copy() background_livetime.setdefault(key, {}) for id, time_slide in background_time_slides.items(): seglists.offsets.update(time_slide) segs=seglists.intersection(list(on_inst))-seglists.union(list(off_inst)) if coinc_segments is not None: segs &= coinc_segments tskey = frozenset(time_slide.items()) background_livetime[key].setdefault(tskey,0) background_livetime[key][tskey] += float(abs(segs)) seglists.offsets.update(old_offsets) return background_livetime
def plot_Efficiency_hrss_vs_freq(efficiency): """ Generate a plot from an Efficiency_hrss_vs_freq instance. """ fig, axes = SnglBurstUtils.make_burst_plot("Frequency (Hz)", efficiency.amplitude_lbl) axes.loglog() xcoords, ycoords = efficiency.efficiency.centres() zvals = efficiency.efficiency.ratio() cset = axes.contour(xcoords, ycoords, numpy.transpose(zvals), (.1, .2, .3, .4, .5, .6, .7, .8, .9)) cset.clabel(inline = True, fontsize = 5, fmt = r"$%%g \pm %g$" % efficiency.error, colors = "k") axes.set_title(r"%s Injection Detection Efficiency (%d of %d Found)" % ("+".join(sorted(efficiency.instruments)), len(efficiency.found_x), len(efficiency.injected_x))) return fig
def plot_Efficiency_hrss_vs_freq(efficiency): """ Generate a plot from an Efficiency_hrss_vs_freq instance. """ fig, axes = SnglBurstUtils.make_burst_plot("Frequency (Hz)", efficiency.amplitude_lbl) axes.loglog() xcoords, ycoords = efficiency.efficiency.centres() zvals = efficiency.efficiency.ratio() cset = axes.contour(xcoords, ycoords, zvals.T, (.1, .2, .3, .4, .5, .6, .7, .8, .9)) cset.clabel(inline = True, fontsize = 5, fmt = r"$%%g \pm %g$" % efficiency.error, colors = "k") axes.set_title(r"%s Injection Detection Efficiency (%d of %d Found)" % ("+".join(sorted(efficiency.instruments)), len(efficiency.found_x), len(efficiency.injected_x))) return fig