mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 09:38:02 +00:00
Fix reading varysmall (#103)
* Fix paths * Add new chains options * Remove old imports
This commit is contained in:
parent
b4a29aea85
commit
78443e30b5
4 changed files with 22 additions and 15 deletions
|
@ -94,7 +94,7 @@ class Paths:
|
||||||
files = [int(search(r'chain_(\d+)', f).group(1)) for f in files]
|
files = [int(search(r'chain_(\d+)', f).group(1)) for f in files]
|
||||||
elif simname == "csiborg2_varysmall":
|
elif simname == "csiborg2_varysmall":
|
||||||
files = glob(join(self.csiborg2_varysmall_srcdir, "chain_*"))
|
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]
|
for f in files]
|
||||||
elif simname == "quijote":
|
elif simname == "quijote":
|
||||||
files = glob(join(self.quijote_dir, "fiducial_processed",
|
files = glob(join(self.quijote_dir, "fiducial_processed",
|
||||||
|
@ -138,7 +138,8 @@ class Paths:
|
||||||
for f in snaps]
|
for f in snaps]
|
||||||
snaps = sorted(snaps)
|
snaps = sorted(snaps)
|
||||||
elif simname == "csiborg2_varysmall":
|
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_*"))
|
"snapshot_*"))
|
||||||
snaps = [int(search(r'snapshot_16417_(\d+)', f).group(1))
|
snaps = [int(search(r'snapshot_16417_(\d+)', f).group(1))
|
||||||
for f in snaps]
|
for f in snaps]
|
||||||
|
@ -183,8 +184,9 @@ class Paths:
|
||||||
return join(self.csiborg2_random_srcdir, f"chain_{nsim}", "output",
|
return join(self.csiborg2_random_srcdir, f"chain_{nsim}", "output",
|
||||||
f"snapshot_{str(nsnap).zfill(3)}.hdf5")
|
f"snapshot_{str(nsnap).zfill(3)}.hdf5")
|
||||||
elif simname == "csiborg2_varysmall":
|
elif simname == "csiborg2_varysmall":
|
||||||
return join(self.csiborg2_varysmall_srcdir, f"chain_{nsim}",
|
return join(self.csiborg2_varysmall_srcdir,
|
||||||
"output", f"snapshot_{str(nsnap).zfill(3)}.hdf5")
|
f"chain_16417_{str(nsim).zfill(3)}", "output",
|
||||||
|
f"snapshot_{str(nsnap).zfill(3)}.hdf5")
|
||||||
elif simname == "quijote":
|
elif simname == "quijote":
|
||||||
return join(self.quijote_dir, "fiducial_processed",
|
return join(self.quijote_dir, "fiducial_processed",
|
||||||
f"chain_{nsim}",
|
f"chain_{nsim}",
|
||||||
|
@ -219,8 +221,8 @@ class Paths:
|
||||||
return join(self.csiborg2_ranodm_srcdir, f"chain_{nsim}", "output",
|
return join(self.csiborg2_ranodm_srcdir, f"chain_{nsim}", "output",
|
||||||
f"fof_subhalo_tab_{str(nsnap).zfill(3)}.hdf5")
|
f"fof_subhalo_tab_{str(nsnap).zfill(3)}.hdf5")
|
||||||
elif simname == "csiborg2_varysmall":
|
elif simname == "csiborg2_varysmall":
|
||||||
return join(self.csiborg2_varysmall_srcdir, f"chain_{nsim}",
|
return join(self.csiborg2_varysmall_srcdir,
|
||||||
"output",
|
f"chain_16417_{str(nsim).zfill(3)}", "output",
|
||||||
f"fof_subhalo_tab_{str(nsnap).zfill(3)}.hdf5")
|
f"fof_subhalo_tab_{str(nsnap).zfill(3)}.hdf5")
|
||||||
elif simname == "quijote":
|
elif simname == "quijote":
|
||||||
return join(self.quijote_dir, "fiducial_processed",
|
return join(self.quijote_dir, "fiducial_processed",
|
||||||
|
|
|
@ -21,6 +21,4 @@ from .overlap_summary import (NPairsOverlap, PairOverlap, get_cross_sims,
|
||||||
find_peak) # noqa
|
find_peak) # noqa
|
||||||
from .pk_summary import PKReader # noqa
|
from .pk_summary import PKReader # noqa
|
||||||
from .tpcf_summary import TPCFReader # noqa
|
from .tpcf_summary import TPCFReader # noqa
|
||||||
from .field_interp import (read_interpolated_field, # noqa
|
from .field_interp import read_interpolated_field # noqa
|
||||||
bayesian_bootstrap_correlation, # noqa
|
|
||||||
correlate_at_fixed_smoothing) # noqa
|
|
||||||
|
|
|
@ -319,6 +319,9 @@ class CSiBORG2Reader(BaseReader):
|
||||||
raise ValueError(f"Unknown kind `{kind}`.")
|
raise ValueError(f"Unknown kind `{kind}`.")
|
||||||
self.base_dir = f"/mnt/extraspace/rstiskalek/csiborg2_{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":
|
if which_snapshot == "initial":
|
||||||
self.nsnap = 0
|
self.nsnap = 0
|
||||||
elif which_snapshot == "final":
|
elif which_snapshot == "final":
|
||||||
|
@ -327,19 +330,19 @@ class CSiBORG2Reader(BaseReader):
|
||||||
raise ValueError(f"Unknown snapshot option `{which_snapshot}`.")
|
raise ValueError(f"Unknown snapshot option `{which_snapshot}`.")
|
||||||
|
|
||||||
self.source_dir = join(
|
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")
|
f"snapshot_{str(self.nsnap).zfill(3)}_full.hdf5")
|
||||||
if which_snapshot == "initial":
|
if which_snapshot == "initial":
|
||||||
self.source_dir = self.source_dir.replace("_full.hdf5", ".hdf5")
|
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_snap = join(
|
||||||
self.output_dir,
|
self.output_dir,
|
||||||
f"snapshot_{str(self.nsnap).zfill(3)}_sorted.hdf5")
|
f"snapshot_{str(self.nsnap).zfill(3)}_sorted.hdf5")
|
||||||
self.output_cat = None
|
self.output_cat = None
|
||||||
|
|
||||||
self.offset_path = join(
|
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")
|
f"fof_subhalo_tab_{str(self.nsnap).zfill(3)}_full.hdf5")
|
||||||
|
|
||||||
def read_info(self):
|
def read_info(self):
|
||||||
|
|
|
@ -15,9 +15,13 @@
|
||||||
from os import system
|
from os import system
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
chains = [15717, 15817, 15917, 16017, 16117, 16217, 16317, 16417, 16517,
|
# chains = [15717, 15817, 15917, 16017, 16117, 16217, 16317, 16417, 16517,
|
||||||
16617, 16717, 16817, 16917, 17017, 17117, 17217, 17317, 17417]
|
# 16617, 16717, 16817, 16917, 17017, 17117, 17217, 17317, 17417]
|
||||||
simname = "csiborg2_main"
|
# simname = "csiborg2_main"
|
||||||
|
# mode = 1
|
||||||
|
|
||||||
|
chains = [1] + [25 + n * 25 for n in range(19)]
|
||||||
|
simname = "csiborg2_varysmall"
|
||||||
mode = 1
|
mode = 1
|
||||||
|
|
||||||
# chains = [7444 + n * 24 for n in range(1, 101)]
|
# chains = [7444 + n * 24 for n in range(1, 101)]
|
||||||
|
|
Loading…
Reference in a new issue