diff --git a/tupak/core/prior.py b/tupak/core/prior.py index 90ace22259f2d58d896ff1c82400b144f5488528..8f9cfcd8130633b2b777861edb2469296194a069 100644 --- a/tupak/core/prior.py +++ b/tupak/core/prior.py @@ -802,7 +802,7 @@ class Sine(Prior): class Gaussian(Prior): - def __init__(self, mu, sigma, name=None, latex_label=None): + def __init__(self, mu, sigma, name=None, latex_label=None, use_pymc3=False): """Gaussian prior with mean mu and width sigma Parameters @@ -820,7 +820,7 @@ class Gaussian(Prior): latex_label: str See superclass """ - Prior.__init__(self, name, latex_label) + Prior.__init__(self, name, latex_label, use_pymc3=use_pymc3) self.mu = mu self.sigma = sigma @@ -849,6 +849,14 @@ class Gaussian(Prior): def lnprob(self, val): return -0.5 * ((self.mu - val) ** 2 / self.sigma ** 2 + np.log(2 * np.pi * self.sigma ** 2)) + def pymc3_prior(self, sampler): + priortype = 'Normal' + priorargs = {} + priorargs['mu'] = self.mu + priorargs['sd'] = self.sigma + + return self.set_pymc3_prior(sampler, priortype, **priorargs) + def __repr__(self): """Call to helper method in the super class.""" return Prior._subclass_repr_helper(self, subclass_args=['mu', 'sigma'])