diff --git a/CHANGELOG.md b/CHANGELOG.md index ffe1a6dac12c4d39c1059ce4d7d0d4ace3e2498a..09006839bd3cca5fbd02ccfdea53f5cc1c5c5c6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ ### Changed - Cosmology generalised, users can now specify the cosmology used, default is astropy Planck15 - UniformComovingVolume prior *requires* the name to be one of "luminosity_distance", "comoving_distance", "redshift" -- +- Updates the bilby.core.utils constants to match those of Astropy v3.0.4 ### Removed - diff --git a/README.rst b/README.rst index 34f08878f8fe37053b0274d6860cfd4e1a15333d..1039bda3168e88b4709ab85e6614f94f30a8517e 100644 --- a/README.rst +++ b/README.rst @@ -1,20 +1,25 @@ -|pipeline status| |coverage report| |pypi| |version| +|pipeline status| |coverage report| |pypi| |conda| |version| Bilby ===== -Fulfilling all your Bayesian inference dreams. +A user-friendly Bayesian inference library. +Fulfilling all your Bayesian dreams. -- `Installation - instructions <https://lscsoft.docs.ligo.org/bilby/installation.html>`__ -- `Contributing <https://git.ligo.org/lscsoft/bilby/blob/master/CONTRIBUTING.md>`__ +For online material to help you get started: + +- `Installation instructions <https://lscsoft.docs.ligo.org/bilby/installation.html>`__ - `Documentation <https://lscsoft.docs.ligo.org/bilby/index.html>`__ -- `Issue tracker <https://git.ligo.org/lscsoft/bilby/issues>`__ -We encourage you to contribute to the development via a merge request. For +If you need help, find an issue, or just have a question/suggestion: + +- `Join our Slack workspace <https://bilby-code.slack.com/>`__ +- `For www.git.ligo.org users, submit issues directly through the issue tracker <https://git.ligo.org/lscsoft/bilby/issues>`__ + +We encourage you to contribute to the development of bilby. This is done via a merge request. For help in creating a merge request, see `this page <https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.html>`__ or contact -us directly. +us directly. For advice on contributing, see `this help page <https://git.ligo.org/lscsoft/bilby/blob/master/CONTRIBUTING.md>`__. .. |pipeline status| image:: https://git.ligo.org/lscsoft/bilby/badges/master/pipeline.svg :target: https://git.ligo.org/lscsoft/bilby/commits/master @@ -22,5 +27,7 @@ us directly. :target: https://lscsoft.docs.ligo.org/bilby/htmlcov/ .. |pypi| image:: https://badge.fury.io/py/bilby.svg :target: https://pypi.org/project/bilby/ +.. |conda| image:: https://img.shields.io/conda/vn/conda-forge/bilby.svg + :target: https://anaconda.org/conda-forge/bilby .. |version| image:: https://img.shields.io/pypi/pyversions/bilby.svg :target: https://pypi.org/project/bilby/ diff --git a/bilby/core/utils.py b/bilby/core/utils.py index b23872827115c551b391e591648f904d7d6b7869..ce634a6e1964ab8866ae8cf5ec46bc7123d05718 100644 --- a/bilby/core/utils.py +++ b/bilby/core/utils.py @@ -13,12 +13,12 @@ from scipy.interpolate import interp2d logger = logging.getLogger('bilby') -# Constants -speed_of_light = 299792458.0 # speed of light in m/s -parsec = 3.085677581 * 1e16 -solar_mass = 1.98855 * 1e30 -radius_of_earth = 6371 * 1e3 # metres +# Constants: values taken from astropy v3.0.4 +speed_of_light = 299792458.0 # m/s +parsec = 3.0856775814671916e+16 # m +solar_mass = 1.9884754153381438e+30 # Kg +radius_of_earth = 6378100.0 # m def infer_parameters_from_function(func): diff --git a/containers/Dockerfile-bilby b/containers/Dockerfile-bilby new file mode 100644 index 0000000000000000000000000000000000000000..45a53475d2e197940d915a3b2e66f8f27c0c4917 --- /dev/null +++ b/containers/Dockerfile-bilby @@ -0,0 +1,7 @@ +FROM bilbydev/bilby-test-suite-python37 + +LABEL name="bilby" \ +maintainer="Gregory Ashton <gregory.ashton@ligo.org>" \ +date="20190130" + +RUN pip install bilby diff --git a/containers/Singularity.0.3.3 b/containers/Singularity.0.3.3 index fe1506c755cb2235a7a9d403837c20867f95b6dc..ed8a2c5fbcb199912a29c91879446b1cf9f0ca8c 100644 --- a/containers/Singularity.0.3.3 +++ b/containers/Singularity.0.3.3 @@ -8,6 +8,7 @@ container, providing the bilby_script and any additional arguments. E.g., ./name_of_this_container.simg run_script.py %post +export PATH="/opt/conda/bin:$PATH" pip install bilby==0.3.3 %runscript diff --git a/containers/Singularity.0.3.5 b/containers/Singularity.0.3.5 new file mode 100644 index 0000000000000000000000000000000000000000..ae53b871425bbb1337ad4b241ae32007b6ab151a --- /dev/null +++ b/containers/Singularity.0.3.5 @@ -0,0 +1,15 @@ +Bootstrap: docker +From: bilbydev/bilby-test-suite-python37 + +%help +A singularity container for running bilby scripts. To use, simply execute the +container, providing the bilby_script and any additional arguments. E.g., + +./name_of_this_container.simg run_script.py + +%post +export PATH="/opt/conda/bin:$PATH" +pip install bilby==0.3.5 + +%runscript +exec /opt/conda/bin/python "$@" diff --git a/docs/code-overview.txt b/docs/code-overview.txt new file mode 100644 index 0000000000000000000000000000000000000000..210a1e6a445ca7d95967cf5c943103eaa1538b9a --- /dev/null +++ b/docs/code-overview.txt @@ -0,0 +1,7 @@ +==================== +Code Overview +==================== + +Below is a flowchart showing the dependency of different packages and modules within Bilby. + +.. image:: images/bilby_layout.png diff --git a/docs/index.txt b/docs/index.txt index b226d11953af6582ffb1c17d91dd59c4b5d753f3..c2dbb5e804c0f334663ca0c54021ea5fbf57b9ab 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -9,6 +9,7 @@ Welcome to bilby's documentation! :caption: Contents: installation + code-overview examples basics-of-parameter-estimation prior diff --git a/test/gw_likelihood_test.py b/test/gw_likelihood_test.py index 4d343a04f85526bc71b2a8df6b0a66027c48c433..b2d9a8128a0c2dcfa0089747dbd2d8a727a9422d 100644 --- a/test/gw_likelihood_test.py +++ b/test/gw_likelihood_test.py @@ -42,7 +42,7 @@ class TestBasicGWTransient(unittest.TestCase): """Test log likelihood matches precomputed value""" self.likelihood.log_likelihood() self.assertAlmostEqual(self.likelihood.log_likelihood(), - -4055.2526551677647, 3) + -4055.236283345252, 3) def test_log_likelihood_ratio(self): """Test log likelihood ratio returns the correct value""" @@ -111,7 +111,7 @@ class TestGWTransient(unittest.TestCase): """Test log likelihood matches precomputed value""" self.likelihood.log_likelihood() self.assertAlmostEqual(self.likelihood.log_likelihood(), - -4055.2526551677647, 3) + -4055.236283345252, 3) def test_log_likelihood_ratio(self): """Test log likelihood ratio returns the correct value""" diff --git a/test/utils_test.py b/test/utils_test.py index 9b3abf9414755f6e641397caa653a1e452a4ae69..ad1d22783215bcfc00c356df2176548931b4ef3d 100644 --- a/test/utils_test.py +++ b/test/utils_test.py @@ -2,11 +2,27 @@ from __future__ import absolute_import, division import unittest import numpy as np +from astropy import constants import bilby from bilby.core import utils +class TestConstants(unittest.TestCase): + + def test_speed_of_light(self): + self.assertTrue(bilby.core.utils.speed_of_light, constants.c.value) + + def test_parsec(self): + self.assertTrue(bilby.core.utils.parsec, constants.pc.value) + + def test_solar_mass(self): + self.assertTrue(bilby.core.utils.solar_mass, constants.M_sun.value) + + def test_radius_of_earth(self): + self.assertTrue(bilby.core.utils.radius_of_earth, constants.R_earth.value) + + class TestFFT(unittest.TestCase): def setUp(self):