Skip to content

Commit

Permalink
fix bug repeatedly loading same Cobaya info
Browse files Browse the repository at this point in the history
  • Loading branch information
cmbant committed Dec 23, 2022
1 parent c48c6c1 commit b9832f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
19 changes: 10 additions & 9 deletions getdist/cobaya_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,22 @@ def get_info_params(info):
def get_range(param_info):
# Sampled
if is_sampled_param(param_info):
if isinstance(param_info[_prior], Sequence) and len(param_info[_prior]) == 2:
param_info[_prior] = \
{lim: n for lim, n in zip(["min", "max"], param_info[_prior])}
elif not isinstance(param_info[_prior], Mapping):
prior = param_info[_prior]
if isinstance(prior, Sequence) and len(prior) == 2:
prior = {lim: n for lim, n in zip(["min", "max"], prior)}
elif not isinstance(prior, Mapping):
raise ValueError(
"Format of prior not recognised: %r. " % param_info[_prior] +
"Format of prior not recognised: %r. " % prior +
"Use '[min, max]' or a dictionary following Cobaya's documentation.")
info_lims = dict((tag, param_info[_prior].get(tag))
info_lims = dict((tag, prior.get(tag))
for tag in ["min", "max", "loc", "scale"])
if info_lims["min"] is not None or info_lims["max"] is not None:
lims = [param_info[_prior].get("min"), param_info[_prior].get("max")]
lims = [prior.get("min"), prior.get("max")]
elif info_lims["loc"] is not None or info_lims["scale"] is not None:
dist = param_info[_prior].pop(_p_dist, "uniform")
args = prior.copy()
dist = args.pop(_p_dist, "uniform")
pdf_dist = getattr(import_module("scipy.stats", dist), dist)
lims = pdf_dist.interval(1, **param_info[_prior])
lims = pdf_dist.interval(1, **args)
# Derived
elif is_derived_param(param_info):
lims = (lambda i: [i.get("min", -np.inf), i.get("max", np.inf)])(param_info or {})
Expand Down
2 changes: 1 addition & 1 deletion getdist/convolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def convolve2D(x, y, mode, largest_size=0, cache=None, cache_args=(1, 2)):
# noinspection PyUnboundLocalVariable
def convolveFFT(x, y, mode='same', yfft=None, xfft=None, largest_size=0, cache=None, cache_args=(1, 2)):
"""
convolution of x with y; fft cans be cached.
convolution of x with y; ffts can be cached.
Be careful with caches, key uses id which can be reused for different object if object is freed.
"""
size = x.size + y.size - 1
Expand Down
1 change: 1 addition & 0 deletions getdist/gui/mainwindow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python

# !/usr/bin/env python

import os
Expand Down

0 comments on commit b9832f9

Please sign in to comment.