Add dumping to ASCII of halos (#89)

* Rename file

* Add argument

* Add ASCII positions paths

* Add halo positions dumping

* Update halo catalogues
This commit is contained in:
Richard Stiskalek 2023-09-03 12:11:39 +01:00 committed by GitHub
parent eccd8e3507
commit 9ae93bed14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 142 additions and 82 deletions

View file

@ -256,6 +256,10 @@ class BaseCatalogue(ABC):
@observer_velocity.setter
def observer_velocity(self, obs_vel):
if obs_vel is None:
self._observer_velocity = None
return
assert isinstance(obs_vel, (list, tuple, numpy.ndarray))
obs_vel = numpy.asanyarray(obs_vel)
assert obs_vel.shape == (3,)

View file

@ -449,6 +449,26 @@ class Paths:
fname = f"parts_{str(nsim).zfill(5)}.h5"
return join(fdir, fname)
def ascii_positions(self, nsim, kind):
"""
Path to ASCII files containing the positions of particles or halos.
Parameters
----------
nsim : int
IC realisation index.
kind : str
Kind of data to extract. Must be one of `particles`,
`particles_rsp`, `halos`, `halos_rsp`.
"""
assert kind in ["particles", "particles_rsp", "halos", "halos_rsp"]
fdir = join(self.postdir, "ascii_positions")
try_create_directory(fdir)
fname = f"pos_{kind}_{str(nsim).zfill(5)}.txt"
return join(fdir, fname)
def structfit(self, nsnap, nsim, simname):
"""
Path to the halo catalogue from `fit_halos.py`.