query_segments

dqsegdb2.query_segments(flag, start, end, host=None, coalesce=True, raw=False, **request_kwargs)

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

Parameters:
  • flag (str) – The name for which to query, see _Notes_ for information on how versionless-flags are queried.

  • start (float) – The GPS start time.

  • end (float) – The GPS end time.

  • host (str, optional) – The URL of the DQSegDB server; if None get_default_host() will be used to discover the default host.

  • coalesce (bool, 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. This option is ignored if raw=True is given.

  • raw (bool, optional) – Return the full JSON response from the request. If an explicit version is not given, the result will be a list of JSON responses, one for each discovered version.

  • request_kwargs – Other keyword arguments are passed to igwn_auth_utils.get().

Returns:

  • dict – If raw=False (default): 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)

  • object – If raw=True is given, and the flag name includes an explicit version, the result will be the raw JSON response from the single request, otherwise a list of JSON responses will be returned.

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 (if raw=False).

Examples

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