From 7d947f5421eaf507c5cab52df44bd5acd98565d5 Mon Sep 17 00:00:00 2001 From: rstiskalek Date: Sun, 30 Apr 2023 12:12:37 +0100 Subject: [PATCH] Edit the particle paths --- csiborgtools/read/paths.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/csiborgtools/read/paths.py b/csiborgtools/read/paths.py index 121a5e7..a41a59f 100644 --- a/csiborgtools/read/paths.py +++ b/csiborgtools/read/paths.py @@ -326,30 +326,32 @@ class CSiBORGPaths: fname = f"radpos_{str(nsim).zfill(5)}_{str(nsnap).zfill(5)}.npz" return join(fdir, fname) - def particle_h5py_path(self, nsim, with_vel): + def particle_h5py_path(self, nsim, kind=None): """ - Path to the files containing all particles in a `.hdf5` file. Used for - the SPH calculation. + Path to the file containing all particles in a `.h5` file. Parameters ---------- nsim : int IC realisation index. - with_vel : bool - Whether velocities are included. + kind : str + Type of output. Must be one of `[None, 'pos', 'clumpmap']`. + pos_only : bool + Whether this file contains only positions. Returns ------- path : str """ - fdir = join(self.postdir, "environment") + assert kind in [None, "pos", "clumpmap"] + fdir = join(self.postdir, "particles") if not isdir(fdir): makedirs(fdir) warn(f"Created directory `{fdir}`.", UserWarning, stacklevel=1) - if with_vel: + if kind is None: fname = f"parts_{str(nsim).zfill(5)}.h5" else: - fname = f"parts_pos_{str(nsim).zfill(5)}.h5" + fname = f"parts_{kind}_{str(nsim).zfill(5)}.h5" return join(fdir, fname) def density_field_path(self, mas, nsim):