gwsumm.segments module

Utilities for segment handling and display

gwsumm.segments.format_padding(flags, padding)[source]

Format an arbitrary collection of paddings into a dict

gwsumm.segments.get_segments(flag, validity=None, config=<configparser.ConfigParser object>, cache=None, query=True, return_=True, coalesce=True, padding=None, ignore_undefined=False, segdb_error='raise', url=None, **read_kw)[source]

Retrieve the segments for a given flag

Segments will be loaded from global memory if already defined, otherwise they will be loaded from the given :class:`~glue.lal.Cache`, or finally from the segment database

Parameters:
flagstr, list

either the name of one flag, or a list of names

validity~gwpy.segments.SegmentList

the segments over which to search for other segments

querybool, optional, default: True

actually execute a read/query operation (if needed), otherwise just retrieve segments that have already been cached

config~configparser.ConfigParser, optional

the configuration for your analysis, if you have one. If present the [segment-database] section will be queried for the following options

  • gps-start-time, and gps-end-time, if validity is not given

  • url (the remote hostname for the segment database) if the url keyword is not given

cache:class:`glue.lal.Cache`, optional

a cache of files from which to read segments, otherwise segments will be downloaded from the segment database

coalescebool, optional, default: True

coalesce all segmentlists before returning, otherwise just return segments as they were downloaded/read

paddingtuple, or dict of tuples, optional

(start, end) padding with which to pad segments that are downloaded/read

ignore_undefinedbool, optional, default: False

Special case needed for network calculation compound flags so that when this is True, DataQualityFlag.known values are set to the same value as validity

segdb_errorstr, optional, default: 'raise'

how to handle errors returned from the segment database, one of

  • 'raise' (default) : raise the exception as normal

  • 'warn' : print the exception as a warning, but return no segments

  • 'ignore' : silently ignore the error and return no segments

urlstr, optional

the remote hostname for the target segment database

return_bool, optional, default: True

internal flag to enable (True) or disable (False) actually returning anything. This is useful if you want to download/read segments now but not use them until later (e.g. plotting)

**read_kwdict, optional

additional keyword arguments to ~gwpy.segments.DataQualityDict.read or ~gwpy.segments.DataQualityFlag.read

Returns:
flag~gwpy.segments.DataQualityFlag

the flag object representing segments for the given single flag, OR

flagdict~gwpy.segments.DataQualityDict

the dict of ~gwpy.segments.DataQualityFlag objects for multiple flags, if flag is given as a list, OR

None

if return_=False

gwsumm.segments.not_equal(a, b, f)[source]
gwsumm.segments.split_compound_flag(compound)[source]

Parse the configuration for this state.

Returns:
flagstuple

a 2-tuple containing lists of flags defining required ON and OFF segments respectively for this state