Skip to content

Commit

Permalink
restore sampled params
Browse files Browse the repository at this point in the history
  • Loading branch information
xgarrido committed Mar 29, 2024
1 parent db3ea10 commit 96110c3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cobaya_utilities/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ def get_sampled_parameters(mcmc_samples, prefix="mcmc", return_params=False):
r1 = re.compile(r".*mcmc\] \*.*: (.*)")
r2 = re.compile(r".*model\].*Input: (.*)")

latex_params = {}
sampled_params = {}
for name, value in mcmc_samples.items():
path = _get_path(name, value)
Expand All @@ -569,13 +570,14 @@ def get_sampled_parameters(mcmc_samples, prefix="mcmc", return_params=False):
if len(found) == 0:
continue
params = eval(found[0])
sampled_params.setdefault(name, []).extend(
sampled_params.setdefault(name, []).extend(params)
latex_params.setdefault(name, []).extend(
[latex_table.get(par, par) for par in params]
)
if "Sampling!" in line:
break

df = pd.DataFrame.from_dict(sampled_params, orient="index").T.fillna("")
df = pd.DataFrame.from_dict(latex_params, orient="index").T.fillna("")
df = df.style.set_properties(width="150px")
if return_params:
return df, sampled_params
Expand Down

0 comments on commit 96110c3

Please sign in to comment.