diff --git a/pypolychord/polychord.py b/pypolychord/polychord.py index 76ba3862..a040ac72 100644 --- a/pypolychord/polychord.py +++ b/pypolychord/polychord.py @@ -553,7 +553,9 @@ def run(loglikelihood, nDims, **kwargs): 'nlives': {}, 'seed': -1, } - default_kwargs['grade_frac'] = [1.0]*len(default_kwargs['grade_dims']) + default_kwargs['grade_frac'] = ([1.0]*len(default_kwargs['grade_dims']) + if 'grade_dims' not in kwargs else + [1.0]*len(kwargs['grade_dims'])) if not set(kwargs.keys()) <= set(default_kwargs.keys()): raise TypeError(f"{__name__} got unknown keyword arguments: " diff --git a/tests/test_run_pypolychord.py b/tests/test_run_pypolychord.py index d9181a86..6852da37 100644 --- a/tests/test_run_pypolychord.py +++ b/tests/test_run_pypolychord.py @@ -121,11 +121,10 @@ def no_derived_gaussian_likelihood(theta): def test_grade_dims(): grade_dims = [1, 3] - grade_frac = [0.5, 0.5] pypolychord.run(gaussian_likelihood, 4, nDerived=1, prior=uniform_prior, read_resume=False, - grade_dims=grade_dims, grade_frac=grade_frac) + grade_dims=grade_dims) with pytest.raises(ValueError): pypolychord.run(gaussian_likelihood, 5, nDerived=1, prior=uniform_prior, read_resume=False, - grade_dims=grade_dims, grade_frac=grade_frac) + grade_dims=grade_dims)