GWpy is a collaboration‑driven Python package providing tools for studying data from ground‑based gravitational‑wave detectors. It offers a user‑friendly interface to time‑ and frequency‑domain data from the LIGO, Virgo, and KAGRA observatories, with step‑by‑step tutorials.
The GWpy package contains classes and utilities for astrophysical and instrumental analysis. It targets users who want to “do the science” without worrying about low‑level details, through simple, well‑documented APIs and sensible examples.
GWpy builds on, and extends, the functionality of Astropy and the LVK LALSuite libraries (via SWIG Python bindings), combining rich astronomy abstractions with the completeness and speed of mature C99 routines.
To install, you can do:
conda install -c conda-forge gwpy
or
python -m pip install gwpy
You can test your installation, and its version by
python -c "import gwpy; print(gwpy.__version__)"
Here is how you can fetch, filter, whiten, and visualize real LIGO data from GWOSC in just a few lines:
from gwpy.timeseries import TimeSeries
from gwosc import datasets
gps = datasets.event_gps("GW150914")
h = TimeSeries.fetch_open_data("H1", gps-4, gps+4, sample_rate=4096)
w = h.bandpass(20, 1024).whiten(4, 2)
spec = w.spectrogram2(fftlength=0.25, overlap=0.20)
spec.plot(norm="log").show()GWpy is released under the GNU General Public License v3.0 or later, see here for a description of this license, or see the LICENSE file for the full text.