segments-web queries (sometimes?) return segments that extend beyond query boundaries
A user recently noticed that in response to a query, segments-web returned segments that extended past the boundaries of the query for coalesced JSON files. An investigation found that this problem has existed since at least June 2018 [1], that the problem still exists [2], and that all 5 formats returned by segments-web return the same segments (extending past the query boundaries) [3], whereas queries with command-line tools return segments that are within the query boundaries [4]. I have done some digging into the segments-web code base, but I haven't yet found what processing is done on query results.
[1] https://segments-web.ligo.org/downloads/1528481349.coalesced.json - query run for L1:DCS-ANALYSIS_READY_C02:1 on 8 June 2018
query: 1169344961 - 1169350609
known: 1167433728 - 1169918976
active: 1169347046 - 1169353719
So the 'known' segment starts before the start of the query and ends after the end of the query; the 'active' segment starts after the start of the query (good) but ends after the end of the query (bad).
[2] https://segments-web.ligo.org/downloads/1764341273.coalesced.json - query run on 28 Nov. 2025. Same flag as [1] with the same query start and end times. Returned known segment and active segment are the same as from the 8 June 2018 file.
[3] Queries run for the same flag and query times as [1] and [2]. Returned known and active segments are the same as each other and [1] and [2]. Output formats and associated files:
- json: 1764341235.json
- vdb: 1764341248.json; note: no .vdb file was saved; this is being investigated; but results were displayed and saved (and same as the others)
- ascii: 1764341259.json + 1764341259.ascii
- coalesced_json: 1764341273.json + 1764341273.coalesced_json + 1764341273.coalesced.json (all 3 files are identical)
- tsv: 1764341279.json + 1764341279.tsv
[4] Testing with "ligolw_segment_query_dqsegdb --query-segments --segment-url https://segments.ligo.org --include-segments L1:DCS-ANALYSIS_READY_C02:1 --gps-start-time 1169344961 --gps-end-time 1169350609" returns the following results:
query: 1169344961 - 1169350609
known: 1169344961 - 1169350609
active: 1169347046 - 1169350609
So 'known' segment start and end times match the start and end times of the query, and 'active' segment start and end times are match or are inside of the 'known' segment times, as would be expected.
Checking with GWpy and dqsegdb2 returned the same results as ligolw_segment_query_dqsegdb.