Skip to content

Commit

Permalink
Added new keyword argument halo_boundary_key allowing users to overri…
Browse files Browse the repository at this point in the history
…de the enforcement of consistent column names between halo mass and halo boundary
  • Loading branch information
aphearin committed Sep 18, 2020
1 parent de727d3 commit d3abd0a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@ def test_host_centric_distance():
def test_mass_definition_flexibility():
""" Regression test for Issue #993.
"""
model = PrebuiltHodModelFactory("zheng07", mdef="200m")
model = PrebuiltHodModelFactory(
"zheng07", mdef="200m", halo_boundary_key="halo_radius_arbitrary"
)
halocat = FakeSim(seed=43)
halocat.halo_table["halo_m200m"] = np.copy(halocat.halo_table["halo_mvir"])
halocat.halo_table["halo_radius_arbitrary"] = np.copy(
halocat.halo_table["halo_mvir"]
)
model.populate_mock(halocat, seed=43)
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(
cosmology=sim_defaults.default_cosmology,
redshift=sim_defaults.default_redshift,
mdef=model_defaults.halo_mass_definition,
halo_boundary_key=None,
**kwargs
):
"""
Expand Down Expand Up @@ -59,7 +60,10 @@ def __init__(
self.cosmology = cosmology
self.redshift = redshift
self.mdef = mdef
self.halo_boundary_key = model_defaults.get_halo_boundary_key(self.mdef)
if halo_boundary_key is None:
self.halo_boundary_key = model_defaults.get_halo_boundary_key(self.mdef)
else:
self.halo_boundary_key = halo_boundary_key

def assign_phase_space(self, table, **kwargs):
r"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class AnalyticDensityProf(object):
the profile is the necessary and sufficient ingredient.
"""

def __init__(self, cosmology, redshift, mdef, **kwargs):
def __init__(self, cosmology, redshift, mdef, halo_boundary_key=None, **kwargs):
r"""
Parameters
-----------
Expand All @@ -55,6 +55,9 @@ def __init__(self, cosmology, redshift, mdef, **kwargs):
mdef: str
String specifying the halo mass definition, e.g., 'vir' or '200m'.
halo_boundary_key : str, optional
Default behavior is to use the column associated with the input mdef.
"""
self.cosmology = cosmology
self.redshift = redshift
Expand All @@ -65,7 +68,10 @@ def __init__(self, cosmology, redshift, mdef, **kwargs):
self.density_threshold = halo_boundary_functions.density_threshold(
cosmology=self.cosmology, redshift=self.redshift, mdef=self.mdef
)
self.halo_boundary_key = model_defaults.get_halo_boundary_key(self.mdef)
if halo_boundary_key is None:
self.halo_boundary_key = model_defaults.get_halo_boundary_key(self.mdef)
else:
self.halo_boundary_key = halo_boundary_key
self.prim_haloprop_key = model_defaults.get_halo_mass_key(self.mdef)

self.gal_prof_param_keys = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ def __init__(self, profile_integration_tol=1e-5, **kwargs):
String specifying the halo mass definition, e.g., 'vir' or '200m'.
Default is set in `~halotools.empirical_models.model_defaults`.
halo_boundary_key : str, optional
Default behavior is to use the column associated with the input mdef.
concentration_key : string, optional
Column name of the halo catalog storing NFW concentration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def __init__(
mdef=model_defaults.halo_mass_definition,
conc_mass_model=model_defaults.conc_mass_model,
concentration_key=model_defaults.concentration_key,
halo_boundary_key=None,
**kwargs
):
r"""
Expand All @@ -60,6 +61,9 @@ def __init__(
String specifying the halo mass definition, e.g., 'vir' or '200m'.
Default is set in `~halotools.empirical_models.model_defaults`.
halo_boundary_key : str, optional
Default behavior is to use the column associated with the input mdef.
conc_mass_model : string or callable, optional
Specifies the function used to model the relation between
NFW concentration and halo mass.
Expand All @@ -80,7 +84,9 @@ def __init__(
--------
>>> nfw = NFWProfile()
"""
AnalyticDensityProf.__init__(self, cosmology, redshift, mdef)
AnalyticDensityProf.__init__(
self, cosmology, redshift, mdef, halo_boundary_key=halo_boundary_key
)

self.gal_prof_param_keys = ["conc_NFWmodel"]
self.halo_prof_param_keys = ["conc_NFWmodel"]
Expand Down

0 comments on commit d3abd0a

Please sign in to comment.