Reorganize lightcone generator functions#41
Open
nvillanova wants to merge 3 commits into
Open
Conversation
aphearin
requested changes
Jun 29, 2026
|
|
||
| __all__ = ("mc_lc_mf", "mc_lc", "weighted_lc") | ||
|
|
||
| # TODO: I think we could also define halo_weight == gal_weight = cen_weight * sat_weight here, instead of leaving the user to multiply afterwards. |
Collaborator
There was a problem hiding this comment.
Yes, I agree this would be nice to include. I think we will continue to need sat_weight and cen_weight separately, but including the product halo_weight is a nice convenience. Please add that, and include a test that the value stored in this new field is equal to cen_weight * sat_weight.
| for i, _param in enumerate(mah_params_names): | ||
| mah_params_tot[i, :] = np.concatenate( | ||
| ( | ||
| cenpop.mah_params._asdict()[_param], |
Collaborator
There was a problem hiding this comment.
This is purely cosmetic: here I think it would be more elegant to use getattr(cenpop.mah_params, _param) rather than converting to a dict.
| n_subs = len(logmu_obs) | ||
| sat_weight = jnp.ones(n_subs) | ||
| # TODO: check shape of sat_weight | ||
| # sat_weight = jnp.repeat(sat_weight, n_mu_per_host) ? |
Collaborator
There was a problem hiding this comment.
Just checking: is this done? It's still listed as a TODO.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a small refactor of the functions in
diffhalos/lightcone_generatorsto make their outputs more consistent across the Monte Carlo and weighted implementations. In particular, the corresponding functions now return the samenamedtuplestructures, providing a unified interface.This is particularly useful for the implementation of
mc_lightcone_generators.pyin diffsky, which will serve as the Monte Carlo counterpart to the existing wrapper around weighted lightcones.Summary of the changes
mc_lightcone_halos.py:mc_lc_halosfunction now returns the exact same namedtupleCenPopasweighted_lc_halos, i.e., with thecen_weightfield, which is equal to one for all halos.mc_lightcone_subhalos.py: defined a global namedtupleSubPop. In order for the outputs to match in bothmc_lc_subhalosandweighted_ld_subhalosfunctions ,mc_lc_subhalosnow computes some additional quantities.mc_lightcone.py: both functionsmc_lcandweighted_lcreturn the same new namedtupleHaloPop, which combines the information of centrals and subs.