LIGO Scientific Collaboration Algorithm Library - minimal Python package
LALSuite is the LIGO Scientific Collaboration Algorithm Library for gravitational-wave analysis. Its primary purpose is searching for and characterizing astrophysical signals in gravitational-wave time series data, particularly data from ground-based detectors such as LIGO and Virgo. This Python package provides a standalone, dependency-free binary distribution of the libraries and Python modules in LALSuite for Linux and macOS. Current version is 7.26.4, with underlying C components (like LAL, LALSimulation) also updated regularly.
Warnings
- gotcha The `lalsuite` Python package is only officially supported on Linux and macOS. Windows users typically need to use Windows Subsystem for Linux (WSL) or a virtual machine to run it.
- gotcha Some advanced compact binary coalescence waveform models require additional data files (e.g., for reduced order models). These files need to be downloaded separately (from Zenodo or specific Git repositories like `lalsuite-waveform-data` for versions >= 7.25, or `lalsuite-extra` for earlier versions). The `LAL_DATA_PATH` environment variable must then be set to point to the downloaded directory.
- gotcha The Python interface of LALSuite wraps underlying C libraries. As a result, users might encounter C-level concepts and conventions, such as `LALStatus` pointers for error handling in 'LAL' functions or distinct error reporting in 'XLAL' functions. This can differ from typical Pythonic error handling and requires familiarity with LAL C-style conventions.
Install
-
pip install lalsuite -
pip install lalsuite[lalinference] -
pip install lalsuite[lalpulsar]
Imports
- lal
import lal
- lalsimulation
import lalsimulation
- GPSTime
from lal import GPSTime
Quickstart
from lal import GPSTime
# Create a GPSTime object representing a specific GPS second
try:
gps_time = GPSTime(1126259642.4) # Example GPS time
print(f"Created GPSTime object: {gps_time}")
print(f"Year of GPS time: {gps_time.gps_year}")
print(f"Fractional seconds: {gps_time.gps_fraction}")
except Exception as e:
print(f"An error occurred: {e}")
print("Note: LALSuite often requires specific environment setups or data files for full functionality.")
# More advanced usage often involves lalsimulation for waveform generation
# import lalsimulation
# hp, hc = lalsimulation.SimIMRSpinAlignedEOBWaveform(...) # Example, not runnable without parameters