def measure_efficiency(filenames, threshold, live_time_program = "lalapps_power", upper_limit_scale = "E", tmp_path = None, verbose = False): # FIXME: instruments are hard-coded. bad bad bad. sigh... if upper_limit_scale == "E": efficiency = EfficiencyData(("H1", "H2", "L1"), (lambda sim, instrument: sim.egw_over_rsquared), r"Equivalent Isotropic Energy ($M_{\odot} / \mathrm{pc}^{2}$)", 0.1) elif upper_limit_scale == "hrss": efficiency = EfficiencyData(("H1", "H2", "L1"), (lambda sim, instrument: sim.hrss), r"$h_{\mathrm{rss}}$", 0.1) else: raise ValueError("bad upper_limit_scale %s" % repr(upper_limit_scale)) # # Iterate over injection files. # for n, filename in enumerate(filenames): # # Open the database file. # if verbose: print("%d/%d: %s" % (n + 1, len(filenames), filename), file=sys.stderr) working_filename = dbtables.get_connection_filename(filename, tmp_path = tmp_path, verbose = verbose) connection = sqlite3.connect(str(working_filename)) connection.create_function("coinc_detection_statistic", 2, coinc_detection_statistic) database = SnglBurstUtils.CoincDatabase(connection, live_time_program) if verbose: SnglBurstUtils.summarize_coinc_database(database) # # Process database contents. # efficiency.add_contents(database, threshold) # # Done with this file. # database.connection.close() dbtables.discard_connection_filename(filename, working_filename, verbose = verbose) # # Compute efficiency from the data that have been collected # if verbose: print("binning and smoothnig efficiency data ...", file=sys.stderr) efficiency.finish(threshold) # # Done # return efficiency
def measure_efficiency(filenames, threshold, live_time_program = "lalapps_power", upper_limit_scale = "E", tmp_path = None, verbose = False): # FIXME: instruments are hard-coded. bad bad bad. sigh... if upper_limit_scale == "E": efficiency = EfficiencyData(("H1", "H2", "L1"), (lambda sim, instrument: sim.egw_over_rsquared), r"Equivalent Isotropic Energy ($M_{\odot} / \mathrm{pc}^{2}$)", 0.1) elif upper_limit_scale == "hrss": efficiency = EfficiencyData(("H1", "H2", "L1"), (lambda sim, instrument: sim.hrss), r"$h_{\mathrm{rss}}$", 0.1) else: raise ValueError("bad upper_limit_scale %s" % repr(upper_limit_scale)) # # Iterate over injection files. # for n, filename in enumerate(filenames): # # Open the database file. # if verbose: print >>sys.stderr, "%d/%d: %s" % (n + 1, len(filenames), filename) working_filename = dbtables.get_connection_filename(filename, tmp_path = tmp_path, verbose = verbose) connection = sqlite3.connect(working_filename) connection.create_function("coinc_detection_statistic", 2, coinc_detection_statistic) database = SnglBurstUtils.CoincDatabase(connection, live_time_program) if verbose: SnglBurstUtils.summarize_coinc_database(database) # # Process database contents. # efficiency.add_contents(database, threshold) # # Done with this file. # database.connection.close() dbtables.discard_connection_filename(filename, working_filename, verbose = verbose) # # Compute efficiency from the data that have been collected # if verbose: print >>sys.stderr, "binning and smoothnig efficiency data ..." efficiency.finish(threshold) # # Done # return efficiency
def measure_threshold(filenames, n_survivors, live_time_program = "lalapps_power", tmp_path = None, open_box = False, verbose = False): # # Initialize the book-keeping object. # rate_vs_threshold_data = RateVsThresholdData() # # Iterate over non-injection files. # for n, filename in enumerate(filenames): # # Open the database file. # if verbose: print("%d/%d: %s" % (n + 1, len(filenames), filename), file=sys.stderr) working_filename = dbtables.get_connection_filename(filename, tmp_path = tmp_path, verbose = verbose) database = SnglBurstUtils.CoincDatabase(sqlite3.connect(str(working_filename)), live_time_program) if verbose: SnglBurstUtils.summarize_coinc_database(database) # # Process database contents. # rate_vs_threshold_data.update_from(database, filename = filename, verbose = verbose) # # Done with this file. # database.connection.close() dbtables.discard_connection_filename(filename, working_filename, verbose = verbose) # # Determine likelihood threshold. # if verbose: print("finishing rate vs. threshold measurement ...", file=sys.stderr) rate_vs_threshold_data.finish(n_survivors, open_box = open_box, verbose = verbose) # # Done. # return rate_vs_threshold_data
def measure_threshold(filenames, n_survivors, live_time_program = "lalapps_power", tmp_path = None, open_box = False, verbose = False): # # Initialize the book-keeping object. # rate_vs_threshold_data = RateVsThresholdData() # # Iterate over non-injection files. # for n, filename in enumerate(filenames): # # Open the database file. # if verbose: print >>sys.stderr, "%d/%d: %s" % (n + 1, len(filenames), filename) working_filename = dbtables.get_connection_filename(filename, tmp_path = tmp_path, verbose = verbose) database = SnglBurstUtils.CoincDatabase(sqlite3.connect(working_filename), live_time_program) if verbose: SnglBurstUtils.summarize_coinc_database(database) # # Process database contents. # rate_vs_threshold_data.update_from(database, filename = filename, verbose = verbose) # # Done with this file. # database.connection.close() dbtables.discard_connection_filename(filename, working_filename, verbose = verbose) # # Determine likelihood threshold. # if verbose: print >>sys.stderr, "finishing rate vs. threshold measurement ..." rate_vs_threshold_data.finish(n_survivors, open_box = open_box, verbose = verbose) # # Done. # return rate_vs_threshold_data
def process_file(filename, products, live_time_program, tmp_path = None, veto_segments_name = None, verbose = False): # # connect to database and summarize contents # working_filename = dbtables.get_connection_filename(filename, tmp_path = tmp_path, verbose = verbose) contents = SnglBurstUtils.CoincDatabase(sqlite3.connect(working_filename), live_time_program, search = "StringCusp", veto_segments_name = veto_segments_name) if verbose: SnglBurstUtils.summarize_coinc_database(contents, filename = working_filename) # # augment summary with extra stuff we need. the filename # is recorded for dumping debuggin information related to # missed injections. if burca was run with the # --coincidence-segments option then the value is copied # into a segmentlistdict to facilitate the computation of # livetime # contents.filename = filename contents.coincidence_segments = ligolwprocess.get_process_params(contents.xmldoc, "lalapps_burca", "--coincidence-segments") if contents.coincidence_segments: # as a side-effect, this enforces the rule that # burca has been run on the input file exactly once contents.coincidence_segments, = contents.coincidence_segments # FIXME: remove when LAL accepts unicode contents.coincidence_segments = contents.coincidence_segments.encode('utf-8') contents.coincidence_segments = segments.segmentlistdict.fromkeys(contents.seglists, segmentsUtils.from_range_strings(contents.coincidence_segments.split(","), boundtype = dbtables.lsctables.LIGOTimeGPS).coalesce()) else: contents.coincidence_segments = None # # process contents # for n, product in enumerate(products): if verbose: print("%s: adding to product %d ..." % (working_filename, n), file=sys.stderr) product.add_contents(contents, verbose = verbose) # # close # contents.connection.close() dbtables.discard_connection_filename(filename, working_filename, verbose = verbose)
def process_file(filename, products, live_time_program, tmp_path = None, veto_segments_name = None, verbose = False): # # connect to database and summarize contents # working_filename = dbtables.get_connection_filename(filename, tmp_path = tmp_path, verbose = verbose) contents = SnglBurstUtils.CoincDatabase(sqlite3.connect(working_filename), live_time_program, search = "StringCusp", veto_segments_name = veto_segments_name) if verbose: SnglBurstUtils.summarize_coinc_database(contents, filename = working_filename) # # augment summary with extra stuff we need. the filename # is recorded for dumping debuggin information related to # missed injections. if burca was run with the # --coincidence-segments option then the value is copied # into a segmentlistdict to facilitate the computation of # livetime # contents.filename = filename contents.coincidence_segments = ligolwprocess.get_process_params(contents.xmldoc, "lalapps_burca", "--coincidence-segments") if contents.coincidence_segments: # as a side-effect, this enforces the rule that # burca has been run on the input file exactly once contents.coincidence_segments, = contents.coincidence_segments contents.coincidence_segments = segments.segmentlistdict.fromkeys(contents.seglists, segmentsUtils.from_range_strings(contents.coincidence_segments.split(","), boundtype = dbtables.lsctables.LIGOTimeGPS).coalesce()) else: contents.coincidence_segments = None # # process contents # for n, product in enumerate(products): if verbose: print >>sys.stderr, "%s: adding to product %d ..." % (working_filename, n) product.add_contents(contents, verbose = verbose) # # close # contents.connection.close() dbtables.discard_connection_filename(filename, working_filename, verbose = verbose)
if options.tmp_space is not None: dbtables.set_temp_store_directory(connection, options.tmp_space, verbose=options.verbose) # # Summarize the database. # contents = SnglBurstUtils.CoincDatabase( connection, live_time_program="StringSearch", search="StringCusp", veto_segments_name=options.vetoes_name) if options.verbose: SnglBurstUtils.summarize_coinc_database(contents) if not contents.seglists and options.verbose: print >> sys.stderr, "\twarning: no segments found" # # Build triangulators. The timing uncertainty of +/- 8e-5 s was # measured with lalapps_string_plot_binj and is essentially # identical for H1, H2, L1, and V1. # triangulators = stringutils.triangulators( dict((instrument, 8e-5) for instrument in contents.instruments)) # # Run likelihood ratio calculation. #
# Process files # for n, filename in enumerate( ligolw_utils.sort_files_by_size(filenames, options.verbose, reverse=True)): if options.verbose: print("%d/%d: %s" % (n + 1, len(filenames), filename), file=sys.stderr) working_filename = dbtables.get_connection_filename( filename, tmp_path=options.tmp_space, verbose=options.verbose) database = SnglBurstUtils.CoincDatabase(sqlite3.connect(working_filename), options.live_time_program, search="StringCusp") if options.verbose: SnglBurstUtils.summarize_coinc_database(database) is_injection_db = "sim_burst" in dbtables.get_table_names( database.connection) if is_injection_db: database.connection.cursor().execute( """ CREATE TEMPORARY TABLE sim_burst_map AS SELECT a.event_id AS simulation_id, a.coinc_event_id AS coinc_event_id, b.event_id AS event_id FROM coinc_event_map AS a JOIN coinc_event ON (
def dump_confidence_likelihood_scatter_data(globs, live_time_program = "lalapps_power", tmp_path = None, verbose = False): # # Collect file names. # if verbose: print("building file list ...", file=sys.stderr) filenames = sorted(filename for g in globs for filename in glob.glob(g)) # # Initialize storage. # injections = [] background = [] zero_lag = [] # # Iterate over files. # for n, filename in enumerate(filenames): # # Open the database file. # if verbose: print("%d/%d: %s" % (n + 1, len(filenames), filename), file=sys.stderr) working_filename = dbtables.get_connection_filename(filename, tmp_path = tmp_path, verbose = verbose) connection = sqlite3.connect(working_filename) connection.create_function("coinc_detection_statistic", 2, coinc_detection_statistic) database = SnglBurstUtils.CoincDatabase(connection, live_time_program) if verbose: SnglBurstUtils.summarize_coinc_database(database) # # Process database contents. Assume all files with # sim_burst tables are the outputs of injection runs, and # others aren't. # if database.sim_burst_table is None: # non-injections for id, l, c, is_background in bb_id_likelihood_confidence_background(database): record = (coinc_detection_statistic(l, c), l, c) if is_background: if len(background) < 1e6: heapq.heappush(background, record) else: heapq.heappushpop(background, record) else: if len(zero_lag) < 1e6: heapq.heappush(zero_lag, record) else: heapq.heappushpop(zero_ag, record) else: # injections create_sim_coinc_map_view(database.connection) for a, l, c in database.connection.cursor().execute(""" SELECT burst_coinc_amplitude, burst_coinc_likelihood, burst_coinc_confidence FROM sim_coinc_map WHERE sim_coinc_def_id == ? """, (database.sce_definer_id,)): record = (-a, l, c) if len(injections) < 1e6: heapq.heappush(injections, record) else: heapq.heappushpop(injections, record) # # Done with this file. # database.connection.close() dbtables.discard_connection_filename(filename, working_filename, verbose = verbose) # # Dump scatter plot data. # if verbose: print("writing scatter plot data ...", file=sys.stderr) f = file("lalapps_excesspowerfinal_background_scatter.dat", "w") for a, l, c in background: print("%.16g %.16g" % (l, c), file=f) f = file("lalapps_excesspowerfinal_zero_lag_scatter.dat", "w") for a, l, c in zero_lag: print("%.16g %.16g" % (l, c), file=f) f = file("lalapps_excesspowerfinal_injections_scatter.dat", "w") for a, l, c in injections: print("%.16g %.16g" % (l, c), file=f) if verbose: print("done.", file=sys.stderr)
# # Process files # plots = {} coincplots = new_coinc_plots(("H1", "H2", "L1"), options.amplitude_func, options.amplitude_lbl, options.coinc_plot) for n, filename in enumerate(utils.sort_files_by_size(filenames, options.verbose, reverse = True)): if options.verbose: print("%d/%d: %s" % (n + 1, len(filenames), filename), file=sys.stderr) working_filename = dbtables.get_connection_filename(filename, tmp_path = options.tmp_space, verbose = options.verbose) database = SnglBurstUtils.CoincDatabase(sqlite3.connect(working_filename), options.live_time_program) if options.verbose: SnglBurstUtils.summarize_coinc_database(database) if options.plot: if database.coinc_table is not None: database.connection.cursor().execute(""" CREATE TEMPORARY VIEW sim_burst_map AS SELECT a.event_id AS simulation_id, a.coinc_event_id AS coinc_event_id, b.event_id AS event_id FROM coinc_event_map AS a JOIN coinc_event_map AS b ON ( a.table_name == 'sim_burst' AND b.table_name == 'sngl_burst'
def dump_confidence_likelihood_scatter_data(globs, live_time_program = "lalapps_power", tmp_path = None, verbose = False): # # Collect file names. # if verbose: print >>sys.stderr, "building file list ..." filenames = sorted(filename for g in globs for filename in glob.glob(g)) # # Initialize storage. # injections = [] background = [] zero_lag = [] # # Iterate over files. # for n, filename in enumerate(filenames): # # Open the database file. # if verbose: print >>sys.stderr, "%d/%d: %s" % (n + 1, len(filenames), filename) working_filename = dbtables.get_connection_filename(filename, tmp_path = tmp_path, verbose = verbose) connection = sqlite3.connect(working_filename) connection.create_function("coinc_detection_statistic", 2, coinc_detection_statistic) database = SnglBurstUtils.CoincDatabase(connection, live_time_program) if verbose: SnglBurstUtils.summarize_coinc_database(database) # # Process database contents. Assume all files with # sim_burst tables are the outputs of injection runs, and # others aren't. # if database.sim_burst_table is None: # non-injections for id, l, c, is_background in bb_id_likelihood_confidence_background(database): record = (coinc_detection_statistic(l, c), l, c) if is_background: if len(background) < 1e6: heapq.heappush(background, record) else: heapq.heappushpop(background, record) else: if len(zero_lag) < 1e6: heapq.heappush(zero_lag, record) else: heapq.heappushpop(zero_ag, record) else: # injections create_sim_coinc_map_view(database.connection) for a, l, c in database.connection.cursor().execute(""" SELECT burst_coinc_amplitude, burst_coinc_likelihood, burst_coinc_confidence FROM sim_coinc_map WHERE sim_coinc_def_id == ? """, (database.sce_definer_id,)): record = (-a, l, c) if len(injections) < 1e6: heapq.heappush(injections, record) else: heapq.heappushpop(injections, record) # # Done with this file. # database.connection.close() dbtables.discard_connection_filename(filename, working_filename, verbose = verbose) # # Dump scatter plot data. # if verbose: print >>sys.stderr, "writing scatter plot data ..." f = file("lalapps_excesspowerfinal_background_scatter.dat", "w") for a, l, c in background: print >>f, "%.16g %.16g" % (l, c) f = file("lalapps_excesspowerfinal_zero_lag_scatter.dat", "w") for a, l, c in zero_lag: print >>f, "%.16g %.16g" % (l, c) f = file("lalapps_excesspowerfinal_injections_scatter.dat", "w") for a, l, c in injections: print >>f, "%.16g %.16g" % (l, c) if verbose: print >>sys.stderr, "done."
if options.verbose: print >>sys.stderr, "%d/%d: %s" % (n + 1, len(filenames), filename) working_filename = dbtables.get_connection_filename(filename, tmp_path = options.tmp_space, verbose = options.verbose) connection = sqlite3.connect(working_filename) if options.tmp_space is not None: dbtables.set_temp_store_directory(connection, options.tmp_space, verbose = options.verbose) # # Summarize the database. # contents = SnglBurstUtils.CoincDatabase(connection, live_time_program = "StringSearch", search = "StringCusp", veto_segments_name = options.vetoes_name) if options.verbose: SnglBurstUtils.summarize_coinc_database(contents) if not contents.seglists and options.verbose: print >>sys.stderr, "\twarning: no segments found" segs |= contents.seglists # # Build triangulators. The timing uncertainty of +/- 8e-5 s was # measured with lalapps_string_plot_binj and is essentially # identical for H1, H2, L1, and V1. # triangulators = stringutils.triangulators(dict.fromkeys(contents.instruments, 8e-5)) # # Record statistics. Assume all files with sim_burst tables are # the outputs of injection runs, and others aren't.
def apply_excess_power_veto(contents, veto_segs, verbose = False): if verbose: SnglBurstUtils.summarize_coinc_database(contents) def sngl_burst_is_vetoed(ifo, start, start_ns, duration, veto_segs = veto_segs): start = dbtables.lsctables.LIGOTimeGPS(start, start_ns) return ifo in veto_segs and veto_segs[ifo].intersects_segment(segments.segment(start, start + duration)) contents.connection.create_function("sngl_burst_is_vetoed", 4, sngl_burst_is_vetoed) cursor = contents.connection.cursor() # # Delete burst <--> burst coincs containing vetoed bursts # if verbose: print("applying excess power event veto strategy:", file=sys.stderr) print("\tremoving vetoed burst <--> burst coincs ...", file=sys.stderr) cursor.execute(""" DELETE FROM coinc_event WHERE coinc_def_id == ? AND coinc_event_id IN ( SELECT coinc_event_id FROM coinc_event_map JOIN sngl_burst ON ( coinc_event_map.table_name == 'sngl_burst' AND coinc_event_map.event_id == sngl_burst.event_id ) WHERE sngl_burst_is_vetoed(sngl_burst.ifo, sngl_burst.start_time, sngl_burst.start_time_ns, sngl_burst.duration) ) """, (contents.bb_definer_id,)) # # Delete sim <--> coinc coincs pointing to deleted coincs # if contents.sc_definer_id is not None: if verbose: print("\tremoving vetoed sim <--> coinc coincs ...", file=sys.stderr) cursor.execute(""" DELETE FROM coinc_event WHERE coinc_def_id == ? AND coinc_event_id IN ( SELECT coinc_event_id FROM coinc_event_map WHERE table_name == 'coinc_event' AND event_id NOT IN ( SELECT coinc_event_id FROM coinc_event ) ) """, (contents.sc_definer_id,)) # # Now that we no longer need to form links through the # coinc_def_map table, delete vetoed burst rows from it # if verbose: print("\tremoving vetoed bursts from coinc_def_map table ...", file=sys.stderr) cursor.execute(""" DELETE FROM coinc_event_map WHERE coinc_event_map.table_name == 'sngl_burst' AND coinc_event_map.event_id IN ( SELECT event_id FROM sngl_burst WHERE sngl_burst_is_vetoed(ifo, start_time, start_time_ns, duration) ) """) # # The coinc_def_map table no longer contains any rows pointing to # vetoed bursts, update the event counts in sim <--> burst coincs # and delete any for which this is now 0 # if contents.sb_definer_id is not None: if verbose: print("\tupdating sim <--> burst event counts ...", file=sys.stderr) cursor.execute(""" UPDATE coinc_event SET nevents = (SELECT COUNT(*) FROM coinc_event_map WHERE coinc_event_map.coinc_event_id == coinc_event.coinc_event_id AND coinc_event_map.table_name == 'sngl_burst') WHERE coinc_event.coinc_def_id == ? """, (contents.sb_definer_id,)) if verbose: print("\tremoving empty sim <--> burst coincs ...", file=sys.stderr) cursor.execute(""" DELETE FROM coinc_event WHERE coinc_def_id == ? AND nevents == 0 """, (contents.sb_definer_id,)) # # We have removed all the rows from the coinc_event table that will # be removed, so now remove multi_burst and coinc_event_map rows # that point to non-existent coinc_events # if verbose: print("\ttrimming coinc_event_map table ...", file=sys.stderr) cursor.execute(""" DELETE FROM coinc_event_map WHERE coinc_event_map.coinc_event_id NOT IN ( SELECT coinc_event_id FROM coinc_event ) """) if verbose: print("\ttrimming multi_burst table ...", file=sys.stderr) cursor.execute(""" DELETE FROM multi_burst WHERE multi_burst.coinc_event_id NOT IN ( SELECT coinc_event_id FROM coinc_event ) """) # # Tables are now consistent, and contain no coincs involving a # vetoed burst # if verbose: print("\tdone (excess power event vetos).", file=sys.stderr)
def apply_excess_power_veto(contents, veto_segs, verbose=False): if verbose: SnglBurstUtils.summarize_coinc_database(contents) def sngl_burst_is_vetoed(ifo, start, start_ns, duration, veto_segs=veto_segs): start = dbtables.lsctables.LIGOTimeGPS(start, start_ns) return ifo in veto_segs and veto_segs[ifo].intersects_segment( segments.segment(start, start + duration)) contents.connection.create_function("sngl_burst_is_vetoed", 4, sngl_burst_is_vetoed) cursor = contents.connection.cursor() # # Delete burst <--> burst coincs containing vetoed bursts # if verbose: print >> sys.stderr, "applying excess power event veto strategy:" print >> sys.stderr, "\tremoving vetoed burst <--> burst coincs ..." cursor.execute( """ DELETE FROM coinc_event WHERE coinc_def_id == ? AND coinc_event_id IN ( SELECT coinc_event_id FROM coinc_event_map JOIN sngl_burst ON ( coinc_event_map.table_name == 'sngl_burst' AND coinc_event_map.event_id == sngl_burst.event_id ) WHERE sngl_burst_is_vetoed(sngl_burst.ifo, sngl_burst.start_time, sngl_burst.start_time_ns, sngl_burst.duration) ) """, (contents.bb_definer_id, )) # # Delete sim <--> coinc coincs pointing to deleted coincs # if contents.sc_definer_id is not None: if verbose: print >> sys.stderr, "\tremoving vetoed sim <--> coinc coincs ..." cursor.execute( """ DELETE FROM coinc_event WHERE coinc_def_id == ? AND coinc_event_id IN ( SELECT coinc_event_id FROM coinc_event_map WHERE table_name == 'coinc_event' AND event_id NOT IN ( SELECT coinc_event_id FROM coinc_event ) ) """, (contents.sc_definer_id, )) # # Now that we no longer need to form links through the # coinc_def_map table, delete vetoed burst rows from it # if verbose: print >> sys.stderr, "\tremoving vetoed bursts from coinc_def_map table ..." cursor.execute(""" DELETE FROM coinc_event_map WHERE coinc_event_map.table_name == 'sngl_burst' AND coinc_event_map.event_id IN ( SELECT event_id FROM sngl_burst WHERE sngl_burst_is_vetoed(ifo, start_time, start_time_ns, duration) ) """) # # The coinc_def_map table no longer contains any rows pointing to # vetoed bursts, update the event counts in sim <--> burst coincs # and delete any for which this is now 0 # if contents.sb_definer_id is not None: if verbose: print >> sys.stderr, "\tupdating sim <--> burst event counts ..." cursor.execute( """ UPDATE coinc_event SET nevents = (SELECT COUNT(*) FROM coinc_event_map WHERE coinc_event_map.coinc_event_id == coinc_event.coinc_event_id AND coinc_event_map.table_name == 'sngl_burst') WHERE coinc_event.coinc_def_id == ? """, (contents.sb_definer_id, )) if verbose: print >> sys.stderr, "\tremoving empty sim <--> burst coincs ..." cursor.execute( """ DELETE FROM coinc_event WHERE coinc_def_id == ? AND nevents == 0 """, (contents.sb_definer_id, )) # # We have removed all the rows from the coinc_event table that will # be removed, so now remove multi_burst and coinc_event_map rows # that point to non-existent coinc_events # if verbose: print >> sys.stderr, "\ttrimming coinc_event_map table ..." cursor.execute(""" DELETE FROM coinc_event_map WHERE coinc_event_map.coinc_event_id NOT IN ( SELECT coinc_event_id FROM coinc_event ) """) if verbose: print >> sys.stderr, "\ttrimming multi_burst table ..." cursor.execute(""" DELETE FROM multi_burst WHERE multi_burst.coinc_event_id NOT IN ( SELECT coinc_event_id FROM coinc_event ) """) # # Tables are now consistent, and contain no coincs involving a # vetoed burst # if verbose: print >> sys.stderr, "\tdone (excess power event vetos)."