diff --git a/AUTHORS.md b/AUTHORS.md index 42d22edbc19da2e09d4d7d1d98581acde8fddfb7..a1a3176a7742c09b17b8a238f0098f7aa0c71a14 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -75,7 +75,8 @@ Stephen R Green Sumeet Kulkarni Sylvia Biscoveanu Tathagata Ghosh +Tomasz Baka Virginia d'Emilio Vivien Raymond Ka-Lok Lo -Isaac Legred \ No newline at end of file +Isaac Legred diff --git a/bilby/gw/conversion.py b/bilby/gw/conversion.py index 46e9127103f95e68430896503680809a451b2398..c3640abd335ea60cdf7869ae0c4ae9c3329f46b7 100644 --- a/bilby/gw/conversion.py +++ b/bilby/gw/conversion.py @@ -1479,11 +1479,15 @@ def generate_posterior_samples_from_marginalized_likelihood( use_cache = False if use_cache and os.path.exists(cache_filename) and not command_line_args.clean: - with open(cache_filename, "rb") as f: - cached_samples_dict = pickle.load(f) + try: + 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 - 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 nsamples_converted = np.sum( [len(val) for key, val in cached_samples_dict.items() if key != "_samples"]