Skip to content

Commit

Permalink
add new preset model
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Gilman committed Oct 30, 2024
1 parent 1043de4 commit 28a8d95
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 1 deletion.
69 changes: 69 additions & 0 deletions pyHalo/PresetModels/sidm.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,72 @@ class for details
probabilities_subhalos, probabilities_field_halos, kwargs_sub_function, kwargs_field_function)
sidm = extension.add_core_collapsed_halos(index_collapsed, collapsed_halo_profile, **kwargs_collapsed_profile)
return sidm

def SIDM_parametric(z_lens, z_source, log10_mass_ranges, collapse_timescales, subhalo_time_scaling=1.0,
sigma_sub=0.025, log10_sigma_sub=None, log_mlow=6., log_mhigh=10.,
concentration_model_subhalos='DIEMERJOYCE19', kwargs_concentration_model_subhalos={},
concentration_model_fieldhalos='DIEMERJOYCE19', kwargs_concentration_model_fieldhalos={},
truncation_model_subhalos='TRUNCATION_GALACTICUS', kwargs_truncation_model_subhalos={},
infall_redshift_model='HYBRID_INFALL', kwargs_infall_model={},
truncation_model_fieldhalos='TRUNCATION_RN', kwargs_truncation_model_fieldhalos={},
shmf_log_slope=-1.9, cone_opening_angle_arcsec=6., log_m_host=13.3, r_tidal=0.25,
LOS_normalization=1.0, geometry_type='DOUBLE_CONE', kwargs_cosmo=None):
"""
Generates realizations of SIDM halos in terms of the core collapse timescale in different mass bins using the
parametric model by Yang et al.
:param z_lens: main deflector redshift
:param z_source: source redshift
:param log10_mass_ranges: a list of lists specifying halo mass ranges, e.g. [[6, 8], [8, 10]]
:param collapse_timescales: a list of core collapse timescales in Gyr for halos in each bin, e.g. [6.0, 1.0]
:param subhalo_time_scaling: a number that makes time pass quicker (>1) or lower (<1) for subhalos relative to
field halos
:param sigma_sub: normalization of the subhalo mass function
:param log10_sigma_sub: normalization of the subhalo mass function in log units (overwrites sigma_sub)
:param log_mlow: log base 10 of the minimum halo mass to render
:param log_mhigh: log base 10 of the maximum halo mass to render
:param concentration_model_subhalos: the concentration-mass relation applied to subhalos,
see concentration_models.py for a complete list of available models
:param kwargs_concentration_model_subhalos: keyword arguments for the subhalo MC relation
NOTE: keyword args returned by the load_concentration_model override these keywords with duplicate arguments
:param concentration_model_subhalos: the concentration-mass relation applied to field halos,
see concentration_models.py for a complete list of available models
:param kwargs_concentration_model_fieldhalos: keyword arguments for the field halo MC relation
NOTE: keyword args returned by the load_concentration_model override these keywords with duplicate arguments
:param truncation_model_subhalos: the truncation model applied to subhalos, see truncation_models for a complete list
:param kwargs_truncation_model_subhalos: keyword arguments for the truncation model applied to subhalos
:param truncation_model_fieldhalos: the truncation model applied to field halos, see truncation_models for a
complete list
:param kwargs_truncation_model_fieldhalos: keyword arguments for the truncation model applied to field halos
:param infall_redshift_model: a string that specifies that infall redshift sampling distribution, see the LensCosmo
class for details
:param kwargs_infall_model: keyword arguments for the infall redshift model
:param shmf_log_slope: the logarithmic slope of the subhalo mass function pivoting around 10^8 M_sun
:param cone_opening_angle_arcsec: the opening angle of the rendering volume in arcsec
:param log_m_host: log base 10 of the host halo mass [M_sun]
:param r_tidal: the core radius of the host halo in units of the host halo scale radius. Subhalos are distributed
in 3D with a cored NFW profile with this core radius
:param LOS_normalization: rescales the amplitude of the line-of-sight mass function
:param geometry_type: string that specifies the geometry of the rendering volume; options include
DOUBLE_CONE, CONE, CYLINDER
:param kwargs_cosmo: keyword arguments that specify the cosmology, see Cosmology/cosmology.py
:param collapsed_halo_profile: string that sets the density profile of core-collapsed halos
currently implemented models are SPL_CORE and GNFW (see example notebook)
:param kwargs_collapsed_profile: keyword arguments for the collapsed profile (see example notebook)
:return: a realization of dark matter structure in SIDM
"""
two_halo_contribution = True
delta_power_law_index = 0.0
cdm = CDM(z_lens, z_source, sigma_sub, log_mlow, log_mhigh, log10_sigma_sub,
concentration_model_subhalos, kwargs_concentration_model_subhalos,
concentration_model_fieldhalos, kwargs_concentration_model_fieldhalos,
truncation_model_subhalos, kwargs_truncation_model_subhalos,
truncation_model_fieldhalos, kwargs_truncation_model_fieldhalos,
infall_redshift_model, kwargs_infall_model,
shmf_log_slope, cone_opening_angle_arcsec, log_m_host, r_tidal,
LOS_normalization, two_halo_contribution, delta_power_law_index,
geometry_type, kwargs_cosmo)
extension = RealizationExtensions(cdm)
sidm = extension.toSIDM(log10_mass_ranges, collapse_timescales, subhalo_time_scaling)
return sidm
3 changes: 3 additions & 0 deletions pyHalo/preset_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def preset_model_from_name(name):
elif name == 'SIDM_core_collapse':
from pyHalo.PresetModels.sidm import SIDM_core_collapse
return SIDM_core_collapse
elif name == 'SIDM_parametric':
from pyHalo.PresetModels.sidm import SIDM_parametric
return SIDM_parametric
elif name == 'ULDM':
from pyHalo.PresetModels.uldm import ULDM
return ULDM
Expand Down
11 changes: 10 additions & 1 deletion tests/test_preset_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pyHalo.PresetModels.cdm import CDM, CDMCorrelatedStructure
from pyHalo.PresetModels.wdm import WDM, WDM_mixed
from pyHalo.PresetModels.sidm import SIDM_core_collapse
from pyHalo.PresetModels.sidm import SIDM_core_collapse, SIDM_parametric
from pyHalo.PresetModels.uldm import ULDM
from pyHalo.preset_models import preset_model_from_name
from pyHalo.PresetModels.external import CDMFromEmulator, DMFromGalacticus
Expand Down Expand Up @@ -52,6 +52,15 @@ def test_WDM(self):
_ = preset_model_from_name('WDM')
self._test_default_infall_model(wdm, 'hybrid')

def test_SIDM(self):

mass_ranges = [[6, 8], [8, 10]]
collapse_times = [10.5, 1.0]
sidm = SIDM_parametric(0.5, 1.5, mass_ranges, collapse_times)
_ = sidm.lensing_quantities()
_ = preset_model_from_name('SIDM_parametric')
self._test_default_infall_model(sidm, 'HYBRID')

def test_ULDM(self):

flucs_shape = 'ring'
Expand Down

0 comments on commit 28a8d95

Please sign in to comment.