Skip to content
Snippets Groups Projects
Commit 4b09136f authored by Tomasz Baka's avatar Tomasz Baka Committed by Colm Talbot
Browse files

Fix cashe reading error

parent ed43d6d9
No related branches found
No related tags found
1 merge request!1126Fix cashe reading error
...@@ -75,7 +75,8 @@ Stephen R Green ...@@ -75,7 +75,8 @@ Stephen R Green
Sumeet Kulkarni Sumeet Kulkarni
Sylvia Biscoveanu Sylvia Biscoveanu
Tathagata Ghosh Tathagata Ghosh
Tomasz Baka
Virginia d'Emilio Virginia d'Emilio
Vivien Raymond Vivien Raymond
Ka-Lok Lo Ka-Lok Lo
Isaac Legred Isaac Legred
\ No newline at end of file
...@@ -1479,11 +1479,15 @@ def generate_posterior_samples_from_marginalized_likelihood( ...@@ -1479,11 +1479,15 @@ def generate_posterior_samples_from_marginalized_likelihood(
use_cache = False use_cache = False
if use_cache and os.path.exists(cache_filename) and not command_line_args.clean: if use_cache and os.path.exists(cache_filename) and not command_line_args.clean:
with open(cache_filename, "rb") as f: try:
cached_samples_dict = pickle.load(f) with open(cache_filename, "rb") as f:
cached_samples_dict = pickle.load(f)
except EOFError:
logger.warning("Cache file is empty")
cached_samples_dict = None
# Check the samples are identical between the cache and current # Check the samples are identical between the cache and current
if cached_samples_dict["_samples"].equals(samples): if (cached_samples_dict is not None) and (cached_samples_dict["_samples"].equals(samples)):
# Calculate reconstruction percentage and print a log message # Calculate reconstruction percentage and print a log message
nsamples_converted = np.sum( nsamples_converted = np.sum(
[len(val) for key, val in cached_samples_dict.items() if key != "_samples"] [len(val) for key, val in cached_samples_dict.items() if key != "_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