mirror of
https://github.com/Richard-Sti/csiborgtools_public.git
synced 2025-05-13 06:01:13 +00:00
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:
parent
eccd8e3507
commit
9ae93bed14
5 changed files with 142 additions and 82 deletions
|
@ -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,)
|
||||
|
|
|
@ -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`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue