diff --git a/README.rst b/README.rst index 70305b17..bf3a7b2f 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ :target: https://arxiv.org/abs/1506.00171 :alt: Open-access paper -PolyChord v 1.22.1 +PolyChord v 1.22.2 Will Handley, Mike Hobson & Anthony Lasenby diff --git a/pypolychord/__init__.py b/pypolychord/__init__.py index 738345c0..5d14faca 100644 --- a/pypolychord/__init__.py +++ b/pypolychord/__init__.py @@ -1,3 +1,3 @@ -__version__ = "1.22.1" +__version__ = "1.22.2" from pypolychord.settings import PolyChordSettings from pypolychord.polychord import run_polychord, run diff --git a/pypolychord/polychord.py b/pypolychord/polychord.py index 947fe4b7..5e1236ea 100644 --- a/pypolychord/polychord.py +++ b/pypolychord/polychord.py @@ -552,6 +552,7 @@ def run(loglikelihood, nDims, **kwargs): 'grade_dims': [nDims], 'nlives': {}, 'seed': -1, + 'cube_samples': None, } default_kwargs['grade_frac'] = ([1.0]*len(default_kwargs['grade_dims']) if 'grade_dims' not in kwargs else @@ -573,10 +574,10 @@ def run(loglikelihood, nDims, **kwargs): (kwargs['file_root'] + ".paramnames")) - if 'cube_samples' in kwargs: - _make_resume_file(loglikelihood, kwargs['prior'], **kwargs) - read_resume = kwargs['read_resume'] - kwargs['read_resume'] = True + read_resume = kwargs['read_resume'] + if kwargs['cube_samples'] is not None: + _make_resume_file(loglikelihood, **kwargs) + read_resume = True def wrap_loglikelihood(theta, phi): logL = loglikelihood(theta) @@ -617,7 +618,7 @@ def wrap_prior(cube, theta): kwargs['cluster_posteriors'], kwargs['write_resume'], kwargs['write_paramnames'], - kwargs['read_resume'], + read_resume, kwargs['write_stats'], kwargs['write_live'], kwargs['write_dead'], @@ -633,9 +634,6 @@ def wrap_prior(cube, theta): kwargs['seed'], ) - if 'cube_samples' in kwargs: - kwargs['read_resume'] = read_resume - try: import anesthetic except ImportError: diff --git a/src/polychord/feedback.f90 b/src/polychord/feedback.f90 index 571c1289..6ff5cf4e 100644 --- a/src/polychord/feedback.f90 +++ b/src/polychord/feedback.f90 @@ -28,8 +28,8 @@ subroutine write_opening_statement(settings) write(stdout_unit,'("")') write(stdout_unit,'("PolyChord: Next Generation Nested Sampling")') write(stdout_unit,'("copyright: Will Handley, Mike Hobson & Anthony Lasenby")') - write(stdout_unit,'(" version: 1.22.1")') - write(stdout_unit,'(" release: 10th Jan 2024")') + write(stdout_unit,'(" version: 1.22.2")') + write(stdout_unit,'(" release: 27th Sep 2024")') write(stdout_unit,'(" email: wh260@mrao.cam.ac.uk")') write(stdout_unit,'("")') end if diff --git a/tests/test_run_pypolychord.py b/tests/test_run_pypolychord.py index 6852da37..9df38c51 100644 --- a/tests/test_run_pypolychord.py +++ b/tests/test_run_pypolychord.py @@ -70,7 +70,7 @@ def test_run(likelihood, nDims, nDerived): ns = pypolychord.run(likelihood, nDims, nDerived=nDerived, prior=uniform_prior, paramnames=paramnames, - read_resume=False) + read_resume=False, feedback=0) assert isinstance(ns, ac.NestedSamples) @@ -128,3 +128,12 @@ def test_grade_dims(): pypolychord.run(gaussian_likelihood, 5, nDerived=1, prior=uniform_prior, read_resume=False, grade_dims=grade_dims) + + +def test_cube_samples(): + cube_samples = np.array([[0.1, 0.2, 0.3, 0.4], + [0.5, 0.6, 0.7, 0.8]]) + pypolychord.run(gaussian_likelihood, 4, nDerived=1, + prior=uniform_prior, + read_resume=False, + cube_samples=cube_samples)