Esempio n. 1
0
        likelihood_files = options.likelihood_data
    if likelihood_files != cached_likelihood_files:
        distributions = load_likelihood_data(likelihood_files,
                                             verbose=options.verbose)
        cached_likelihood_files = likelihood_files

    #
    # Run likelihood ratio calculation.
    #

    calc_likelihood.assign_likelihood_ratios(
        connection=database.connection,
        coinc_def_id=database.bb_definer_id,
        offset_vectors=database.time_slide_table.as_dict(),
        vetoseglists=database.vetoseglists,
        events_func=lambda cursor, coinc_event_id:
        calc_likelihood.sngl_burst_events_func(
            cursor, coinc_event_id, database.sngl_burst_table.row_from_cols),
        veto_func=calc_likelihood.sngl_burst_veto_func,
        ln_likelihood_ratio_func=distributions.ln_lr_from_triggers,
        verbose=options.verbose)

    #
    # Done with this file.
    #

    connection.close()
    dbtables.put_connection_filename(filename,
                                     working_filename,
                                     verbose=options.verbose)
	#
	# 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))

	#
	# Run likelihood ratio calculation.
	#

	calc_likelihood.assign_likelihood_ratios(
		connection = contents.connection,
		coinc_def_id = contents.bb_definer_id,
		offset_vectors = contents.time_slide_table.as_dict(),
		vetoseglists = contents.vetoseglists,
		events_func = lambda cursor, coinc_event_id: calc_likelihood.sngl_burst_events_func(cursor, coinc_event_id, contents.sngl_burst_table.row_from_cols),
		veto_func = calc_likelihood.sngl_burst_veto_func,
		ln_likelihood_ratio_func = coincparamsdistributions.ln_lr_from_triggers,
		verbose = options.verbose
	)

	#
	# Clean up.
	#

	contents.xmldoc.unlink()
	connection.close()
	dbtables.put_connection_filename(filename, working_filename, verbose = options.verbose)