Skip to content

Commit

Permalink
found and fixed bug in TP1 repreated measreuments histograms
Browse files Browse the repository at this point in the history
  • Loading branch information
kylajones committed Dec 21, 2023
1 parent cb0ea2c commit 9e3eaac
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
12 changes: 10 additions & 2 deletions linfa/plot_disc.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def plot_disr_histograms(lf_file, lf_dicr_file, lf_discr_noise_file, data_file,
lf_model = np.loadtxt(lf_file) # Samples from low-fidelity posterior
lf_model_plus_disc = np.loadtxt(lf_dicr_file) # Samples from low-fidelity posterior + discrepancy
lf_model_plus_disc_plus_noise = np.loadtxt(lf_discr_noise_file) # Samples from low-fidelity posterior + discrepancy + noise

# Check for repated observations
## shape : no. var inputs pairs x no. batches
num_dim = len(np.shape(lf_model))
Expand All @@ -35,7 +35,15 @@ def plot_disr_histograms(lf_file, lf_dicr_file, lf_discr_noise_file, data_file,
plt.hist(lf_model, label = r'$\eta \vert \mathbf{\theta}$', alpha = 0.5, density = True, hatch = '/')
plt.hist(lf_model_plus_disc, label = r'$\zeta \vert \mathbf{\theta}, \delta$', alpha = 0.5, density = True)
plt.hist(lf_model_plus_disc_plus_noise, label = r'$y \vert \mathbf{\theta}, \delta, \epsilon$', alpha = 0.5, density = True, hatch = '.')
plt.axvline(data[2], label = r'$y$', color = 'k', linewidth = 3)

for loopA in range(len(data[2:])):
if loopA == 0:
# add label to legend
plt.axvline(data[2 + loopA], label = r'$y$', color = 'k', linewidth = 3)
else:
plt.axvline(data[2 + loopA], color = 'k', linewidth = 3)


plt.legend(fontsize = 14)
ax.set_xlabel('Coverage [ ]', fontweight = 'bold', fontsize = 16)
ax.set_ylabel('Density', fontweight = 'bold', fontsize = 16)
Expand Down
24 changes: 12 additions & 12 deletions linfa/tests/test_plot_discr.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# # discr_surface
# python3 -m linfa.plot_disc --folder results/ \
# --name test_08_lf_w_disc_TP1_prior \
# --iter 25000 \
# --mode histograms \
# --num_points 10 \
# --limfactor 1.0 \
python3 -m linfa.plot_disc --folder results/ \
--name test_17_lf_w_disc_TP1_prior_rep_meas \
--iter 25000 \
--mode histograms \
--num_points 10 \
--limfactor 1.0 \

# python3 -m linfa.plot_disc --folder results/ \
# --name test_18_lf_w_disc_TP15_prior_rep_meas \
Expand All @@ -13,12 +13,12 @@
# --num_points 40 \
# --limfactor 1.0 \

python3 -m linfa.plot_disc --folder results/ \
--name test_18_lf_w_disc_TP15_prior_rep_meas \
--iter 25000 \
--mode marginal_posterior \
--num_points 40 \
--limfactor 1.0 \
# python3 -m linfa.plot_disc --folder results/ \
# --name test_17_lf_w_disc_TP1_prior_rep_meas \
# --iter 25000 \
# --mode marginal_posterior \
# --num_points 40 \
# --limfactor 1.0 \

# python3 -m linfa.plot_res --folder results/ \
# --name test_08_lf_w_disc_TP1_prior \
Expand Down

0 comments on commit 9e3eaac

Please sign in to comment.