Skip to content
Snippets Groups Projects
Commit 5d2dc914 authored by Colm Talbot's avatar Colm Talbot
Browse files

Merge branch 'fix-prior-writing' into 'master'

Fix the writing of priors to include the module

See merge request !1127
parents 6b3fbba8 2671d174
No related branches found
No related tags found
1 merge request!1127Fix the writing of priors to include the module
Pipeline #437760 passed
......@@ -214,10 +214,13 @@ class Prior(object):
"""
prior_name = self.__class__.__name__
prior_module = self.__class__.__module__
instantiation_dict = self.get_instantiation_dict()
args = ', '.join(['{}={}'.format(key, repr(instantiation_dict[key]))
for key in instantiation_dict])
return "{}({})".format(prior_name, args)
args = ', '.join([f'{key}={repr(instantiation_dict[key])}' for key in instantiation_dict])
if "bilby.core.prior" in prior_module:
return f"{prior_name}({args})"
else:
return f"{prior_module}.{prior_name}({args})"
@property
def _repr_dict(self):
......
......@@ -673,7 +673,7 @@ class TestPriorClasses(unittest.TestCase):
"bilby.core.prior.MultivariateGaussianDist",
)
elif isinstance(prior, bilby.gw.prior.HealPixPrior):
repr_prior_string = "bilby.gw.prior." + repr(prior)
repr_prior_string = repr(prior)
repr_prior_string = repr_prior_string.replace(
"HealPixMapPriorDist", "bilby.gw.prior.HealPixMapPriorDist"
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment