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:
commit
46f215fb36
3 changed files with 53 additions and 5 deletions
|
@ -109,7 +109,7 @@ def create_plot(mode):
|
||||||
ax.set_xlabel("k [Mpc$^{-1}$]")
|
ax.set_xlabel("k [Mpc$^{-1}$]")
|
||||||
ax.text(
|
ax.text(
|
||||||
0.01,
|
0.01,
|
||||||
0.85,
|
0.82,
|
||||||
f"{waveform}",
|
f"{waveform}",
|
||||||
horizontalalignment="left",
|
horizontalalignment="left",
|
||||||
verticalalignment="top",
|
verticalalignment="top",
|
||||||
|
@ -117,7 +117,7 @@ def create_plot(mode):
|
||||||
)
|
)
|
||||||
ax.text(
|
ax.text(
|
||||||
0.99,
|
0.99,
|
||||||
0.85,
|
0.82,
|
||||||
axes_names[ax],
|
axes_names[ax],
|
||||||
horizontalalignment="right",
|
horizontalalignment="right",
|
||||||
verticalalignment="top",
|
verticalalignment="top",
|
||||||
|
@ -216,7 +216,7 @@ def create_plot(mode):
|
||||||
crossings[i][j] = crossing_value
|
crossings[i][j] = crossing_value
|
||||||
|
|
||||||
ax_end.set_xlim(right=k0 * resolutions[-1])
|
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:
|
if bottom_row:
|
||||||
lines: List[Line2D] = ax_ics.get_lines()
|
lines: List[Line2D] = ax_ics.get_lines()
|
||||||
half_lines1 = []
|
half_lines1 = []
|
||||||
|
|
43
study_cosmo_params_arepo.py
Normal file
43
study_cosmo_params_arepo.py
Normal 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)
|
|
@ -41,8 +41,13 @@ def plotnp3d(pl: Plotter, data: np.ndarray, color="white"):
|
||||||
glrenderer.SetPass(blur_pass)
|
glrenderer.SetPass(blur_pass)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
input_file = cdm_zoom_dir / f"snapshot_{int(sys.argv[1]):03d}.hdf5"
|
if sys.argv[1] == 'cdm':
|
||||||
highres_coords, lowres_coords = read_g4_file(input_file, '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_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)]
|
random_lowres_selection = lowres_coords[np.random.choice(lowres_coords.shape[0], 100000, replace=False)]
|
||||||
|
|
Loading…
Reference in a new issue