Commit f3dfadce authored by Kipp Cannon's avatar Kipp Cannon
Browse files

update for upcoming python-ligo-lw release

- for Python 3 compatibility, the database working copy mechanism in python-ligo-lw has been reworked.  the file name returned is no longer a string object and must be cast to one when opening a connection.
- the additional string type casts are no-ops when used with the current release of python-ligo-lw
parent 29016513
......@@ -85,7 +85,7 @@ for n, filename in enumerate(databases, 1):
# assume it's an SQLite file
fileformat = "sqlite"
working_filename = dbtables.get_connection_filename(filename, tmp_path = options.tmp_space, verbose = options.verbose)
connection = sqlite3.connect(working_filename)
connection = sqlite3.connect(str(working_filename))
# disable sync() system calls for the database
connection.execute("PRAGMA synchronous = OFF;")
# also use the scratch space for sqlite's temp store, but don't try
......
......@@ -143,7 +143,7 @@ for n, filename in enumerate(filenames):
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)
connection = sqlite3.connect(working_filename)
connection = sqlite3.connect(str(working_filename))
connection.execute("PRAGMA synchronous = OFF;")
connection.execute("PRAGMA temp_store_directory = '%s';" % dbtables.tempfile.gettempdir())
......
......@@ -137,7 +137,7 @@ for n, filename in enumerate(filenames):
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)
connection = sqlite3.connect(working_filename)
connection = sqlite3.connect(str(working_filename))
connection.execute("PRAGMA temp_store_directory = '%s';" % dbtables.tempfile.gettempdir())
database = SnglBurstUtils.CoincDatabase(connection, options.program)
if options.verbose:
......
......@@ -607,7 +607,7 @@ def measure_threshold(filenames, n_survivors, live_time_program = "lalapps_power
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(working_filename), live_time_program)
database = SnglBurstUtils.CoincDatabase(sqlite3.connect(str(working_filename)), live_time_program)
if verbose:
SnglBurstUtils.summarize_coinc_database(database)
......@@ -989,7 +989,7 @@ def measure_efficiency(filenames, threshold, live_time_program = "lalapps_power"
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 = sqlite3.connect(str(working_filename))
connection.create_function("coinc_detection_statistic", 2, coinc_detection_statistic)
database = SnglBurstUtils.CoincDatabase(connection, live_time_program)
if verbose:
......
......@@ -741,7 +741,7 @@ for n, filename in enumerate(utils.sort_files_by_size(filenames, options.verbose
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)
database = SnglBurstUtils.CoincDatabase(sqlite3.connect(str(working_filename)), options.live_time_program)
if options.verbose:
SnglBurstUtils.summarize_coinc_database(database)
if options.plot:
......
......@@ -127,7 +127,7 @@ for n, filename in enumerate(filenames):
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)
connection = sqlite3.connect(working_filename)
connection = sqlite3.connect(str(working_filename))
#
# Define the is_vetoed() SQL function.
......
......@@ -125,7 +125,7 @@ for n, filename in enumerate(filenames):
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)
connection = sqlite3.connect(working_filename)
connection = sqlite3.connect(str(working_filename))
if options.tmp_space is not None:
dbtables.set_temp_store_directory(connection, options.tmp_space, verbose = options.verbose)
......
......@@ -792,7 +792,7 @@ def process_file(filename, products, live_time_program, tmp_path = None, veto_se
#
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)
contents = SnglBurstUtils.CoincDatabase(sqlite3.connect(str(working_filename)), live_time_program, search = "StringCusp", veto_segments_name = veto_segments_name)
if verbose:
SnglBurstUtils.summarize_coinc_database(contents, filename = working_filename)
......
......@@ -195,7 +195,7 @@ for n, filename in enumerate(filenames):
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)
connection = sqlite3.connect(working_filename)
connection = sqlite3.connect(str(working_filename))
if options.tmp_space is not None:
dbtables.set_temp_store_directory(connection, options.tmp_space, verbose = options.verbose)
......
......@@ -483,7 +483,7 @@ for n, filename in enumerate(ligolw_utils.sort_files_by_size(filenames, options.
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")
database = SnglBurstUtils.CoincDatabase(sqlite3.connect(str(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)
......
......@@ -376,7 +376,7 @@ for n, filename in enumerate(filenames):
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)
connection = sqlite3.connect(str(working_filename))
dbtables.DBTable_set_connection(connection)
database = SnglBurstUtils.CoincDatabase(connection, "StringSearch", search = "StringCusp", veto_segments_name = options.vetoes_name)
if options.verbose:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment