Skip to content

Commit

Permalink
Refactored Gaussian model init function to be compatible with tests a…
Browse files Browse the repository at this point in the history
…gain.
  • Loading branch information
mschoengens committed Feb 13, 2017
1 parent cc7f724 commit 95513a8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions abcpy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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. ")
Expand All @@ -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)
Expand Down

0 comments on commit 95513a8

Please sign in to comment.