diff --git a/bilby/core/prior.py b/bilby/core/prior.py index c03aa80338f670c5f8b647d7a098bfa5f60dc1ba..4e731629ad51b3a6d70fa12a079dfd02363ca025 100644 --- a/bilby/core/prior.py +++ b/bilby/core/prior.py @@ -2223,7 +2223,7 @@ class MultivariateGaussianDist(object): probability will not be properly normalised. """ - return np.exp(self.log_prob(samp)) + return np.exp(self.ln_prob(samp)) def __len__(self): return len(self.names) diff --git a/test/prior_test.py b/test/prior_test.py index 28df11dc9216dcdcf6d29ad0745e41d4a8bdefee..e3abc3e5ee3b34cb0a0fc41ea33e2258c2447f1f 100644 --- a/test/prior_test.py +++ b/test/prior_test.py @@ -129,6 +129,10 @@ class TestPriorClasses(unittest.TestCase): mus=[1, 1], covs=np.array([[2., 0.5], [0.5, 2.]]), weights=1.) + mvn = bilby.core.prior.MultivariateGaussianDist(names=['testa', 'testb'], + mus=[1, 1], + covs=np.array([[2., 0.5], [0.5, 2.]]), + weights=1.) self.priors = [ bilby.core.prior.DeltaFunction(name='test', unit='unit', peak=1), @@ -162,6 +166,8 @@ class TestPriorClasses(unittest.TestCase): bilby.gw.prior.AlignedSpin(name='test', unit='unit'), bilby.core.prior.MultivariateGaussian(mvg=mvg, name='testa', unit='unit'), bilby.core.prior.MultivariateGaussian(mvg=mvg, name='testb', unit='unit'), + bilby.core.prior.MultivariateNormal(mvg=mvn, name='testa', unit='unit'), + bilby.core.prior.MultivariateNormal(mvg=mvn, name='testb', unit='unit') ] def test_minimum_rescaling(self): @@ -447,7 +453,7 @@ class TestPriorClasses(unittest.TestCase): bilby.core.prior.HalfGaussian, bilby.core.prior.LogNormal, bilby.core.prior.Exponential, bilby.core.prior.StudentT, bilby.core.prior.Logistic, bilby.core.prior.Cauchy, - bilby.core.prior.Gamma)): + bilby.core.prior.Gamma, bilby.core.prior.MultivariateGaussian)): continue prior.maximum = (prior.maximum + prior.minimum) / 2 self.assertTrue(max(prior.sample(10000)) < prior.maximum) @@ -459,7 +465,7 @@ class TestPriorClasses(unittest.TestCase): bilby.core.prior.HalfGaussian, bilby.core.prior.LogNormal, bilby.core.prior.Exponential, bilby.core.prior.StudentT, bilby.core.prior.Logistic, bilby.core.prior.Cauchy, - bilby.core.prior.Gamma)): + bilby.core.prior.Gamma, bilby.core.prior.MultivariateGaussian)): continue prior.minimum = (prior.maximum + prior.minimum) / 2 self.assertTrue(min(prior.sample(10000)) > prior.minimum) diff --git a/test/sampler_test.py b/test/sampler_test.py index 2500fab13aede95032c78cda76e8a7832a7f2dd5..f3063b4628e9d76b3808a557258ea8a3321cc7eb 100644 --- a/test/sampler_test.py +++ b/test/sampler_test.py @@ -363,7 +363,7 @@ class TestPyMC3(unittest.TestCase): draws=500, step=None, init='auto', n_init=200000, start=None, trace=None, chain_idx=0, chains=2, cores=1, tune=500, nuts_kwargs=None, step_kwargs=None, progressbar=True, model=None, random_seed=None, live_plot=False, discard_tuned_samples=True, - live_plot_kwargs=None, compute_convergence_checks=True, use_mmap=False) + live_plot_kwargs=None, compute_convergence_checks=True) self.assertDictEqual(expected, self.sampler.kwargs) def test_translate_kwargs(self): @@ -371,7 +371,7 @@ class TestPyMC3(unittest.TestCase): draws=500, step=None, init='auto', n_init=200000, start=None, trace=None, chain_idx=0, chains=2, cores=1, tune=500, nuts_kwargs=None, step_kwargs=None, progressbar=True, model=None, random_seed=None, live_plot=False, discard_tuned_samples=True, - live_plot_kwargs=None, compute_convergence_checks=True, use_mmap=False) + live_plot_kwargs=None, compute_convergence_checks=True) self.sampler.kwargs['draws'] = 123 for equiv in bilby.core.sampler.base_sampler.NestedSampler.npoints_equiv_kwargs: new_kwargs = self.sampler.kwargs.copy()