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

Improve tau plot

parent 214b16a9
No related branches found
No related tags found
1 merge request!750Improve ptemcee
Pipeline #113275 failed
This commit is part of merge request !750. Comments created here will be created in the context of that merge request.
......@@ -232,7 +232,7 @@ class Ptemcee(MCMCSampler):
tau_usable,
)
if converged:
if converged and tau_usable:
logger.info("Finished sampling")
break
......@@ -301,7 +301,8 @@ class Ptemcee(MCMCSampler):
)
# Generate the tau plot diagnostic
plot_tau(self.tau_list_n, self.tau_list, self.outdir, self.label)
plot_tau(self.tau_list_n, self.tau_list, self.outdir, self.label,
self.autocorr_tol)
def print_progress(
......@@ -419,9 +420,13 @@ def plot_walkers(walkers, nburn, parameter_labels, outdir, label):
plt.close(fig)
def plot_tau(tau_list_n, tau_list, outdir, label):
def plot_tau(tau_list_n, tau_list, outdir, label, autocorr_tol):
fig, ax = plt.subplots()
ax.plot(tau_list_n, tau_list, "-")
check_tau_idx = -int(tau_list[-1] * autocorr_tol)
check_taus = tau_list[check_tau_idx:]
check_taus_n = tau_list_n[check_tau_idx:]
ax.plot(check_taus_n, check_taus, "--")
ax.set_xlabel("Iteration")
ax.set_ylabel(r"$\langle \tau \rangle$")
fig.savefig("{}/{}_tau.png".format(outdir, label))
......
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