Skip to content

Commit

Permalink
fix default grade_frac
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamOrmondroyd committed Jan 10, 2024
1 parent a17d78d commit cdaf063
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pypolychord/polychord.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: "
Expand Down
5 changes: 2 additions & 3 deletions tests/test_run_pypolychord.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit cdaf063

Please sign in to comment.