Skip to content

Commit 7b563a8

Browse files
authored
DEP: deprecate dnest4 interface (#980)
* DEP: deprecate dnest4 interface * BUG: add missing import * DOC: change placement of listed samplers * DOC: remove duplicate list of plugins
1 parent eca1c38 commit 7b563a8

9 files changed

Lines changed: 28 additions & 93 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ The original MRs are only visible on the [LIGO GitLab repository](https://git.li
55

66
## [Unreleased]
77

8+
### Deprecated
9+
10+
- `dnest4` is no longer tested, the plugin package should be used instead.
11+
812
## [2.6.0]
913

1014
We noticed a longstanding mis-definition in the `GravitationalWaveTransient` likelihood that caused the PSD to be

bilby/core/sampler/base_sampler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ def _setup_run_directory(self):
10441044
"""
10451045
If using a temporary directory, the output directory is moved to the
10461046
temporary directory.
1047-
Used for Dnest4, Pymultinest, and Ultranest.
1047+
Used for Pymultinest, and Ultranest.
10481048
"""
10491049
check_directory_exists_and_if_not_mkdir(self.outputfiles_basename)
10501050
if self.use_temporary_directory:

bilby/core/sampler/dnest4.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import datetime
22
import time
3+
import warnings
34

45
import numpy as np
56

@@ -8,6 +9,13 @@
89

910

1011
class _DNest4Model(object):
12+
msg = (
13+
"The DNest4 sampler interface in bilby is deprecated and will"
14+
" be removed in future release. Please use the `dnest4-bilby`"
15+
"sampler plugin instead: https://github.com/bilby-dev/dnest4-bilby."
16+
)
17+
warnings.warn(msg, FutureWarning)
18+
1119
def __init__(
1220
self, log_likelihood_func, from_prior_func, widths, centers, highs, lows
1321
):

containers/env-template.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ dependencies:
5353
- ultranest
5454
- cpnest
5555
- kombine
56-
- dnest4
5756
- zeus-mcmc
5857
- pytorch
5958
- pymc>=5.9

docs/plugins.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,6 @@ for creating sampler plugins on GitHub.
5151
the plugin (e.g. 'nest', 'mcmc') as this may lead to naming conflicts.
5252

5353

54-
Sampler plugin library
55-
----------------------
56-
57-
This is a list of known sampler plugins. if you don't see your plugin listed
58-
here, we encourage you to open a
59-
`pull request <https://github.com/bilby-dev/bilby/compare>`_ to add it.
60-
61-
- :code:`nessai-bilby`: https://github.com/bilby-dev/nessai-bilby
62-
- :code:`pypolychord-bilby`: https://github.com/bilby-dev/pypolychord-bilby
63-
64-
6554
Bilby-native samplers
6655
---------------------
6756

docs/samplers.txt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,21 @@ recommended for direct use by the user, rather it should be accessed via the
5353
Nested Samplers
5454
---------------
5555

56+
Native
57+
======
58+
5659
- Dynesty: :code:`bilby.core.sampler.dynesty.Dynesty`
5760
- Nestle :code:`bilby.core.sampler.nestle.Nestle`
5861
- CPNest :code:`bilby.core.sampler.cpnest.Cpnest`
5962
- PyMultiNest :code:`bilby.core.sampler.pymultinest.Pymultinest`
60-
- PyPolyChord :code:`bilby.core.sampler.polychord.PyPolyChord`
6163
- UltraNest :code:`bilby.core.sampler.ultranest.Ultranest`
62-
- DNest4 :code:`bilby.core.sampler.dnest4.DNest4`
63-
- Nessai :code:`bilby.core.sampler.nessai.Nessai`
64+
65+
External
66+
========
67+
68+
- DNest4 :code:`dnest4-bilby`
69+
- Nessai :code:`nessai-bilby`
70+
- PyPolyChord :code:`pypolychord-bilby`
6471

6572
-------------
6673
MCMC samplers
@@ -72,7 +79,6 @@ MCMC samplers
7279
- pymc :code:`bilby.core.sampler.pymc.Pymc`
7380
- zeus :code:`bilby.core.sampler.zeus.Zeus`
7481

75-
7682
--------------------------
7783
Listing available samplers
7884
--------------------------
@@ -117,7 +123,6 @@ can simply download that file and use the command above).
117123
Some samplers are being migrated to use sampler plugins and may require an
118124
additional step, see `migrating to sampler plugins`_.
119125

120-
121126
Installing PyPolyChord
122127
======================
123128

@@ -182,11 +187,14 @@ We actively encourage the addition of new samplers to :code:`bilby`.
182187
We now recommended adding support for new samplers via the sampler plugins
183188
interface. For more details, and a template, see `sampler plugins`_.
184189

190+
If you have a :code:`bilby` sampler plugin that you would like to be listed here,
191+
please let us know!
192+
185193
----------------------------
186194
Migrating to sampler plugins
187195
----------------------------
188196

189-
The interfaces for some samplers are being move from bilby to external sampler
197+
The interface for some samplers are being moved from bilby to external sampler
190198
plugins. This does not change how the samplers are used for most users, you
191199
still specify :code:`sampler='sampler name'` in :code:`run_sampler`, however,
192200
an additional dependency must be installed before using a sampler.

sampler_requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pymc>=4.0.0
88
pymultinest
99
kombine
1010
ultranest>=3.0.0
11-
dnest4
1211
nessai>=0.7.0
1312
schwimmbad
1413
zeus-mcmc>=2.3.0

test/core/sampler/dnest4_test.py

Lines changed: 0 additions & 61 deletions
This file was deleted.

test/integration/sampler_run_test.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@
1919
_sampler_kwargs = dict(
2020
bilby_mcmc=dict(nsamples=200, printdt=1),
2121
cpnest=dict(nlive=100),
22-
dnest4=dict(
23-
max_num_levels=2,
24-
num_steps=10,
25-
new_level_interval=10,
26-
num_per_step=10,
27-
thread_steps=1,
28-
num_particles=50,
29-
max_pool=1,
30-
),
3122
dynesty=dict(nlive=10, sample="acceptance-walk", nact=5, proposals=["diff"]),
3223
dynamic_dynesty=dict(
3324
nlive_init=10,
@@ -64,7 +55,7 @@
6455
dynamic_dynesty="dynesty"
6556
)
6657

67-
no_pool_test = ["dnest4", "pymultinest", "nestle", "ptmcmcsampler", "ultranest", "pymc"]
58+
no_pool_test = ["pymultinest", "nestle", "ptmcmcsampler", "ultranest", "pymc"]
6859

6960
loaded_samplers = {k: v.load() for k, v in bilby.core.sampler.IMPLEMENTED_SAMPLERS.items()}
7061

@@ -143,8 +134,6 @@ def _run_sampler(self, sampler, pool_size, **extra_kwargs):
143134
**extra_kwargs,
144135
)
145136
assert "derived" in res.posterior
146-
if sampler != "dnest4":
147-
assert res.log_likelihood_evaluations is not None
148137

149138
@parameterized.expand(_sampler_kwargs.keys())
150139
def test_interrupt_sampler_single(self, sampler):

0 commit comments

Comments
 (0)