Installation#

This guide explains how to install the required components to run the Makefile and draw the GWTC-4 distribution. It is recommended to use uv to create and manage the virtual environment, which avoids dependency conflicts.

Note

The model describes neutron stars and the primary black hole mass distribution as a broken power law between minimum and maximum masses, with two Gaussian peaks at \(\sim 10~M_\odot\) and \(\sim 35~M_\odot\). The file includes the posterior values for mass, spin, and merger-rate hyperparameters.

Using these hyperparameters, the model can be used to generate synthetic CBC distributions under the GWTC-4 AllCBC_FullPop-4.0 population model. Here, we draw a distribution of one million samples to be used with the observing-scenarios pipeline together with ligo.skymap to simulate observing campaigns for upcoming runs.

Requirements

You will need the following:

gwpopulation

Python >= 3.11

Environment setup with uv
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync

Read the hyperparams file#

Below we provide a small script to read the FullPop-4.0 result file with bilby and extract the MAP (or ML) sample.

fullpop4_hyperparams

Show script
 1import numpy as np
 2import pandas as pd
 3from bilby.core.result import read_in_result
 4
 5
 6def _get_map_sample(hyperparams) -> pd.Series:
 7    """
 8    Return MAP sample if prior is informative, else ML sample.
 9    """
10    post = hyperparams.posterior.copy()
11    if "log_prior" in post and post["log_prior"].nunique() > 1:
12        score = post.log_likelihood + post.log_prior
13        return post.iloc[np.argmax(score)]
14    else:
15        return post.iloc[np.argmax(post.log_likelihood)]
16
17
18hyperparams_file = (
19    "../data/"
20    "baseline5_widesigmachi2_mass_NotchFilterBinnedPairingMassDistribution_"
21    "redshift_powerlaw_mag_iid_spin_magnitude_gaussian_tilt_"
22    "iid_spin_orientation_result.hdf5"
23)
24
25# Load "FullPop-4.0" model and extract MAP sample
26hyperparams = read_in_result(hyperparams_file)
27maxp_samp = _get_map_sample(hyperparams)

Run the Pipeline#

Running the pipeline

Two equivalent options are available - choose one:

Run commands without activating the environment explicitly:

uv run make

Activate the .venv created by uv and run the pipeline:

source .venv/bin/activate
make