Particle dumping (#49)

* Add paths

* Add dumping script

* Remove snap from density fields

* Add progress statement

* Update import ordering

* Update nb
This commit is contained in:
Richard Stiskalek 2023-04-28 13:57:23 +01:00 committed by GitHub
parent 4f8335e0a3
commit c14be720b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 175 additions and 3 deletions

View file

@ -326,6 +326,49 @@ class CSiBORGPaths:
fname = f"radpos_{str(nsim).zfill(5)}_{str(nsnap).zfill(5)}.npz"
return join(fdir, fname)
def particle_h5py_path(self, nsim):
"""
Path to the files containing all particles in a `.hdf5` file. Used for
the SPH calculation.
Parameters
----------
nsim : int
IC realisation index.
Returns
-------
path : str
"""
fdir = join(self.postdir, "environment")
if not isdir(fdir):
makedirs(fdir)
warn(f"Created directory `{fdir}`.", UserWarning, stacklevel=1)
fname = f"particles_{str(nsim).zfill(5)}.h5"
return join(fdir, fname)
def density_field_path(self, mas, nsim):
"""
Path to the files containing the calculated density fields.
Parameters
----------
mas : str
Mass-assignment scheme. Currently only SPH is supported.
nsim : int
IC realisation index.
Returns
-------
path : str
"""
fdir = join(self.postdir, "environment")
if not isdir(fdir):
makedirs(fdir)
warn(f"Created directory `{fdir}`.", UserWarning, stacklevel=1)
fname = f"density_{mas}_{str(nsim).zfill(5)}.npy"
return join(fdir, fname)
def knnauto_path(self, run, nsim=None):
"""
Path to the `knn` auto-correlation files. If `nsim` is not specified