コード例 #1
0
ファイル: imr_utils.py プロジェクト: llondon6/lalsuite-mmrd
def get_segments(connection,
                 xmldoc,
                 table_name,
                 live_time_program,
                 veto_segments_name=None,
                 data_segments_name="datasegments"):
    segs = segments.segmentlistdict()

    if table_name == dbtables.lsctables.CoincInspiralTable.tableName:
        if live_time_program == "gstlal_inspiral":
            segs = ligolw_segments.segmenttable_get_by_name(
                xmldoc, data_segments_name).coalesce()
            segs &= ligolw_search_summary.segmentlistdict_fromsearchsummary(
                xmldoc, live_time_program).coalesce()
        elif live_time_program == "thinca":
            segs = db_thinca_rings.get_thinca_zero_lag_segments(
                connection, program_name=live_time_program).coalesce()
        else:
            raise ValueError(
                "for burst tables livetime program must be one of gstlal_inspiral, thinca"
            )
        if veto_segments_name is not None:
            veto_segs = db_thinca_rings.get_veto_segments(
                connection, veto_segments_name)
            segs -= veto_segs
        return segs
    elif table_name == dbtables.lsctables.CoincRingdownTable.tableName:
        segs = ligolw_search_summary.segmentlistdict_fromsearchsummary(
            xmldoc, live_time_program).coalesce()
        if veto_segments_name is not None:
            veto_segs = ligolw_segments.segmenttable_get_by_name(
                xmldoc, veto_segments_name).coalesce()
            segs -= veto_segs
        return segs
    elif table_name == dbtables.lsctables.MultiBurstTable.tableName:
        if live_time_program == "omega_to_coinc":
            segs = ligolw_search_summary.segmentlistdict_fromsearchsummary(
                xmldoc, live_time_program).coalesce()
            if veto_segments_name is not None:
                veto_segs = ligolw_segments.segmenttable_get_by_name(
                    xmldoc, veto_segments_name).coalesce()
                segs -= veto_segs
        elif live_time_program == "waveburst":
            segs = db_thinca_rings.get_thinca_zero_lag_segments(
                connection, program_name=live_time_program).coalesce()
            if veto_segments_name is not None:
                veto_segs = db_thinca_rings.get_veto_segments(
                    connection, veto_segments_name)
                segs -= veto_segs
        else:
            raise ValueError(
                "for burst tables livetime program must be one of omega_to_coinc, waveburst"
            )
        return segs
    else:
        raise ValueError("table must be in " +
                         " ".join(allowed_analysis_table_names()))
コード例 #2
0
def get_veto_segments(xmldoc, verbose):
    """
	Return a dictionary of glue.segments.segmentlistdict objects containing 
	veto segments dictionaries for each ifo and the top-level keys being the
	associated veto-definer names.
	"""
    veto_segments = {}

    # get the set of unique veto_definer names in this xmldoc
    veto_def_names = set(
        table.get_table(
            xmldoc,
            lsctables.SegmentDefTable.tableName).getColumnByName('name'))

    for name in veto_def_names:
        if verbose:
            print >> sys.stderr, "Retrieving veto segments for %s..." % name
        try:
            veto_segments[name] = ligolw_segments.segmenttable_get_by_name(
                xmldoc, name).coalesce()
        except AttributeError:
            # will get an AttributeError if using newer format veto segment file because
            # the new format does not include _ns; if so, remove the _ns columns from the
            # segment table and reset the definitions of lsctables.Segment.get and lsctables.Segment.set
            from glue.lal import LIGOTimeGPS

            del lsctables.SegmentTable.validcolumns['start_time_ns']
            del lsctables.SegmentTable.validcolumns['end_time_ns']

            def get_segment(self):
                """
				Return the segment described by this row.
				"""
                return segments.segment(LIGOTimeGPS(self.start_time, 0),
                                        LIGOTimeGPS(self.end_time, 0))

            def set_segment(self, segment):
                """
				Set the segment described by this row.
				"""
                self.start_time = segment[0].seconds
                self.end_time = segment[1].seconds

            lsctables.Segment.get = get_segment
            lsctables.Segment.set = set_segment

            veto_segments[name] = ligolw_segments.segmenttable_get_by_name(
                xmldoc, name).coalesce()

    return veto_segments
コード例 #3
0
def create_string_sngl_is_vetoed_function(connection, veto_segments_name = None):
	"""
	Creates a function named string_sngl_is_vetoed in the database at
	connection.  The function accepts three parameters --- the
	instrument name, and the integer and integer nanoseconds components
	of a time --- and returns true if the instrument is vetoed at that
	time or false otherwise.  veto_segments_name sets the name of the
	segment lists used to define the vetoes.

	If veto_segments_name is None then a no-op function is created that
	always returns False.

	Note:  this funtion requires glue.ligolw.dbtables and
	glue.ligolw.utils.segments to be imported as dbtables and
	ligolwsegments respectively.
	"""
	if veto_segments_name is None:
		connection.create_function("string_sngl_is_vetoed", 3, lambda instrument, peak_time, peak_time_ns: False)
		return
	xmldoc = dbtables.get_xml(connection)
	seglists = ligolwsegments.segmenttable_get_by_name(xmldoc, options.vetoes_name).coalesce()
	xmldoc.unlink()
	def is_vetoed(instrument, peak_time, peak_time_ns, seglists = seglists):
		return instrument in seglists and dbtables.lsctables.LIGOTimeGPS(peak_time, peak_time_ns) in seglists[instrument]
	connection.create_function("string_sngl_is_vetoed", 3, is_vetoed)
コード例 #4
0
def create_string_sngl_is_vetoed_function(connection, veto_segments_name=None):
    """
	Creates a function named string_sngl_is_vetoed in the database at
	connection.  The function accepts three parameters --- the
	instrument name, and the integer and integer nanoseconds components
	of a time --- and returns true if the instrument is vetoed at that
	time or false otherwise.  veto_segments_name sets the name of the
	segment lists used to define the vetoes.

	If veto_segments_name is None then a no-op function is created that
	always returns False.

	Note:  this funtion requires glue.ligolw.dbtables and
	glue.ligolw.utils.segments to be imported as dbtables and
	ligolwsegments respectively.
	"""
    if veto_segments_name is None:
        connection.create_function(
            "string_sngl_is_vetoed", 3,
            lambda instrument, peak_time, peak_time_ns: False)
        return
    xmldoc = dbtables.get_xml(connection)
    seglists = ligolwsegments.segmenttable_get_by_name(
        xmldoc, options.vetoes_name).coalesce()
    xmldoc.unlink()

    def is_vetoed(instrument, peak_time, peak_time_ns, seglists=seglists):
        return instrument in seglists and dbtables.lsctables.LIGOTimeGPS(
            peak_time, peak_time_ns) in seglists[instrument]

    connection.create_function("string_sngl_is_vetoed", 3, is_vetoed)
コード例 #5
0
ファイル: farutils.py プロジェクト: llondon6/lalsuite-mmrd
def get_veto_segments(connection, program_name, xmldoc=None, veto_segments_name=None):
	veto_segments = segments.segmentlistdict()
	#FIXME only handles thinca case
	if not veto_segments_name: return veto_segments
	if program_name == "thinca": veto_segments = db_thinca_rings.get_veto_segments(connection, veto_segments_name)
	if program_name == "rinca": veto_segments = ligolw_segments.segmenttable_get_by_name(xmldoc, veto_segments_name).coalesce()
	return veto_segments
コード例 #6
0
def get_veto_segments(xmldoc, verbose):
    """
	Return a dictionary of glue.segments.segmentlistdict objects containing 
	veto segments dictionaries for each ifo and the top-level keys being the
	associated veto-definer names.
	"""
    veto_segments = {}

    # get the set of unique veto_definer names in this xmldoc
    veto_def_names = set(table.get_table(xmldoc, lsctables.SegmentDefTable.tableName).getColumnByName("name"))

    for name in veto_def_names:
        if verbose:
            print >>sys.stderr, "Retrieving veto segments for %s..." % name
        try:
            veto_segments[name] = ligolw_segments.segmenttable_get_by_name(xmldoc, name).coalesce()
        except AttributeError:
            # will get an AttributeError if using newer format veto segment file because
            # the new format does not include _ns; if so, remove the _ns columns from the
            # segment table and reset the definitions of lsctables.Segment.get and lsctables.Segment.set
            from glue.lal import LIGOTimeGPS

            del lsctables.SegmentTable.validcolumns["start_time_ns"]
            del lsctables.SegmentTable.validcolumns["end_time_ns"]

            def get_segment(self):
                """
				Return the segment described by this row.
				"""
                return segments.segment(LIGOTimeGPS(self.start_time, 0), LIGOTimeGPS(self.end_time, 0))

            def set_segment(self, segment):
                """
				Set the segment described by this row.
				"""
                self.start_time = segment[0].seconds
                self.end_time = segment[1].seconds

            lsctables.Segment.get = get_segment
            lsctables.Segment.set = set_segment

            veto_segments[name] = ligolw_segments.segmenttable_get_by_name(xmldoc, name).coalesce()

    return veto_segments
コード例 #7
0
ファイル: db_thinca_rings.py プロジェクト: Solaro/lalsuite
def get_veto_segments(connection, name):
  """
  Return a coalesced glue.segments.segmentlistdict object containing the
  segments of the given name extracted from the database at the given
  connection.
  """
  xmldoc = dbtables.get_xml(connection)
  seglists = ligolw_segments.segmenttable_get_by_name(xmldoc, name).coalesce()
  xmldoc.unlink()
  return seglists
コード例 #8
0
def get_veto_segments(connection, name):
    """
  Return a coalesced glue.segments.segmentlistdict object containing the
  segments of the given name extracted from the database at the given
  connection.
  """
    xmldoc = dbtables.get_xml(connection)
    seglists = ligolw_segments.segmenttable_get_by_name(xmldoc,
                                                        name).coalesce()
    xmldoc.unlink()
    return seglists
コード例 #9
0
def load_segments(filename, name, verbose = False):
	if verbose:
		print >>sys.stderr, "loading \"%s\" segments ... " % name,
	connection = sqlite3.connect(filename)
	segs = ligolw_segments.segmenttable_get_by_name(dbtables.get_xml(connection), name).coalesce()
	connection.close()
	if verbose:
		print >>sys.stderr, "done."
		for ifo in segs:
			print >>sys.stderr, "loaded %d veto segment(s) for %s totalling %g s" % (len(segs[ifo]), ifo, float(abs(segs[ifo])))
	return segs
コード例 #10
0
def get_vetoes(xmldoc, vetoes_name, verbose = False):
	if not ligolw_segments.has_segment_tables(xmldoc):
		if verbose:
			print >>sys.stderr, "warning: no segment definitions found, vetoes will not be applied"
		vetoes = None
	elif not ligolw_segments.has_segment_tables(xmldoc, name = vetoes_name):
		if verbose:
			print >>sys.stderr, "warning: document contains segment definitions but none named \"%s\", vetoes will not be applied" % options.vetoes_name
		vetoes = None
	else:
		vetoes = ligolw_segments.segmenttable_get_by_name(xmldoc, vetoes_name).coalesce()
	return vetoes
コード例 #11
0
def get_vetoes(xmldoc, vetoes_name, verbose = False):
	if not ligolw_segments.has_segment_tables(xmldoc):
		if verbose:
			print >>sys.stderr, "warning: no segment definitions found, vetoes will not be applied"
		vetoes = None
	elif not ligolw_segments.has_segment_tables(xmldoc, name = vetoes_name):
		if verbose:
			print >>sys.stderr, "warning: document contains segment definitions but none named \"%s\", vetoes will not be applied" % options.vetoes_name
		vetoes = None
	else:
		vetoes = ligolw_segments.segmenttable_get_by_name(xmldoc, vetoes_name).coalesce()
	return vetoes
コード例 #12
0
def load_segments(filename, name, verbose=False):
    if verbose:
        print >> sys.stderr, "loading \"%s\" segments ... " % name,
    connection = sqlite3.connect(filename)
    segs = ligolw_segments.segmenttable_get_by_name(
        dbtables.get_xml(connection), name).coalesce()
    connection.close()
    if verbose:
        print >> sys.stderr, "done."
        for ifo in segs:
            print >> sys.stderr, "loaded %d veto segment(s) for %s totalling %g s" % (
                len(segs[ifo]), ifo, float(abs(segs[ifo])))
    return segs
コード例 #13
0
def get_segments(connection, xmldoc, table_name, live_time_program, veto_segments_name = None, data_segments_name = "datasegments"):
	from pylal import db_thinca_rings
	segs = segments.segmentlistdict()

	if table_name == dbtables.lsctables.CoincInspiralTable.tableName:
		if live_time_program == "gstlal_inspiral":
			segs = ligolw_segments.segmenttable_get_by_name(xmldoc, data_segments_name).coalesce()
			segs &= ligolw_search_summary.segmentlistdict_fromsearchsummary(xmldoc, live_time_program).coalesce()
		elif live_time_program == "thinca":
			segs = db_thinca_rings.get_thinca_zero_lag_segments(connection, program_name = live_time_program).coalesce()
		else:
			raise ValueError("for burst tables livetime program must be one of gstlal_inspiral, thinca")
		if veto_segments_name is not None:
			veto_segs = db_thinca_rings.get_veto_segments(connection, veto_segments_name)
			segs -= veto_segs
		return segs
	elif table_name == dbtables.lsctables.CoincRingdownTable.tableName:
		segs = ligolw_search_summary.segmentlistdict_fromsearchsummary(xmldoc, live_time_program).coalesce()
		if veto_segments_name is not None:
			veto_segs = ligolw_segments.segmenttable_get_by_name(xmldoc, veto_segments_name).coalesce()
			segs -= veto_segs
		return segs
	elif table_name == dbtables.lsctables.MultiBurstTable.tableName:
		if live_time_program == "omega_to_coinc":
			segs = ligolw_search_summary.segmentlistdict_fromsearchsummary(xmldoc, live_time_program).coalesce()
			if veto_segments_name is not None:
				veto_segs = ligolw_segments.segmenttable_get_by_name(xmldoc, veto_segments_name).coalesce()
				segs -= veto_segs
		elif live_time_program == "waveburst":
			segs = db_thinca_rings.get_thinca_zero_lag_segments(connection, program_name = live_time_program).coalesce()
			if veto_segments_name is not None:
				veto_segs = db_thinca_rings.get_veto_segments(connection, veto_segments_name)
				segs -= veto_segs
		else:
			raise ValueError("for burst tables livetime program must be one of omega_to_coinc, waveburst")
		return segs
	else:
		raise ValueError("table must be in " + " ".join(allowed_analysis_table_names()))
コード例 #14
0
    if not ligolw_segments.has_segment_tables(xmldoc):
        if options.verbose:
            print(
                "warning: no segment definitions found, vetoes will not be applied",
                file=sys.stderr)
        vetoes = None
    elif not ligolw_segments.has_segment_tables(xmldoc,
                                                name=options.vetoes_name):
        if options.verbose:
            print(
                "warning: document contains segment definitions but none named \"%s\", vetoes will not be applied"
                % options.vetoes_name,
                file=sys.stderr)
        vetoes = None
    else:
        vetoes = ligolw_segments.segmenttable_get_by_name(
            xmldoc, options.vetoes_name).coalesce()

    #
    # Run coincidence algorithm.
    #

    thinca.ligolw_thinca(
        xmldoc,
        process_id=process.process_id,
        delta_t=options.threshold,
        ntuple_comparefunc=ntuple_comparefunc,
        seglists=None,  # FIXME
        veto_segments=vetoes,
        min_instruments=options.min_instruments,
        verbose=options.verbose)
コード例 #15
0
#
# get chunk lengths from the values in the ini file
#

short_segment_duration = config_parser.getint('lalapps_StringSearch', 'short-segment-duration')
pad = config_parser.getint('lalapps_StringSearch', 'pad')
min_segment_length = config_parser.getint('pipeline', 'segment-length') # not including pad at each end
trig_overlap = config_parser.getint('pipeline', 'trig_overlap')
overlap = short_segment_duration / 2 + 2 * pad	# FIXME:  correct?

#
# get the instruments and raw segments
#

instruments = lsctables.instrument_set_from_ifos(config_parser.get('pipeline','ifos'))
seglists = ligolwsegments.segmenttable_get_by_name(utils.load_filename(options.segments_file, gz = (options.segments_file or "stdin").endswith(".gz"), verbose = options.verbose), options.segments_name).coalesce()
# remove extra instruments
for instrument in set(seglists) - instruments:
	if options.verbose:
		print >>sys.stderr, "warning: ignoring segments for '%s' found in '%s'" % (instrument, options.segments_file)
	del seglists[instrument]
# check for missing instruments
if not instruments.issubset(set(seglists)):
	raise ValueError, "segment lists retrieved from '%s' missing segments for instruments %s" % (options.segments_file, ", ".join(instruments - set(seglists)))
# now rely on seglists' keys to provide the instruments
del instruments

#
# Using time slide information, construct segment lists describing times
# requiring trigger construction.
#
コード例 #16
0
def load_veto_segments(filename, verbose = False, contenthandler = None):
	return ligolw_segments.segmenttable_get_by_name(ligolw_utils.load_filename(filename, verbose = verbose, contenthandler = contenthandler), "sngl_burst_veto").coalesce()
コード例 #17
0
#
# get chunk lengths from the values in the ini file
#

short_segment_duration = config_parser.getint('lalapps_StringSearch', 'short-segment-duration')
pad = config_parser.getint('lalapps_StringSearch', 'pad')
min_segment_length = config_parser.getint('pipeline', 'segment-length') # not including pad at each end
trig_overlap = config_parser.getint('pipeline', 'trig_overlap')
overlap = short_segment_duration / 2 + 2 * pad	# FIXME:  correct?

#
# get the instruments and raw segments
#

instruments = lsctables.instrumentsproperty.get(config_parser.get('pipeline','ifos'))
seglists = ligolw_segments.segmenttable_get_by_name(ligolw_utils.load_filename(options.segments_file, contenthandler = ligolw_segments.LIGOLWContentHandler, verbose = options.verbose), options.segments_name).coalesce()
# remove extra instruments
for instrument in set(seglists) - instruments:
	if options.verbose:
		print >>sys.stderr, "warning: ignoring segments for '%s' found in '%s'" % (instrument, options.segments_file)
	del seglists[instrument]
# check for missing instruments
if not instruments.issubset(set(seglists)):
	raise ValueError, "segment lists retrieved from '%s' missing segments for instruments %s" % (options.segments_file, ", ".join(instruments - set(seglists)))
# now rely on seglists' keys to provide the instruments
del instruments

#
# Using time slide information, construct segment lists describing times
# requiring trigger construction.
#
コード例 #18
0
def load_veto_segments(filename, verbose=False, contenthandler=None):
    return ligolw_segments.segmenttable_get_by_name(
        ligolw_utils.load_filename(filename,
                                   verbose=verbose,
                                   contenthandler=contenthandler),
        "sngl_burst_veto").coalesce()
コード例 #19
0
    def __init__(self,
                 connection,
                 live_time_program,
                 search="excesspower",
                 veto_segments_name=None):
        """
		Compute and record some summary information about the
		database.  Call this after all the data has been inserted,
		and before you want any of this information.
		"""

        self.connection = connection
        self.xmldoc = dbtables.get_xml(connection)

        # find the tables
        try:
            self.sngl_burst_table = lsctables.SnglBurstTable.get_table(
                self.xmldoc)
        except ValueError:
            self.sngl_burst_table = None
        try:
            self.sim_burst_table = lsctables.SimBurstTable.get_table(
                self.xmldoc)
        except ValueError:
            self.sim_burst_table = None
        try:
            self.coinc_def_table = lsctables.CoincDefTable.get_table(
                self.xmldoc)
            self.coinc_table = lsctables.CoincTable.get_table(self.xmldoc)
            self.time_slide_table = lsctables.TimeSlideTable.get_table(
                self.xmldoc)
        except ValueError:
            self.coinc_def_table = None
            self.coinc_table = None
            self.time_slide_table = None
        try:
            self.multi_burst_table = lsctables.MultiBurstTable.get_table(
                self.xmldoc)
        except ValueError:
            self.multi_burst_table = None

        # get the segment lists
        self.seglists = ligolw_search_summary.segmentlistdict_fromsearchsummary(
            self.xmldoc, live_time_program).coalesce()
        self.instruments = set(self.seglists.keys())
        if veto_segments_name is not None:
            self.vetoseglists = ligolw_segments.segmenttable_get_by_name(
                self.xmldoc, veto_segments_name).coalesce()
        else:
            self.vetoseglists = ligolw_segments.segments.segmentlistdict()

        # determine a few coinc_definer IDs
        # FIXME:  don't hard-code the numbers
        if self.coinc_def_table is not None:
            try:
                self.bb_definer_id = self.coinc_def_table.get_coinc_def_id(
                    search, 0, create_new=False)
            except KeyError:
                self.bb_definer_id = None
            try:
                self.sb_definer_id = self.coinc_def_table.get_coinc_def_id(
                    search, 1, create_new=False)
            except KeyError:
                self.sb_definer_id = None
            try:
                self.sce_definer_id = self.coinc_def_table.get_coinc_def_id(
                    search, 2, create_new=False)
            except KeyError:
                self.sce_definer_id = None
            try:
                self.scn_definer_id = self.coinc_def_table.get_coinc_def_id(
                    search, 3, create_new=False)
            except KeyError:
                self.scn_definer_id = None
        else:
            self.bb_definer_id = None
            self.sb_definer_id = None
            self.sce_definer_id = None
            self.scn_definer_id = None
コード例 #20
0
ファイル: SnglBurstUtils.py プロジェクト: johnveitch/lalsuite
	def __init__(self, connection, live_time_program, search = "excesspower", veto_segments_name = None):
		"""
		Compute and record some summary information about the
		database.  Call this after all the data has been inserted,
		and before you want any of this information.
		"""

		self.connection = connection
		self.xmldoc = dbtables.get_xml(connection)

		# find the tables
		try:
			self.sngl_burst_table = lsctables.SnglBurstTable.get_table(self.xmldoc)
		except ValueError:
			self.sngl_burst_table = None
		try:
			self.sim_burst_table = lsctables.SimBurstTable.get_table(self.xmldoc)
		except ValueError:
			self.sim_burst_table = None
		try:
			self.coinc_def_table = lsctables.CoincDefTable.get_table(self.xmldoc)
			self.coinc_table = lsctables.CoincTable.get_table(self.xmldoc)
			self.time_slide_table = lsctables.TimeSlideTable.get_table(self.xmldoc)
		except ValueError:
			self.coinc_def_table = None
			self.coinc_table = None
			self.time_slide_table = None
		try:
			self.multi_burst_table = lsctables.MultiBurstTable.get_table(self.xmldoc)
		except ValueError:
			self.multi_burst_table = None

		# get the segment lists
		self.seglists = ligolw_search_summary.segmentlistdict_fromsearchsummary(self.xmldoc, live_time_program).coalesce()
		self.instruments = set(self.seglists.keys())
		if veto_segments_name is not None:
			self.vetoseglists = ligolw_segments.segmenttable_get_by_name(self.xmldoc, veto_segments_name).coalesce()
		else:
			self.vetoseglists = ligolw_segments.segments.segmentlistdict()

		# determine a few coinc_definer IDs
		# FIXME:  don't hard-code the numbers
		if self.coinc_def_table is not None:
			try:
				self.bb_definer_id = self.coinc_def_table.get_coinc_def_id(search, 0, create_new = False)
			except KeyError:
				self.bb_definer_id = None
			try:
				self.sb_definer_id = self.coinc_def_table.get_coinc_def_id(search, 1, create_new = False)
			except KeyError:
				self.sb_definer_id = None
			try:
				self.sce_definer_id = self.coinc_def_table.get_coinc_def_id(search, 2, create_new = False)
			except KeyError:
				self.sce_definer_id = None
			try:
				self.scn_definer_id = self.coinc_def_table.get_coinc_def_id(search, 3, create_new = False)
			except KeyError:
				self.scn_definer_id = None
		else:
			self.bb_definer_id = None
			self.sb_definer_id = None
			self.sce_definer_id = None
			self.scn_definer_id = None
コード例 #21
0
                                              'short-segment-duration')
pad = config_parser.getint('lalapps_StringSearch', 'pad')
min_segment_length = config_parser.getint(
    'pipeline', 'segment-length')  # not including pad at each end
trig_overlap = config_parser.getint('pipeline', 'trig_overlap')
overlap = short_segment_duration / 2 + 2 * pad  # FIXME:  correct?

#
# get the instruments and raw segments
#

instruments = lsctables.instrument_set_from_ifos(
    config_parser.get('pipeline', 'ifos'))
seglists = ligolwsegments.segmenttable_get_by_name(
    utils.load_filename(options.segments_file,
                        gz=(options.segments_file or "stdin").endswith(".gz"),
                        verbose=options.verbose),
    options.segments_name).coalesce()
# remove extra instruments
for instrument in set(seglists) - instruments:
    if options.verbose:
        print >> sys.stderr, "warning: ignoring segments for '%s' found in '%s'" % (
            instrument, options.segments_file)
    del seglists[instrument]
# check for missing instruments
if not instruments.issubset(set(seglists)):
    raise ValueError, "segment lists retrieved from '%s' missing segments for instruments %s" % (
        options.segments_file, ", ".join(instruments - set(seglists)))
# now rely on seglists' keys to provide the instruments
del instruments
コード例 #22
0
                                              'short-segment-duration')
pad = config_parser.getint('lalapps_StringSearch', 'pad')
min_segment_length = config_parser.getint(
    'pipeline', 'segment-length')  # not including pad at each end
trig_overlap = config_parser.getint('pipeline', 'trig_overlap')
overlap = short_segment_duration / 2 + 2 * pad  # FIXME:  correct?

#
# get the instruments and raw segments
#

instruments = lsctables.instrumentsproperty.get(
    config_parser.get('pipeline', 'ifos'))
seglists = ligolw_segments.segmenttable_get_by_name(
    ligolw_utils.load_filename(
        options.segments_file,
        contenthandler=ligolw_segments.LIGOLWContentHandler,
        verbose=options.verbose), options.segments_name).coalesce()
# remove extra instruments
for instrument in set(seglists) - instruments:
    if options.verbose:
        print >> sys.stderr, "warning: ignoring segments for '%s' found in '%s'" % (
            instrument, options.segments_file)
    del seglists[instrument]
# check for missing instruments
if not instruments.issubset(set(seglists)):
    raise ValueError, "segment lists retrieved from '%s' missing segments for instruments %s" % (
        options.segments_file, ", ".join(instruments - set(seglists)))
# now rely on seglists' keys to provide the instruments
del instruments