Edit the particle paths

This commit is contained in:
rstiskalek 2023-04-30 12:12:37 +01:00
parent 553eec8228
commit 7d947f5421

View file

@ -326,30 +326,32 @@ class CSiBORGPaths:
fname = f"radpos_{str(nsim).zfill(5)}_{str(nsnap).zfill(5)}.npz" fname = f"radpos_{str(nsim).zfill(5)}_{str(nsnap).zfill(5)}.npz"
return join(fdir, fname) 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 Path to the file containing all particles in a `.h5` file.
the SPH calculation.
Parameters Parameters
---------- ----------
nsim : int nsim : int
IC realisation index. IC realisation index.
with_vel : bool kind : str
Whether velocities are included. Type of output. Must be one of `[None, 'pos', 'clumpmap']`.
pos_only : bool
Whether this file contains only positions.
Returns Returns
------- -------
path : str path : str
""" """
fdir = join(self.postdir, "environment") assert kind in [None, "pos", "clumpmap"]
fdir = join(self.postdir, "particles")
if not isdir(fdir): if not isdir(fdir):
makedirs(fdir) makedirs(fdir)
warn(f"Created directory `{fdir}`.", UserWarning, stacklevel=1) warn(f"Created directory `{fdir}`.", UserWarning, stacklevel=1)
if with_vel: if kind is None:
fname = f"parts_{str(nsim).zfill(5)}.h5" fname = f"parts_{str(nsim).zfill(5)}.h5"
else: else:
fname = f"parts_pos_{str(nsim).zfill(5)}.h5" fname = f"parts_{kind}_{str(nsim).zfill(5)}.h5"
return join(fdir, fname) return join(fdir, fname)
def density_field_path(self, mas, nsim): def density_field_path(self, mas, nsim):