Esempio n. 1
0
          RecoveredVsInjectedAmplitude(options.amplitude_func,
                                       options.amplitude_lbl)),
         (2, True, RecoveredTimeOffset(segments.segment(-0.01, +0.01),
                                       0.00005)), (3, True, RecoveredFreq()),
         (4, False, Chi2VsRho())]

if options.plot is not None:
    plots = [plots[i] for i in options.plot]

#
# 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(
            """
Esempio n. 2
0
	(1, True, RecoveredVsInjectedAmplitude(options.amplitude_func, options.amplitude_lbl)),
	(2, True, RecoveredTimeOffset(segments.segment(-0.01, +0.01), 0.00005)),
	(3, True, RecoveredFreq()),
	(4, False, Chi2VsRho())
]

if options.plot is not None:
	plots = [plots[i] for i in options.plot]


#
# 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,
options, filenames = parse_command_line()
if not options.plot and not options.coinc_plot or not filenames:
	print("Nothing to do!", file=sys.stderr)
	sys.exit(0)


#
# 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,
		ConfidenceContours("L1", "H1", magnitude_b, r"Power / D.o.F. / ($F_{+}^{2} + F_{\times}^{2}$)", 1, 10**10),
		ConfidenceContourProjection(numpy.array((-1/math.sqrt(2), +1/math.sqrt(2), 0), "Float64"), numpy.array((-1/math.sqrt(4), -1/math.sqrt(4), +1/math.sqrt(2)), "Float64"), magnitude_b, 10**5),
		RateVsConfidence("H1"),
		RateVsConfidence("H2"),
		RateVsConfidence("L1")
	]
	return [l[i] for i in plots]


options, filenames = parse_command_line()


plots = new_plots(options.plot)


for n, filename in enumerate(ligolw_utils.sort_files_by_size(filenames, options.verbose, reverse = True)[options.skip:]):
	if options.verbose:
		print("%d/%d: %s" % (n + 1, len(filenames) - options.skip, filename), file=sys.stderr)

	database = SnglBurstUtils.CoincDatabase(sqlite3.connect(filename), options.live_time_program)
	if options.verbose:
		SnglBurstUtils.summarize_coinc_database(database)

	for n, plot in zip(options.plot, plots):
		if options.verbose:
			print("adding to burca plot %d ..." % n, file=sys.stderr)
		plot.add_contents(database)

	database.connection.close()