Skip to content
Snippets Groups Projects

Improve ptemcee

Merged Gregory Ashton requested to merge improve-ptemcee into master
All threads resolved!
1 file
+ 8
3
Compare changes
  • Side-by-side
  • Inline
@@ -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))
Loading