Fix reading varysmall (#103)

* Fix paths

* Add new chains options

* Remove old imports
This commit is contained in:
Richard Stiskalek 2023-12-22 21:46:41 +01:00 committed by GitHub
parent b4a29aea85
commit 78443e30b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 15 deletions

View file

@ -94,7 +94,7 @@ class Paths:
files = [int(search(r'chain_(\d+)', f).group(1)) for f in files]
elif simname == "csiborg2_varysmall":
files = glob(join(self.csiborg2_varysmall_srcdir, "chain_*"))
files = [int(search(r'chain_16417(\d+)', f).group(1))
files = [int(search(r'chain_16417_(\d+)', f).group(1))
for f in files]
elif simname == "quijote":
files = glob(join(self.quijote_dir, "fiducial_processed",
@ -138,7 +138,8 @@ class Paths:
for f in snaps]
snaps = sorted(snaps)
elif simname == "csiborg2_varysmall":
snaps = glob(join(self.csiborg2_random_srcdir, f"chain_{nsim}",
snaps = glob(join(self.csiborg2_random_srcdir,
f"chain_16417_{str(nsim).zfill(3)}",
"snapshot_*"))
snaps = [int(search(r'snapshot_16417_(\d+)', f).group(1))
for f in snaps]
@ -183,8 +184,9 @@ class Paths:
return join(self.csiborg2_random_srcdir, f"chain_{nsim}", "output",
f"snapshot_{str(nsnap).zfill(3)}.hdf5")
elif simname == "csiborg2_varysmall":
return join(self.csiborg2_varysmall_srcdir, f"chain_{nsim}",
"output", f"snapshot_{str(nsnap).zfill(3)}.hdf5")
return join(self.csiborg2_varysmall_srcdir,
f"chain_16417_{str(nsim).zfill(3)}", "output",
f"snapshot_{str(nsnap).zfill(3)}.hdf5")
elif simname == "quijote":
return join(self.quijote_dir, "fiducial_processed",
f"chain_{nsim}",
@ -219,8 +221,8 @@ class Paths:
return join(self.csiborg2_ranodm_srcdir, f"chain_{nsim}", "output",
f"fof_subhalo_tab_{str(nsnap).zfill(3)}.hdf5")
elif simname == "csiborg2_varysmall":
return join(self.csiborg2_varysmall_srcdir, f"chain_{nsim}",
"output",
return join(self.csiborg2_varysmall_srcdir,
f"chain_16417_{str(nsim).zfill(3)}", "output",
f"fof_subhalo_tab_{str(nsnap).zfill(3)}.hdf5")
elif simname == "quijote":
return join(self.quijote_dir, "fiducial_processed",

View file

@ -21,6 +21,4 @@ from .overlap_summary import (NPairsOverlap, PairOverlap, get_cross_sims,
find_peak) # noqa
from .pk_summary import PKReader # noqa
from .tpcf_summary import TPCFReader # noqa
from .field_interp import (read_interpolated_field, # noqa
bayesian_bootstrap_correlation, # noqa
correlate_at_fixed_smoothing) # noqa
from .field_interp import read_interpolated_field # noqa

View file

@ -319,6 +319,9 @@ class CSiBORG2Reader(BaseReader):
raise ValueError(f"Unknown kind `{kind}`.")
self.base_dir = f"/mnt/extraspace/rstiskalek/csiborg2_{kind}"
if kind == "varysmall":
self.nsim = f"16417_{str(self.nsim).zfill(3)}"
if which_snapshot == "initial":
self.nsnap = 0
elif which_snapshot == "final":
@ -327,19 +330,19 @@ class CSiBORG2Reader(BaseReader):
raise ValueError(f"Unknown snapshot option `{which_snapshot}`.")
self.source_dir = join(
self.base_dir, f"chain_{nsim}", "output",
self.base_dir, f"chain_{self.nsim}", "output",
f"snapshot_{str(self.nsnap).zfill(3)}_full.hdf5")
if which_snapshot == "initial":
self.source_dir = self.source_dir.replace("_full.hdf5", ".hdf5")
self.output_dir = join(self.base_dir, f"chain_{nsim}", "output")
self.output_dir = join(self.base_dir, f"chain_{self.nsim}", "output")
self.output_snap = join(
self.output_dir,
f"snapshot_{str(self.nsnap).zfill(3)}_sorted.hdf5")
self.output_cat = None
self.offset_path = join(
self.base_dir, f"chain_{nsim}", "output",
self.base_dir, f"chain_{self.nsim}", "output",
f"fof_subhalo_tab_{str(self.nsnap).zfill(3)}_full.hdf5")
def read_info(self):

View file

@ -15,9 +15,13 @@
from os import system
if __name__ == "__main__":
chains = [15717, 15817, 15917, 16017, 16117, 16217, 16317, 16417, 16517,
16617, 16717, 16817, 16917, 17017, 17117, 17217, 17317, 17417]
simname = "csiborg2_main"
# chains = [15717, 15817, 15917, 16017, 16117, 16217, 16317, 16417, 16517,
# 16617, 16717, 16817, 16917, 17017, 17117, 17217, 17317, 17417]
# simname = "csiborg2_main"
# mode = 1
chains = [1] + [25 + n * 25 for n in range(19)]
simname = "csiborg2_varysmall"
mode = 1
# chains = [7444 + n * 24 for n in range(1, 101)]