Commit b1f289d0 authored by Colm Talbot's avatar Colm Talbot

Merge remote-tracking branch 'origin/master' into combine-coverage

parents 23281b0b fb0db4eb
Pipeline #143279 passed with stages
in 14 minutes and 22 seconds
......@@ -4,7 +4,7 @@ Bilby
Bilby: a user-friendly Bayesian inference library.
The aim of bilby is to provide user friendly interface to perform parameter
The aim of bilby is to provide a user-friendly interface to perform parameter
estimation. It is primarily designed and built for inference of compact
binary coalescence events in interferometric data, but it can also be used for
more general problems.
......
......@@ -16,7 +16,7 @@ from bilby.core.utils import logger, check_directory_exists_and_if_not_mkdir, Bi
class PriorDict(dict):
def __init__(self, dictionary=None, filename=None,
conversion_function=None):
""" A set of priors
""" A dictionary of priors
Parameters
----------
......
......@@ -44,6 +44,8 @@ class Interped(Prior):
"""
self.xx = xx
self.min_limit = min(xx)
self.max_limit = max(xx)
self._yy = yy
self.YY = None
self.probability_density = None
......@@ -97,6 +99,8 @@ class Interped(Prior):
Updates the prior distribution if minimum is set to a different value.
Yields an error if value is set below instantiated x-array minimum.
Returns
-------
float: Minimum of the prior distribution
......@@ -106,6 +110,8 @@ class Interped(Prior):
@minimum.setter
def minimum(self, minimum):
if minimum < self.min_limit:
raise ValueError('Minimum cannot be set below {}.'.format(round(self.min_limit, 2)))
self._minimum = minimum
if '_maximum' in self.__dict__ and self._maximum < np.inf:
self._update_instance()
......@@ -116,6 +122,8 @@ class Interped(Prior):
Updates the prior distribution if maximum is set to a different value.
Yields an error if value is set above instantiated x-array maximum.
Returns
-------
float: Maximum of the prior distribution
......@@ -125,6 +133,8 @@ class Interped(Prior):
@maximum.setter
def maximum(self, maximum):
if maximum > self.max_limit:
raise ValueError('Maximum cannot be set above {}.'.format(round(self.max_limit, 2)))
self._maximum = maximum
if '_minimum' in self.__dict__ and self._minimum < np.inf:
self._update_instance()
......@@ -190,12 +200,12 @@ class FromFile(Interped):
"""
try:
self.id = file_name
xx, yy = np.genfromtxt(self.id).T
self.file_name = file_name
xx, yy = np.genfromtxt(self.file_name).T
super(FromFile, self).__init__(xx=xx, yy=yy, minimum=minimum,
maximum=maximum, name=name, latex_label=latex_label,
unit=unit, boundary=boundary)
except IOError:
logger.warning("Can't load {}.".format(self.id))
logger.warning("Can't load {}.".format(self.file_name))
logger.warning("Format should be:")
logger.warning(r"x\tp(x)")
......@@ -570,7 +570,15 @@ class MultivariateGaussianDist(BaseJointPriorDist):
if self.nmodes == 1:
mode = 0
else:
mode = np.argwhere(self.cumweights - np.random.rand() > 0)[0][0]
if size == 1:
mode = np.argwhere(self.cumweights - np.random.rand() > 0)[0][0]
else:
# pick modes
mode = [
np.argwhere(self.cumweights - r > 0)[0][0]
for r in np.random.rand(size)
]
samps = np.zeros((size, len(self)))
for i in range(size):
inbound = False
......@@ -578,7 +586,10 @@ class MultivariateGaussianDist(BaseJointPriorDist):
# sample the multivariate Gaussian keys
vals = np.random.uniform(0, 1, len(self))
samp = np.atleast_1d(self.rescale(vals, mode=mode))
if isinstance(mode, list):
samp = np.atleast_1d(self.rescale(vals, mode=mode[i]))
else:
samp = np.atleast_1d(self.rescale(vals, mode=mode))
samps[i, :] = samp
# check sample is in bounds (otherwise perform another draw)
......
......@@ -271,6 +271,7 @@ class Pymultinest(NestedSampler):
current_time = time.time()
new_sampling_time = current_time - self.start_time
self.total_sampling_time += new_sampling_time
self.start_time = current_time
with open(self.time_file_path, 'w') as time_file:
time_file.write(str(self.total_sampling_time))
......
......@@ -6,7 +6,6 @@ import os
import shutil
from math import fmod
import argparse
import traceback
import inspect
import functools
import types
......@@ -16,7 +15,6 @@ from importlib import import_module
import json
import warnings
from distutils.version import StrictVersion
import numpy as np
from scipy.interpolate import interp2d
from scipy.special import logsumexp
......@@ -972,28 +970,6 @@ command_line_args, command_line_parser = set_up_command_line_arguments()
# Instantiate the default logging
setup_logger(print_version=False, log_level=command_line_args.log_level)
if 'DISPLAY' in os.environ:
logger.debug("DISPLAY={} environment found".format(os.environ['DISPLAY']))
pass
else:
logger.debug('No $DISPLAY environment variable found, so importing \
matplotlib.pyplot with non-interactive "Agg" backend.')
import matplotlib
import matplotlib.pyplot as plt
non_gui_backends = matplotlib.rcsetup.non_interactive_bk
for backend in non_gui_backends:
try:
logger.debug("Trying backend {}".format(backend))
if StrictVersion(matplotlib.__version__) >= StrictVersion("3.1"):
matplotlib.use(backend)
else:
matplotlib.use(backend, warn=False)
plt.switch_backend(backend)
break
except Exception:
print(traceback.format_exc())
class BilbyJsonEncoder(json.JSONEncoder):
......
......@@ -1116,13 +1116,14 @@ def compute_snrs(sample, likelihood):
if isinstance(sample, dict):
signal_polarizations =\
likelihood.waveform_generator.frequency_domain_strain(sample)
likelihood.parameters.update(sample)
for ifo in likelihood.interferometers:
signal = ifo.get_detector_response(signal_polarizations, sample)
per_detector_snr = likelihood.calculate_snrs(
signal_polarizations, ifo)
sample['{}_matched_filter_snr'.format(ifo.name)] =\
ifo.matched_filter_snr(signal=signal)
per_detector_snr.complex_matched_filter_snr
sample['{}_optimal_snr'.format(ifo.name)] = \
ifo.optimal_snr_squared(signal=signal) ** 0.5
per_detector_snr.optimal_snr_squared.real ** 0.5
else:
logger.info(
'Computing SNRs for every sample.')
......
......@@ -408,6 +408,7 @@ class InterferometerStrainData(object):
self.time_array = array
elif domain == 'frequency':
self.frequency_array = array
self.start_time = start_time
return
elif sampling_frequency is None or duration is None:
raise ValueError(
......
......@@ -137,7 +137,7 @@ class GravitationalWaveTransient(Likelihood):
self.reference_ifo = None
if self.time_marginalization:
self._check_prior_is_set(key='geocent_time')
self._check_marginalized_prior_is_set(key='geocent_time')
self._setup_time_marginalization()
priors['geocent_time'] = float(self.interferometers.start_time)
if self.jitter_time:
......@@ -152,7 +152,7 @@ class GravitationalWaveTransient(Likelihood):
self.jitter_time = False
if self.phase_marginalization:
self._check_prior_is_set(key='phase')
self._check_marginalized_prior_is_set(key='phase')
self._bessel_function_interped = None
self._setup_phase_marginalization()
priors['phase'] = float(0)
......@@ -160,7 +160,7 @@ class GravitationalWaveTransient(Likelihood):
if self.distance_marginalization:
self._lookup_table_filename = None
self._check_prior_is_set(key='luminosity_distance')
self._check_marginalized_prior_is_set(key='luminosity_distance')
self._distance_array = np.linspace(
self.priors['luminosity_distance'].minimum,
self.priors['luminosity_distance'].maximum, int(1e4))
......@@ -234,7 +234,11 @@ class GravitationalWaveTransient(Likelihood):
complex_matched_filter_snr=complex_matched_filter_snr,
d_inner_h_squared_tc_array=d_inner_h_squared_tc_array)
def _check_prior_is_set(self, key):
def _check_marginalized_prior_is_set(self, key):
if key in self.priors and self.priors[key].is_fixed:
raise ValueError(
"Cannot use marginalized likelihood for {}: prior is fixed"
.format(key))
if key not in self.priors or not isinstance(
self.priors[key], Prior):
logger.warning(
......
......@@ -139,7 +139,10 @@ class Cosmological(Interped):
@minimum.setter
def minimum(self, minimum):
self._set_limit(value=minimum, limit_dict=self._minimum)
if (self.name in self._minimum) and (minimum < self.minimum):
self._set_limit(value=minimum, limit_dict=self._minimum, recalculate_array=True)
else:
self._set_limit(value=minimum, limit_dict=self._minimum)
@property
def maximum(self):
......@@ -147,11 +150,14 @@ class Cosmological(Interped):
@maximum.setter
def maximum(self, maximum):
self._set_limit(value=maximum, limit_dict=self._maximum)
if (self.name in self._maximum) and (maximum > self.maximum):
self._set_limit(value=maximum, limit_dict=self._maximum, recalculate_array=True)
else:
self._set_limit(value=maximum, limit_dict=self._maximum)
def _set_limit(self, value, limit_dict):
def _set_limit(self, value, limit_dict, recalculate_array=False):
"""
Set either the limits for redshift luminosity and comoving distances
Set either of the limits for redshift, luminosity, and comoving distances
Parameters
----------
......@@ -159,6 +165,8 @@ class Cosmological(Interped):
Limit value in current class' parameter
limit_dict: dict
The limit dictionary to modify in place
recalculate_array: boolean
Determines if the distance arrays are recalculated
"""
cosmology = get_cosmology(self.cosmology)
limit_dict[self.name] = value
......@@ -185,6 +193,13 @@ class Cosmological(Interped):
limit_dict['luminosity_distance'] = (
cosmology.luminosity_distance(limit_dict['redshift']).value
)
if recalculate_array:
if self.name == 'redshift':
self.xx, self.yy = self._get_redshift_arrays()
elif self.name == 'comoving_distance':
self.xx, self.yy = self._get_comoving_distance_arrays()
elif self.name == 'luminosity_distance':
self.xx, self.yy = self._get_luminosity_distance_arrays()
try:
self._update_instance()
except (AttributeError, KeyError):
......
......@@ -2,13 +2,11 @@
Bilby output
============
In this document, we will describe what :code:`bilby` outputs, where it is stored,
and how you can access it.
When you call :code:`run_sampler`, there are two arguments :code:`outdir` and :code:`label` which
are used in generating all the file names for saved data. In the rest of these
documents, we'll assume the defaults where used (which are :code:`outdir` and
:code:`label`).
In this document, we will describe what :code:`bilby` outputs, where it is
stored, and how you can access it. When you call :code:`run_sampler`, there
are two arguments :code:`outdir` and :code:`label` which are used in generating
all the file names for saved data. In the rest of these documents, we'll assume
the defaults where used (which are :code:`outdir` and :code:`label`).
The result file
......@@ -97,8 +95,8 @@ done via::
which will generate a file :code:`outdir/label_posterior.txt`.
Visualising the results
--------------------
Visualising the results
-----------------------
Bilby also provides some useful built-in plotting tools. Some examples on how
to visualise results using these tools (and how to extend them) are shown in
one of the tutorials at `visualising_the_results.ipynb <https://git.ligo.org/lscsoft/bilby/-/blob/master/examples/tutorials/visualising_the_results.ipynb>`_.
......
......@@ -49,34 +49,28 @@ until one of the stopping criteria are reached:
Bilby-specific implementation details
-------------------------------------
In Bilby, we have re-implemented the :code:`sample="rwalk"` sample method. In
dynesty, this method took an argument :code:`walks` which was the fixed number
of walks to take each time a new point was proposed. In the bilby implementation,
we still take an argument :code:`walks` which has the new meaning: the minimum
number of walks to take (this ensures backward compatibility). Meanwhile, we
add two new arguments
1. :code:`maxmcmc`: the maximum number of walks to use. This naming is chosen for consistency with other codes. Default is 5000. If this limit is reached, a warning will be printed during sampling.
2. :code:`nact`: the number of auto-correlation times to use before accepting a point. Default is 5.
The autocorrelation time calculation uses the `emcee
<https://emcee.readthedocs.io/en/stable/>`_ autocorr methods. For a detailed
discussion on the topics, see `this post by Dan Foreman-Mackey
<https://dfm.io/posts/autocorr/>`_.
In Bilby, we have re-implemented the :code:`sample="rwalk"` sample method (you
can see exact details by looking at the function
:code:`bilby.core.sampler.dynesty.sample_rwalk_bilby`. In dynesty, this method
took an argument :code:`walks` which was the fixed number of walks to take each
time a new point was proposed. In the bilby implementation, we still take an
argument :code:`walks` which has the new meaning: the minimum number of walks
to take (this ensures backward compatibility). Meanwhile, we add two new
arguments
You can revert to the original dynesty implementation by specifying
:code:`sample="rwalk_dynesty"`.
1. :code:`maxmcmc`: the maximum number of walks to use. This naming is chosen for consistency with other codes. Default is 5000. If this limit is reached, a warning will be printed during sampling.
In addition, we also set several kwargs by default
2. :code:`nact`: the number of auto-correlation times to use before accepting a point.
1. :code:`nwalk` (alias of :code:`nlive`), the number of live poinst. This defaults to 1000.
2. :code:`facc`: The target acceptance fraction for the 'rwalk'. In dynesty, this defaults 0.5, but in testing we found that a value of 0.2 produced better behaviour at boundaries.
In general, poor convergance can be resolved by increasing :code:`nact`. For GW
events, we find a value of 10 is typically okay. You can revert to the
original dynesty implementation by specifying :code:`sample="rwalk_dynesty"`.
Understanding the output
------------------------
Before sampling begins, you will see a message like this
.. code-block:: console
10:42 bilby INFO : Single likelihood evaluation took 2.977e-03 s
......
......@@ -2,28 +2,26 @@
Examples
========
1. `General inference examples <https://git.ligo.org/lscsoft/bilby/tree/master/examples/core_examples>`_
- `A simple Gaussian likelihood <https://git.ligo.org/lscsoft/bilby/blob/master/examples/core_examples/gaussian_example.py>`_: a good example to see how to write your own likelihood.
- `Linear regression for unknown noise <https://git.ligo.org/lscsoft/bilby/blob/master/examples/core_examples/linear_regression_unknown_noise.py>`_: fitting to general time-domain data.
1. `General inference examples <https://git.ligo.org/lscsoft/bilby/tree/master/examples/core_examples>`_:
* `A simple Gaussian likelihood <https://git.ligo.org/lscsoft/bilby/blob/master/examples/core_examples/gaussian_example.py>`_: a good example to see how to write your own likelihood.
* `Linear regression for unknown noise <https://git.ligo.org/lscsoft/bilby/blob/master/examples/core_examples/linear_regression_unknown_noise.py>`_: fitting to general time-domain data.
2. `Examples of injecting and recovering
data <https://git.ligo.org/lscsoft/bilby/tree/master/examples/gw_examples/injection_examples>`__
- `4-parameter CBC tutorial <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/injection_examples/fast_tutorial.py>`__
- `15-parameter CBC tutorial <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/injection_examples/standard_15d_cbc_tutorial.py>`__
- `Create your own source model <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/injection_examples/create_your_own_source_model.py>`__
- `Create your own time-domain source model <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/injection_examples/create_your_own_time_domain_source_model.py>`__
- `How to specify the prior <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/injection_examples/how_to_specify_the_prior.py>`__
- `Using a partially marginalized likelihood <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/injection_examples/marginalized_likelihood.py>`__
- `Injecting and recovering a neutron-star equation of state <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/injection_examples/bns_eos_example.py>`__
2. `Examples of injecting and recovering data <https://git.ligo.org/lscsoft/bilby/tree/master/examples/gw_examples/injection_examples>`__:
* `4-parameter CBC tutorial <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/injection_examples/fast_tutorial.py>`__
* `15-parameter CBC tutorial <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/injection_examples/standard_15d_cbc_tutorial.py>`__
* `Create your own source model <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/injection_examples/create_your_own_source_model.py>`__
* `Create your own time-domain source model <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/injection_examples/create_your_own_time_domain_source_model.py>`__
* `How to specify the prior <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/injection_examples/how_to_specify_the_prior.py>`__
* `Using a partially marginalized likelihood <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/injection_examples/marginalized_likelihood.py>`__
* `Injecting and recovering a neutron-star equation of state <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/injection_examples/bns_eos_example.py>`__
3. `Examples using open
data <https://git.ligo.org/lscsoft/bilby/tree/master/examples/gw_examples/data_examples>`__
- `Analysing the first Binary Black hole detection, GW150914 <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/data_examples/GW150914.py>`__
3. `Examples using open data <https://git.ligo.org/lscsoft/bilby/tree/master/examples/gw_examples/data_examples>`__:
* `Analysing the first Binary Black hole detection, GW150914 <https://git.ligo.org/lscsoft/bilby/blob/master/examples/gw_examples/data_examples/GW150914.py>`__
4. `Notebook-style tutorials <https://git.ligo.org/lscsoft/bilby/tree/master/examples/tutorials>`__
4. `Notebook-style tutorials <https://git.ligo.org/lscsoft/bilby/tree/master/examples/tutorials>`__:
- `Comparing different samplers <https://git.ligo.org/lscsoft/bilby/blob/master/examples/tutorials/compare_samplers.ipynb>`__
- `Visualising the output <https://git.ligo.org/lscsoft/bilby/blob/master/examples/tutorials/visualising_the_results.ipynb>`__
* `Comparing different samplers <https://git.ligo.org/lscsoft/bilby/blob/master/examples/tutorials/compare_samplers.ipynb>`__
* `Visualising the output <https://git.ligo.org/lscsoft/bilby/blob/master/examples/tutorials/visualising_the_results.ipynb>`__
.. gw_prior:
===================================
Transient Graviatiaonal wave priors
Transient Gravitational wave priors
===================================
We provide two base prior dictionaries for binary black hole (BBH) and binary
neutron star (BNS) systems. These are :code:`bilby.gw.prior.BBHPriorDict` and
:code:`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.
.. code:: python
>>> 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
.. code:: python
>>> 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.
.. code:: python
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 :code:`bbh.prior`
which contains:
.. literalinclude:: /../bilby/gw/prior_files/precessing_spins_bbh.prior
You can load this with
.. code:: python
prior = bilby.gw.prior.BBHPriorDict("bbh.prior")
Here we see several examples of different types of priors. For those available
in the :code:`bilby.core.prior` module, you can specify these without a prefix,
but for other (including any exisiting in your own modules) you need to specify
the module path.
Aligned spins waveform with tides off
-------------------------------------
.. literalinclude:: /../bilby/gw/prior_files/aligned_spins_bbh.prior
Aligned spins waveform with tides on
------------------------------------
.. literalinclude:: /../bilby/gw/prior_files/aligned_spins_bns.prior
Precessing spins waveform with tides off
----------------------------------------
.. literalinclude:: /../bilby/gw/prior_files/precessing_spins_bbh.prior
Precessing spins waveform with tides on
---------------------------------------
.. literalinclude:: /../bilby/gw/prior_files/precessing_spins_bns.prior
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
.. code:: python
parameter_name = <value>
while to constrain the prior to a certain range , you can use:
.. code:: python
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 <https://git.ligo.org/lscsoft/bilby/-/blob/master/examples/tutorials/making_priors.ipynb>`_.
Notes on GW-specific priors
===========================
A Cosmological GW prior, :code:`Cosmological`:
----------------------------------------------
.. autoclass:: bilby.gw.prior.Cosmological
:members:
Uniform in Comoving Volume GW Prior (inherited from Cosmological) :code:`UniformComovingVolume`:
------------------------------------------------------------------------------------------------
.. autoclass:: bilby.gw.prior.UniformComovingVolume
:members:
Uniform in Source Frame GW Prior :code:`UniformSourceFrame`:
------------------------------------------------------------
.. autoclass:: bilby.gw.prior.UniformSourceFrame
:members:
Aligned Spine GW Prior :code:`AlignedSpin`:
-------------------------------------------
.. autoclass:: bilby.gw.prior.AlignedSpin
:members:
HealPixMap JointPriorDist (See JointPriors in bilby.core.prior.joint) :code:`HealPixMapPriorDist`:
--------------------------------------------------------------------------------------------------
.. autoclass:: bilby.gw.prior.HealPixMapPriorDist
:members:
......@@ -93,7 +93,7 @@ The `requirements.txt
<https://git.ligo.org/lscsoft/bilby/blob/master/requirements.txt>`_ is a
minimal set of requirements for using :code:`bilby`. Additionally, we provide:
1. `optional_requirements.txt
1. The file `optional_requirements.txt
<https://git.ligo.org/lscsoft/bilby/blob/master/optional_requirements.txt>`_
which you should install if you plan to use :code:`bilby` for
gravitational-wave data analysis.
......
......@@ -30,22 +30,9 @@ simple example that sets a uniform prior for :code:`a`, and a fixed value for
Notice, that the :code:`latex_label` is optional, but if given will be used
when generating plots. Latex label strings containing escape characters like :code:`\t`
should either be preceded by :code:`r'` or include an extra backslash. As an example,
either :code:`r'$\theta$'` or :code:`'$\\theta$'` is permissable. For a list of
recognized escape sequences, see the `python docs <https://docs.python.org/2.0/ref/strings.html>`_.
either :code:`r'$\theta$'` or :code:`'$\\theta$'` is permissable. For a list of
recognized escape sequences, see the `python docs <https://docs.python.org/2.0/ref/strings.html>`_.
--------------
Default priors
--------------
If any model parameter required by the :ref:`likelihood` are not defined in the
`priors` dictionary passed to :ref:`run_sampler <run_sampler>` then the code
will try to use a default prior. By default, these are setup for a binary black
hole and defined in a file like this
.. literalinclude:: /../bilby/gw/prior_files/binary_black_holes.prior
You can define your own default prior and pass a string pointing to that file
to :ref:`run_sampler <run_sampler>`.
--------------------------
......@@ -92,7 +79,7 @@ Multivariate Gaussian prior
We provide a prior class for correlated parameters in the form of a
`multivariate Gaussian distribution <https://en.wikipedia.org/wiki/Multivariate_normal_distribution>`_.
To set the prior you first must define the distribution using the
To set the prior you first must define the distribution using the
:class:`bilby.core.prior.MultivariateGaussianDist` class. This requires the names of the
correlated variables, their means, and either the covariance matrix or the correlation
matrix and standard deviations, e.g.:
......@@ -209,72 +196,4 @@ Sample from this distribution and plot the samples.
------
Gravitational wave priors
=========================
We provide default conversion functions for the BBH and BNS PriorDicts.
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.
-----------------
Prior Examples
-----------------
Here we show some examples of prior files for different waveform families.
To constrain a certain parameter to a fixed value, you just need:
.. code:: python
parameter_name = <value>
------
To constrain the prior to a certain range , you can use:
.. code:: python
parameter_name = Constraint(name='parameter_name', minimum=<value>, maximum=<value>)
------
Note that to activate the tidal effect you need to specify in your configuration
file:
.. code:: python
frequency_domain_source_model=lal_binary_neutron_star
------
Aligned spins waveform with tides off
==============
.. literalinclude:: /../bilby/gw/prior_files/aligned_spins_waveform_tides_off.prior
Aligned spins waveform with tides on
==============
.. literalinclude:: /../bilby/gw/prior_files/aligned_spins_waveform_tides_on.prior
Precessing spins waveform with tides off
==============
.. literalinclude:: /../bilby/gw/prior_files/precessing_spins_waveform_tides_off.prior
Precessing spins waveform with tides on
==============
.. literalinclude:: /../bilby/gw/prior_files/precessing_spins_waveform_tides_on.prior
-----------------
Priors using a Jupyter notebook
-----------------