30LIGO Light-Weight XML Coincidence Analysis Front End.
34from optparse
import OptionParser
37from igwn_ligolw
import lsctables
38from igwn_ligolw
import utils
as ligolw_utils
39from lalburst
import git_version
40from lalburst
import cafe
43__author__ =
"Kipp Cannon <kipp.cannon@ligo.org>"
44__version__ =
"git id %s" % git_version.id
45__date__ = git_version.date
58 parser = OptionParser(
59 version =
"Name: %%prog\n%s" % git_version.verbose_msg,
60 usage =
"%prog --time-slides time_slides_filename [options] [filename ...]",
61 description =
"%prog is a generic coincidence analysis front-end for trigger-based searches for gravitational wave events. This program answers the question \"given that I have a collection of files containing event lists, and given that I wish to perform a coincidence analysis by time-shifting the events to simulate a background, what are the smallest groups of trigger files such that if each group is analyzed separately no coincidences will be missed?\" The inputs consist of one or more LAL cache files describing the collection of trigger files to be analyzed, and a LIGO Light Weight XML file containing a time_slide table describing the time shifts to be applied to the triggers. If no cache files are named on the command line, then the cache is read from stdin. The output is a collection of LAL cache files, one each for the file groups identified from the input. See also lalapps_ll2cache (a program that constructs a LAL cache file from a list of LIGO Light Weight XML trigger files by parsing each file's search_summary table), and ligolw_add (a program that combines LIGO Light Weight XML trigger files, and is capable of reading its input file list from a LAL cache)."
63 parser.add_option(
"-s",
"--single-instrument", action =
"store_true", help =
"Select single instrument mode. In this mode, after grouping the files as usual, for each group a separate LAL cache file is written for each instrument, rather than a single cache listing all input files.")
64 parser.add_option(
"-t",
"--time-slides", metavar =
"filename", help =
"Read the time slide table from this file.")
65 parser.add_option(
"-v",
"--verbose", action =
"store_true", help =
"Be verbose.")
66 parser.add_option(
"-b",
"--base", metavar =
"base", default =
"cafe_", help =
"Set base for output caches (default = \"cafe_\").")
67 options, cachenames = parser.parse_args()
69 if not options.time_slides:
70 raise ValueError(
"--time-slides required")
72 return options, (cachenames
or [
None])
88for filename
in cachenames:
89 cache.extend(cafe.load_cache(filename, options.verbose))
92seglists, outputcaches = cafe.ligolw_cafe(cache, lsctables.TimeSlideTable.get_table(ligolw_utils.load_filename(options.time_slides, verbose = options.verbose)).as_dict().values(), options.verbose)
93instruments = set(seglists.keys())
96if options.single_instrument:
97 cafe.write_single_instrument_caches(options.base, outputcaches, instruments, options.verbose)
99 cafe.write_caches(options.base, outputcaches, instruments, options.verbose)