mirror of
https://github.com/Richard-Sti/csiborgtools_public.git
synced 2025-05-12 13:41:13 +00:00
Fix overlap runs (#125)
* Update nb * Update script * Update script * Rename * Update script * Update script * Remove warning * Ignore minors when extracting MAH * Fix paths bug * Move notebooks * Move files * Rename and delete things * Rename file * Move file * Rename things * Remove old print statement * Add basic MAH plot * Add random MAH path * Output snapshot numbers * Add MAH random extraction * Fix redshift bug * Edit script * Add extracting random MAH * Little updates * Add CB2 redshift * Add some caching * Add diagnostic plots * Add caching * Minor updates * Update nb * Update notebook * Update script * Add Sorce randoms * Add CB2 varysmall * Update nb * Update nb * Update nb * Use catalogue HMF * Move definition of radec2galactic * Update nb * Update import * Update import * Add galatic coords to catalogues * Update nb
This commit is contained in:
parent
c71f5a8513
commit
ee222cd010
31 changed files with 1813 additions and 798 deletions
192
notebooks/diagnostic/hmf.ipynb
Normal file
192
notebooks/diagnostic/hmf.ipynb
Normal file
File diff suppressed because one or more lines are too long
48
notebooks/diagnostic/hmf.py
Normal file
48
notebooks/diagnostic/hmf.py
Normal file
|
@ -0,0 +1,48 @@
|
|||
# Copyright (C) 2024 Richard Stiskalek
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation; either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
"""Script to help with `hmf.py`."""
|
||||
|
||||
import csiborgtools
|
||||
import numpy as np
|
||||
from tqdm import tqdm
|
||||
|
||||
|
||||
def calculate_hmf(simname, bin_edges, halofinder="FOF", max_distance=135):
|
||||
"""
|
||||
Calculate the halo mass function for a given simulation from catalogues.
|
||||
"""
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
nsims = paths.get_ics(simname)
|
||||
bounds = {"dist": (0, max_distance)}
|
||||
|
||||
hmf = np.full((len(nsims), len(bin_edges) - 1), np.nan)
|
||||
volume = 4 / 3 * np.pi * max_distance**3
|
||||
for i, nsim in enumerate(tqdm(nsims)):
|
||||
if "csiborg2_" in simname:
|
||||
kind = simname.split("_")[-1]
|
||||
if halofinder == "FOF":
|
||||
cat = csiborgtools.read.CSiBORG2Catalogue(
|
||||
nsim, 99, kind, bounds=bounds)
|
||||
elif halofinder == "SUBFIND":
|
||||
cat = csiborgtools.read.CSiBORG2SUBFINDCatalogue(
|
||||
nsim, 99, kind, kind, bounds=bounds)
|
||||
else:
|
||||
raise ValueError(f"Unknown halofinder: {halofinder}")
|
||||
else:
|
||||
raise ValueError(f"Unknown simname: {simname}")
|
||||
|
||||
hmf[i] = cat.halo_mass_function(bin_edges, volume, "totmass")[1]
|
||||
|
||||
return hmf
|
4827
notebooks/diagnostic/plot_correlation.ipynb
Normal file
4827
notebooks/diagnostic/plot_correlation.ipynb
Normal file
File diff suppressed because one or more lines are too long
112
notebooks/diagnostic/powerspectrum_H0.ipynb
Normal file
112
notebooks/diagnostic/powerspectrum_H0.ipynb
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue