Add radial selection

This commit is contained in:
Deaglan Bartlett 2024-09-18 22:01:24 +02:00
parent 7348a826ff
commit fca3d19059
25 changed files with 1384 additions and 85 deletions

View file

@ -7,11 +7,12 @@ import borg_velocity.likelihood as likelihood
import borg_velocity.forwards as forwards
import borg_velocity.utils as utils
ini_file = '../conf/basic_ini.ini'
ini_file = '../conf/supranta_ini.ini'
test_scaling = True
test_sigma8 = True
test_omegam = True
test_alpha = True
test_lam = True
test_muA = True
# Input box
@ -34,6 +35,7 @@ mylike = likelihood.VelocityBORGLikelihood(model, fwd_param, fwd_vel, ini_file)
state = borg.likelihood.MarkovState()
mylike.initializeLikelihood(state)
mylike.updateCosmology(cosmo)
np.random.seed(2)
s_hat = np.fft.rfftn(np.random.randn(*box_in.N)) / box_in.Ntot ** (0.5)
mylike.generateMockData(s_hat, state)
@ -84,8 +86,7 @@ if test_sigma8:
fig.clf()
plt.close(fig)
# Test sigma8
# Test omegam
if test_omegam:
all_omegam = np.linspace(0.1, 0.6, 100)
all_lkl = np.empty(all_omegam.shape)
@ -134,6 +135,29 @@ if test_alpha:
fig.clf()
plt.close(fig)
# Test radial sampling
if test_lam:
all_lam = np.linspace(0.0, 10.0, 100)
all_lkl = np.empty(all_lam.shape)
for i, lam in enumerate(all_lam):
mylike.fwd_param.setModelParams({'lam0':lam})
all_lkl[i] = mylike.logLikelihoodComplex(s_hat, None)
mylike.fwd_param.setModelParams({'lam0':mylike.lam[0]})
fid_lkl = mylike.logLikelihoodComplex(s_hat, None)
all_lkl -= fid_lkl
all_lkl = np.exp(-all_lkl)
fig, ax = plt.subplots(1, 1, figsize=(5,5))
ax.plot(all_lam, all_lkl)
ax.axhline(y=0, color='k')
ax.axvline(x=mylike.lam[0], color='k')
ax.set_xlabel(r'$\lambda_0$')
ax.set_ylabel(r'$\mathcal{L}$')
fig.tight_layout()
fig.savefig('../figs/lam_test.png')
fig.clf()
plt.close(fig)
# Test bias model
if test_muA:
@ -157,3 +181,4 @@ if test_muA:
fig.savefig('../figs/muA_test.png')
fig.clf()
plt.close(fig)