From 6d295bdc9cdd239b7fe2ae87bf7d372488781bfe Mon Sep 17 00:00:00 2001 From: Lukas Winkler Date: Thu, 21 Jul 2022 14:05:19 +0200 Subject: [PATCH] improve 1024 halo_mass_functions --- halo_mass_functions.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/halo_mass_functions.py b/halo_mass_functions.py index fd1f1ed..69605f8 100644 --- a/halo_mass_functions.py +++ b/halo_mass_functions.py @@ -1,6 +1,5 @@ -from math import log10, log +from math import log from pathlib import Path -from sys import argv import numpy as np # from colossus.cosmology import cosmology @@ -8,9 +7,8 @@ import numpy as np from matplotlib import pyplot as plt from matplotlib.axes import Axes 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 utils import print_progress @@ -27,8 +25,10 @@ def monofonic_tests(): fig: Figure = plt.figure() ax: Axes = fig.gca() - linestyles = ["solid", "dashed", "dotted"] - colors = ["C1", "C2"] + linestyles = ["solid", "dashed", "dotted", "dashdot"] + resolutions = [128, 256, 512] + if has_1024_simulations: + resolutions.append(1024) for i, waveform in enumerate(["DB2", "shannon"]): for j, resolution in enumerate([128, 256, 512]): @@ -36,7 +36,6 @@ def monofonic_tests(): dir = base_dir / f"{waveform}_{resolution}_100" halos = read_velo_halos(dir) - # halos.to_csv("weird_halos.csv") 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) 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( left_edges, @@ -152,7 +151,6 @@ def hmf_from_rockstar_tree(file: Path): plt.show() - if __name__ == '__main__': monofonic_tests() # hmf_from_rockstar_tree(Path(argv[1]))