GWDataFind

Installation

$ python -m pip install gwdatafind

Supported python versions: 2.7, 3.4+.

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 the HTTPConnection and HTTPSConnection class objects, for connecting to an LDR server in open and authenticated access modes respectively. The authenticated HTTPSConnection requires users have a valid X509 certificate that is registered with the server in question.

Quick-start

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

ping

Ping the LDR host to test for life.

find_observatories

Query the LDR host for observatories.

find_types

Query the LDR host for frame types.

find_times

Query the LDR for times for which files are avaliable.

find_url

Query the LDR host for a single filename.

find_urls

Find all files of the given type in the [start, end) GPS interval.

find_latest

Query for the most recent file of a given type.

For example:

>>> from gwdatafind import find_urls
>>> urls = find_urls("L", "L1_GWOSC_O2_4KHZ_R1", 1187008880, 1187008884,
...                  host="datafind.ligo.org:443")
>>> 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 manually open a connection using the connect() function, and then perform multiple queries. The connect() function will automatically select the correct protocol based on the host given, and will attempt to access any required X509 credentials.

For example:

>>> from gwdatafind import connect
>>> conn = connect(host="datafind.ligo.org", port=443)
>>> obs = conn.find_observatories()
>>> print(obs)
['H', 'V', 'L']
>>> urls = {}
>>> for ifo in obs:
...     urls[ifo] = conn.find_urls(ifo, "{}1_GWOSC_O2_4KHZ_R1".format(ifo),
...                                1187008880, 1187008884)
>>> print(urls)
{'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']}