Add hmc model sampler and fix initial As set to zero

This commit is contained in:
Deaglan Bartlett 2024-08-15 17:47:43 +02:00
parent e55eee4b17
commit 7348a826ff
20 changed files with 430 additions and 211 deletions

View file

@ -37,12 +37,6 @@ mylike.updateCosmology(cosmo)
s_hat = np.fft.rfftn(np.random.randn(*box_in.N)) / box_in.Ntot ** (0.5)
mylike.generateMockData(s_hat, state)
scale = 1.0
L = mylike.logLikelihoodComplex(scale * s_hat, None)
print(L)
quit()
if test_scaling:
all_scale = np.linspace(0.5, 1.5, 100)
all_lkl = np.empty(all_scale.shape)
@ -66,7 +60,7 @@ if test_scaling:
# Test sigma8
if test_sigma8:
all_sigma8 = np.linspace(0.5, 1.2, 40)
all_sigma8 = np.linspace(0.5, 1.2, 100)
all_lkl = np.empty(all_sigma8.shape)
cosmo_true = mylike.fwd.getCosmoParams()
cosmo = mylike.fwd.getCosmoParams()
@ -93,7 +87,7 @@ if test_sigma8:
# Test sigma8
if test_omegam:
all_omegam = np.linspace(0.1, 0.6, 40)
all_omegam = np.linspace(0.1, 0.6, 100)
all_lkl = np.empty(all_omegam.shape)
cosmo_true = mylike.fwd.getCosmoParams()
cosmo = mylike.fwd.getCosmoParams()
@ -119,7 +113,7 @@ if test_omegam:
# Test bias model
if test_alpha:
all_alpha = np.linspace(-2.0, 5.0, 50)
all_alpha = np.linspace(-2.0, 5.0, 100)
all_lkl = np.empty(all_alpha.shape)
for i, alpha in enumerate(all_alpha):
mylike.fwd_param.setModelParams({'alpha0':alpha})
@ -143,7 +137,7 @@ if test_alpha:
# Test bias model
if test_muA:
all_muA = np.linspace(0.95, 1.05, 50)
all_muA = np.linspace(0.95, 1.05, 100)
all_lkl = np.empty(all_muA.shape)
for i, muA in enumerate(all_muA):
mylike.fwd_param.setModelParams({'mua0':muA})