Getting Segments
sage.data.primer provides TimelineQuery to query
GWOSC for science-mode segments across any combination of detectors and observing runs.
Listing available detectors and runs
from sage.data.primer import TimelineQuery, get_all_detnames, get_all_runnames
print(get_all_detnames())
# {'H1', 'L1', 'V1', 'G1', 'K1', 'H2'}
print(get_all_runnames())
# ['O1', 'O2', 'O3GK', 'O3a', 'O3b', 'O4a', 'O4b1Disc', ...]
Creating a timeline query
Pass a list of detectors and observing runs. Setting auto_clean_empty_timelines=True
silently drops any detector/run combination that returns no segments.
tq = TimelineQuery(
detector=["H1", "L1", "V1"],
observing_run=["O3b"],
auto_clean_empty_timelines=True,
)
tq.download_segments()
After download_segments() returns, tq.timeline holds a structured NumPy array
with one row per (detector, flag) pair. Each row contains:
Field |
Description |
|---|---|
|
Detector name, e.g. |
|
DQ flag used for the query, e.g. |
|
GPS start of the run epoch |
|
GPS end of the run epoch |
|
Observing run name |
|
|
# Inspect the first detector's segment array
print(tq.timeline[0]["detector"]) # 'H1'
print(tq.timeline[0]["segments"]) # array([[1256663440., ...], ...])