diff --git a/c3dev/galmocks/scripts/make_gumbo_v1.0.py b/c3dev/galmocks/scripts/make_gumbo_v1.0.py new file mode 100644 index 0000000..66625b8 --- /dev/null +++ b/c3dev/galmocks/scripts/make_gumbo_v1.0.py @@ -0,0 +1,213 @@ +"""Production script for gumbo_v0.3 +""" +import argparse +import os +from time import time + +import numpy as np +from astropy.table import Table +from c3dev.galmocks.data_loaders.load_umachine import load_umachine_diffsky +from c3dev.galmocks.data_loaders.load_unit_sims import ( + UNIT_LBOX, + load_value_added_unit_sim, +) +from c3dev.galmocks.galhalo_models.assign_elliptical_velocities import ( + assign_ellipsoidal_velocities, +) +from c3dev.galmocks.galhalo_models.galsampler_phase_space import ( + add_central_velbias, + inherit_host_centric_posvel, +) +from c3dev.galmocks.utils import galmatch +from c3dev.galmocks.utils.galprops import compute_lg_ssfr +from halotools.empirical_models.phase_space_models import NFWPhaseSpace +from halotools.utils import crossmatch, sliding_conditional_percentile +from jax import random as jran + +UM_LOGSM_CUT = 9.0 +SEED = 43 +OUTDRN = "/lcrc/project/halotools/C3EMC/gumbo" + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("unit_sim_fn", help="path to unit sim subhalo catalog") + parser.add_argument( + "um_drn", help="directory to tng data read with illustris_python" + ) + parser.add_argument("um_redshift", type=int, help="UM redshift") + parser.add_argument("unit_redshift", type=int, help="UNIT redshift") + parser.add_argument("outname", help="Output fname") + args = parser.parse_args() + + unit_redshift = args.unit_redshift + + t0 = time() + + ran_key = jran.PRNGKey(SEED) + + # GBM: This function needs to be written + # Should be a ~1-liner that simply picks up the mock from disk + um_mock = load_umachine_diffsky() + + logsm_msk = um_mock["mstar"] > 10**UM_LOGSM_CUT + um_mock = um_mock[logsm_msk] + t1 = time() + print("{0:.1f} total seconds to load value-added TNG".format(t1 - t0)) + + # GBM: This function needs to be written + # The GalSampler algorithm needs both host halos and the galaxies occupying them + um_mock, um_halos = get_value_added_um_data(um_mock) + + unit = load_value_added_unit_sim(args.unit_sim_fn) + t2 = time() + print("{0:.1f} seconds to load UNIT".format(t2 - t1)) + + unit = unit[unit["halo_upid"] == -1] + + nfw = NFWPhaseSpace(redshift=unit_redshift) + unit["halo_vvir"] = nfw.virial_velocity(unit["halo_mvir"]) + + # Compute Prob(