Пример #1
0
def open_pipedown_database(database_filename,tmp_space):
    """
    Open the connection to the pipedown database
    """
    if not os.access(database_filename,os.R_OK):
	raise Exception('Unable to open input file: %s'%(database_filename))
    from glue.ligolw import dbtables
    try:
        import sqlite3
    except ImportError:
        # Pre-2.5
        from pysqlite2 import dbapi2 as sqlite3
    working_filename=dbtables.get_connection_filename(database_filename,tmp_path=tmp_space)
    connection = sqlite3.connect(working_filename)
    if tmp_space:
	dbtables.set_temp_store_directory(connection,tmp_space)
    dbtables.DBTable_set_connection(connection)
    return (connection,working_filename) 
from glue.ligolw import dbtables

for n, filename in enumerate(filenames):
    #
    # Open the database file.
    #

    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"
# Iterate over files
#


for n, filename in enumerate(filenames):
	#
	# Open the database file.
	#

	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