Substructure – Subhalos and Line-of-Sight Halos Rendering Modules
Substructure Classes Available
SubhalosDG19 - Class for rendering the subhalos of a main halos according to DG19.
LOSDG19 - Class for rendering the line of sight structure according to DG19.
paltas.Substructure.los_base module
Define the base class to draw line of sight substructure for a lens
This module contains the base class that all the los classes will build from. Because the steps for rendering halos can vary between different models, the required functions are very sparse.
- class paltas.Substructure.los_base.LOSBase(los_parameters, main_deflector_parameters, source_parameters, cosmology_parameters)[source]
Bases:
objectBase class for rendering the los of a main halo.
- Parameters:
los_parameters (dict) – A dictionary containing the type of los distribution and the value for each of its parameters.
main_deflector_parameters (dict) – A dictionary containing the type of main deflector and the value for each of its parameters.
source_parameters (dict) – A dictionary containing the type of the source and the value for each of its parameters.
cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).
- calculate_average_alpha(n_draws=100)[source]
Calculates the average deflection maps from the los at each redshift specified by the los parameters and returns corresponding lenstronomy objects.
- Parameters:
num_pix (int) – The number of pixels to sample for our interpolation maps.
- Returns:
A tuple of two lists: the first is the interpolation profile type for each redshift slice and the second is the lenstronomy kwargs for that profile.
- Return type:
(tuple)
- check_parameterization(required_params)[source]
Check that all the required parameters are present in the los_parameters.
- Parameters:
required_params ([str,...]) – A list of strings containing the required parameters.
- draw_los()[source]
Draws masses, concentrations,and positions for the los substructure of a main lens halo.
- Returns:
A tuple of three lists: the first is the profile type for each los halo returned, the second is the lenstronomy kwargs for that halo, and the third is a list of redshift values for each profile.
- Return type:
(tuple)
- required_parameters = ()
- update_parameters(los_parameters=None, main_deflector_parameters=None, source_parameters=None, cosmology_parameters=None)[source]
Updated the class parameters
- Parameters:
los_parameters (dict) – A dictionary containing the type of los distribution and the value for each of its parameters.
main_deflector_parameters (dict) – A dictionary containing the type of main deflector and the value for each of its parameters.
source_parameters (dict) – A dictionary containing the type of the source and the value for each of its parameters.
cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).
paltas.Substructure.los_dg19 module
Define the class to draw line of sight substructure for a lens according to https://arxiv.org/pdf/1909.02573.pdf
This module contains the functions needed to turn the parameters of the los halo distribution into masses, concentrations, and positions.
- class paltas.Substructure.los_dg19.LOSDG19(los_parameters, main_deflector_parameters, source_parameters, cosmology_parameters)[source]
Bases:
LOSBaseClass for rendering the line of sight structure according to DG19.
- Parameters:
los_parameters (dict) – A dictionary containing the type of los distribution and the value for each of its parameters.
main_deflector_parameters (dict) – A dictionary containing the type of main deflector and the value for each of its parameters.
source_parameters (dict) – A dictionary containing the type of the source and the value for each of its parameters.
cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).
Notes:
Required Parameters
delta_los - mass function normalization
m_min - minimum rendered mass in units of M_sun
m_max - maximum rendered mass in units of M_sun
z_min - minimum redshift at which to render los halos
dz - redshift bin width
cone_angle - cone opening angle for rendering los halos
c_0 - concentration normalization
conc_zeta - concentration redshift power law slope
conc_beta - concentration peak height power law slope
conc_m_ref - concentration peak height pivot mass
dex_scatter - scatter in concentration in units of dex
alpha_dz_factor- deflection angle correction redshift bin width
- calculate_average_alpha(num_pix)[source]
Calculates the average deflection maps from the los at each redshift specified by the los parameters and returns corresponding lenstronomy objects.
- Parameters:
num_pix (int) – The number of pixels to sample for our interpolation maps.
- Returns:
A tuple of two lists: the first is the interpolation profile type for each redshift slice and the second is the lenstronomy kwargs for that profile.
- Return type:
(tuple)
Notes
The average los deflection angles of the lenstronomy objects will be the negative of the average (since we want to subtract the average effect not add it). Pixel scale will be set such that at each redshift a box of 5*r_los is captured.
- cone_angle_to_radius(z, z_lens, z_source, cone_angle, angle_buffer=0.8)[source]
Returns the radius in kpc at the given redshift for the given cone angle.
- Parameters:
z (float) – The redshift at which to calculate the radius
z_lens (float) – The redshift of the main deflector
z_source (float) – The redshift of the source
dz (float) – The thickness of the redshift slice to consider
cone_angle (float) – The opening angle of the cone for the los realization in units of arcseconds.
angle_buffer (float) – A buffer for how small the second cone gets as it approaches the source. Should be between 0 and 1 with 1 meaning that the second cone converges to a point at the source.
- Retruns:
(float): The radius in units of physical kpc.
- convert_to_lenstronomy(z, z_masses, z_cart_pos)[source]
Converts the subhalo masses and position to truncated NFW profiles for lenstronomy
- Parameters:
z (float) – The redshift for each of the halos
z_masses (np.array) – The masses of each of the halos that were drawn
z_cart_pos (np.array) – A n_los x 2D array of the position of the halos that were drawn
- Returns:
A tuple containing the list of models and the list of kwargs for the truncated NFWs.
- Return type:
([string,…],[dict,…])
- dn_dm(m, z)[source]
Returns the mass function at a given mass and redshift.
- Parameters:
m (np.array) – An array of the mass values at which to calculate the mass function in units of M_sun.
z (np.array) – Either one redshift at which to calculate the mass function or one redshift for each mass input.
- Returns:
The values of the mass function at each mass in units of physical number density in units of 1/(M_sun*kpc^3).
- Return type:
(np.array)
Notes
It is slower to pass in multiple z values that are identical. If only a few redshift bins are being considered, run this function on each bin with a float redshift.
- draw_los()[source]
Draws masses, concentrations,and positions for the los substructure of a main lens halo.
- Returns:
A tuple of three lists: the first is the profile type for each los halo returned, the second is the lenstronomy kwargs for that halo, and the third is a list of redshift values for each profile.
- Return type:
(tuple)
Notes
The returned lens model list includes terms to correct for the average deflection angle introduced from the los halos.
- draw_nfw_masses(z)[source]
Draws from the Sheth Tormen mass function with an additional correction for two point correlation with main lens.
- Parameters:
z (float) – The redshift at which to draw the masses
- Returns:
An array with the drawn masses in units of M_sun.
- Return type:
(np.array)
- mass_concentration(z, m_200, scatter_mult=1.0)[source]
Returns the concentration of halos at a certain mass given the parameterization of DG_19.
- Parameters:
z (float) – The redshift of the nfw halos
m_200 (np.array) – array of M_200 of the nfw halo units of M_sun
scatter_mult (float) – an additional scaling to the scatter. Likely only useful for los rendering to force scatter to 0.
- Returns:
The concentration for each halo.
- Return type:
(np.array)
- static nu_f_nu(nu)[source]
Calculates nu f(nu) for the Sheth Tormen 2001 model.
- Parameters:
nu (np.array) – An array of nu values to at which to calculate nu_f_nu
- Returns:
The value of nu f(nu)
- Return type:
(np.array)
- power_law_dn_dm(z, m_min, m_max, n_dm=100)[source]
Returns the best fit power law parameters for the physical number density at a given redshift and mass range.
- Parameters:
z (float) – The redshift at which to calculate the power law parameters.
m_min (float) – The lower bound of the mass M_sun
m_max (float) – The upper bound of the mass M_sun
n_dm (int) – The number of dm samples to consider in the fit.
- Returns:
The power law slope and the norm for the power law in units of 1/M_sun/kpc**3
- Return type:
(tuple)
- required_parameters = ('m_min', 'm_max', 'z_min', 'dz', 'cone_angle', 'r_max', 'r_min', 'c_0', 'conc_zeta', 'conc_beta', 'conc_m_ref', 'dex_scatter', 'delta_los', 'alpha_dz_factor')
- sample_los_pos(z, n_los)[source]
Draws the positions for the line of sight substructure at the given redshift.
- Parameters:
z (float) – The redshift to place the los halos at.
n_los (int) – The number of los halos to draw position for
- Returns:
A n_los x 2 array giving the x,y position of the line of sight structure in units of kpc.
- Return type:
(np.array)
- two_halo_boost(z, z_lens, dz, lens_m200, r_max, r_min, n_quads=100)[source]
Calculates the boost from the two halo term of the host halo at the given redshift.
- Parameters:
z (float) – The redshift to calculate the boost at.
z_len (float) – The redshift of the main deflector
dz (float) – The thickness of the redshift slice to consider
lens_m200 (float) – The mass of the host lens in units of M_sun with mass definition 200c.
r_max (float) – The maximum radius to calculate the correlation function out to.
r_min (float) – The minimum radius to consider the correlation funciton to (to avoid overlap with substructure draws).
n_quads (int) – The number of points to use in averaging the two halo term of the redshift slice.
- Returns
(float): The boost at the given redshift.
- volume_element(z, z_lens, z_source, dz, cone_angle, angle_buffer=0.8)[source]
Returns the physical volume element at the given redshift
- Parameters:
z (float) – The redshift at which to calculate the volume element
z_lens (float) – The redshift of the main deflector
z_source (float) – The redshift of the source
dz (float) – The thickness of the redshift slice to consider
cone_angle (float) – The opening angle of the cone for the los realization in units of arcseconds.
- Retruns:
(float): The physical volume element in kpc**3
Notes
This depends on parameters like the cone angle, the redshift of the source, and the redshift of the lens.
paltas.Substructure.nfw_functions module
Define functions useful for conversion between different NFW conventions
This module contains the functions used to move between NFW conventions and to transform NFW parameters into lenstronomy inputs.
- paltas.Substructure.nfw_functions.calculate_sigma_crit(z, z_source, cosmo)[source]
Calculates the critical density for the given configuration
- Parameters:
z (np.array) – The redshift of the nfw
z_source (float) – The redshift of the source
cosmo (colossus.cosmology.cosmology.Cosmology) – An instance of the colossus cosmology object.
- Returns:
The critical surface density in units of M_sun/kpc^2
- Return type:
(np.array)
- paltas.Substructure.nfw_functions.convert_from_lenstronomy_NFW(r_scale_ang, alpha_rs, z, z_source, cosmo)[source]
Converts parameters used by lenstronomy to physical NFW parameters
- Parameters:
r_scale_ang (np.array) – The scale radius of the nfw in angular units
alpha_rs (np.array) – The deflection angle at the scale radius
z (np.array) – The redshift of the nfw
z_source (float) – The redshift of the source
cosmo (colossus.cosmology.cosmology.Cosmology) – An instance of the colossus cosmology object.
- Returns:
A list of 2 numpy arrays: The scale radius in kpc and the amplitude of the nfw halo in units of M_sun/kpc^3.
- Return type:
[np.array,…]
- paltas.Substructure.nfw_functions.convert_from_lenstronomy_tNFW(r_scale_ang, alpha_rs, r_trunc_ang, z, z_source, cosmo)[source]
Converts parameters used by lenstronomy to physical tNFW parameters
- Parameters:
r_scale_ang (np.array) – The scale radius of the nfw in angular units
alpha_rs (np.array) – The deflection angle at the scale radius
r_trunc_ang (np.array) – The truncation radius for each nfw in angular units.
z (np.array) – The redshift of the nfw
z_source (float) – The redshift of the source
cosmo (colossus.cosmology.cosmology.Cosmology) – An instance of the colossus cosmology object.
- Returns:
A list of 3 numpy arrays: The scale radius in kpc, the amplitude of the nfw halo in units of M_sun/kpc^3, and the truncation radius in units of kpc.
- Return type:
[np.array,…]
- paltas.Substructure.nfw_functions.convert_to_lenstronomy_NFW(r_scale, z, rho_nfw, z_source, cosmo)[source]
Converts physical NFW parameters to parameters used by lenstronomy
- Parameters:
r_scale (np.array) – The scale radius of the nfw in units of kpc
z (np.array) – The redshift of the nfw
rho_nfw (np.array) – The amplitude of the nfw halos in units of M_sun/kpc^3
z_source (float) – The redshift of the source
cosmo (colossus.cosmology.cosmology.Cosmology) – An instance of the colossus cosmology object.
- Returns:
A list of 2 numpy arrays: The angular r_scale and the deflection angle at the scale radius.
- Return type:
[np.array,…]
- paltas.Substructure.nfw_functions.convert_to_lenstronomy_tNFW(r_scale, z, rho_nfw, r_trunc, z_source, cosmo)[source]
Converts physical tNFW parameters to parameters used by lenstronomy
- Parameters:
r_scale (np.array) – The scale radius of the nfw in units of kpc
z (np.array) – The redshift of the nfw
rho_nfw (np.array) – The amplitude of the nfw halos in units of M_sun/kpc^3
r_trunc (np.array) – The truncation radius for each nfw in units of kpc.
z_source (float) – The redshift of the source
cosmo (colossus.cosmology.cosmology.Cosmology) – An instance of the colossus cosmology object.
- Returns:
A list of 3 numpy arrays: The angular r_scale, the deflection angle at the scale radius, and the angular truncation radius in units of kpc.
- Return type:
[np.array,…]
- paltas.Substructure.nfw_functions.cored_nfw_draws(r_tidal, rho_nfw, r_scale, r_max, n_subs, n_cdf_samps=1000)[source]
Returns radial samples from a cored nfw mass profile
- Parameters:
r_tidal (float) – The tidal radius within which the NFW profile will be replaced by a uniform profile in units of kpc.
rho_nfw (float) – The amplitude of the nfw density outside the cored radius in units of M_sun / kpc^3.
r_scale (float) – The scale radius of the nfw in units of kpc.
r_max (float) – The maximum value of r to sample in units of kpc.
n_subs (int) – The number of subhalo positions to sample
n_cdf_samps (int) – The number of samples to use to numerically invert the cdf for sampling.
- Returns:
A n_subs array giving sampled radii in units of kpc.
- Return type:
(np.array)
Notes
The cored NFW profile here assume uniform distribution within the tidal radius and then an NFW radial distribution outside the tidal radius.
- paltas.Substructure.nfw_functions.cored_nfw_integral(r_tidal, rho_nfw, r_scale, r_upper)[source]
Integrates the cored nfw mass profile from 0 to r_upper
- Parameters:
r_tidal (float) – The tidal radius within which the NFW profile will be replaced by a uniform profile. Units of kpc
rho_nfw (float) – The amplitude of the nfw density outside the cored radius. Units of M_sun/kpc^3
r_scale (float) – The scale radius of the nfw in units of kpc
r_upper (np.array) – An array containing the upper bounds to be evaluated in units of kpc.
- Returns:
The value of the integral for each r_upper given.
- Return type:
(np.array)
Notes
The cored NFW profile here assume uniform distribution within the tidal radius and then an NFW radial distribution outside the tidal radius.
- paltas.Substructure.nfw_functions.m_c_from_rho_r_scale(rho_nfw, r_scale, cosmo, z)[source]
Calculates the mass and concentration from the amplitude of the nfw profile and scale radius.
- Parameters:
rho_nfw (np.array) – The amplitude of the nfw in units of M_sun/kpc^3
r_scale (np.array) – The scale radius in units of kpc
cosmo (colossus.cosmology.cosmology.Cosmology) – An instance of the colossus cosmology object.
z (float) – The redshift of the NFW halos.
- Returns:
A list of 2 np.array objects. This first is the mass and the second the concentration for each NFW.
- Return type:
[np.array,…]
- paltas.Substructure.nfw_functions.nfw_draws(rho_nfw, r_scale, r_max, n_subs, n_cdf_samps=1000)[source]
Returns radial samples from the nfw mass profile.
- Parameters:
rho_nfw (float) – The amplitude of the nfw density outside the cored radius in units of M_sun / kpc^3.
r_scale (float) – The scale radius of the nfw in units of kpc.
r_max (float) – The maximum value of r to sample in units of kpc.
n_subs (int) – The number of subhalo positions to sample
n_cdf_samps (int) – The number of samples to use to numerically invert the cdf for sampling.
- Returns:
A n_subs array giving sampled radii in units of kpc.
- Return type:
(np.array)
- paltas.Substructure.nfw_functions.nfw_integral(rho_nfw, r_scale, r_upper)[source]
Integrates the nfw mass profile from 0 to r_upper.
- Parameters:
rho_nfw (float) – The amplitude of the nfw density outside the cored radius. Units of M_sun/kpc^3
r_scale (float) – The scale radius of the nfw in units of kpc
r_upper (np.array) – An array containing the upper bounds to be evaluated in units of kpc.
- Returns:
The value of the integral for each r_upper given.
- Return type:
(np.array)
- paltas.Substructure.nfw_functions.r_200_from_m(m_200, z, cosmo)[source]
Calculates r_200 for our NFW profile given our m_200 mass.
- Parameters:
m_200 (float, or np.array) – The mass contained within r_200 in units of M_sun
z (float, or np.array) – The redshift of the halo
cosmo (colossus.cosmology.cosmology.Cosmology) – An instance of the colossus cosmology object.
- Returns:
The r_200 radius corresponding to the given mass in units of kpc.
- Return type:
(float, or np.array)
Notes
This equation assumes that for a halo at redshift z, m200 is defined in terms of the critical density at that redshift. Therefore the output to the equation is in physical units.
- paltas.Substructure.nfw_functions.rho_nfw_from_m_c(m_200, c, cosmo, r_scale=None, z=None)[source]
Calculates the amplitude of the nfw profile given the physical parameters.
- Parameters:
m_200 (float, or np.array) – The mass of the nfw halo in units of M_sun
c (float, or np.array) – The concentration of the nfw_halo
cosmo (colossus.cosmology.cosmology.Cosmology) – An instance of the colossus cosmology object.
r_scale (float, or np.array) – The scale radius in units of kpc
z (float, or np.array) – The redshift at which to calculate r_200.
- Returns:
The amplitude for the nfw in units of M_sun/kpc^3.
- Return type:
(float, or np.array)
- paltas.Substructure.nfw_functions.tnfw_draws(rho_nfw, r_scale, r_trunc, r_max, n_subs, n_cdf_samps=1000)[source]
Returns radial samples from truncated nfw mass profile This is the same as the nfw profile but scaled by a factor of r_trunc^2/(r_trunc^2+r^2)
- Parameters:
rho_nfw (float) – The amplitude of the nfw density outside the cored radius in units of M_sun / kpc^3.
r_scale (float) – The scale radius of the nfw in units of kpc.
r_trunc (float) – The truncation radius for the profile.
r_max (float) – The maximum value of r to sample in units of kpc.
n_subs (int) – The number of subhalo positions to sample
n_cdf_samps (int) – The number of samples to use to numerically invert the cdf for sampling.
- Returns:
A n_subs array giving sampled radii in units of kpc.
- Return type:
(np.array)
Notes
Set r_max to a value larger than r_trunc but not so large that you’re wasting a lot of interpolation points for the inverse cdf.
- paltas.Substructure.nfw_functions.tnfw_integral(rho_nfw, r_scale, r_trunc, r_upper)[source]
Integrates the truncated nfw mass profile from 0 to r_upper. This is the same as the nfw profile but scaled by a factor of r_trunc^2/(r_trunc^2+r^2)
- Parameters:
rho_nfw (float) – The amplitude of the nfw density outside the cored radius. Units of M_sun/kpc^3
r_scale (float) – The scale radius of the nfw in units of kpc
r_trunc (float) – The truncation radius for the profile.
r_upper (np.array) – An array containing the upper bounds to be evaluated in units of kpc.
- Returns:
The value of the integral for each r_upper given.
- Return type:
(np.array)
paltas.Substructure.subhalos_base module
Define the base class to draw subhalos for a lens
This module contains the base class that all the subhalo classes will build from. Because the steps for rendering subhalos can vary between different models, the required functions are very sparse.
- class paltas.Substructure.subhalos_base.SubhalosBase(subhalo_parameters, main_deflector_parameters, source_parameters, cosmology_parameters)[source]
Bases:
objectBase class for rendering the subhalos of a main halo.
- Parameters:
subhalo_parameters (dict) – A dictionary containing the type of subhalo distribution and the value for each of its parameters.
main_deflector_parameters (dict) – A dictionary containing the type of main deflector and the value for each of its parameters.
source_parameters (dict) – A dictionary containing the type of the source and the value for each of its parameters.
cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).
- check_parameterization(required_params)[source]
Check that all the required parameters are present in the subhalo_parameters.
- Parameters:
required_params ([str,...]) – A list of strings containing the required parameters.
- draw_subhalos()[source]
Draws masses, concentrations,and positions for the subhalos of a main lens halo.
- Returns:
A tuple of three lists: the first is the profile type for each subhalo returned, the second is the lenstronomy kwargs for that subhalo, and the third is the redshift for each subhalo.
- Return type:
(tuple)
- required_parameters = ()
- update_parameters(subhalo_parameters=None, main_deflector_parameters=None, source_parameters=None, cosmology_parameters=None)[source]
Updated the class parameters
- Parameters:
subhalo_parameters (dict) – A dictionary containing the type of los distribution and the value for each of its parameters.
main_deflector_parameters (dict) – A dictionary containing the type of main deflector and the value for each of its parameters.
source_parameters (dict) – A dictionary containing the type of the source and the value for each of its parameters.
cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).
Notes
Use this function to update parameter values instead of starting a new class.
paltas.Substructure.subhalos_dg19 module
Draw subhalo masses and concentrations for NFW subhalos according to https://arxiv.org/pdf/1909.02573.pdf
This module contains the functions needed to turn the parameters of NFW subhalo distributions into masses, concentrations, and positions for those NFW subhalos.
- class paltas.Substructure.subhalos_dg19.SubhalosDG19(subhalo_parameters, main_deflector_parameters, source_parameters, cosmology_parameters)[source]
Bases:
SubhalosBaseClass for rendering the subhalos of a main halos according to DG19.
- Parameters:
subhalo_parameters (dict) – A dictionary containing the type of subhalo distribution and the value for each of its parameters.
main_deflector_parameters (dict) – A dictionary containing the type of main deflector and the value for each of its parameters.
source_parameters (dict) – A dictionary containing the type of the source and the value for each of its parameters.
cosmology_parameters (str,dict, or colossus.cosmology.Cosmology) – Either a name of colossus cosmology, a dict with ‘cosmology name’: name of colossus cosmology, an instance of colussus cosmology, or a dict with H0 and Om0 ( other parameters will be set to defaults).
Notes:
Required Parameters
sigma_sub - SHMF normalization in units of kpc^(-2)
shmf_plaw_index - SHMF mass function power-law slope
m_pivot - SHMF power-law pivot mass in unit of M_sun
m_min - SHMF minimum rendered mass in units of M_sun
m_max - SHMF maximum rendered mass in units of M_sun
c_0 - concentration normalization
conc_zeta - concentration redshift power law slope
conc_beta - concentration peak height power law slope
conc_m_ref - concentration peak height pivot mass
dex_scatter - scatter in concentration in units of dex
k1 - slope of SHMF host mass dependence
k2 - slope of SHMF host redshift dependence
- convert_to_lenstronomy(subhalo_masses, subhalo_cart_pos)[source]
Converts the subhalo masses and position to truncated NFW profiles for lenstronomy
- Parameters:
subhalo_masses (np.array) – The masses of each of the subhalos that were drawn
subhalo_cart_pos (np.array) – A n_subs x 3D array of the positions of the subhalos that were drawn
- Returns:
A tuple containing the list of models and the list of kwargs for the truncated NFWs.
- Return type:
([string,…],[dict,…])
- draw_nfw_masses()[source]
Draws from the https://arxiv.org/pdf/1909.02573.pdf subhalo mass function and returns an array of the masses.
- Returns:
The masses of the drawn halos in units of M_sun
- Return type:
(np.array)
- draw_subhalos()[source]
Draws masses, concentrations,and positions for the subhalos of a main lens halo.
- Returns:
A tuple of three lists: the first is the profile type for each subhalo returned, the second is the lenstronomy kwargs for that subhalo, and the third is the redshift for each subhalo.
- Return type:
(tuple)
Notes
The redshift for each subhalo is the same as the host, so the returned redshift list is not necessary unless the output is being combined with los substructure.
- static get_truncation_radius(m_200, r, m_pivot=10000000.0, r_pivot=50)[source]
Returns the truncation radius for a subhalo given the mass and radial position in the host NFW
- Parameters:
m_200 (np.array) – The mass of the subhalos in units of M_sun
r (np.array) – The radial position of the subhalos in units of kpc
m_pivot (float) – The pivot mass for the scaling in units of M_sun
r_pivot (float) – The pivot radius for the relation in unit of kpc
- Returns:
The truncation radii for the subhalos in units of kpc
- Return type:
(np.array)
- static host_scaling_function(host_m200, z_lens, k1=0.88, k2=1.7)[source]
Returns scaling for the subhalo mass function based on the mass of the host halo.
Derived from galacticus in https://arxiv.org/pdf/1909.02573.pdf.
- Parameters:
host_m200 (float) – The mass of the host halo in units of M_sun
z_lens (flat) – The redshift of the host halo / main deflector
k1 (flaot) – Amplitude of halo mass dependence
k2 (flaot) – Amplitude of the redshift scaling
- Returns:
The normalization scaling for the subhalo mass function
- Return type:
(float)
Notes
Default values of k1 and k2 are derived from galacticus.
- mass_concentration(z, m_200)[source]
Returns the concentration of halos at a certain mass given the parameterization of DG_19.
- Parameters:
z (np.array) – The redshift of the nfw halo
m_200 (np.array) – array of M_200 of the nfw halo units of M_sun
- Returns:
The concentration for each halo.
- Return type:
(np.array)
- static rejection_sampling(r_samps, r_200, r_3E)[source]
Given the radial sampling of the positions and DG_19 constraints, conducts rejection sampling and return the cartesian positions.
- Parameters:
r_samps (np.array) – Samples of the radial coordinates for the subhalos in units of kpc.
r_200 (float) – The r_200 of the host halo which will be used as the maximum z magnitude in units of kpc.
r_3E (float) – 3 times the einstein radius, which will be used to bound the x and y coordinates in units of kpc.
- Returns:
A list of two numpy arrays: the boolean array of accepted samples and a n_subsx3 array of x,y,z coordinates. All in units of kpc.
- Return type:
([np.array,…])
- required_parameters = ('sigma_sub', 'shmf_plaw_index', 'm_pivot', 'm_min', 'm_max', 'c_0', 'conc_zeta', 'conc_beta', 'conc_m_ref', 'dex_scatter', 'k1', 'k2')
- sample_cored_nfw(n_subs)[source]
Given the a tidal radius that defines a core region and the parameters of the main deflector, samples positions for NFW subhalos bounded as described in https://arxiv.org/pdf/1909.02573.pdf
- Parameters:
n_subs (int) – The number of subhalo positions to sample
- Returns:
A n_subs x 3 array giving the x,y,z position of the subhalos in units of kpc.
- Return type:
(np.array)
Notes
The code works through rejection sampling, which can be inneficient for certain configurations. If this is a major issue, it may be worth introducing more analytical components.