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

improve 1024 halo_mass_functions

This commit is contained in:
Lukas Winkler 2022-07-21 14:05:19 +02:00
parent d6e757535c
commit 6d295bdc9c
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -1,6 +1,5 @@
from math import log10, log from math import log
from pathlib import Path from pathlib import Path
from sys import argv
import numpy as np import numpy as np
# from colossus.cosmology import cosmology # from colossus.cosmology import cosmology
@ -8,9 +7,8 @@ import numpy as np
from matplotlib import pyplot as plt from matplotlib import pyplot as plt
from matplotlib.axes import Axes from matplotlib.axes import Axes
from matplotlib.figure import Figure from matplotlib.figure import Figure
from scipy.interpolate import interp1d
from paths import base_dir from paths import base_dir, has_1024_simulations
from read_vr_files import read_velo_halos from read_vr_files import read_velo_halos
from utils import print_progress from utils import print_progress
@ -27,8 +25,10 @@ def monofonic_tests():
fig: Figure = plt.figure() fig: Figure = plt.figure()
ax: Axes = fig.gca() ax: Axes = fig.gca()
linestyles = ["solid", "dashed", "dotted"] linestyles = ["solid", "dashed", "dotted", "dashdot"]
colors = ["C1", "C2"] resolutions = [128, 256, 512]
if has_1024_simulations:
resolutions.append(1024)
for i, waveform in enumerate(["DB2", "shannon"]): for i, waveform in enumerate(["DB2", "shannon"]):
for j, resolution in enumerate([128, 256, 512]): for j, resolution in enumerate([128, 256, 512]):
@ -36,7 +36,6 @@ def monofonic_tests():
dir = base_dir / f"{waveform}_{resolution}_100" dir = base_dir / f"{waveform}_{resolution}_100"
halos = read_velo_halos(dir) halos = read_velo_halos(dir)
# halos.to_csv("weird_halos.csv") # halos.to_csv("weird_halos.csv")
halo_masses: np.ndarray = halos["Mvir"].to_numpy() halo_masses: np.ndarray = halos["Mvir"].to_numpy()
@ -48,7 +47,7 @@ def monofonic_tests():
# ax.bar(centers, number_densities, width=widths, log=True, fill=False) # ax.bar(centers, number_densities, width=widths, log=True, fill=False)
name = f"{waveform} {resolution}" name = f"{waveform} {resolution}"
ax.step(left_edges, number_densities, where="post", color=colors[i], linestyle=linestyles[j], label=name) ax.step(left_edges, number_densities, where="post", color=f"C{i}", linestyle=linestyles[j], label=name)
ax.fill_between( ax.fill_between(
left_edges, left_edges,
@ -152,7 +151,6 @@ def hmf_from_rockstar_tree(file: Path):
plt.show() plt.show()
if __name__ == '__main__': if __name__ == '__main__':
monofonic_tests() monofonic_tests()
# hmf_from_rockstar_tree(Path(argv[1])) # hmf_from_rockstar_tree(Path(argv[1]))