diff --git a/csiborgtools/io/__init__.py b/csiborgtools/io/__init__.py index e4a6c7c..3f22163 100644 --- a/csiborgtools/io/__init__.py +++ b/csiborgtools/io/__init__.py @@ -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 diff --git a/csiborgtools/io/readsim.py b/csiborgtools/io/readsim.py index 65f9e6d..777b3ce 100644 --- a/csiborgtools/io/readsim.py +++ b/csiborgtools/io/readsim.py @@ -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.