Skip to content

Commit

Permalink
run: more informative error when sampler mis/non-specified
Browse files Browse the repository at this point in the history
  • Loading branch information
JesusTorrado committed Oct 8, 2020
1 parent e59880f commit ab6d04b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cobaya/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ def run(info):
# END OF DEPRECATION BLOCK
# 1. Prepare output driver, if requested by defining an output_prefix
# GetDist needs to know the original sampler, so don't overwrite if minimizer
which_sampler = list(info["sampler"])[0]
try:
which_sampler = list(info["sampler"])[0]
except (KeyError, TypeError):
raise LoggedError(
logger_run, "You need to specify a sampler using the 'sampler' key as e.g. "
"`sampler: {mcmc: None}.`")
infix = "minimize" if which_sampler == "minimize" else None
output = get_output(prefix=info.get(_output_prefix), resume=info.get(_resume),
force=info.get(_force), infix=infix)
Expand Down

0 comments on commit ab6d04b

Please sign in to comment.