dsigma.physics module

Physics functions for the dsigma pipeline.

dsigma.physics.critical_surface_density(z_l, z_s, cosmology=None, comoving=True, d_l=None, d_s=None)[source]

Compute the critical surface density.

Parameters:
z_lfloat or numpy.ndarray

Redshift of lens.

z_sfloat or numpy.ndarray

Redshift of source.

cosmologyastropy.cosmology or None, optional

Cosmology to assume for calculations. Only used if comoving distances are not passed. If None, use dsigma.default_cosmology. Default is None.

comovingbool, optional

Flag for using comoving instead of physical units. Default is True.

d_lastropy.units.quantity.Quantity, optional

Comoving transverse distance to the lens. If not given, it is calculated from the redshift provided. Default is None.

d_sastropy.units.quantity.Quantity, optional

Comoving transverse distance to the source. If not given, it is calculated from the redshift provided. Default is None.

Returns:
sigma_critastropy.units.quantity.Quantity

Critical surface density for each lens-source pair.

dsigma.physics.effective_critical_surface_density(z_l, z_s, n_s, cosmology=None, comoving=True)[source]

Compute the effective critical surface density.

Parameters:
z_lfloat or numpy.ndarray

Redshift of lens.

z_snumpy.ndarray

Redshifts of sources.

n_snumpy.ndarray

Fraction of source galaxies in each redshift bin. Does not need to be normalized.

cosmologyastropy.cosmology or None, optional

Cosmology to assume for calculations. If None, use dsigma.default_cosmology. Default is None.

comovingbool, optional

Flag for using comoving instead of physical units. Default is True.

Returns:
sigma_crit_effastropy.units.quantity.Quantity

Effective critical surface density for the lens redshift given the source redshift distribution. Has the same length as z_l.

dsigma.physics.lens_magnification_shear_bias(theta, alpha_l, z_l, z_s, cosmology=None, sigma_8=0.82, n_s=0.96, n_z=10, n_ell=1000, bessel_function_zeros=100, k_max=1000.0)[source]

Compute the lens magnification bias to the mean tangential shear.

This function is based on equations (13) and (14) in Unruh et al. (2020).

Parameters:
thetafloat, numpy.ndarray or astropy.units.quantity.Quantity

Angular separation \(\theta\) from the lens sample. If it has no unit, assume the value is given in radians.

alpha_lfloat

Local slope of the flux distribution of lenses near the flux limit.

z_lfloat or numpy.ndarray

Redshift of lens. Can also be a array if theta is an array.

z_sfloat or numpy.ndarray

Redshift of source. Can also be a array if theta is an array.

cosmologyastropy.cosmology or None, optional

Cosmology to assume for calculations. If None, use dsigma.default_cosmology. Default is None.

sigma_8float, optional

Scale of fluctuations at \(8 h^{-1} \, \mathrm{Mpc}\). Default is 0.82.

n_sfloat, optional

Primordial power spectrum index. Default is 0.96.

n_zint, optional

Number of redshift bins used in the integral. Larger numbers will be more accurate. Default is 10.

n_ellint, optional

Number of \(\ell\) bins used in the integral. Larger numbers will be more accurate. Default is 1000.

bessel_function_zerosint, optional

The calculation involves an integral over the second order Bessel function \(J_2 (\ell \theta)\) from \(\ell = 0\) to \(\ell = \infty\). In practice, this function replaces the upper bound with the bessel_function_zeros-th zero point of the Bessel function. Larger number should lead to more accurate results. However, in practice, this also requires larger n_ell. Particularly, n_ell should never fall below bessel_function_zeros. Default is 100.

k_maxfloat, optional

The maximum wavenumber (in \(\mathrm{Mpc}^{-1}\)) beyond which the power spectrum is assumed to be 0. Default is 100.

Returns:
gtfloat or numpy.ndarray

Bias in the mean tangential shear due to lens magnification effects.

dsigma.physics.mpc_per_degree(z, cosmology=None, comoving=False)[source]

Calculate the conversion factor between angular and physical scales.

Parameters:
zfloat or numpy.ndarray

Redshift of the object.

cosmologyastropy.cosmology or None, optional

Cosmology to use for calculation. If None, use dsigma.default_cosmology. Default is None.

comovingbool, optional

Use comoving distance instead of physical distance when True. Default is False.

Returns:
factorastropy.units.quantity.Quantity

Conversion factor.