GWDataFind

Installation

$ python -m pip install gwdatafind

Overview

The client library for the LIGO Data Replicator (LDR) service.

The DataFind service allows users to query for the location of Gravitational-Wave Frame (GWF) files containing data from the current gravitational-wave detectors.

This package provides a number of functions to make requests to a GWDataFind server with authorization credential handling.

Quick-start

The following convenience functions are provided to perform single queries without a persistent connection:

ping

Ping the GWDataFind host to test for life.

find_observatories

Query a GWDataFind host for observatories with available data.

find_types

Query a GWDataFind host for dataset types.

find_times

Query a GWDataFind host for times in which data are available.

find_url

Query a GWDataFind host for the URL of a single filename.

find_urls

Query a GWDataFind host for all URLs for a dataset in an interval.

find_latest

Query a GWDataFind host for the latest file in a given dataset.

For example:

>>> from gwdatafind import find_urls
>>> urls = find_urls("L", "L1_GWOSC_O2_4KHZ_R1", 1187008880, 1187008884,
...                  host="datafind.gw-openscience.org")
>>> print(urls)
['file://localhost/cvmfs/gwosc.osgstorage.org/gwdata/O2/strain.4k/frame.v1/L1/1186988032/L-L1_GWOSC_O2_4KHZ_R1-1187008512-4096.gwf']

Additionally, one can create a requests.Session to reuse a connection to a server.

For example:

>>> from gwdatafind import (find_observatories, find_urls, Session)
>>> with Session() as sess:
...     obs = find_observatories(
...               host="datafind.gw-openscience.org",
...               session=sess,
...     )
...     print(obs)
...     urls = {}
...     for ifo in obs:
...         urls[ifo] = find_urls(
...             ifo,
...             "{}1_GWOSC_O2_4KHZ_R1".format(ifo),
...             1187008880,
...             1187008884,
...             host="datafind.gw-openscience.org",
...             session=sess,
...         )
...     print(urls)
['H', 'V', 'L']
{'H': ['file://localhost/cvmfs/gwosc.osgstorage.org/gwdata/O2/strain.4k/frame.v1/H1/1186988032/H-H1_GWOSC_O2_4KHZ_R1-1187008512-4096.gwf'],
 'V': ['file://localhost/cvmfs/gwosc.osgstorage.org/gwdata/O2/strain.4k/frame.v1/V1/1186988032/V-V1_GWOSC_O2_4KHZ_R1-1187008512-4096.gwf'],
 'L': ['file://localhost/cvmfs/gwosc.osgstorage.org/gwdata/O2/strain.4k/frame.v1/L1/1186988032/L-L1_GWOSC_O2_4KHZ_R1-1187008512-4096.gwf']}

See Also