Transient Gravitational wave priors

We provide two base prior dictionaries for binary black hole (BBH) and binary neutron star (BNS) systems. These are bilby.gw.prior.BBHPriorDict and bilby.gw.prior.BNSPriorDict respectively. For BBHs this generates all the BBH mass parameters so constraints can be placed on any mass parameters. For BNSs it also generates the tidal deformability parameters.

You can load in the default priors by running, e.g.

>>> prior = bilby.gw.prior.BBHPriorDict()

This prior has a complete set of parameters for a BBH system. You can modify this, for example to set a different prior range for the chirp mass

>>> prior["chirp_mass"] = bilby.core.prior.Uniform(30, 31, "chirp_mass")

Note

If you are using a tidal waveform, you need to specify a frequency domain source model which includes tidal effects, e.g.

frequency_domain_source_model=lal_binary_neutron_star

Prior files

As an alternative to specifying the prior in a python script, we also provide the ability to use a prior file. For example, given a file bbh.prior which contains:

# These are the default priors we use for BBH systems.
# Note that you may wish to use more specific mass and distance parameters.
# These commands are all known to bilby.gw.prior.
# Lines beginning "#" are ignored.
mass_1 = Constraint(name='mass_1', minimum=5, maximum=100)
mass_2 = Constraint(name='mass_2', minimum=5, maximum=100)
mass_ratio = bilby.gw.prior.UniformInComponentsMassRatio(name='mass_ratio', minimum=0.125, maximum=1)
chirp_mass = bilby.gw.prior.UniformInComponentsChirpMass(name='chirp_mass', minimum=25, maximum=100)
luminosity_distance = bilby.gw.prior.UniformSourceFrame(name='luminosity_distance', minimum=1e2, maximum=5e3)
dec = Cosine(name='dec')
ra = Uniform(name='ra', minimum=0, maximum=2 * np.pi, boundary='periodic')
theta_jn = Sine(name='theta_jn')
psi = Uniform(name='psi', minimum=0, maximum=np.pi, boundary='periodic')
phase = Uniform(name='phase', minimum=0, maximum=2 * np.pi, boundary='periodic')
a_1 = Uniform(name='a_1', minimum=0, maximum=0.99)
a_2 = Uniform(name='a_2', minimum=0, maximum=0.99)
tilt_1 = Sine(name='tilt_1')
tilt_2 = Sine(name='tilt_2')
phi_12 = Uniform(name='phi_12', minimum=0, maximum=2 * np.pi, boundary='periodic')
phi_jl = Uniform(name='phi_jl', minimum=0, maximum=2 * np.pi, boundary='periodic')

You can load this with

prior = bilby.gw.prior.BBHPriorDict("bbh.prior")

Here we see several examples of different types of priors. For those available in the bilby.core.prior module, you can specify these without a prefix, but for other (including any existing in your own modules) you need to specify the module path.

Aligned spins waveform with tides off

# These are the default priors we use for BBH systems.
# Note that you may wish to use more specific mass and distance parameters.
# These commands are all known to bilby.gw.prior.
# Lines beginning "#" are ignored.
mass_1 = Constraint(name='mass_1', minimum=5, maximum=100)
mass_2 = Constraint(name='mass_2', minimum=5, maximum=100)
mass_ratio = bilby.gw.prior.UniformInComponentsMassRatio(name='mass_ratio', minimum=0.125, maximum=1)
chirp_mass = bilby.gw.prior.UniformInComponentsChirpMass(name='chirp_mass', minimum=25, maximum=100)
luminosity_distance = bilby.gw.prior.UniformSourceFrame(name='luminosity_distance', minimum=1e2, maximum=5e3)
dec = Cosine(name='dec')
ra = Uniform(name='ra', minimum=0, maximum=2 * np.pi, boundary='periodic')
theta_jn = Sine(name='theta_jn')
psi = Uniform(name='psi', minimum=0, maximum=np.pi, boundary='periodic')
phase = Uniform(name='phase', minimum=0, maximum=2 * np.pi, boundary='periodic')
chi_1 = bilby.gw.prior.AlignedSpin(name='chi_1', a_prior=Uniform(minimum=0, maximum=0.99))
chi_2 = bilby.gw.prior.AlignedSpin(name='chi_2', a_prior=Uniform(minimum=0, maximum=0.99))

Aligned spins waveform with tides on

# These are the default priors we use for BNS systems.
# Note that you may wish to use more specific mass and distance parameters.
# These commands are all known to bilby.gw.prior.
# Lines beginning "#" are ignored.
mass_1 = Constraint(name='mass_1', minimum=0.5, maximum=5)
mass_2 = Constraint(name='mass_2', minimum=0.5, maximum=5)
mass_ratio = bilby.gw.prior.UniformInComponentsMassRatio(name='mass_ratio', minimum=0.125, maximum=1)
chirp_mass = bilby.gw.prior.UniformInComponentsChirpMass(name='chirp_mass', minimum=0.4, maximum=4.4)
luminosity_distance = bilby.gw.prior.UniformSourceFrame(name='luminosity_distance', minimum=1e2, maximum=5e3)
dec = Cosine(name='dec')
ra = Uniform(name='ra', minimum=0, maximum=2 * np.pi, boundary='periodic')
theta_jn = Sine(name='theta_jn')
psi = Uniform(name='psi', minimum=0, maximum=np.pi, boundary='periodic')
phase = Uniform(name='phase', minimum=0, maximum=2 * np.pi, boundary='periodic')
chi_1 = bilby.gw.prior.AlignedSpin(name='chi_1', a_prior=Uniform(minimum=0, maximum=0.99))
chi_2 = bilby.gw.prior.AlignedSpin(name='chi_2', a_prior=Uniform(minimum=0, maximum=0.99))

Precessing spins waveform with tides off

# These are the default priors we use for BBH systems.
# Note that you may wish to use more specific mass and distance parameters.
# These commands are all known to bilby.gw.prior.
# Lines beginning "#" are ignored.
mass_1 = Constraint(name='mass_1', minimum=5, maximum=100)
mass_2 = Constraint(name='mass_2', minimum=5, maximum=100)
mass_ratio = bilby.gw.prior.UniformInComponentsMassRatio(name='mass_ratio', minimum=0.125, maximum=1)
chirp_mass = bilby.gw.prior.UniformInComponentsChirpMass(name='chirp_mass', minimum=25, maximum=100)
luminosity_distance = bilby.gw.prior.UniformSourceFrame(name='luminosity_distance', minimum=1e2, maximum=5e3)
dec = Cosine(name='dec')
ra = Uniform(name='ra', minimum=0, maximum=2 * np.pi, boundary='periodic')
theta_jn = Sine(name='theta_jn')
psi = Uniform(name='psi', minimum=0, maximum=np.pi, boundary='periodic')
phase = Uniform(name='phase', minimum=0, maximum=2 * np.pi, boundary='periodic')
a_1 = Uniform(name='a_1', minimum=0, maximum=0.99)
a_2 = Uniform(name='a_2', minimum=0, maximum=0.99)
tilt_1 = Sine(name='tilt_1')
tilt_2 = Sine(name='tilt_2')
phi_12 = Uniform(name='phi_12', minimum=0, maximum=2 * np.pi, boundary='periodic')
phi_jl = Uniform(name='phi_jl', minimum=0, maximum=2 * np.pi, boundary='periodic')

Precessing spins waveform with tides on

# These are the default priors we use for BNS systems.
# Note that you may wish to use more specific mass and distance parameters.
# These commands are all known to bilby.gw.prior.
# Lines beginning "#" are ignored.
mass_1 = Constraint(name='mass_1', minimum=0.5, maximum=5)
mass_2 = Constraint(name='mass_2', minimum=0.5, maximum=5)
mass_ratio = bilby.gw.prior.UniformInComponentsMassRatio(name='mass_ratio', minimum=0.125, maximum=1)
chirp_mass = bilby.gw.prior.UniformInComponentsChirpMass(name='chirp_mass', minimum=0.4, maximum=4.4)
luminosity_distance = bilby.gw.prior.UniformSourceFrame(name='luminosity_distance', minimum=1e2, maximum=5e3)
dec = Cosine(name='dec')
ra = Uniform(name='ra', minimum=0, maximum=2 * np.pi, boundary='periodic')
theta_jn = Sine(name='theta_jn')
psi = Uniform(name='psi', minimum=0, maximum=np.pi, boundary='periodic')
phase = Uniform(name='phase', minimum=0, maximum=2 * np.pi, boundary='periodic')
a_1 = Uniform(name='a_1', minimum=0, maximum=0.99)
a_2 = Uniform(name='a_2', minimum=0, maximum=0.99)
tilt_1 = Sine(name='tilt_1')
tilt_2 = Sine(name='tilt_2')
phi_12 = Uniform(name='phi_12', minimum=0, maximum=2 * np.pi, boundary='periodic')
phi_jl = Uniform(name='phi_jl', minimum=0, maximum=2 * np.pi, boundary='periodic')

Modifying the prior

Taking the example priors above, you can copy and modify them to suite your needs. For example, to fix a parameter to a given value

parameter_name = <value>

while to constrain the prior to a certain range , you can use:

parameter_name = Constraint(name='parameter_name', minimum=<value>, maximum=<value>)

Priors using a Jupyter notebook

Bilby saves as output the prior volume sampled. You might also find useful to produce priors directly from a Jupyter notebook. You can have a look at one of the Bilby tutorials to check how you define and plot priors in a Jupyter notebook: making_priors.ipynb.