mirror of
https://github.com/Richard-Sti/csiborgtools_public.git
synced 2025-05-14 06:31:11 +00:00
Add Quijote (#61)
* Rename paths object * Remove redshift calculation * Explicit keywrod arg * Rename box units * Basic renaming * Little docs * Rename paths * add imports * Sort imports * Add Quijote cat * Split boxes * add Quijote path * Add origin argument * Update nbs
This commit is contained in:
parent
b3fd14b81f
commit
1d847cbd06
34 changed files with 1401 additions and 292 deletions
|
@ -48,8 +48,8 @@ rank = comm.Get_rank()
|
|||
nproc = comm.Get_size()
|
||||
MAS = "CIC" # mass asignment scheme
|
||||
|
||||
paths = csiborgtools.read.CSiBORGPaths(**csiborgtools.paths_glamdring)
|
||||
box = csiborgtools.read.BoxUnits(paths)
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
box = csiborgtools.read.CSiBORGBox(paths)
|
||||
reader = csiborgtools.read.ParticleReader(paths)
|
||||
ics = paths.get_ics()
|
||||
nsims = len(ics)
|
||||
|
|
|
@ -49,7 +49,7 @@ with open("../scripts/knn_auto.yml", "r") as file:
|
|||
|
||||
Rmax = 155 / 0.705 # Mpc (h = 0.705) high resolution region radius
|
||||
totvol = 4 * numpy.pi * Rmax**3 / 3
|
||||
paths = csiborgtools.read.CSiBORGPaths(**csiborgtools.paths_glamdring)
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
ics = paths.get_ics()
|
||||
knncdf = csiborgtools.clustering.kNN_CDF()
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ with open("../scripts/knn_cross.yml", "r") as file:
|
|||
config = yaml.safe_load(file)
|
||||
|
||||
Rmax = 155 / 0.705 # Mpc (h = 0.705) high resolution region radius
|
||||
paths = csiborgtools.read.CSiBORGPaths(**csiborgtools.paths_glamdring)
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
ics = paths.get_ics()
|
||||
knncdf = csiborgtools.clustering.kNN_CDF()
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ with open("../scripts/tpcf_auto.yml", "r") as file:
|
|||
config = yaml.safe_load(file)
|
||||
|
||||
Rmax = 155 / 0.705 # Mpc (h = 0.705) high resolution region radius
|
||||
paths = csiborgtools.read.CSiBORGPaths()
|
||||
paths = csiborgtools.read.Paths()
|
||||
ics = paths.get_ics()
|
||||
tpcf = csiborgtools.clustering.Mock2PCF()
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ parser.add_argument("--grid", type=int, help="Grid resolution.")
|
|||
parser.add_argument("--in_rsp", type=lambda x: bool(strtobool(x)),
|
||||
help="Calculate from the RSP density field?")
|
||||
args = parser.parse_args()
|
||||
paths = csiborgtools.read.CSiBORGPaths(**csiborgtools.paths_glamdring)
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
|
||||
if args.ics is None or args.ics[0] == -1:
|
||||
ics = paths.get_ics()
|
||||
|
@ -59,7 +59,7 @@ for i in csiborgtools.fits.split_jobs(len(ics), nproc)[rank]:
|
|||
print(f"{datetime.now()}: rank {rank} working on simulation {nsim}.",
|
||||
flush=True)
|
||||
nsnap = max(paths.get_snapshots(nsim))
|
||||
box = csiborgtools.read.BoxUnits(nsnap, nsim, paths)
|
||||
box = csiborgtools.read.CSiBORGBox(nsnap, nsim, paths)
|
||||
density_gen = csiborgtools.field.DensityField(box, args.MAS)
|
||||
|
||||
rho = numpy.load(paths.field_path("density", args.MAS, args.grid, nsim,
|
||||
|
|
|
@ -46,7 +46,7 @@ parser.add_argument("--grid", type=int, help="Grid resolution.")
|
|||
parser.add_argument("--in_rsp", type=lambda x: bool(strtobool(x)),
|
||||
help="Calculate the density field in redshift space?")
|
||||
args = parser.parse_args()
|
||||
paths = csiborgtools.read.CSiBORGPaths(**csiborgtools.paths_glamdring)
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
mpart = 1.1641532e-10 # Particle mass in CSiBORG simulations.
|
||||
|
||||
if args.ics is None or args.ics[0] == -1:
|
||||
|
@ -61,7 +61,7 @@ for i in csiborgtools.fits.split_jobs(len(ics), nproc)[rank]:
|
|||
flush=True)
|
||||
|
||||
nsnap = max(paths.get_snapshots(nsim))
|
||||
box = csiborgtools.read.BoxUnits(nsnap, nsim, paths)
|
||||
box = csiborgtools.read.CSiBORGBox(nsnap, nsim, paths)
|
||||
parts = csiborgtools.read.read_h5(paths.particles_path(nsim))["particles"]
|
||||
|
||||
if args.kind == "density":
|
||||
|
|
|
@ -42,7 +42,7 @@ parser.add_argument("--kind", type=str, choices=["halos", "clumps"])
|
|||
parser.add_argument("--ics", type=int, nargs="+", default=None,
|
||||
help="IC realisations. If `-1` processes all simulations.")
|
||||
args = parser.parse_args()
|
||||
paths = csiborgtools.read.CSiBORGPaths(**csiborgtools.paths_glamdring)
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
partreader = csiborgtools.read.ParticleReader(paths)
|
||||
nfwpost = csiborgtools.fits.NFWPosterior()
|
||||
|
||||
|
@ -105,7 +105,7 @@ for nsim in [ics[i] for i in jobs]:
|
|||
print(f"{datetime.now()}: rank {rank} calculating simulation `{nsim}`.",
|
||||
flush=True)
|
||||
nsnap = max(paths.get_snapshots(nsim))
|
||||
box = csiborgtools.read.BoxUnits(nsnap, nsim, paths)
|
||||
box = csiborgtools.read.CSiBORGBox(nsnap, nsim, paths)
|
||||
|
||||
# Particle archive
|
||||
f = csiborgtools.read.read_h5(paths.particles_path(nsim))
|
||||
|
|
|
@ -22,7 +22,6 @@ from datetime import datetime
|
|||
|
||||
import numpy
|
||||
from mpi4py import MPI
|
||||
|
||||
from tqdm import tqdm
|
||||
|
||||
try:
|
||||
|
@ -45,7 +44,7 @@ parser = ArgumentParser()
|
|||
parser.add_argument("--ics", type=int, nargs="+", default=None,
|
||||
help="IC realisations. If `-1` processes all simulations.")
|
||||
args = parser.parse_args()
|
||||
paths = csiborgtools.read.CSiBORGPaths(**csiborgtools.paths_glamdring)
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
partreader = csiborgtools.read.ParticleReader(paths)
|
||||
|
||||
if args.ics is None or args.ics[0] == -1:
|
||||
|
|
|
@ -45,7 +45,7 @@ nproc = comm.Get_size()
|
|||
if nproc > 1:
|
||||
raise NotImplementedError("MPI is not implemented implemented yet.")
|
||||
|
||||
paths = csiborgtools.read.CSiBORGPaths(**csiborgtools.paths_glamdring)
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
cols_collect = [("r", numpy.float32), ("M", numpy.float32)]
|
||||
if args.ics is None or args.ics == -1:
|
||||
nsims = paths.get_ics()
|
||||
|
@ -59,7 +59,7 @@ for i, nsim in enumerate(nsims):
|
|||
now = datetime.now()
|
||||
print(f"{now}: calculating {i}th simulation `{nsim}`.", flush=True)
|
||||
nsnap = max(paths.get_snapshots(nsim))
|
||||
box = csiborgtools.read.BoxUnits(nsnap, nsim, paths)
|
||||
box = csiborgtools.read.CSiBORGBox(nsnap, nsim, paths)
|
||||
|
||||
f = csiborgtools.read.read_h5(paths.particles_path(nsim))
|
||||
particles = f["particles"]
|
||||
|
|
|
@ -54,7 +54,7 @@ def get_combs():
|
|||
Get the list of all pairs of simulations, then permute them with a known
|
||||
seed to minimise loading the same files simultaneously.
|
||||
"""
|
||||
paths = csiborgtools.read.CSiBORGPaths(**csiborgtools.paths_glamdring)
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
ics = paths.get_ics()
|
||||
combs = list(combinations(ics, 2))
|
||||
Random(42).shuffle(combs)
|
||||
|
|
|
@ -32,7 +32,7 @@ except ModuleNotFoundError:
|
|||
def pair_match(nsim0, nsimx, sigma, smoothen, verbose):
|
||||
from csiborgtools.read import HaloCatalogue, read_h5
|
||||
|
||||
paths = csiborgtools.read.CSiBORGPaths(**csiborgtools.paths_glamdring)
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
smooth_kwargs = {"sigma": sigma, "mode": "constant", "cval": 0.0}
|
||||
overlapper = csiborgtools.match.ParticleOverlap()
|
||||
matcher = csiborgtools.match.RealisationsMatcher()
|
||||
|
|
|
@ -49,7 +49,7 @@ parser.add_argument("--ics", type=int, nargs="+", default=None,
|
|||
args = parser.parse_args()
|
||||
|
||||
verbose = nproc == 1
|
||||
paths = csiborgtools.read.CSiBORGPaths(**csiborgtools.paths_glamdring)
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
partreader = csiborgtools.read.ParticleReader(paths)
|
||||
# Keep "ID" as the last column!
|
||||
pars_extract = ['x', 'y', 'z', 'vx', 'vy', 'vz', 'M', "ID"]
|
||||
|
|
|
@ -33,7 +33,7 @@ comm = MPI.COMM_WORLD
|
|||
rank = comm.Get_rank()
|
||||
nproc = comm.Get_size()
|
||||
|
||||
paths = csiborgtools.read.CSiBORGPaths(**csiborgtools.paths_glamdring)
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
mmain_reader = csiborgtools.read.MmainReader(paths)
|
||||
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ snapshot ordering, which is sorted by the clump IDs.
|
|||
"""
|
||||
from argparse import ArgumentParser
|
||||
from datetime import datetime
|
||||
from gc import collect
|
||||
|
||||
import h5py
|
||||
from gc import collect
|
||||
import numpy
|
||||
from mpi4py import MPI
|
||||
|
||||
|
@ -44,7 +44,7 @@ parser = ArgumentParser()
|
|||
parser.add_argument("--ics", type=int, nargs="+", default=None,
|
||||
help="IC realisations. If `-1` processes all simulations.")
|
||||
args = parser.parse_args()
|
||||
paths = csiborgtools.read.CSiBORGPaths(**csiborgtools.paths_glamdring)
|
||||
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
|
||||
partreader = csiborgtools.read.ParticleReader(paths)
|
||||
# NOTE: ID has to be the last column.
|
||||
pars_extract = ["x", "y", "z", "M", "ID"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue