Exemplo n.º 1
0
def ligolw_burca(
	xmldoc,
	process_id,
	EventListType,
	CoincTables,
	coinc_definer_row,
	event_comparefunc,
	thresholds,
	ntuple_comparefunc = lambda events, offset_vector: False,
	verbose = False
):
	#
	# prepare the coincidence table interface.
	#

	if verbose:
		print >>sys.stderr, "indexing ..."
	coinc_tables = CoincTables(xmldoc)
	coinc_def_id = ligolw_coincs.get_coinc_def_id(xmldoc, coinc_definer_row.search, coinc_definer_row.search_coinc_type, create_new = True, description = coinc_definer_row.description)
	sngl_index = dict((row.event_id, row) for row in lsctables.SnglBurstTable.get_table(xmldoc))

	#
	# build the event list accessors, populated with events from those
	# processes that can participate in a coincidence
	#

	eventlists = snglcoinc.make_eventlists(xmldoc, EventListType, lsctables.SnglBurstTable.tableName)

	#
	# construct offset vector assembly graph
	#

	time_slide_graph = snglcoinc.TimeSlideGraph(coinc_tables.time_slide_index, verbose = verbose)

	#
	# retrieve all coincidences, apply the final n-tuple compare func
	# and record the survivors
	#

	for node, coinc in time_slide_graph.get_coincs(eventlists, event_comparefunc, thresholds, verbose = verbose):
		ntuple = tuple(sngl_index[id] for id in coinc)
		if not ntuple_comparefunc(ntuple, node.offset_vector):
			coinc_tables.append_coinc(process_id, node.time_slide_id, coinc_def_id, ntuple)

	#
	# remove time offsets from events
	#

	del eventlists.offsetvector

	#
	# done
	#

	return xmldoc
Exemplo n.º 2
0
def ligolw_thinca(xmldoc,
                  process_id,
                  coinc_definer_row,
                  event_comparefunc,
                  thresholds,
                  ntuple_comparefunc=default_ntuple_comparefunc,
                  effective_snr_factor=250.0,
                  veto_segments=None,
                  trigger_program=u"inspiral",
                  likelihood_func=None,
                  likelihood_params_func=None,
                  verbose=False,
                  max_dt=None):
    #
    # prepare the coincidence table interface.
    #

    if verbose:
        print >> sys.stderr, "indexing ..."
    coinc_tables = InspiralCoincTables(
        xmldoc,
        vetoes=veto_segments,
        program=trigger_program,
        likelihood_func=likelihood_func,
        likelihood_params_func=likelihood_params_func)
    coinc_def_id = ligolw_coincs.get_coinc_def_id(
        xmldoc,
        coinc_definer_row.search,
        coinc_definer_row.search_coinc_type,
        create_new=True,
        description=coinc_definer_row.description)
    sngl_index = dict((row.event_id, row)
                      for row in lsctables.SnglInspiralTable.get_table(xmldoc))

    #
    # build the event list accessors, populated with events from those
    # processes that can participate in a coincidence.  apply vetoes by
    # removing events from the lists that fall in vetoed segments
    #

    eventlists = snglcoinc.make_eventlists(
        xmldoc, InspiralEventList, lsctables.SnglInspiralTable.tableName)
    if veto_segments is not None:
        for eventlist in eventlists.values():
            iterutils.inplace_filter(
                (lambda event: event.ifo not in veto_segments or event.end
                 not in veto_segments[event.ifo]), eventlist)

    #
    # set the \Delta t parameter on all the event lists
    #

    if max_dt is None:
        max_dt = inspiral_max_dt(lsctables.SnglInspiralTable.get_table(xmldoc),
                                 thresholds)
    if verbose:
        print >> sys.stderr, "event bisection search window will be %.16g s" % max_dt
    for eventlist in eventlists.values():
        eventlist.set_dt(max_dt)

    #
    # replicate the ethinca parameter for every possible instrument
    # pair
    #

    thresholds = replicate_threshold(thresholds, set(eventlists))

    #
    # construct offset vector assembly graph
    #

    time_slide_graph = snglcoinc.TimeSlideGraph(coinc_tables.time_slide_index,
                                                verbose=verbose)

    #
    # retrieve all coincidences, apply the final n-tuple compare func
    # and record the survivors
    #

    for node, coinc in time_slide_graph.get_coincs(eventlists,
                                                   event_comparefunc,
                                                   thresholds,
                                                   verbose=verbose):
        coinc = tuple(sngl_index[event_id] for event_id in coinc)
        if not ntuple_comparefunc(coinc, node.offset_vector):
            coinc_tables.append_coinc(process_id, node.time_slide_id,
                                      coinc_def_id, coinc,
                                      effective_snr_factor)

    #
    # remove time offsets from events
    #

    del eventlists.offsetvector

    #
    # done
    #

    return xmldoc
Exemplo n.º 3
0
def ligolw_thinca(
	xmldoc,
	process_id,
	coinc_definer_row,
	event_comparefunc,
	thresholds,
	ntuple_comparefunc = default_ntuple_comparefunc,
	effective_snr_factor = 250.0,
	veto_segments = None,
	trigger_program = u"inspiral",
	likelihood_func = None,
	likelihood_params_func = None,
	verbose = False,
	max_dt = None
):
	#
	# prepare the coincidence table interface.
	#

	if verbose:
		print >>sys.stderr, "indexing ..."
	coinc_tables = InspiralCoincTables(xmldoc, vetoes = veto_segments, program = trigger_program, likelihood_func = likelihood_func, likelihood_params_func = likelihood_params_func)
	coinc_def_id = ligolw_coincs.get_coinc_def_id(xmldoc, coinc_definer_row.search, coinc_definer_row.search_coinc_type, create_new = True, description = coinc_definer_row.description)
	sngl_index = dict((row.event_id, row) for row in lsctables.SnglInspiralTable.get_table(xmldoc))

	#
	# build the event list accessors, populated with events from those
	# processes that can participate in a coincidence.  apply vetoes by
	# removing events from the lists that fall in vetoed segments
	#

	eventlists = snglcoinc.make_eventlists(xmldoc, InspiralEventList, lsctables.SnglInspiralTable.tableName)
	if veto_segments is not None:
		for eventlist in eventlists.values():
			iterutils.inplace_filter((lambda event: event.ifo not in veto_segments or event.get_end() not in veto_segments[event.ifo]), eventlist)

	#
	# set the \Delta t parameter on all the event lists
	#

	if max_dt is None:
		max_dt = inspiral_max_dt(lsctables.SnglInspiralTable.get_table(xmldoc), thresholds)
	if verbose:
		print >>sys.stderr, "event bisection search window will be %.16g s" % max_dt
	for eventlist in eventlists.values():
		eventlist.set_dt(max_dt)

	#
	# replicate the ethinca parameter for every possible instrument
	# pair
	#

	thresholds = replicate_threshold(thresholds, set(eventlists))

	#
	# construct offset vector assembly graph
	#

	time_slide_graph = snglcoinc.TimeSlideGraph(coinc_tables.time_slide_index, verbose = verbose)

	#
	# retrieve all coincidences, apply the final n-tuple compare func
	# and record the survivors
	#

	for node, coinc in time_slide_graph.get_coincs(eventlists, event_comparefunc, thresholds, verbose = verbose):
		coinc = tuple(sngl_index[event_id] for event_id in coinc)
		if not ntuple_comparefunc(coinc, node.offset_vector):
			coinc_tables.append_coinc(process_id, node.time_slide_id, coinc_def_id, coinc, effective_snr_factor)

	#
	# remove time offsets from events
	#

	del eventlists.offsetvector

	#
	# done
	#

	return xmldoc
Exemplo n.º 4
0
def ligolw_rinca(
	xmldoc,
	process_id,
	EventListType,
	CoincTables,
	coinc_definer_row,
	event_comparefunc,
	thresholds,
	ntuple_comparefunc = lambda events, offset_vector: False,
	small_coincs = False,
	veto_segments = None,
	coinc_end_time_segment = None,
	verbose = False
):
	#
	# prepare the coincidence table interface.
	#

	if verbose:
		print >>sys.stderr, "indexing ..."
	coinc_tables = CoincTables(xmldoc, vetoes = veto_segments)
	coinc_def_id = llwapp.get_coinc_def_id(xmldoc, coinc_definer_row.search, coinc_definer_row.search_coinc_type, create_new = True, description = coinc_definer_row.description)
	sngl_index = dict((row.event_id, row) for row in lsctables.table.get_table(xmldoc, lsctables.SnglRingdownTable.tableName))

	#
	# build the event list accessors, populated with events from those
	# processes that can participate in a coincidence.  apply vetoes by
	# removing events from the lists that fall in vetoed segments
	#

	eventlists = snglcoinc.make_eventlists(xmldoc, EventListType, lsctables.SnglRingdownTable.tableName)
	if veto_segments is not None:
		for eventlist in eventlists.values():
			iterutils.inplace_filter((lambda event: event.ifo not in veto_segments or event.get_start() not in veto_segments[event.ifo]), eventlist)

	#
	# set the \Delta t parameter on all the event lists
	#

	max_dt = ringdown_max_dt(lsctables.table.get_table(xmldoc, lsctables.SnglRingdownTable.tableName), thresholds)
	if verbose:
		print >>sys.stderr, "event bisection search window will be %.16g s" % max_dt
	for eventlist in eventlists.values():
		eventlist.set_dt(max_dt)

	#
	# replicate the ds_sq threshold for every possible instrument
	# pair
	#

	thresholds = replicate_threshold(thresholds, set(eventlists))

	#
	# construct offset vector assembly graph
	#

	time_slide_graph = snglcoinc.TimeSlideGraph(coinc_tables.time_slide_index, verbose = verbose)

	#
	# retrieve all coincidences, apply the final n-tuple compare func
	# and record the survivors
	#

	for node, coinc in time_slide_graph.get_coincs(eventlists, event_comparefunc, thresholds, include_small_coincs = small_coincs, verbose = verbose):
		ntuple = tuple(sngl_index[id] for id in coinc)
		if not ntuple_comparefunc(ntuple, node.offset_vector):
			coinc_tables.append_coinc(process_id, node, coinc_def_id, ntuple)

	#
	# remove time offsets from events
	#

	del eventlists.offsetvector

	#
	# done
	#

	return xmldoc
Exemplo n.º 5
0
def ligolw_rinca(xmldoc,
                 process_id,
                 EventListType,
                 CoincTables,
                 coinc_definer_row,
                 event_comparefunc,
                 thresholds,
                 ntuple_comparefunc=lambda events, offset_vector: False,
                 small_coincs=False,
                 veto_segments=None,
                 coinc_end_time_segment=None,
                 verbose=False):
    #
    # prepare the coincidence table interface.
    #

    if verbose:
        print >> sys.stderr, "indexing ..."
    coinc_tables = CoincTables(xmldoc, vetoes=veto_segments)
    coinc_def_id = llwapp.get_coinc_def_id(
        xmldoc,
        coinc_definer_row.search,
        coinc_definer_row.search_coinc_type,
        create_new=True,
        description=coinc_definer_row.description)
    sngl_index = dict((row.event_id, row) for row in lsctables.table.get_table(
        xmldoc, lsctables.SnglRingdownTable.tableName))

    #
    # build the event list accessors, populated with events from those
    # processes that can participate in a coincidence.  apply vetoes by
    # removing events from the lists that fall in vetoed segments
    #

    eventlists = snglcoinc.make_eventlists(
        xmldoc, EventListType, lsctables.SnglRingdownTable.tableName)
    if veto_segments is not None:
        for eventlist in eventlists.values():
            iterutils.inplace_filter(
                (lambda event: event.ifo not in veto_segments or event.
                 get_start() not in veto_segments[event.ifo]), eventlist)

    #
    # set the \Delta t parameter on all the event lists
    #

    max_dt = ringdown_max_dt(
        lsctables.table.get_table(xmldoc,
                                  lsctables.SnglRingdownTable.tableName),
        thresholds)
    if verbose:
        print >> sys.stderr, "event bisection search window will be %.16g s" % max_dt
    for eventlist in eventlists.values():
        eventlist.set_dt(max_dt)

    #
    # replicate the ds_sq threshold for every possible instrument
    # pair
    #

    thresholds = replicate_threshold(thresholds, set(eventlists))

    #
    # construct offset vector assembly graph
    #

    time_slide_graph = snglcoinc.TimeSlideGraph(coinc_tables.time_slide_index,
                                                verbose=verbose)

    #
    # retrieve all coincidences, apply the final n-tuple compare func
    # and record the survivors
    #

    for node, coinc in time_slide_graph.get_coincs(
            eventlists,
            event_comparefunc,
            thresholds,
            include_small_coincs=small_coincs,
            verbose=verbose):
        ntuple = tuple(sngl_index[id] for id in coinc)
        if not ntuple_comparefunc(ntuple, node.offset_vector):
            coinc_tables.append_coinc(process_id, node, coinc_def_id, ntuple)

    #
    # remove time offsets from events
    #

    del eventlists.offsetvector

    #
    # done
    #

    return xmldoc
Exemplo n.º 6
0
def ligolw_burca(xmldoc,
                 process_id,
                 EventListType,
                 CoincTables,
                 coinc_definer_row,
                 event_comparefunc,
                 thresholds,
                 ntuple_comparefunc=lambda events, offset_vector: False,
                 verbose=False):
    #
    # prepare the coincidence table interface.
    #

    if verbose:
        print >> sys.stderr, "indexing ..."
    coinc_tables = CoincTables(xmldoc)
    coinc_def_id = ligolw_coincs.get_coinc_def_id(
        xmldoc,
        coinc_definer_row.search,
        coinc_definer_row.search_coinc_type,
        create_new=True,
        description=coinc_definer_row.description)
    sngl_index = dict((row.event_id, row)
                      for row in lsctables.SnglBurstTable.get_table(xmldoc))

    #
    # build the event list accessors, populated with events from those
    # processes that can participate in a coincidence
    #

    eventlists = snglcoinc.make_eventlists(xmldoc, EventListType,
                                           lsctables.SnglBurstTable.tableName)

    #
    # construct offset vector assembly graph
    #

    time_slide_graph = snglcoinc.TimeSlideGraph(coinc_tables.time_slide_index,
                                                verbose=verbose)

    #
    # retrieve all coincidences, apply the final n-tuple compare func
    # and record the survivors
    #

    for node, coinc in time_slide_graph.get_coincs(eventlists,
                                                   event_comparefunc,
                                                   thresholds,
                                                   verbose=verbose):
        ntuple = tuple(sngl_index[id] for id in coinc)
        if not ntuple_comparefunc(ntuple, node.offset_vector):
            coinc_tables.append_coinc(process_id, node.time_slide_id,
                                      coinc_def_id, ntuple)

    #
    # remove time offsets from events
    #

    del eventlists.offsetvector

    #
    # done
    #

    return xmldoc