Skip to content
Snippets Groups Projects
Commit 1c537b0b authored by Gregory Ashton's avatar Gregory Ashton
Browse files

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
No related branches found
No related tags found
No related merge requests found
......@@ -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'])
......
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