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; ifNone
get_default_host()
will be used to discover the default host.coalesce (
bool
, optional) – IfTrue
, 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 ifraw=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 alist
of JSON responses, one for each discovered version.request_kwargs – Other keyword arguments are passed to
igwn_auth_utils.get()
.
- Returns:
dict
– Ifraw=False
(default): adict
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
)
object
– Ifraw=True
is given, and the flag name includes an explicit version, the result will be the raw JSON response from the single request, otherwise alist
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 (ifraw=False
).Examples
>>> from dqsegdb2.query import query_segments >>> query_segments('G1:GEO-SCIENCE:1', 1000000000, 1000001000)