slsim.Deflectors.MassLightConnection package

Submodules

slsim.Deflectors.MassLightConnection.galaxy_population module

class slsim.Deflectors.MassLightConnection.galaxy_population.GalaxySizeModel[source]

Bases: object

Characteristics of galaxy effective radius models.

This object contains certain characteristics of a galaxy effective radius model.

The models dictionary contains one item of this class for each available model.

slsim.Deflectors.MassLightConnection.galaxy_population.galaxy_size(mh, mstar, z, cosmo_col, q_out='tb', model='oguri20', scatter=False, sig_tb=0.1)[source]

Calculate the size of a galaxy based on halo mass, stellar mass, redshift, and cosmology, optionally including scatter.

Parameters:
  • mh (float, np.ndarray, list) – The halo mass or masses at which to compute the galaxy size in units of M_sol/h

  • mstar (float, np.ndarray, list) – The stellar mass or masses in units of M_sol/h

  • z (float) – The redshift at which to compute the galaxy size.

  • cosmo_col (Class (e.g., colossus.cosmology)) – An instance of a cosmology class to calculate angular diameter distances.

  • q_out (str) – The desired output quantity (‘tb’ for theta_b in arcsec or ‘rb’ for r_b in kpc/h).

  • model (str) – The name of the model used to calculate galaxy size (‘oguri20’ is default).

  • scatter (bool) – Whether to include scatter in the galaxy size calculation.

  • sig_tb (float) – The standard deviation of lognormal scatter if scatter is included for oguri20 model

Returns:

Galaxy effective radius calculated according to the specified model and parameters. Units are either in arcseconds (if q_out=’tb’) or kpc/h (if q_out=’rb’), np.ndarray or float

Notes

This function supports multiple galaxy size models which may depend on different combinations of halo mass, stellar mass, and redshift. It can also apply lognormal scatter to the sizes.

slsim.Deflectors.MassLightConnection.galaxy_population.gals_init(TYPE_SMHM='true')[source]

The fitting parameters for calculating stellar-mass-halo-mass function of P. Behroozi et al. 2019. arXiv: 1806.07893

Parameters:

TYPE_SMHM (str) – “true” and “obs” are for quiescent galaxies but “true_all” is for all galaxies in [“true”, “obs”, “true_all”]

Returns:

paramc, params. list. The fitting parameters for central galaxies and satellite galaxies For the meaning of each parameters, please see the Notes in p_smhm.__init__

Notes

The following values are summarized in Table J1 of P. Behroozi et al. 2019 (arXiv: 1806.07893) The values with TYPE_SMHM == “true” show the true values for quenched galaxies from Markov Chain Monte Carlo calculation in P. Behroozi et al. 2019 The values with TYPE_SMHM == “obs” show the values from observations for quenched galaxies The values with TYPE_SMHM == “true_all” show the true values for all galaxies including star-forming and quenched galaxies

slsim.Deflectors.MassLightConnection.galaxy_population.gene_ang_gal(pol_h)[source]

Position angle of the galaxies relative to the major axis of the halos in T. Okumura et al. 2009 arXiv: 0809.3790

Parameters:

pol_h (ndarray) – position angles of halos

Returns:

pol_gal. ndarray. position angle of galaxies

slsim.Deflectors.MassLightConnection.galaxy_population.gene_e(n)[source]

Generate an ellipticity distribution for a sample of galaxies in M. Oguri et al. 2008 arXiv: 0708.0825

Parameters:

n (int) – Number of galaxies in the sample for which to generate ellipticities.

Returns:

elipticity of 1-q, where q is axis ratio. ndarray. An array of galaxy ellipticities drawn from a truncated normal distribution.

slsim.Deflectors.MassLightConnection.galaxy_population.log10Re_log10Mstar_vdW(log10M, a, b, c, d)[source]

Function to calculate the logarithm of the effective radius as a function of the logarithm of the stellar mass used in vdw23 model.

Parameters:
  • log10M (float) – The logarithm (base 10) of the stellar mass.

  • a (float) – Coefficient for the constant term in the relation.

  • b (float) – Coefficient for the linear term in the relation.

  • c (float) – Coefficient defining the curvature of the relation.

  • d (float) – Characteristic mass where the curvature changes.

Returns:

log10Re. float. The logarithm (base 10) of the effective radius computed using the given parameters.

slsim.Deflectors.MassLightConnection.galaxy_population.modelKarmakar23(mh, z)[source]

The galaxy-size model of T. Karmakar et al 2023. arXiv: 2301.10409 We here adopt the following double-power-law fitting function as one of simple fitting functions,

\[r_e/R_\mathrm{vir} = a*\frac{M_h}{10^{12} \mathrm{M_\odot/h}}**b*(0.5*(1 +\frac{M_h}{10^{12} \mathrm{M_\odot/h}}^6))^{0.001-b/6}\]

where \(r_e\) and \(R_\mathrm{vir}\) are galaxy effective radius and halo virial radius.

Parameters:
  • mh (ndarray) – (sub)halo mass [Msun/h]; can be a number or a numpy array.

  • z (ndarray) – redshift; can be a number or a numpy array.

Returns:

rb. ndarray or a number. The galaxy size, has the dimensions as 1.0e-3 * mass_so.M_to_R(mh, z, ‘vir’) i.e. [Mpc].

Notes

The following values of a_z and b_z are determined by applying the curve_fit function in scipy.optimize to the ratio between \(r_e\) and \(R_\mathrm{vir}\) for the data at four redshifts (z=0, 1, 2, 3) in T. Karmakar et al. (2023) with the above fitting function and then applying numpy.polyfit at a linear level as functions of z.

slsim.Deflectors.MassLightConnection.galaxy_population.modelOguri20(mh, z)[source]

The galaxy-size model of Oguri&Takahashi et al 2020.

Parameters:
  • mh (ndarray) – The mass of the halo in units of M_sol/h

  • z (float) – The redshift

Returns:

rb, float, The galaxy size, has the dimensions as 1.0e-3 * mass_so.M_to_R(mh, z, ‘vir’) i.e. [Mpc].

slsim.Deflectors.MassLightConnection.galaxy_population.modelVanderwel23(mstar, z)[source]

The galaxy-size model of van der Wel et al 2023. arXiv: 2307.03264 re: effective (half-mass) radius

re is calculated as follows

\[\log_{10}(r_e/(h^{-1}\mathrm{kpc}))= \Gamma + lpha \log_{10}(M_\mathrm{cen}/M_\odot) \ + (eta-lpha)\log_{10}(1+10^{\log_{10}(M_\mathrm{cen}/M_\odot)-\delta} - \omega \log_{10}((1+z)/(1+z_\mathrm{data}))\]

where z_data= 0.75

Parameters:
  • mstar (ndarray) – satellite or central galaxy mass [Msun/h]; can be a number or a numpy array. NOTICE: this mstar is based on Chabrier IMF. Then we use mstar_cor = mstar_chab/frac_SM_IMF as an input param

  • z (float) – redshift; can be a number or a numpy array.

Returns:

rb. ndarray or a number. The galaxy size, has the dimensions as 1.0e-3 * mass_so.M_to_R(mh, z, ‘vir’) i.e. [Mpc/h].

Notes

The following list of c_vdW50 shows [Gamma, lpha, eta, delta] appeared in the above equation. These values are determined by applying the curve_fit function in scipy.optimize to the stellar half-mass radii data of the 50% percentile in Table 5 of van der Wel et al. 2023 (arXiv: 2307.03264), which is for quiescent galaxies at 0.5 < z < 1.0.

slsim.Deflectors.MassLightConnection.galaxy_population.models = {'karmakar23': <slsim.Deflectors.MassLightConnection.galaxy_population.GalaxySizeModel object>, 'oguri20': <slsim.Deflectors.MassLightConnection.galaxy_population.GalaxySizeModel object>, 'vdW23': <slsim.Deflectors.MassLightConnection.galaxy_population.GalaxySizeModel object>}

Dictionary containing a list of models.

An ordered dictionary containing one GalaxySizeModel entry for each model.

slsim.Deflectors.MassLightConnection.galaxy_population.modelscKarmakar23(mh, z, n)[source]

Generate a log-normal distribution of the scaling relation parameter based on halo mass and redshift from T. Karmakar et al 2023. arXiv: 2301.10409 We here adopt the following double-power-law fitting function as one of simple fitting functions,

\[r_e/R_\mathrm{vir} = a*\frac{M_h}{d}**b*(0.5*(1+\frac{M_h}{d)^{c-b/6}\]

where \(r_e\) and \(R_\mathrm{vir}\) are galaxy effective radius and halo virial radius.

Parameters:
  • mh (float or np.ndarray) – The halo mass or masses used in the scaling relation in units of M_sol/h

  • z (float) – The redshift value used in the scaling relation.

  • n (int) – The number of samples to draw from the distribution.

Returns:

An array of values drawn from a log-normal distribution defined by the scaling relation. ndndarray

Notes

The following values of a_z, b_z, c_z, and d_z are determined by applying the curve_fit function in scipy.optimize to the ratio between \(r_e\) and \(R_\mathrm{vir}\) for the data at four redshifts (z=0, 1, 2, 3) in T. Karmakar et al. (2023) with the above fitting function and then applying numpy.polyfit at a linear level as functions of z. d is in units of M_sol/h

slsim.Deflectors.MassLightConnection.galaxy_population.modelscLognormal(sig_tb, n)[source]

Generate samples from a lognormal distribution with specified standard deviation and number of samples.

Parameters:
  • sig_tb (float) – The standard deviation of the lognormal distribution.

  • n (int) – The number of samples to generate.

Returns:

Samples from a lognormal distribution. ndndarray

slsim.Deflectors.MassLightConnection.galaxy_population.modelscVanderwel23(mstar, n)[source]

Generate samples of effective radii for galaxies based on a lognormal distribution using parameters from van der Wel et al.(2023).

sigma_log(r_e) is calculated as follows

\[\sigma_\log(r_e) = \frac{\log(r_e^{84}(z_\mathrm{data}))-\log(r_e^{16}(z_\mathrm{data}))}{2}\]
where
log_{10}(r_e/(h^{-1}mathrm{kpc}))= Gamma + lpha log_{10}(M_mathrm{cen}/M_odot)
  • (eta-lpha)log_{10}(1+10^{log_{10}(M_mathrm{cen}/M_odot)-delta}

where z_data= 0.75, r_e^{84} and r_e^{16} are the values of effective radii of the 16%th and 84%th percentiles

Parameters:
  • mstar (np.ndarray) – Stellar mass of galaxies for which to generate the effective radius in units of M_sol/h

  • n (int) – The number of samples

Returns:

Scatters of galaxy effective radii from the lognormal distribution. ndndarray

Notes

The following lists of c_vdW84 and c_vdW16 show [Gamma, lpha, eta, delta] appeared in the above equation. These values are determined by applying the curve_fit function in scipy.optimize to the stellar half-mass radii data of the 84% and 16% percentiles in Table 5 of van der Wel et al. 2023 (arXiv: 2307.03264), which are for quiescent galaxies at 0.5 < z < 1.0. mstar_cor is defined to prevent the scatter from becoming too small or negative at the high mass end considering the fitting function. The criteria mass of 10**11.4 mostly corresponds the maximum limit of data sets in van der Wel et al. 2023.

class slsim.Deflectors.MassLightConnection.galaxy_population.p_smhm(data)[source]

Bases: object

Characteristics of stellar mass halo mass relation models.

based on the fitting function for the stellar mass - halo mass relation in Behroozi+ 2019

slsim.Deflectors.MassLightConnection.galaxy_population.set_gals_param(pol_halo)[source]

Set the galaxy parameters based on the halo position angle.

Parameters:

pol_halo (list or numpy.array) – Array or list of halo position angle values.

Returns:

elip_gal and polar_gal. An array of galaxy ellipticities generated for each halo and an array of galaxy position anglen angles derived from the halo position angle

slsim.Deflectors.MassLightConnection.galaxy_population.stellarmass_halomass(Mh, z, pa, frac_SM_IMF=1.715)[source]

Calculate the stellar mass of a galaxy from its halo mass using an empirical relation. see P. Behroozi et al. 2019. for detail arXiv: 1806.07893

Parameters:
  • Mh (float) – Halo mass of the galaxy in units of M_sol/h

  • z (float) – The redshift at which the stellar mass is calculated.

  • pa (object) – Parameter set for the stellar-mass halo-mass relation.

  • frac_SM_IMF (float) – Fraction of the stellar mass due to the initial mass function (IMF) against Chabrier IMF. Default value is set to 1.715, coming from Salpeter IMF. (set to 1.0 for Chabrier IMF)

Returns:

stellar_mass. float. The estimated stellar mass of the galaxy in units of M_sol/h

slsim.Deflectors.MassLightConnection.light2mass module

slsim.Deflectors.MassLightConnection.light2mass.Lsigma_relation_spectroscopic(mgSDSS, mrSDSS, Dlum, redshift)

input params:

mgSDSS: k-corrected g-band magnitude of the deflector type: a 1D array of floats

mrSDSS: k-corrected r-band magnitude of the deflector type: a 1D array of floats

Dlum: distance luminosity of the deflector type: a 1D array of floats

redshift: redshift of the deflector type: a 1D array of floats

slsim.Deflectors.MassLightConnection.light2mass.Lsigma_relation_weaklensing(mrSDSS, miSDSS, Dlum, redshift)

input params:

mrSDSS: k-corrected r-band magnitude of the deflector type: a 1D array of floats

miSDSS: k-corrected i-band magnitude of the deflector type: a 1D array of floats

Dlum: distance luminosity of the deflector type: a 1D array of floats

redshift: redshift of the deflector type: a 1D array of floats

slsim.Deflectors.MassLightConnection.light2mass.get_velocity_dispersion(deflector_type, lsst_mags, lsst_errs, redshift, cosmo=FlatLambdaCDM(name=None, H0=<Quantity 70. km / (Mpc s)>, Om0=0.3, Tcmb0=<Quantity 0. K>, Neff=3.04, m_nu=None, Ob0=0.0), bands=['u', 'g', 'r', 'i', 'z'], scaling_relation='spectroscopic')

input_params:

deflector_type: type of the foreground/ deflector, e.g., ‘elliptical’ type: string

lsst_mags: a 2D array of the lsst magnitudes of the deflector with multi-band magnitudes along the row, and different deflector along the column. type: a 2D array of floats.

lsst_errs: a 2D array of the lsst magnitude errors of the deflector with multi-band errors along the row, and different deflector along the column. type: a 2D array of floats.

redshift: a 1D array of the redshifts type: a 1D array of floats

cosmo: cosmology defined type: astropy.cosmology

bands: bands for which you’re providing the magnitudes, type: a list of strings e.g., [‘u’, ‘g’, ‘r’, ‘i’, ‘z’ ]

returns: stellar velocity dispersion [km/s]

References

slsim.Deflectors.MassLightConnection.massive_deflectors_DP0p2 module

slsim.Deflectors.MassLightConnection.massive_deflectors_DP0p2.compute_magnitude(flux, flux_err, zeropoint=31.4)[source]

Convert LSST flux to magnitude and compute errors.

params:

:param flux : from DP0.2 catalogs type flux: float or array-like

:param flux_err : float or array-like type flux_err : flux error

:param zeropoint : zeropoint of the AB magnitude system :type zeropoint : float

Returns:

tuple (magnitude, magnitude_error)
  • magnitudefloat or array-like

    The computed magnitude using the LSST zero-point calibration.

  • magnitude_errorfloat or array-like

    The propagated uncertainty in the magnitude.

slsim.Deflectors.MassLightConnection.massive_deflectors_DP0p2.find_massive_ellipticals(DP0_table, fracDev_limit=0.8, iMag_cut_massive=-22, pixel_scale=0.2, cosmo=FlatLambdaCDM(name=None, H0=<Quantity 72. km / (Mpc s)>, Om0=0.26, Tcmb0=<Quantity 0. K>, Neff=3.04, m_nu=None, Ob0=0.0), parallel=False)[source]

This function identifies potential lensing galaxies (deflectors) from the LSST DP0.2 object catalogs or any other catalog, based on the morphology, and provides their lens model parameters using the light-to- mass function in SLSim.

: param DP0_table: the foreground galaxy catalog extracted from DP0.2 Object catalog

having the g, r, i, z, y bands cModel, deVaucouleur, and exponential fluxes and errors, the true/ or photometric redshift, redshift, gmag, rmag, imag, zmag, ymag, err-g, err-r, err-i, err-z, err-y Please check the query in ‘extract_catalogs_DP0.py’ to extract the required parameters from DP0.2 Object Catalogs NOTE: the input catalog should have column names, as returned from DP0.2 Object catalogs’

: type DP0_table: astropy table

: param fracDev_limit: the fracDev limit above which a galaxy is considered to be an elliptical galaxy

(default is 0.8)

: type fracDev_limit: float

: param magnitude_cut_massive: absolute magnitude cut for selecting massive (luminous) galaxies : type magnitude_cut_massive: float

: param pixel_scale: pixel scale for the LSST : type pixel_scale: float

: param cosmo: the cosmology model used : type cosmo: astropy.cosmology

: param parallel: will be set to True only if you are running the code in parallel

default is False

Returns: An output catalog (astropy table) of all the massive ellipticals selected from the input catalog

having the same columns as in the input catalog, with additional columns added for velocity dispersion, position angle, axis ratio, half light radius (in arcsec), ellipticity.

: type : astropy table

slsim.Deflectors.MassLightConnection.massive_deflectors_DP0p2.get_galaxy_parameters_from_moments(xx, xy, yy)[source]

Calculate the parameters for a galaxy using the HSM moments.

: param xx : xx component of the Hirata-Seljak-Mandelbaum (HSM) moments in the reference band : type xx : float

: param xy : xy component of the HSM moments in the reference band : type xy : float

: param yy : yy component of the HSM moments in the reference band : type yy : float

returns: tuple

(position angle, effective radius, axis ratio, and the ellipticity)

slsim.Deflectors.MassLightConnection.richness2mass module

slsim.Deflectors.MassLightConnection.richness2mass.general_mass_richness(rich, alpha, rich_0, m_0, ln_m_scatter, min_mass=0.0)[source]

Mass-richness relation: M(N) = M_0 * (N / N_0) ** alpha VAR[ln(M)] = alpha**2 / N + lnM_scatter**2. :param rich: richness :type rich: float :param alpha: slope :type alpha: float :param rich_0: pivot richness :type rich_0: float :param m_0: mass at pivot richness :type m_0: float :param ln_m_scatter: scatter in log mass :type ln_m_scatter: float :param min_mass: minimum mass :type min_mass: float

slsim.Deflectors.MassLightConnection.richness2mass.mass_richness_abdullah2022(rich, min_mass=1000000000000.0)[source]

Mass-richness relation from Abdullah et al.

2022 (sred13) :param rich: richness :type rich: float :param min_mass: minimum mass :type min_mass: float

slsim.Deflectors.MassLightConnection.richness2mass.mass_richness_relation(rich, relation='Abdullah2022')[source]

Mass-richness relation :param rich: richness :param relation: mass- richness relation :type relation: str.

slsim.Deflectors.MassLightConnection.richness2mass.mass_richness_simet2017(rich, min_mass=1000000000000.0)[source]

Mass-richness relation from Simet et al.

2017 :param rich: richness :type rich: float :param min_mass: minimum mass :type min_mass: float

slsim.Deflectors.MassLightConnection.velocity_dispersion module

slsim.Deflectors.MassLightConnection.velocity_dispersion.redshifts_from_comoving_density(redshift, density, sky_area, cosmo, noise=True)[source]

Sample redshifts from a comoving density function. We took this function is from SkyPy package but we have modified it to make suitable for the constant comoving number density.

Sample galaxy redshifts such that the resulting distribution matches a past lightcone with comoving galaxy number density density at redshifts redshift. The comoving volume sampled corresponds to a sky area sky_area and transverse comoving distance given by the cosmology cosmology.

If the noise parameter is set to true, the number of galaxies has Poisson noise. If noise is false, the expected number of galaxies is used.

Parameters

redshiftarray_like

Redshifts at which comoving number densities are provided.

densityarray_like

Comoving galaxy number density at each redshift in Mpc-3.

sky_area~astropy.units.Quantity

Sky area over which galaxies are sampled. Must be in units of solid angle.

cosmoCosmology

Cosmology object for conversion to comoving volume.

noisebool, optional

Poisson-sample the number of galaxies. Default is True.

Returns

redshiftsarray_like

Sampled redshifts such that the comoving number density of galaxies corresponds to the input distribution.

Warnings

The inverse cumulative distribution function is approximated from the number density and comoving volume calculated at the given redshift values. The user must choose suitable redshift values to satisfy their desired numerical accuracy.

slsim.Deflectors.MassLightConnection.velocity_dispersion.schechter_vel_disp(redshift, phi_star, alpha, beta, vd_star, vd_min, vd_max, sky_area, cosmo, noise=True)[source]

Sample redshifts and stellar masses from a Schechter mass function.

Sample the redshifts and stellar masses of galaxies following a Schechter mass function with potentially redshift-dependent parameters, limited by maximum and minimum masses m_min, m_max, for a sky area sky_area.

Parameters

redshiftarray_like

Input redshift grid on which the Schechter function parameters are evaluated. Galaxies are sampled over this redshift range.

phi_stararray_like or function

Normalisation of the Schechter function. Can be a single value, an array of values for each redshift, or a function of redshift.

alpha: float

The alpha parameter in the modified Schechter equation.

beta: float

The beta parameter in the modified Schechter equation.

vd_star: float

The characteristic velocity dispersion.

vd_min, vd_max: float

Lower and upper bounds of random variable x. Samples are drawn uniformly from bounds.

sky_area~astropy.units.Quantity

Sky area over which galaxies are sampled. Must be in units of solid angle.

cosmo~astropy.cosmology

astropy.cosmology object to calculate comoving densities.

noisebool, optional

Poisson-sample the number of galaxies. Default is True.

Notes

Effectively calls ~skypy.galaxies.redshift.schechter_smf_redshift and ~skypy.galaxies.stellar_mass.schechter_smf_mass internally and returns the tuple of results.

Returns

redshifts, velocity dispersiontuple of array_like

Redshifts and velocity dispersion of the galaxy sample described by the Schechter velocity dispersion function.

slsim.Deflectors.MassLightConnection.velocity_dispersion.schechter_vel_disp_redshift(redshift, phi_star, alpha, beta, vd_star, vd_min, vd_max, sky_area, cosmo, noise=True)[source]

Sample redshifts from Schechter function.

Sample the redshifts of velocity dispersion following a Schechter function with potentially redshift-dependent parameters, limited by velocity dispersion vd_max and vd_min, for a sky area sky_area.

Parameters

redshiftarray_like

Input redshift grid on which the Schechter function parameters are evaluated. Galaxies are sampled over this redshift range.

phi_stararray_like or function

Normalisation of the Schechter function. Can be a single value, an array of values for each redshift, or a function of redshift.

alpha: float

The alpha parameter in the modified Schechter equation.

beta: float

The beta parameter in the modified Schechter equation.

vd_star: float

The characteristic velocity dispersion.

vd_min, vd_max: float

Lower and upper bounds of random variable x. Samples are drawn uniformly from bounds.

sky_area~astropy.units.Quantity

Sky area over which galaxies are sampled. Must be in units of solid angle.

cosmo~astropy.cosmology

astropy.cosmology object to calculate comoving densities.

noisebool, optional

Poisson-sample the number of galaxies. Default is True.

Returns

redshifts: array_like

redshifts drawn from Schechter function.

Notes

The probability distribution function \(p(\\sigma)\) for velocity dispersion \(\sigma\) can be described by a Schechter function (see eq. (4) in [2]_)

\[\begin{split}\\phi = \\phi_* \\left(\\frac{\\sigma}{\\sigma_*}\\right)^\\alpha \\exp\\left[-\\left( \\frac{\\sigma}{\\sigma_*} \\right)^\\beta\\right] \\frac{\\beta}{\\Gamma(\\alpha/\\beta)} \\frac{1}{\\sigma} \\mathrm{d} \\sigma \\;.\end{split}\]

where \(\\Gamma\) is the gamma function, \(\\sigma_*\) is the characteristic velocity dispersion, \(\\phi_*\) is number density and \(\\alpha\) and \(\beta\) are free parameters.

References

slsim.Deflectors.MassLightConnection.velocity_dispersion.schechter_velocity_dispersion_function(alpha, beta, phi_star, vd_star, vd_min, vd_max, size=None, resolution=1000, scale=1)[source]
Sample velocity dispersion of elliptical galaxies in the local universe

following a Schecter function.

alpha: float

The alpha parameter in the modified Schechter equation.

beta: float

The beta parameter in the modified Schechter equation.

vd_star: float

The characteristic velocity dispersion.

vd_min, vd_max: float

Lower and upper bounds of random variable x. Samples are drawn uniformly from bounds.

size: int

Number of samples returned. Default is 1.

resolution: int

Resolution of the inverse transform sampling spline. Default is 100.

scale: array-like, optional

Scale factor for the returned samples. Default is 1.

velocity_dispersion: array_like

Velocity dispersion drawn from Schechter function.

The probability distribution function \(p(\sigma)\) for velocity dispersion \(\sigma\) can be described by a Schechter function (see eq. (4) in [3]_)

\[\phi = \phi_* \left(\frac{\sigma}{\sigma_*}\right)^\alpha \exp\left[-\left( \frac{\sigma}{\sigma_*} \right)^\beta\right] \frac{\beta}{\Gamma(\alpha/\beta)} \]
rac{1}{sigma} mathrm{d}

sigma ;.

where \(\Gamma\) is the gamma function, \(\sigma_*\) is the characteristic velocity dispersion, \(\phi_*\) is number density of all spiral galaxies and \(\alpha\) and \(\beta\) are free parameters.

slsim.Deflectors.MassLightConnection.velocity_dispersion.theta_E_from_vel_disp_epl(vel_disp, gamma, r_half, kwargs_light, light_model_list, lens_cosmo, kappa_ext=0, sis_convention=True)[source]

Calculates Einstein radius given measured aperture averaged velocity dispersion and given power-law slope.

Parameters:
  • vel_disp – velocity dispersion measured within an aperture radius [km/s]

  • gamma – power-law slope

  • r_half – half light radius (aperture radius) [arc seconds]

  • kwargs_light – list of dict for light model parameters

  • light_model_list – list of light models

  • lens_cosmo – ~LensCosmo instance

  • kappa_ext – external convergence

  • sis_convention – it True, uses velocity dispersion not as measured one but as the SIS equivalent velocity dispersion

Returns:

Einstein radius matching the velocity dispersion and external convergence

slsim.Deflectors.MassLightConnection.velocity_dispersion.vel_disp_abundance_matching(galaxy_list, z_max, sky_area, cosmo)[source]

Calculates the velocity dispersion from the steller mass. The routine uses abundance matching between stellar mass and velocity dispersion taking the sample drawn from z=0 to z_max (which can be still at low redshift where there is data on the velocity dispersion function)

Parameters:
  • galaxy_list (Table object) – list of galaxies with stellar masses given

  • z_max – maximum redshift to which the abundance matching with the SDSS velocity dispersion function is valid

  • cosmo – astropy.cosmology instance

  • sky_area (~astropy.units.Quantity) – Sky area over which galaxies are sampled. Must be in units of solid angle.

Returns:

interpolation function f; f(stellar_mass) -> vel_disp

slsim.Deflectors.MassLightConnection.velocity_dispersion.vel_disp_composite_model(r, m_star, rs_star, m_halo, c_halo, cosmo, z_lens)[source]

Computes the luminosity weighted velocity dispersion for a deflector with a stellar Hernquist profile and a NFW halo profile, assuming isotropic anisotropy.

Parameters:
  • r – radius of the luminosity-weighted velocity dispersion [arcsec]

  • m_star – stellar mass [M_sun]

  • rs_star – stellar half light radius [physical Mpc]

  • m_halo – Halo mass [physical M_sun]

  • c_halo – halo concentration

  • cosmo (cosmology class) – cosmology

  • z_lens – redshift of the deflector

Returns:

velocity dispersion [km/s]

slsim.Deflectors.MassLightConnection.velocity_dispersion.vel_disp_nfw(m_halo, c_halo, cosmo, z_lens)[source]

Computes vel_disp_nfw_aperture using the characteristic radius rs of the NFW as aperture (which is independent of the source redshift).

Parameters:
  • m_halo – Halo mass [physical M_sun]

  • c_halo – halo concentration

  • cosmo (cosmology class) – cosmology

  • z_lens – redshift of the deflector

Returns:

velocity dispersion [km/s]

slsim.Deflectors.MassLightConnection.velocity_dispersion.vel_disp_nfw_3d(r, m_halo, c_halo, cosmo, z_lens)[source]

Computes the unweighted velocity dispersion at 3D radius r for a deflector with a NFW halo profile, assuming isotropic anisotropy (beta = 0).

Based on equation (14) of Lokas and Mamon 2001 ( https://arxiv.org/abs/astro-ph/0002395)

Parameters:
  • r – radius of the unweighted velocity dispersion [arcsec]

  • m_halo – Halo mass [physical M_sun]

  • c_halo – halo concentration

  • cosmo (cosmology class) – cosmology

  • z_lens – redshift of the deflector

Returns:

velocity dispersion [km/s]

slsim.Deflectors.MassLightConnection.velocity_dispersion.vel_disp_nfw_aperture(r, m_halo, c_halo, cosmo, z_lens)[source]

Computes the average line-of-sight velocity dispersion in an aperture r for a deflector with a NFW halo profile, assuming isotropic anisotropy (beta = 0).

Based on equation (48) of Lokas & Mamon 2001 ( https://arxiv.org/abs/astro-ph/0002395)

Parameters:
  • r – radius of the aperture for the velocity dispersion [arcsec]

  • m_halo – Halo mass [physical M_sun]

  • c_halo – halo concentration

  • cosmo (cosmology class) – cosmology

  • z_lens – redshift of the deflector

Returns:

velocity dispersion [km/s]

slsim.Deflectors.MassLightConnection.velocity_dispersion.vel_disp_power_law(theta_E, gamma, r_half, kwargs_light, light_model_list, lens_cosmo)[source]

Velocity dispersion for a power-law mass density profile.

Parameters:
  • theta_E – Einstein radius [arc seconds]

  • gamma – power-law slope of deflector

  • r_half – half light radius of deflector

  • kwargs_light – list of dict for light model parameters

  • light_model_list – list of light models

  • lens_cosmo – ~LensCosmo instance

Returns:

half light radius averaged velocity dispersion

slsim.Deflectors.MassLightConnection.velocity_dispersion.vel_disp_sdss(sky_area, redshift, vd_min, vd_max, cosmology, noise=True)[source]

Velocity dispersion function in a cone matched by SDSS measurements.

sky_area~astropy.units.Quantity

Sky area over which galaxies are sampled. Must be in units of solid angle.

redshiftnumpy.array

Input redshift grid on which the Schechter function parameters are evaluated. Galaxies are sampled over this redshift range.

vd_min, vd_max: int

Lower and upper bounds of random variable x (velocity dispersion). Samples are drawn uniformly from bounds.

cosmologyastropy.cosmology

astropy.cosmology object to calculate comoving densities.

noisebool, optional

Poisson-sample the number of galaxies. Default is True.

redshifts, velocity dispersiontuple of array_like

Redshifts and velocity dispersion of the galaxy sample described by the Schechter velocity dispersion function.

The probability distribution function \(p(\sigma)\) for velocity dispersion \(\sigma\) can be described by a Schechter function (see eq. (4) in [1]_)

\[\phi = \phi_* \left(\frac{\sigma}{\sigma_*}\right)^\alpha \exp\left[-\left( \frac{\sigma}{\sigma_*} \right)^\beta\right] \frac{\beta}{\Gamma(\alpha/\beta)} \]
rac{1}{sigma}

mathrm{d}sigma ;.

where \(\Gamma\) is the gamma function, \(\sigma_*\) is the characteristic velocity dispersion, \(\phi_*\) is number density and \(\alpha\) and \(\beta\) are free parameters.

Module contents