Add HMC and BlackJax parameter samplers
This commit is contained in:
parent
fca3d19059
commit
8a0c638e5b
29 changed files with 829 additions and 160 deletions
|
@ -14,6 +14,7 @@ test_omegam = True
|
|||
test_alpha = True
|
||||
test_lam = True
|
||||
test_muA = True
|
||||
test_bulk = True
|
||||
|
||||
# Input box
|
||||
box_in = borg.forward.BoxModel()
|
||||
|
@ -181,4 +182,36 @@ if test_muA:
|
|||
fig.savefig('../figs/muA_test.png')
|
||||
fig.clf()
|
||||
plt.close(fig)
|
||||
|
||||
|
||||
# Test bulk flow
|
||||
if test_bulk:
|
||||
all_vx = np.linspace(-100, 100, 50)
|
||||
all_lkl = np.empty(all_vx.shape)
|
||||
|
||||
for i, vx in enumerate(all_vx):
|
||||
mylike.fwd_param.setModelParams({'bulk_flow_x':vx})
|
||||
all_lkl[i] = mylike.logLikelihoodComplex(s_hat, None)
|
||||
mylike.fwd_param.setModelParams({'bulk_flow_x':mylike.bulk_flow[0]})
|
||||
# fid_lkl = mylike.logLikelihoodComplex(s_hat, None)
|
||||
fid_lkl = np.amin(all_lkl)
|
||||
all_lkl -= fid_lkl
|
||||
all_lkl = np.exp(-all_lkl)
|
||||
|
||||
sigma_bulk = utils.get_sigma_bulk(mylike.L[0], mylike.fwd.getCosmoParams())
|
||||
ref_lkl = np.exp(-all_vx ** 2 / 2 / sigma_bulk ** 2)
|
||||
ref_lkl *= np.amax(all_lkl) / np.amax(ref_lkl)
|
||||
|
||||
fig, ax = plt.subplots(1, 1, figsize=(5,5))
|
||||
ax.plot(all_vx, all_lkl, label='Posterior')
|
||||
ax.plot(all_vx, ref_lkl, ls='--', label=r'$\Lambda$CDM prior')
|
||||
ax.axhline(y=0, color='k')
|
||||
ax.axvline(x=mylike.muA[0], color='k')
|
||||
ax.legend()
|
||||
ax.set_xlabel(r'$v_{{\rm bulk}, x}$')
|
||||
ax.set_ylabel(r'$\mathcal{L}$')
|
||||
fig.tight_layout()
|
||||
fig.savefig('../figs/bulk_test.png')
|
||||
fig.clf()
|
||||
plt.close(fig)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue