diff --git a/examples/core_examples/alternative_samplers/linear_regression_pymc_custom_likelihood.py b/examples/core_examples/alternative_samplers/linear_regression_pymc_custom_likelihood.py index ae6c58a27dad02645813d5e4bf3b16ecd20cf4b4..1fccbcde6e3707738fb2e18bffe0b7f687571ae0 100644 --- a/examples/core_examples/alternative_samplers/linear_regression_pymc_custom_likelihood.py +++ b/examples/core_examples/alternative_samplers/linear_regression_pymc_custom_likelihood.py @@ -12,6 +12,7 @@ import bilby import matplotlib.pyplot as plt import numpy as np import pymc as pm +from bilby.core.sampler.pymc import Pymc # A few simple setup steps label = "linear_regression_pymc_custom_likelihood" @@ -76,13 +77,11 @@ class GaussianLikelihoodPyMC(bilby.core.likelihood.GaussianLikelihood): ---------- sampler: :class:`bilby.core.sampler.Pymc` A Sampler object must be passed containing the prior distributions - and PyMC3 :class:`~pymc3.Model` to use as a context manager. + and PyMC :class:`~pymc.Model` to use as a context manager. If this is not passed, the super class is called and the regular likelihood is evaluated. """ - from bilby.core.sampler.pymc import Pymc - if not isinstance(sampler, Pymc): return super(GaussianLikelihoodPyMC, self).log_likelihood() @@ -116,15 +115,12 @@ class PyMCUniformPrior(bilby.core.prior.Uniform): def ln_prob(self, sampler=None): """ - Change ln_prob method to take in a Sampler and return a PyMC3 + Change ln_prob method to take in a Sampler and return a PyMC distribution. - If the passed argument is not a `Pymc3` sampler, assume that it is a + If the passed argument is not a `Pymc` sampler, assume that it is a float or array to be passed to the superclass. """ - - from bilby.core.sampler import Pymc - if not isinstance(sampler, Pymc): return super(PyMCUniformPrior, self).ln_prob(sampler)