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

Fix CI failures

parent 6532c63d
No related branches found
No related tags found
1 merge request!1095Fix CI failures
......@@ -213,7 +213,7 @@ docs:
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python39
before_script:
- conda install -c conda-forge pandoc -y
- python -m pip install ipykernel ipython jupyter
- python -m pip install --upgrade ipykernel ipython jupyter nbconvert
- python -m ipykernel install
script:
# Make the documentation
......
......@@ -5,7 +5,7 @@ repos:
- id: check-merge-conflict # prevent committing files with merge conflicts
- id: flake8 # checks for flake8 errors
- repo: https://github.com/psf/black
rev: 21.12b0
rev: 22.3.0
hooks:
- id: black
language_version: python3
......
......@@ -614,7 +614,7 @@ class BilbyPTMCMCSampler(object):
elif pt_inputs.Tmax_from_SNR is not None:
ndim = len(_priors.non_fixed_keys)
target_hot_likelihood = ndim / 2
Tmax = pt_inputs.Tmax_from_SNR ** 2 / (2 * target_hot_likelihood)
Tmax = pt_inputs.Tmax_from_SNR**2 / (2 * target_hot_likelihood)
betas = np.logspace(0, -np.log10(Tmax), pt_inputs.ntemps)
else:
raise SamplerError("Unable to set temperature ladder from inputs")
......
......@@ -23,14 +23,14 @@ class ZeroLikelihood(bilby.core.likelihood.Likelihood):
def condition_func_y(reference_params, x):
"""Condition function for our p(y|x) prior."""
radius = 0.5 * (reference_params["maximum"] - reference_params["minimum"])
y_max = np.sqrt(radius ** 2 - x ** 2)
y_max = np.sqrt(radius**2 - x**2)
return dict(minimum=-y_max, maximum=y_max)
def condition_func_z(reference_params, x, y):
"""Condition function for our p(z|x, y) prior."""
radius = 0.5 * (reference_params["maximum"] - reference_params["minimum"])
z_max = np.sqrt(radius ** 2 - x ** 2 - y ** 2)
z_max = np.sqrt(radius**2 - x**2 - y**2)
return dict(minimum=-z_max, maximum=z_max)
......
......@@ -39,7 +39,7 @@ class SimpleGaussianLikelihood(bilby.Likelihood):
sigma = self.parameters["sigma"]
res = self.data - mu
return -0.5 * (
np.sum((res / sigma) ** 2) + self.N * np.log(2 * np.pi * sigma ** 2)
np.sum((res / sigma) ** 2) + self.N * np.log(2 * np.pi * sigma**2)
)
......
......@@ -78,8 +78,8 @@ fig2.savefig("outdir/hyper_parameter_combined_posteriors.png")
def hyper_prior(dataset, mu, sigma):
return (
np.exp(-((dataset["c0"] - mu) ** 2) / (2 * sigma ** 2))
/ (2 * np.pi * sigma ** 2) ** 0.5
np.exp(-((dataset["c0"] - mu) ** 2) / (2 * sigma**2))
/ (2 * np.pi * sigma**2) ** 0.5
)
......
......@@ -85,7 +85,7 @@ class Polynomial(bilby.Likelihood):
res = self.y - self.polynomial(self.x, self.parameters)
return -0.5 * (
np.sum((res / self.sigma) ** 2)
+ self.N * np.log(2 * np.pi * self.sigma ** 2)
+ self.N * np.log(2 * np.pi * self.sigma**2)
)
......
......@@ -27,8 +27,8 @@ bilby.utils.check_directory_exists_and_if_not_mkdir(outdir)
def gaussian(xs, amplitude, mu, sigma):
return (
amplitude
/ np.sqrt(2 * np.pi * sigma ** 2)
* np.exp(-0.5 * (xs - mu) ** 2 / sigma ** 2)
/ np.sqrt(2 * np.pi * sigma**2)
* np.exp(-0.5 * (xs - mu) ** 2 / sigma**2)
)
......
......@@ -26,10 +26,14 @@ gw_args = [(fname.split("/")[-1][:-3], fname) for fname in gw_examples]
def _execute_file(name, fname):
print("Running {}".format(fname))
dname, fname = os.path.split(fname)
old_directory = os.getcwd()
os.chdir(dname)
print(f"Running {fname} from {dname}")
spec = importlib.util.spec_from_file_location(name, fname)
foo = importlib.util.module_from_spec(spec)
spec.loader.exec_module(foo)
os.chdir(old_directory)
class ExampleTest(unittest.TestCase):
......
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