Skip to content

Commit a76f035

Browse files
committed
DOC: update sampler docs
1 parent 95ca32e commit a76f035

1 file changed

Lines changed: 54 additions & 93 deletions

File tree

docs/samplers.txt

Lines changed: 54 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -50,34 +50,50 @@ recommended for direct use by the user, rather it should be accessed via the
5050
:code:`run_sampler`.
5151

5252
---------------
53-
Nested Samplers
53+
Native Samplers
5454
---------------
5555

56-
Native
57-
======
56+
:code:`bilby` includes several samplers by default:
5857

59-
- Dynesty: :code:`bilby.core.sampler.dynesty.Dynesty`
60-
- Nestle :code:`bilby.core.sampler.nestle.Nestle`
61-
- CPNest :code:`bilby.core.sampler.cpnest.Cpnest`
62-
- PyMultiNest :code:`bilby.core.sampler.pymultinest.Pymultinest`
63-
- UltraNest :code:`bilby.core.sampler.ultranest.Ultranest`
58+
- bilby-mcmc :code:`bilby.bilby_mcmc.sampler.Bilby_MCMC`
59+
- dynesty: :code:`bilby.core.sampler.dynesty.Dynesty`
60+
- emcee :code:`bilby.core.sampler.emcee.Emcee`
6461

65-
External
66-
========
62+
-----------------
63+
External Samplers
64+
-----------------
6765

68-
- DNest4 :code:`dnest4-bilby`
69-
- Nessai :code:`nessai-bilby`
70-
- PyPolyChord :code:`pypolychord-bilby`
66+
In addition to the samplers listed above, :code:`bilby` supports a wide range
67+
of external samplers provided by various plugins.
7168

72-
-------------
73-
MCMC samplers
74-
-------------
69+
If your favourite sampler is missing, please open a PR to add it to the list.
7570

76-
- bilby-mcmc :code:`bilby.bilby_mcmc.sampler.Bilby_MCMC`
77-
- emcee :code:`bilby.core.sampler.emcee.Emcee`
78-
- ptemcee :code:`bilby.core.sampler.ptemcee.Ptemcee`
79-
- pymc :code:`bilby.core.sampler.pymc.Pymc`
80-
- zeus :code:`bilby.core.sampler.zeus.Zeus`
71+
MCMC Samplers
72+
=============
73+
74+
- kombine: https://github.com/bilby-dev/kombine-bilby
75+
- numypyro: https://github.com/ColmTalbot/bilby-numpyro
76+
- PTMCMCSampler: https://github.com/bilby-dev/ptmcmsampler-bilby
77+
- ptemcee: https://github.com/bilby-dev/ptemcee-bilby
78+
- pymc: https://github.com/bilby-dev/pymc-bilby
79+
- zeus: https://github.com/bilby-dev/zeus-bilby
80+
81+
Nested Samplers
82+
===============
83+
84+
- cpnest: https://github.com/bilby-dev/cpnest-bilby
85+
- dnest4: https://github.com/bilby-dev/dnest4-bilby
86+
- nestle: https://github.com/bilby-dev/nestle-bilby
87+
- nessai: https://github.com/bilby-dev/nessai-bilby
88+
- pymultinest: https://github.com/bilby-dev/pymultinest-bilby
89+
- pypolychord: https://github.com/bilby-dev/pypolychord-bilby
90+
- ultranest: https://github.com/bilby-dev/ultranest-bilby
91+
92+
Sequential Monte Carlo Samplers
93+
===============================
94+
95+
- aspire: https://github.com/mj-will/aspire-bilby
96+
- pocomc: https://github.com/mj-will/pocomc-bilby
8197

8298
--------------------------
8399
Listing available samplers
@@ -95,89 +111,34 @@ the plugin version. See `sampler plugins`_ for more details.
95111
Installing samplers
96112
-------------------
97113

98-
pip-installable samplers
99-
========================
100-
101-
Most samplers can be installed using `pip <https://pypi.org/project/pip/>`_
102-
(see exceptions below). E.g., to install the :code:`emcee`
103-
104-
.. code:: console
105-
106-
$ pip install emcee
107-
108-
If you installed :code:`bilby` from source, then all the samplers can be
109-
installed using
110-
111-
.. code:: console
114+
Native samplers are installed by default when installing :code:`bilby`.
115+
External samplers require you to install the corresponding plugin.
112116

113-
$ pip install -r sampler_requirements.txt
117+
Most plugins can be installed from `pip <https://pypi.org/project/pip/>`_ or
118+
:code:`conda`. For example:
114119

115-
where the file `sampler_requirements.txt
116-
<https://github.com/bilby-dev/bilby/blob/main/sampler_requirements.txt>`_ can
117-
be found in the at the top-level of `the repository
118-
<https://github.com/bilby-dev/bilby>`_ (Note: if you installed from pip, you
119-
can simply download that file and use the command above).
120120

121-
.. note::
122-
123-
Some samplers are being migrated to use sampler plugins and may require an
124-
additional step, see `migrating to sampler plugins`_.
125-
126-
Installing PyPolyChord
127-
======================
128-
129-
If you want to use the `PyPolyChord` sampler, you first need the
130-
PolyChord library to be installed to work properly. An image of PolyChord can be found on github.
131-
Clone the following repository onto your system. Navigate to the folder you want to install PolyChord in and run:
132-
133-
.. code-block:: console
134-
135-
$ git clone https://github.com/PolyChord/PolyChordLite.git
136-
137-
Then navigate into the PolyChord directory and install PolyChord/PyPolyChord with
138-
139-
.. code-block:: console
140-
141-
$ make pypolychord MPI=
142-
$ python setup.py install --user
121+
.. tab-set::
143122

144-
Add a number after `MPI=` to compile with `MPI`. Leave it like it is if you don't wish to compile with MPI.
123+
.. tabe-item:: Pip
145124

146-
Installing pymultinest
147-
======================
125+
.. code-block
126+
127+
$ pip install nestle-bilby
148128

149-
If you want to use the `pymultinest` sampler, you first need the
150-
MultiNest library to be installed to work properly. The full instructions can
151-
be found here: https://johannesbuchner.github.io/PyMultiNest/install.html. Here
152-
is a shortened version:
129+
.. tab-item:: Conda
153130

154-
First, install the dependencies (for Ubuntu/Linux):
131+
.. code-block
155132

156-
.. code-block:: console
133+
$ conda install conda-forge::nestle-bilby
157134

158-
$ sudo apt-get install python-{scipy,numpy,matplotlib,progressbar} ipython libblas{3,-dev} liblapack{3,-dev} libatlas{3-base,-dev} cmake build-essential git gfortran
159135

160-
For Mac, the advice in the instructions are "If you google for “MultiNest Mac OSX” or “PyMultiNest Mac OSX” you will find installation instructions".
161-
162-
The following will place a directory `MultiNest` in your :code:`$HOME` directory, if you want
163-
to place it somewhere, adjust the instructions as such.
164-
165-
.. code-block:: console
166-
167-
$ git clone https://github.com/JohannesBuchner/MultiNest $HOME
168-
$ cd $HOME/MultiNest/build
169-
$ cmake ..
170-
$ make
171-
172-
Finally, add the libraries to you path. Add this to the `.bashrc` file (
173-
replacing the path where appropriate)
174-
175-
.. code-block:: console
176-
177-
$ export LD_LIBRARY_PATH=$HOME/MultiNest/lib:
178-
179-
(you'll need to re-source your `.bashrc` after this, i.e. run `bash`).
136+
Once the plugin is installed, the sampler can be by specfiying, for example, :code:`sampler="nestle"`.
180137

138+
.. warning::
139+
Some external samplers are only available via :code:`conda` or directly from source.
140+
See the installation instructions in the corresponding sampler plugin for more
141+
details.
181142

182143
----------------------------
183144
Adding new samplers to bilby

0 commit comments

Comments
 (0)