Generate mock data from borg, create MB data and prepare likelihood
This commit is contained in:
parent
874d26e38c
commit
85b93c539f
15 changed files with 1192 additions and 11 deletions
5
tests/allocation_stats_0.txt
Normal file
5
tests/allocation_stats_0.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
Memory still allocated at the end: 0 MB
|
||||
|
||||
Statistics per context (name, allocated, freed, peak)
|
||||
======================
|
||||
|
28
tests/fft_wisdom
Normal file
28
tests/fft_wisdom
Normal file
|
@ -0,0 +1,28 @@
|
|||
(fftw-3.3.10 fftw_wisdom #x3c273403 #x192df114 #x4d08727c #xe98e9b9d
|
||||
(fftw_dft_thr_vrank_geq1_register 0 #x10bdd #x10bdd #x0 #xe7f77f6a #xaf2de8b8 #xad19bc70 #x80305f29)
|
||||
(fftw_codelet_n1bv_32_avx 0 #x10bdd #x10bdd #x0 #x6d197f20 #xfc9cbd23 #x91ddb367 #x208619cb)
|
||||
(fftw_dft_thr_vrank_geq1_register 0 #x10bdd #x10bdd #x0 #x1f2e97fe #x61895cd8 #x6073a2f5 #x6ada2663)
|
||||
(fftw_dft_thr_vrank_geq1_register 0 #x10bdd #x10bdd #x0 #x84033142 #x81339a41 #xb78a491e #x66362e05)
|
||||
(fftw_rdft2_thr_vrank_geq1_register 0 #x10bdd #x10bdd #x0 #x40ffeb6f #x4d232a35 #x49c61e65 #x4d75fa83)
|
||||
(fftw_codelet_n1bv_32_avx 0 #x10bdd #x10bdd #x0 #x35d0d312 #x6b498ae1 #x1ddcffdc #x4a1a1998)
|
||||
(fftw_dft_thr_vrank_geq1_register 0 #x10bdd #x10bdd #x0 #xbffceb36 #x5b340e87 #xc2433c88 #x10e155b2)
|
||||
(fftw_rdft2_thr_vrank_geq1_register 0 #x10bdd #x10bdd #x0 #x7ec9785e #x02957b55 #xab1017dc #xdcd04ed7)
|
||||
(fftw_codelet_r2cf_32 2 #x10bdd #x10bdd #x0 #xe5219ff5 #x7cc0cc2f #x9ce07377 #x12d27b02)
|
||||
(fftw_dft_thr_vrank_geq1_register 0 #x10bdd #x10bdd #x0 #xd78cc60c #x6e1210c6 #x5868829d #x70ada990)
|
||||
(fftw_codelet_r2cf_32 2 #x10bdd #x10bdd #x0 #x68269cfc #xb89b69b3 #x4eaad8fa #x9807c679)
|
||||
(fftw_rdft2_rank_geq2_register 0 #x10bdd #x10bdd #x0 #x7446ec55 #x3f800a5f #xba25afcf #xc0e9d5c1)
|
||||
(fftw_dft_thr_vrank_geq1_register 0 #x10bdd #x10bdd #x0 #x0ac209ed #x737616a2 #xc31f0ad8 #x13c3716f)
|
||||
(fftw_dft_vrank_geq1_register 0 #x10bdd #x10bdd #x0 #x4b54e3ca #x4f94ebf3 #x244f4da3 #x2412ca79)
|
||||
(fftw_rdft2_rank_geq2_register 0 #x10bdd #x10bdd #x0 #x68900aea #xb640ce9e #xcd3b0e06 #x8170fa63)
|
||||
(fftw_dft_vrank_geq1_register 0 #x10bdd #x10bdd #x0 #x404fdd72 #x2323d034 #xc860c577 #x4779492a)
|
||||
(fftw_rdft2_rank_geq2_register 0 #x10bdd #x10bdd #x0 #x3c2e2a1a #x07c08954 #x35c337d9 #x80864862)
|
||||
(fftw_codelet_n1fv_32_sse2 0 #x10bdd #x10bdd #x0 #xe61c7c8d #x2cea019e #x8489a633 #x8d6543c6)
|
||||
(fftw_rdft2_rank_geq2_register 0 #x10bdd #x10bdd #x0 #x962543ac #xb000f636 #xb27fc586 #xd4a83bb7)
|
||||
(fftw_codelet_n1fv_32_avx 0 #x10bdd #x10bdd #x0 #x94cb38f8 #xed5987e0 #xa3d4151a #xeb412d04)
|
||||
(fftw_codelet_r2cb_32 2 #x10bdd #x10bdd #x0 #x92bf92d5 #xdc456f1e #x5a32a424 #xe1f76e14)
|
||||
(fftw_codelet_n1fv_32_avx 0 #x10bdd #x10bdd #x0 #xb5d7d23e #x26089494 #x55133ef3 #x8ac38174)
|
||||
(fftw_dft_thr_vrank_geq1_register 0 #x10bdd #x10bdd #x0 #xe0a3b250 #xab7e7c07 #xf0935dde #x1568a95f)
|
||||
(fftw_codelet_r2cb_32 2 #x10bdd #x10bdd #x0 #x4e6e3714 #xebce55aa #x0ede5253 #x4faf4524)
|
||||
(fftw_codelet_n1bv_32_sse2 0 #x10bdd #x10bdd #x0 #x902cd310 #xa659999d #x6fde2637 #xb23e4fd2)
|
||||
(fftw_dft_thr_vrank_geq1_register 0 #x10bdd #x10bdd #x0 #x21347a5d #x286e0d10 #xabf9ff02 #xccdf80a5)
|
||||
)
|
84
tests/test_forward.py
Normal file
84
tests/test_forward.py
Normal file
|
@ -0,0 +1,84 @@
|
|||
import numpy as np
|
||||
import aquila_borg as borg
|
||||
import configparser
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
import borg_velocity.likelihood as likelihood
|
||||
import borg_velocity.utils as utils
|
||||
import borg_velocity.forwards as forwards
|
||||
|
||||
ini_file = '../conf/basic_ini.ini'
|
||||
|
||||
# Setup config
|
||||
config = configparser.ConfigParser()
|
||||
config.read(ini_file)
|
||||
|
||||
# Cosmology
|
||||
cosmo = utils.get_cosmopar(ini_file)
|
||||
|
||||
# Input box
|
||||
box_in = borg.forward.BoxModel()
|
||||
box_in.L = (float(config['system']['L0']), float(config['system']['L1']), float(config['system']['L2']))
|
||||
box_in.N = (int(config['system']['N0']), int(config['system']['N1']), int(config['system']['N2']))
|
||||
box_in.xmin = (float(config['system']['corner0']), float(config['system']['corner1']), float(config['system']['corner2']))
|
||||
|
||||
# Load forward model
|
||||
fwd_model = likelihood.build_gravity_model(None, box_in, ini_file=ini_file)
|
||||
fwd_model.setCosmoParams(cosmo)
|
||||
|
||||
# Make some initial conditions
|
||||
s_hat = np.fft.rfftn(np.random.randn(*box_in.N)) / box_in.Ntot ** (0.5)
|
||||
|
||||
# Get the real version of this
|
||||
s_real = np.fft.irfftn(s_hat, norm="ortho")
|
||||
|
||||
# Run BORG density field
|
||||
output_density = np.zeros(box_in.N)
|
||||
fwd_model.forwardModel_v2(s_hat)
|
||||
fwd_model.getDensityFinal(output_density)
|
||||
|
||||
# Get growth rate
|
||||
cosmology = borg.cosmo.Cosmology(cosmo)
|
||||
af = float(config['model']['af'])
|
||||
f = cosmology.gplus(af) # dD / da
|
||||
f *= af / cosmology.d_plus(af) # f = dlnD / dlna
|
||||
|
||||
# Get velocity
|
||||
smooth_R = float(config['model']['smooth_R'])
|
||||
output_vel = forwards.dens2vel_linear(output_density, f, box_in.L[0], smooth_R)
|
||||
print(output_vel.shape)
|
||||
|
||||
|
||||
# Plot the IC and dens fields
|
||||
fig, axs = plt.subplots(2, 3, figsize=(15,10))
|
||||
for i, field in enumerate([s_real, np.log10(2 + output_density)]):
|
||||
vmin, vmax = field.min(), field.max()
|
||||
pc = axs[i,0].pcolor(field[box_in.N[0]//2], vmin=vmin, vmax=vmax)
|
||||
fig.colorbar(pc, ax=axs[i,0])
|
||||
pc = axs[i,1].pcolor(field[:,box_in.N[1]//2,:], vmin=vmin, vmax=vmax)
|
||||
fig.colorbar(pc, ax=axs[i,1])
|
||||
pc = axs[i,2].pcolor(field[:,:,box_in.N[2]//2], vmin=vmin, vmax=vmax)
|
||||
fig.colorbar(pc, ax=axs[i,2])
|
||||
axs[0,1].set_title('Initial Conditions')
|
||||
axs[1,1].set_title(r'$\log_{10} (2 + \delta)$')
|
||||
for ax in axs.flatten():
|
||||
ax.set_aspect('equal')
|
||||
fig.savefig('../figs/test_dens_ic.png')
|
||||
|
||||
|
||||
# Plot the velocity fields
|
||||
fig, axs = plt.subplots(3, 3, figsize=(15,15))
|
||||
vmin, vmax = output_vel.min(), output_vel.max()
|
||||
for i in range(3):
|
||||
pc = axs[i,0].pcolor(output_vel[i,box_in.N[0]//2], vmin=vmin, vmax=vmax)
|
||||
fig.colorbar(pc, ax=axs[i,0])
|
||||
pc = axs[i,1].pcolor(output_vel[i,:,box_in.N[1]//2,:], vmin=vmin, vmax=vmax)
|
||||
fig.colorbar(pc, ax=axs[i,1])
|
||||
pc = axs[i,2].pcolor(output_vel[i,:,:,box_in.N[2]//2], vmin=vmin, vmax=vmax)
|
||||
fig.colorbar(pc, ax=axs[i,2])
|
||||
axs[0,1].set_title(r'$v_x$')
|
||||
axs[1,1].set_title(r'$v_y$')
|
||||
axs[2,1].set_title(r'$v_z$')
|
||||
for ax in axs.flatten():
|
||||
ax.set_aspect('equal')
|
||||
fig.savefig('../figs/test_vel.png')
|
7
tests/timing_stats_0.txt
Normal file
7
tests/timing_stats_0.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
ARES version c6de4f62faad20ede0bb40aa3678551dceee637b modules
|
||||
|
||||
Cumulative timing spent in different context
|
||||
--------------------------------------------
|
||||
Context, Total time (seconds)
|
||||
|
||||
[/build/jenkins/miniconda3/envs/builder/conda-bld/aquila_borg_1686906696789/work/libLSS/physics/forwards/adapt_generic_bias.cpp]void {anonymous}::bias_registrator() 1 0.000723925
|
Loading…
Add table
Add a link
Reference in a new issue