Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
)
Expand All @@ -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,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
)
Expand Down
29 changes: 16 additions & 13 deletions diffsky/experimental/lightcone_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = <Nsat(Msub) | Mhost>

nsub_per_host: int
number of subhalos per host halo
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions diffsky/experimental/mc_phot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
)
Expand Down
Loading