Commit f5bfa9a6 authored by Gregory Ashton's avatar Gregory Ashton

If there are NaNs in the posterior, continue onward but print a message

NaNs in the posterior are generted by the conversion function (say when
the prior is fixed to zero for the spins). This causes the
plot_marginals to fail. Instead, a message will be printed, but the
script will otherwise continue.
parent c1ccda15
Pipeline #42718 passed with stage
in 9 minutes and 41 seconds
......@@ -468,8 +468,14 @@ class Result(object):
logger.info('Plotting {} marginal distribution'.format(key))
label = self.get_latex_labels_from_parameter_keys([key])[0]
fig, ax = plt.subplots()
ax.hist(self.posterior[key].values, bins=bins, density=True,
histtype='step', cumulative=cumulative)
try:
ax.hist(self.posterior[key].values, bins=bins, density=True,
histtype='step', cumulative=cumulative)
except ValueError as e:
logger.info(
'Failed to generate 1d plot for {}, error message: {}'
.format(key, e))
return
ax.set_xlabel(label, fontsize=label_fontsize)
if truth is not None:
ax.axvline(truth, ls='-', color='orange')
......
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