Minor updates to flow validation

This commit is contained in:
rstiskalek 2024-03-10 11:22:29 +00:00
parent 9a3e937afd
commit ba2baa0081
2 changed files with 13 additions and 11 deletions

View file

@ -30,7 +30,7 @@ from numpyro.infer import MCMC, NUTS
from taskmaster import work_delegation # noqa from taskmaster import work_delegation # noqa
def get_model(args, nsim): def get_model(args, nsim_iterator):
""" """
Load the data and create the NumPyro model. Load the data and create the NumPyro model.
@ -38,8 +38,8 @@ def get_model(args, nsim):
---------- ----------
args : argparse.Namespace args : argparse.Namespace
Command line arguments. Command line arguments.
nsim : int nsim_iterator : int
Simulation index. Simulation index, not the IC index. Ranges from 0, ... .
Returns Returns
------- -------
@ -58,8 +58,8 @@ def get_model(args, nsim):
Omega_m = csiborgtools.simname2Omega_m(args.simname) Omega_m = csiborgtools.simname2Omega_m(args.simname)
# Read in the data from the loader. # Read in the data from the loader.
los_overdensity = loader.los_density[:, nsim, :] los_overdensity = loader.los_density[:, nsim_iterator, :]
los_velocity = loader.los_radial_velocity[:, nsim, :] los_velocity = loader.los_radial_velocity[:, nsim_iterator, :]
RA = loader.cat["RA"] RA = loader.cat["RA"]
dec = loader.cat["DEC"] dec = loader.cat["DEC"]
@ -186,7 +186,7 @@ if __name__ == "__main__":
nsims = paths.get_ics(args.simname) nsims = paths.get_ics(args.simname)
nsteps = 5000 nsteps = 5000
nchains = 1 nchains = 4
# Create the dumping folder. # Create the dumping folder.
if comm.Get_rank() == 0: if comm.Get_rank() == 0:
@ -198,12 +198,13 @@ if __name__ == "__main__":
dump_folder = None dump_folder = None
dump_folder = comm.bcast(dump_folder, root=0) dump_folder = comm.bcast(dump_folder, root=0)
def main(nsim): def main(i):
model = get_model(args, nsim) model = get_model(args, i)
run_model(model, nsteps, nchains, nsim, dump_folder, run_model(model, nsteps, nchains, nsims[i], dump_folder,
show_progress=size == 1) show_progress=size == 1)
work_delegation(main, nsims, comm, master_verbose=True) work_delegation(main, [i for i in range(len(nsims))], comm,
master_verbose=True)
comm.Barrier() comm.Barrier()
if rank == 0: if rank == 0:

View file

@ -1,13 +1,14 @@
memory=4 memory=4
on_login=${1} on_login=${1}
nthreads=${2} nthreads=${2}
ksmooth=${3}
queue="berg" queue="berg"
env="/mnt/users/rstiskalek/csiborgtools/venv_csiborg/bin/python" env="/mnt/users/rstiskalek/csiborgtools/venv_csiborg/bin/python"
file="flow_validation.py" file="flow_validation.py"
catalogue="A2" catalogue="A2"
simname="Carrick2015" simname="Carrick2015"
ksmooth=2
pythoncm="$env $file --catalogue $catalogue --simname $simname --ksmooth $ksmooth" pythoncm="$env $file --catalogue $catalogue --simname $simname --ksmooth $ksmooth"