Installation

How to install this module?

From pip

pip install mlgw-bns

This is enough to generate waveforms with the pretrained models (see The shipped models); their regressors are downloaded the first time they are used. Precessing waveforms (see Generating precessing waveforms) need JAX, which is an optional extra:

pip install "mlgw-bns[jax]"

TEOBResumS

Having TEOBResumS installed is optional, but it is needed to generate new models and to compare against the reference waveforms. The shipped models are trained with a fork of it, the initial-spa-fix branch of github.com/jacopok/teobresums: the public version aborts on some of the waveforms of the training sets, and its frequency-domain precessing waveforms have spurious \(2\pi\) steps in the precession angle \(\alpha\). It can be installed with

pip install "git+https://github.com/jacopok/teobresums@initial-spa-fix#subdirectory=Python"

It is distributed as a source package which links against the GNU Scientific Library, so its development headers need to be available at install time (sudo apt-get install libgsl-dev on Debian and derivatives). To check whether it is correctly installed, try to

import EOBRun_module

in a python session.

From the repo

Once you have cloned the repo, install uv, and then run

uv sync

in the project directory. This creates a virtual environment in .venv/ with all the dependencies, the fork of TEOBResumS included; add --extra jax for the precessing waveforms.

Testing and dev functionality

To see whether everything is working properly, run the tests with

uv run pytest

To build the documentation locally, in the folder docs/html/ (one can access it starting from index.html), do

uv run --extra docs sphinx-build docs docs/html

Make a pretty dependency graph with

uv run pydeps mlgw_bns/

To make an html page showing the test coverage of the code, do

uv run coverage html

There are pre-commit hooks which will clean up the code, format everything with black, check that there are no large files, check that the typing is correct with mypy.