query_segments

dqsegdb2.query.query_segments(flag, start, end, host='https://segments.ligo.org', coalesce=True, **request_kwargs)

Query for segments for the given flag in a [start, stop) interval

Parameters
flagstr

the name for which to query, see _Notes_ for information on how versionless-flags are queried.

startint

the GPS start time.

endint

the GPS end time.

hoststr, optional

the URL of the database, defaults to DEFAULT_SEGMENT_SERVER.

coalescebool, optional

if True, coalesce the segmentlists returned by the server, and restrict them to lie fully within the [start, end) request segment, otherwise return the β€˜raw’ result, default: True.

Returns
segmentdictdict

a dict with the following keys

  • 'ifo' - the interferometer prefix (str)

  • 'name' - the flag name (str)

  • 'version' - the flag version (int)

  • 'known' - the known segments (segmentlist)

  • 'active' - the active segments (segmentlist)

  • 'metadata' - a dict of flag information (dict)

  • 'query_information' - a dict of query information (dict)

Notes

If flag is given without a version (e.g. 'X1:FLAG-NAME') or the version is given as '*' (e.g. 'X1:FLAG-NAME:*') the result of the query will be the intersection of queries over all versions found in the database. In that case the 'metadata' and 'query_information' in the output will be preserved for the highest version number only.

Examples

>>> from dqsegdb2.query import query_segments
>>> query_segments('G1:GEO-SCIENCE:1', 1000000000, 1000001000)