add max snapshot

This commit is contained in:
rstiskalek 2022-11-14 16:24:53 +00:00
parent f33bf0c3b2
commit 06d3fede95

View file

@ -14,7 +14,8 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
""" """
Script to split particles into smaller files according to their clump Script to split particles into smaller files according to their clump
membership for faster manipulation. Running this will require a lot of memory. membership for faster manipulation. Currently does this for the maximum
snapshot of each simulation. Running this will require a lot of memory.
""" """
from os.path import join from os.path import join
@ -33,17 +34,17 @@ comm = MPI.COMM_WORLD
rank = comm.Get_rank() rank = comm.Get_rank()
nproc = comm.Get_size() nproc = comm.Get_size()
# Nsims = [9844]
Nsims = csiborgtools.io.get_csiborg_ids("/mnt/extraspace/hdesmond") Nsims = csiborgtools.io.get_csiborg_ids("/mnt/extraspace/hdesmond")
Nsnap = 1016
partcols = ["x", "y", "z", "vx", "vy", "vz", "M", "level"] partcols = ["x", "y", "z", "vx", "vy", "vz", "M", "level"]
dumpdir = join(utils.dumpdir, "temp") dumpdir = join(utils.dumpdir, "temp")
jobs = csiborgtools.fits.split_jobs(len(Nsims), nproc)[rank] jobs = csiborgtools.fits.split_jobs(len(Nsims), nproc)[rank]
for icount, Nsim in enumerate(jobs): for icount, sim_index in enumerate(jobs):
print("{}: rank {} working {} / {} jobs.".format(datetime.now(), rank, print("{}: rank {} working {} / {} jobs.".format(datetime.now(), rank,
icount + 1, len(jobs))) icount + 1, len(jobs)))
Nsim = Nsims[sim_index]
simpath = csiborgtools.io.get_sim_path(Nsim) simpath = csiborgtools.io.get_sim_path(Nsim)
Nsnap = csiborgtools.io.get_maximum_snapshot(simpath)
# Load the clumps, particles' clump IDs and particles. # Load the clumps, particles' clump IDs and particles.
clumps = csiborgtools.io.read_clumps(Nsnap, simpath) clumps = csiborgtools.io.read_clumps(Nsnap, simpath)
particle_clumps = csiborgtools.io.read_clumpid(Nsnap, simpath, particle_clumps = csiborgtools.io.read_clumpid(Nsnap, simpath,