Gitlab will migrate to a new storage backend starting 0300 UTC on 2020-04-04. We do not anticipate a maintenance window for this migration. Performance may be impacted over the weekend. Thanks for your patience.

Commit 1c537b0b authored by Gregory Ashton's avatar Gregory Ashton

Add a catch for broken resume files

If the dynesty pickle file is broken, it will print a warning that the
reading of the resume file and otherwise continue as if the resume file
didn't exist
parent 23a4ff2c
......@@ -307,10 +307,14 @@ class Dynesty(NestedSampler):
if os.path.isfile(self.resume_file):
logger.info("Reading resume file {}".format(self.resume_file))
with open(self.resume_file, 'rb') as file:
saved = pickle.load(file)
logger.info(
"Succesfuly read resume file {}".format(self.resume_file))
try:
with open(self.resume_file, 'rb') as file:
saved = pickle.load(file)
logger.info(
"Succesfuly read resume file {}".format(self.resume_file))
except EOFError as e:
logger.warning("Resume file reading failed with error {}".format(e))
return False
self.sampler.saved_u = list(saved['unit_cube_samples'])
self.sampler.saved_v = list(saved['physical_samples'])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment