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

Fix #49

1) Remove the prior from the result object: we already save them as a
text file, so I don't think they need to be in the result. For now, I've
only commented them out with a message as there may be someone tempted
in the future to add it back in.

2) If the saving data does error, it now continues (without writing the
data) and prints a big error message.
parent 8ca3964e
Pipeline #18684 failed with stages
in 59 seconds
......@@ -37,7 +37,12 @@ class Result(dict):
os.rename(file_name, file_name + '.old')
logging.info("Saving result to {}".format(file_name))
deepdish.io.save(file_name, self)
try:
deepdish.io.save(file_name, self)
except Exception as e:
logging.error(
"\n\n Saving the data has failed with the following message:\n {} \n\n"
.format(e))
def plot_corner(self, save=True, **kwargs):
""" Plot a corner-plot using chain-consumer
......
......@@ -401,7 +401,7 @@ def run_sampler(likelihood, priors=None, label='label', outdir='outdir',
result.log_bayes_factor = result.logz - result.noise_logz
result.injection_parameters = injection_parameters
result.fixed_parameter_keys = [key for key in priors if isinstance(key, prior.DeltaFunction)]
result.prior = priors
# result.prior = prior # Removed as this breaks the saving of the data
result.samples_to_data_frame()
result.save_to_file(outdir=outdir, label=label)
return result
......
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