{"id":23111,"library":"gwpy","title":"GWpy","description":"GWpy is a Python package for gravitational-wave astrophysics, enabling data analysis and visualization of gravitational-wave data. Version 4.0.1 requires Python >=3.11. It provides high-level access to time series, frequency series, and spectrograms, with integration to GWOSC and other data sources. The library is under active development with regular releases.","status":"active","version":"4.0.1","language":"python","source_language":"en","source_url":"https://github.com/gwpy/gwpy","tags":["gravitational-waves","ligo","virgo","data-analysis","timeseries","signal-processing"],"install":[{"cmd":"pip install gwpy","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Astronomy utilities (e.g., time conversions, coordinates)","package":"astropy","optional":false},{"reason":"HDF5 file I/O for GW data formats","package":"h5py","optional":false},{"reason":"Core numerical array operations","package":"numpy","optional":false},{"reason":"Signal processing and statistical functions","package":"scipy","optional":false},{"reason":"Segment bookkeeping for gravitational-wave data","package":"ligo-segments","optional":false},{"reason":"Plotting and visualization","package":"matplotlib","optional":true},{"reason":"Access to NDS2 servers for LIGO data (optional, alternative to GWOSC)","package":"nds2-client","optional":true}],"imports":[{"note":"TimeSeries is not at top level; must import from gwpy.timeseries module.","wrong":"from gwpy import TimeSeries","symbol":"TimeSeries","correct":"from gwpy.timeseries import TimeSeries"},{"note":"Similar to TimeSeries, must use the specific submodule.","wrong":"from gwpy import FrequencySeries","symbol":"FrequencySeries","correct":"from gwpy.frequencyseries import FrequencySeries"},{"note":"Spectrogram is in its own submodule; no common wrong import known.","wrong":"","symbol":"Spectrogram","correct":"from gwpy.spectrogram import Spectrogram"},{"note":"The plotting module is 'plot' (not 'plots').","wrong":"","symbol":"plot","correct":"from gwpy.plot import Plot"}],"quickstart":{"code":"from gwpy.timeseries import TimeSeries\nimport os\n\n# Fetch 30 seconds of gravitational-wave strain data from GWOSC\n# from the LIGO Hanford detector (H1) during GW170817\nh1_data = TimeSeries.fetch_open_data(\n    'H1', 1187008882, 1187008912,  # GPS start and end\n    sample_rate=4096,  # Downsample to 4096 Hz\n    verbose=True,\n    token=os.environ.get('GWPY_TOKEN', '')\n)\nprint(h1_data)\nprint('Data length:', len(h1_data), 'samples')","lang":"python","description":"Fetch gravitational-wave strain data from GWOSC using a TimeSeries object. Requires internet access. The os.environ.get simulates an optional token."},"warnings":[{"fix":"Ensure your environment uses Python >= 3.11. Run 'python --version' to check.","message":"In GWpy 4.0.0+, the minimum Python version is 3.11. Older Python versions (3.10, 3.9) are no longer supported. Upgrade Python if you encounter import errors.","severity":"breaking","affected_versions":"4.0.0 and later"},{"fix":"Register at https://datafind.ligo.org and set environment variable 'GWPY_TOKEN' or pass 'token' argument to fetch methods.","message":"Fetching data from LIGO data servers (NDS2) now requires authentication tokens. The old anonymous access is deprecated and may fail.","severity":"breaking","affected_versions":">=3.0"},{"fix":"Use the 'segmentlist' property of TimeSeries to verify coverage, or use 'DataQualityFlag' to check if data is valid.","message":"The 'fetch_open_data' method may return data with gaps (e.g., if detector is not in science mode). Always check for missing data before analysis.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'gwpy.timeseries.TimeSeries.fetch_open_data' for multiple channels or iterate over a list of frequencies.","message":"The 'gwpy.timeseries.TimeSeriesDict' is deprecated in favor of 'gwpy.timeseries.TimeSeries' with dictionary-like access. Use 'TimeSeriesDict' only for legacy code.","severity":"deprecated","affected_versions":">=3.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from gwpy.timeseries import TimeSeries' instead.","cause":"Incorrect import path: trying to import TimeSeries directly from gwpy top-level package.","error":"ImportError: cannot import name 'TimeSeries' from 'gwpy'"},{"fix":"Ensure file paths are correct and use raw strings or forward slashes.","cause":"Often due to file path containing non-ASCII characters or using Windows paths in Linux-style string.","error":"OSError: [Errno 22] Invalid argument when opening data file"},{"fix":"Check the data availability using 'gwpy.segments.DataQualityFlag' or query the data range first.","cause":"The requested GPS time range falls outside the available data segment (e.g., detector not operating).","error":"ValueError: The given GPS end time is not in the data frame's interval"},{"fix":"Obtain a token from LIGO's datafind service and set it as GWPY_TOKEN environment variable, or pass token='your_token' to fetch methods.","cause":"Missing or invalid authentication token for NDS2 data access.","error":"HTTPError: 401 Unauthorized when accessing NDS2 server"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}