diff --git a/diffsky/experimental/kernels/tests/test_dbk_specphot_kernels_merging.py b/diffsky/experimental/kernels/tests/test_dbk_specphot_kernels_merging.py index cb40f80a..8c98fd64 100644 --- a/diffsky/experimental/kernels/tests/test_dbk_specphot_kernels_merging.py +++ b/diffsky/experimental/kernels/tests/test_dbk_specphot_kernels_merging.py @@ -114,7 +114,6 @@ def test_mc_dbk_specphot_kern_merging(mc_merge, num_halos=150): ) fb = 0.13 - sat_weights = np.where(lc_data.is_central == 1, 1.0, lc_data.nhalos) args = ( ran_key, lc_data.z_obs, @@ -132,7 +131,7 @@ def test_mc_dbk_specphot_kern_merging(mc_merge, num_halos=150): lc_data.logmhost_infall, lc_data.t_infall, lc_data.is_central, - sat_weights, + lc_data.sat_weight, lc_data.halo_indx, mc_merge, ) diff --git a/diffsky/experimental/kernels/tests/test_phot_kernels_merging.py b/diffsky/experimental/kernels/tests/test_phot_kernels_merging.py index 4f342dea..d6af337c 100644 --- a/diffsky/experimental/kernels/tests/test_phot_kernels_merging.py +++ b/diffsky/experimental/kernels/tests/test_phot_kernels_merging.py @@ -64,7 +64,6 @@ def test_mc_phot_kern_merging(mc_merge, num_halos=250): ) fb = 0.176 - sat_weights = np.where(lc_data.is_central == 1, 1.0, lc_data.nhalos) phot_kern_results, phot_randoms, merging_randoms = pkm._mc_phot_kern_merging( ran_key, lc_data.z_obs, @@ -81,7 +80,7 @@ def test_mc_phot_kern_merging(mc_merge, num_halos=250): lc_data.logmhost_infall, lc_data.t_infall, lc_data.is_central, - sat_weights, + lc_data.sat_weight, lc_data.halo_indx, mc_merge, ) diff --git a/diffsky/experimental/kernels/tests/test_sed_kernels_merging.py b/diffsky/experimental/kernels/tests/test_sed_kernels_merging.py index 841a8368..7ba1837b 100644 --- a/diffsky/experimental/kernels/tests/test_sed_kernels_merging.py +++ b/diffsky/experimental/kernels/tests/test_sed_kernels_merging.py @@ -25,8 +25,6 @@ def test_sed_kern(mc_merge, num_halos=5, return_results=False): ) fb = 0.176 - sat_weights = np.where(lc_data.is_central == 1, 1.0, lc_data.nhalos) - phot_kern_results, phot_randoms, merging_randoms = pkm._mc_phot_kern_merging( ran_key, lc_data.z_obs, @@ -43,7 +41,7 @@ def test_sed_kern(mc_merge, num_halos=5, return_results=False): lc_data.logmhost_infall, lc_data.t_infall, lc_data.is_central, - sat_weights, + lc_data.sat_weight, lc_data.halo_indx, mc_merge, ) @@ -66,7 +64,7 @@ def test_sed_kern(mc_merge, num_halos=5, return_results=False): lc_data.logmhost_infall, lc_data.t_infall, lc_data.is_central, - sat_weights, + lc_data.sat_weight, lc_data.halo_indx, mc_merge, ) diff --git a/diffsky/experimental/kernels/tests/test_specphot_kernels_merging.py b/diffsky/experimental/kernels/tests/test_specphot_kernels_merging.py index 55f5912e..d73b3acd 100644 --- a/diffsky/experimental/kernels/tests/test_specphot_kernels_merging.py +++ b/diffsky/experimental/kernels/tests/test_specphot_kernels_merging.py @@ -53,7 +53,6 @@ def test_mc_specphot_kern_merging(mc_merge, num_halos=141): ssp_data = lemi.get_subset_emline_data(lc_data.ssp_data, emline_names) lc_data = lc_data._replace(ssp_data=ssp_data) - sat_weights = np.where(lc_data.is_central == 1, 1.0, lc_data.nhalos) phot_kern_results, phot_randoms, spec_kern_results = ( sppkm._mc_specphot_kern_merging( ran_key, @@ -73,7 +72,7 @@ def test_mc_specphot_kern_merging(mc_merge, num_halos=141): lc_data.logmhost_infall, lc_data.t_infall, lc_data.is_central, - sat_weights, + lc_data.sat_weight, lc_data.halo_indx, mc_merge, ) diff --git a/diffsky/experimental/lightcone_generators.py b/diffsky/experimental/lightcone_generators.py index 572a5134..59a97417 100644 --- a/diffsky/experimental/lightcone_generators.py +++ b/diffsky/experimental/lightcone_generators.py @@ -81,8 +81,8 @@ def weighted_lc_halos_photdata( lc_data: namedtuple Population of num_halos halos along with data needed to compute photometry - nhalos: ndarray of shape (num_halos, ) - weight of the (sub)halo + cen_weight: ndarray of shape (n_halos_tot, ) + For centrals, cen_weight is determined by the halo mass function (HMF) z_obs: ndarray of shape (num_halos, ) redshift values @@ -127,7 +127,7 @@ def weighted_lc_halos_photdata( wave_eff_table = get_wave_eff_table(z_phot_table, tcurves) lc_data = LCHalosData( - halopop.nhalos, + halopop.cen_weight, halopop.z_obs, halopop.t_obs, halopop.logmp_obs, @@ -161,7 +161,7 @@ def weighted_lc_photdata( logmp_cutoff=11.0, ): """ - Generate a weighted lightcone of host halos, + Generate a weighted lightcone of host halos and subhalos, and additional data needed for photometry calculations. This function is a wrapper around @@ -234,12 +234,15 @@ def weighted_lc_photdata( logt0: float Base-10 log of z=0 age of the Universe for the input cosmology - nhalos: ndarray of shape (n_halos_tot, ) - weight of the (sub)halo + cen_weight: ndarray of shape (n_halos_tot, ) + + For centrals, cen_weight is determined by the halo mass function (HMF) + For satellites, cen_weight is HMF weight of the associated central - nhalos_host: ndarray of shape (n_halos_tot, ) - weight of the host halo - Equal to nhalos for central halos + sat_weight: ndarray of shape (n_halos_tot, ) + Multiplicity factor of the subhalo richness + Equals 1 for central halos + For subhalos, halopop.sat_weight = nsub_per_host: int number of subhalos per host halo @@ -298,7 +301,7 @@ def weighted_lc_photdata( wave_eff_table = get_wave_eff_table(z_phot_table, tcurves) lc_data = LCData( - halopop.nhalos, + halopop.cen_weight, halopop.z_obs, halopop.t_obs, halopop.logmp_obs, @@ -309,7 +312,7 @@ def weighted_lc_photdata( precomputed_ssp_mag_table, z_phot_table, wave_eff_table, - halopop.nhalos_host, + halopop.sat_weight, t_infall, logmp_infall, logmhost_infall, @@ -349,7 +352,7 @@ def passively_add_emlines_to_lc_data(ssp_data, lc_data): _LCDHKEYS = ( - "nhalos", + "cen_weight", "z_obs", "t_obs", "logmp_obs", @@ -365,7 +368,7 @@ def passively_add_emlines_to_lc_data(ssp_data, lc_data): _LCDKEYS = ( *_LCDHKEYS, - "nhalos_host", + "sat_weight", "t_infall", "logmp_infall", "logmhost_infall", diff --git a/diffsky/experimental/mc_phot.py b/diffsky/experimental/mc_phot.py index 3ff89b53..625974b1 100644 --- a/diffsky/experimental/mc_phot.py +++ b/diffsky/experimental/mc_phot.py @@ -100,7 +100,6 @@ def mc_lc_phot_merging( if not skip_param_check: assert dpwm.check_param_collection_is_ok(param_collection) - sat_weights = jnp.where(lc_data.is_central == 1, 1.0, lc_data.nhalos) _res = mcpk._mc_phot_kern_merging( ran_key, lc_data.z_obs, @@ -122,7 +121,7 @@ def mc_lc_phot_merging( lc_data.logmhost_infall, lc_data.t_infall, lc_data.is_central, - sat_weights, + lc_data.sat_weight, lc_data.halo_indx, mc_merge, )