From 95513a81e94677aaba8534d5d84f78e5cd133a1c Mon Sep 17 00:00:00 2001 From: Marcel Schoengens Date: Mon, 13 Feb 2017 13:23:48 +0100 Subject: [PATCH] Refactored Gaussian model init function to be compatible with tests again. --- abcpy/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/abcpy/models.py b/abcpy/models.py index a8931b57..9cd6179b 100644 --- a/abcpy/models.py +++ b/abcpy/models.py @@ -118,10 +118,9 @@ def __init__(self, prior, mu = None, sigma = None, seed=None): Initial seed. The default value is generated randomly. """ - # test and set prior + # test prior if np.shape(prior.sample(1)) == (1,2): self.prior = prior - self.sample_from_prior() else: raise ValueError("Prior generates values outside the model " "parameter domain. ") @@ -134,6 +133,9 @@ def __init__(self, prior, mu = None, sigma = None, seed=None): if mu != None and sigma != None: if self.set_parameters(np.array([mu, sigma])) == False: raise ValueError("The parameter values are out of the model parameter domain.") + else: + self.sample_from_prior() + # set random number generator self.rng = np.random.RandomState(seed)