add the maximum snapshot

This commit is contained in:
rstiskalek 2022-11-14 16:22:45 +00:00
parent 76349bab3f
commit f33bf0c3b2
2 changed files with 18 additions and 1 deletions

View file

@ -14,7 +14,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from .readsim import (get_csiborg_ids, get_sim_path, get_snapshots, # noqa
get_snapshot_path, read_info, nparts_to_start_ind, # noqa
get_snapshot_path, get_maximum_snapshot, read_info, nparts_to_start_ind, # noqa
open_particle, open_unbinding, read_particle, # noqa
drop_zero_indx, # noqa
read_clumpid, read_clumps, read_mmain, # noqa

View file

@ -106,6 +106,23 @@ def get_snapshots(simpath):
return numpy.sort(snaps)
def get_maximum_snapshot(simpath):
"""
Return the maximum snapshot of an IC realisation stored at `simpath`.
Parameters
----------
simpath : str
Path to the CSiBORG IC realisation.
Returns
-------
maxsnap : float
The maximum snapshot.
"""
return max(get_snapshots(simpath))
def get_snapshot_path(Nsnap, simpath):
"""
Get a path to a CSiBORG IC realisation snapshot.