Skip to content

Commit

Permalink
Changed plotting behaviour in MCMC and nested sampling plot related f…
Browse files Browse the repository at this point in the history
…unctions
  • Loading branch information
VChristiaens committed Mar 26, 2024
1 parent ed00bb9 commit dbb6614
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
3 changes: 2 additions & 1 deletion vip_hci/fm/negfc_fmerit.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,8 @@ def get_mu_and_sigma(

indices = get_annular_wedge(pca_res, radius_int, 2 * fwhm, wedge=wedge)
yy, xx = indices
indices_inv = get_annular_wedge(pca_res_inv, radius_int, 2 * fwhm, wedge=wedge)
indices_inv = get_annular_wedge(pca_res_inv, radius_int, 2 * fwhm,
wedge=wedge)
yyi, xxi = indices_inv
all_res = np.concatenate((pca_res[yy, xx], pca_res_inv[yyi, xxi]))
mu = np.mean(all_res)
Expand Down
4 changes: 0 additions & 4 deletions vip_hci/fm/negfc_mcmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,8 +1162,6 @@ def show_walk_plot(chain, save=False, output_dir='', **kwargs):
if save:
plt.savefig(output_dir+'walk_plot.pdf')
plt.close(fig)
else:
plt.show()


def show_corner_plot(chain, burnin=0.5, save=False, output_dir='', **kwargs):
Expand Down Expand Up @@ -1219,8 +1217,6 @@ def show_corner_plot(chain, burnin=0.5, save=False, output_dir='', **kwargs):
if save:
plt.savefig(output_dir+'corner_plot.pdf')
plt.close(fig)
else:
plt.show()


def confidence(isamples, cfd=68.27, bins=100, gaussian_fit=False, weights=None,
Expand Down
9 changes: 6 additions & 3 deletions vip_hci/fm/negfc_nested.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,17 +391,20 @@ def nested_sampling_results(ns_object, burnin=0.4, bins=None, cfd=68.27,
plt.ylabel('weights')
plt.vlines(indburnin, res.weights.min(), res.weights.max(),
linestyles='dotted')
if save:
plt.savefig(output_dir+'Nested_results.pdf')
if plot:
plt.show()

plt.savefig(output_dir+'Nested_results.pdf')

print("\nWalk plots before the burnin")
show_walk_plot(np.expand_dims(res.samples, axis=0))
if burnin > 0:
print("\nWalk plots after the burnin")
show_walk_plot(np.expand_dims(res.samples[indburnin:], axis=0))
plt.savefig(output_dir+'Nested_walk_plots.pdf')
if save:
plt.savefig(output_dir+'Nested_walk_plots.pdf')
if plot:
plt.show()

mean, cov = nestle.mean_and_cov(res.samples[indburnin:],
res.weights[indburnin:])
Expand Down

0 comments on commit dbb6614

Please sign in to comment.