This repository provides code for measuring a Gaussian gravitational-wave background in the presence of an astrophysical foreground, as described in https://arxiv.org/abs/2009.04418.
You will need to install the following packages: bilby, lalsuite, and cpnest in addition to standard packages like scipy
, numpy
, and matplotlib
.
The code is broken down into three stages. The first stage corresponds to performing standard compact binary parameter estimation on simulated data which includes a Gaussian background characterized by
amplitude
python mixed_backgrounds_marg.py segment_number
where segment_number
is an integer representing the segment of data that will be simulated and analyzed. The simulated data is a 4 second strain timeseries sampled at a frequency of 2048 Hz.
This step should be run for each simulated data segment. The first 10 such segments will have a BBH signal added to them. In our original paper, we used 101 simulated data segments.
This step saves the simualted data so that it can be loaded for the second reweighting step, described below. The file paths specified for some of the loaded data products and for the outputs
(outdir
) may need to be modified. The output of this step will be three sets of bilby
result files, one for each of the following hypotheses:
- "Noise model": the segment contains only a Gaussian background, no BBH
- "CBC model": the segment contains only a BBH, no Gaussian background
- "Signal model": the segment constains both a Gaussian background and a BBH
The "Signal model" results are not used later in the pipeline, but they are interesting to have to be able to compare with the reweighted results, described below.
The second step is the likelihood reweighting step used to generate gridded likelihoods for
python reweighting_test.py segment_number
where the segment_number
corresponds to the same simulated segment of data used in the first step. Here the posterior samples obtained for the 15 BBH parameters in
the first step (masses, spins, location, etc.) are marginalzied over and reweighted to a likelihoods used for the "Noise model" and "Signal model" described above, but evaluated
on 50x50 grid. The file paths specified for the outputs (outdir
) should be modified to match what was used in the first step.
The output of this step is two npy
files containing the likelihood grids in
The final step is combining the individual likelihood grids to obtain a global posterior for python combine_3d_reweighted_grids.py
. The output of this step is a combined 3D grid of the likelihoods for
the three parameters given above and a corner plot.
-
stoch_utils.py
: contains helper functions for simulating the correlated Gaussian background data -
marg_likelihood.py
: contains the analytically marginalized likelihood over the BBH parameters phase and distance, including off-diagonal cross-correlation terms in the covariance matrix. -
bbh.prior
: thebilby
prior file for the binary black hole parameters, used both for generating injections and during parameter estimation -
analytical_orf.dat
: The overlap reduction function for the Hanford-Livingston detector baseline -
full_auto_power.dat
:$P(f) + S_{h}(f)$ pre-calculated (calculation commented out inmixed_backgrounds_marg.py
)