From 9fc0969faf3b2b319d63f347aed30dbd2e1b5ef1 Mon Sep 17 00:00:00 2001
From: Matthew Pitkin <matthew.pitkin@ligo.org>
Date: Mon, 6 Aug 2018 23:03:25 +0100
Subject: [PATCH] sampler.py: fix bug

---
 tupak/core/sampler.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tupak/core/sampler.py b/tupak/core/sampler.py
index 9ef04661f..1e505cf4c 100644
--- a/tupak/core/sampler.py
+++ b/tupak/core/sampler.py
@@ -1196,10 +1196,13 @@ class Pymc3(Sampler):
 
                 if distname in self.prior_map:
                     # check if we have a predefined PyMC3 distribution
-                    if 'pymc3' in self.prior_map[distname] and 'argmap' in self.prior_map[distname] and distname in pymc3.__dict__:
+                    if 'pymc3' in self.prior_map[distname] and 'argmap' in self.prior_map[distname]:
                         # check the required arguments for the PyMC3 distribution
                         pymc3distname = self.prior_map[distname]['pymc3']
 
+                        if pymc3distname not in pymc3.__dict__:
+                            raise ValueError("Prior '{}' is not a known PyMC3 distribution.".format(pymc3distname))
+
                         reqargs = inspect.getargspec(pymc3.__dict__[pymc3distname].__init__).args[1:]
 
                         # set keyword arguments
-- 
GitLab