1
0
Fork 0
mirror of https://github.com/Findus23/halo_comparison.git synced 2024-09-19 16:03:50 +02:00

Merge branch 'main' of github.com:Findus23/halo_comparison

This commit is contained in:
Lukas Winkler 2022-08-23 16:36:59 +02:00
commit 46f215fb36
Signed by: lukas
GPG key ID: 54DE4D798D244853
3 changed files with 53 additions and 5 deletions

View file

@ -109,7 +109,7 @@ def create_plot(mode):
ax.set_xlabel("k [Mpc$^{-1}$]")
ax.text(
0.01,
0.85,
0.82,
f"{waveform}",
horizontalalignment="left",
verticalalignment="top",
@ -117,7 +117,7 @@ def create_plot(mode):
)
ax.text(
0.99,
0.85,
0.82,
axes_names[ax],
horizontalalignment="right",
verticalalignment="top",
@ -216,7 +216,7 @@ def create_plot(mode):
crossings[i][j] = crossing_value
ax_end.set_xlim(right=k0 * resolutions[-1])
ax_end.set_ylim(0.8, 1.02)
ax_end.set_ylim(0.9, 1.02)
if bottom_row:
lines: List[Line2D] = ax_ics.get_lines()
half_lines1 = []

View file

@ -0,0 +1,43 @@
import numpy as np
hubbleparam = 0.6777
omega0 = 0.307
omegab = 0.04825
Gconst = 43.0187
zstart = 127
astart = 1 / (1 + zstart)
m_gas = 0.00310523 / hubbleparam
m_highres = 0.0166524 / hubbleparam
m_lowres_1 = 0.15806103 / hubbleparam
m_lowres_2 = 1.2644882 / hubbleparam
n_gas = 174432
n_highres = 174432
n_lowres_1 = 46964
n_lowres_2 = 2135520 - n_lowres_1
boxsize = 67.77 / hubbleparam
Hsquared = (hubbleparam * 100) ** 2 * (omega0 / (astart) ** 3 + 1 - omega0)
rhocrit = 3 * (hubbleparam * 100) ** 2 / (8 * np.pi * Gconst)
print(rhocrit / hubbleparam ** 2)
#m_gas = omegab *
mass_b = m_gas * n_gas
omega_b = mass_b / (boxsize ** 3) / (3 * (hubbleparam * 100) ** 2 / (8 * np.pi * Gconst))
mass_lowres_1 = m_lowres_1 * n_lowres_1
mass_lowres_2 = m_lowres_2 * n_lowres_2
mass_lowres = mass_lowres_1 + mass_lowres_2
mass_highres = m_highres * n_highres
mass_total = mass_b + mass_highres + mass_lowres
omega_0 = mass_total / (boxsize ** 3) / (3 * (hubbleparam * 100) ** 2 / (8 * np.pi * Gconst))
print(omega_b)
print(omega_0)
print(mass_b * hubbleparam)

View file

@ -41,8 +41,13 @@ def plotnp3d(pl: Plotter, data: np.ndarray, color="white"):
glrenderer.SetPass(blur_pass)
if __name__ == "__main__":
input_file = cdm_zoom_dir / f"snapshot_{int(sys.argv[1]):03d}.hdf5"
highres_coords, lowres_coords = read_g4_file(input_file, 'cdm')
if sys.argv[1] == 'cdm':
input_file = cdm_zoom_dir / f"snapshot_{int(sys.argv[2]):03d}.hdf5"
elif sys.argv[1] == 'pbh':
input_file = pbh_zoom_dir / f"snapshot_{int(sys.argv[2]):03d}.hdf5"
else:
raise ValueError('Please select pbh or cdm as zoom_type!')
highres_coords, lowres_coords = read_g4_file(input_file, sys.argv[1])
random_highres_selection = highres_coords[np.random.choice(highres_coords.shape[0], 100000, replace=False)]
random_lowres_selection = lowres_coords[np.random.choice(lowres_coords.shape[0], 100000, replace=False)]