Observing Scenarios Injection Tool (bayestar-inject)

Rough-cut injection tool.

The idea is to efficiently sample events, uniformly in “sensitive volume” (differential comoving volume divided by 1 + z), and from a distribution of masses and spins, such that later detection cuts will not reject an excessive number of events.

This occurs in two steps. First, we divide the intrinsic parameter space into a very coarse 10x10x10x10 grid and calculate the maximum horizon distance in each grid cell. Second, we directly sample injections jointly from the mass and spin distribution and a uniform and isotropic spatial distribution with a redshift cutoff that is piecewise constant in the masses and spins.

usage: bayestar-inject [-h] [--seed SEED] [--version]
                       [--cosmology {Planck13,Planck15,Planck18,WMAP1,WMAP3,WMAP5,WMAP7,WMAP9}]
                       (--distribution {bns_astro,bns_broad,nsbh_astro,nsbh_broad,bbh_astro,bbh_broad} | --distribution-samples DISTRIBUTION_SAMPLES)
                       --reference-psd PSD.xml[.gz] [--f-low F_LOW]
                       [--snr-threshold SNR_THRESHOLD]
                       [--min-triggers MIN_TRIGGERS] [--min-snr MIN_SNR]
                       [--max-distance Mpc] [--waveform WAVEFORM]
                       [--nsamples NSAMPLES] [-o INJ.xml[.gz]] [-j [JOBS]]

Named Arguments


show program’s version number and exit

-l, --loglevel

Default: INFO


Possible choices: Planck13, Planck15, Planck18, WMAP1, WMAP3, WMAP5, WMAP7, WMAP9

Cosmological model

Default: “Planck15”


Possible choices: bns_astro, bns_broad, nsbh_astro, nsbh_broad, bbh_astro, bbh_broad

Use a preset distribution


Load samples of the intrinsic mass and spin distribution from any file that can be read as an Astropy table. The table columns should be mass1, mass2, spin1z, and spin2z.


PSD file


Low frequency cutoff in Hz

Default: 25.0


Single-detector SNR threshold

Default: 4.0


Emit coincidences only when at least this many triggers are found

Default: 2


Minimum decisive SNR of injections given the reference PSDs. Deprecated; use the synonymous –snr-threshold option instead.


Maximum luminosity distance for injections


Waveform approximant

Default: “o2-uberbank”


Output this many injections

Default: 100000

-o, --output

Output file, optionally gzip-compressed

Default: -

-j, --jobs

Number of threads

Default: 1

random number generator options

Options that affect the Numpy pseudo-random number genrator


Pseudo-random number generator seed [default: initialized from /dev/urandom or clock]

Python helper functions

class ligo.skymap.tool.bayestar_inject.GWCosmo(cosmology)[source] [edit on github]

Evaluate GW distance figures of merit for a given cosmology.


The cosmological model.