Source code for caustics.lenses.func.pseudo_jaffe

from ...backend_obj import backend
from ...constants import arcsec_to_rad, G_over_c2
from ...utils import translate_rotate


[docs] def convergence_0_pseudo_jaffe(mass, Rc, Rs, d_l, critical_surface_density): """ Compute the convergence (dimensionless surface mass density). This is rearranged from Eliasdottir et al 2007 equation A11. Parameters ---------- mass: ArrayLike Total mass of the lens (Msun). *Unit: Msun* Rc: ArrayLike Core radius of the lens. *Unit: arcsec* Rs: ArrayLike Scaling radius of the lens. *Unit: arcsec* d_l: ArrayLike Distance to the lens. *Unit: Mpc* critical_surface_density: ArrayLike Critical surface density of the universe at the lens redshift. *Unit: Msun / Mpc^2* Returns -------- ArrayLike The convergence (dimensionless surface mass density) at the center of the pseudo jaffe. *Unit: unitless* """ return mass / (2 * backend.pi * critical_surface_density * Rc * Rs * (d_l * arcsec_to_rad) ** 2) # fmt: skip
[docs] def mass_enclosed_2d_pseudo_jaffe(radius, mass, Rc, Rs, s=0.0): """ Compute the mass enclosed within a given radius. See Eliasdottir et al 2007 equation A10. Parameters ---------- radius: Optional[ArrayLike] Radius at which to calculate enclosed mass (arcsec). *Unit: arcsec* mass: ArrayLike Total mass of the lens *Unit: Msun* Rc: ArrayLike Core radius of the lens. *Unit: arcsec* Rs: ArrayLike Scaling radius of the lens. *Unit: arcsec* """ theta = radius + s frac_enclosed_num = ( backend.sqrt(Rc**2 + theta**2) - Rc - backend.sqrt(Rs**2 + theta**2) + Rs ) # arcsec frac_enclosed_denom = Rs - Rc # arcsec return mass * frac_enclosed_num / frac_enclosed_denom
[docs] def reduced_deflection_angle_pseudo_jaffe( x0, y0, mass, Rc, Rs, x, y, d_l, critical_surface_density, s=0.0 ): """ Compute the reduced deflection angle. See Eliasdottir et al 2007 equation A19. Parameters ---------- x0: ArrayLike x-coordinate of the center of the lens. *Unit: arcsec* y0: ArrayLike y-coordinate of the center of the lens. *Unit: arcsec* mass: ArrayLike Total mass of the lens *Unit: Msun* Rc: ArrayLike Core radius of the lens. *Unit: arcsec* Rs: ArrayLike Scaling radius of the lens. *Unit: arcsec* x: ArrayLike x-coordinates in the lens plane. *Unit: arcsec* y: ArrayLike y-coordinates in the lens plane. *Unit: arcsec* d_l: ArrayLike Distance to the lens. *Unit: Mpc* critical_surface_density: ArrayLike Critical surface density of the universe at the lens redshift. *Unit: Msun / Mpc^2* s: float Softening parameter to prevent numerical instabilities. *Unit: arcsec* """ x, y = translate_rotate(x, y, x0, y0) R = backend.sqrt(x**2 + y**2) + s f = R / Rc / (1 + backend.sqrt(1 + (R / Rc) ** 2)) - R / (Rs * (1 + backend.sqrt(1 + (R / Rs) ** 2))) # fmt: skip alpha = 2 * convergence_0_pseudo_jaffe(mass, Rc, Rs, d_l, critical_surface_density) * Rc * Rs / (Rs - Rc) * f # fmt: skip ax = alpha * x / R ay = alpha * y / R return ax, ay
[docs] def potential_pseudo_jaffe(x0, y0, mass, Rc, Rs, x, y, d_l, d_s, d_ls, s=0.0): """ Compute the lensing potential for the pseudo jaffe lens. See Eliasdottir et al 2007 equation A18. Parameters ---------- x0: ArrayLike x-coordinate of the center of the lens. *Unit: arcsec* y0: ArrayLike y-coordinate of the center of the lens. *Unit: arcsec* mass: ArrayLike Total mass of the lens *Unit: Msun* Rc: ArrayLike Core radius of the lens. *Unit: arcsec* Rs: ArrayLike Scaling radius of the lens. *Unit: arcsec* x: ArrayLike x-coordinates in the lens plane. *Unit: arcsec* y: ArrayLike y-coordinates in the lens plane. *Unit: arcsec* d_l: ArrayLike Distance to the lens. *Unit: Mpc* d_s: ArrayLike Distance to the source. *Unit: Mpc* d_ls: ArrayLike Distance from the lens to the source. *Unit: Mpc* s: float Softening parameter to prevent numerical instabilities. *Unit: arcsec* """ x, y = translate_rotate(x, y, x0, y0) R_squared = x**2 + y**2 + s # arcsec^2 surface_density_0 = convergence_0_pseudo_jaffe( mass, Rc, Rs, d_l, 1.0 ) # Msun / Mpc^2 coeff = -( 8 * backend.pi * G_over_c2 * surface_density_0 * (d_l * d_ls / d_s) * Rc * Rs / (Rs - Rc) ) # arcsec scale_a = backend.sqrt(Rs**2 + R_squared) # arcsec scale_b = backend.sqrt(Rc**2 + R_squared) # arcsec scale_c = Rc * backend.log(Rc + backend.sqrt(Rc**2 + R_squared)) # arcsec scale_d = Rs * backend.log(Rs + backend.sqrt(Rs**2 + R_squared)) # arcsec scale_factor = scale_a - scale_b + scale_c - scale_d # arcsec return coeff * scale_factor
[docs] def convergence_pseudo_jaffe( x0, y0, mass, Rc, Rs, x, y, d_l, critical_surface_density, s=0.0 ): """ Compute the convergence (dimensionless surface mass density). See Eliasdottir et al 2007 Equation A3. Parameters ---------- x0: ArrayLike x-coordinate of the center of the lens. *Unit: arcsec* y0: ArrayLike y-coordinate of the center of the lens. *Unit: arcsec* mass: ArrayLike Total mass of the lens *Unit: Msun* Rc: ArrayLike Core radius of the lens. *Unit: arcsec* Rs: ArrayLike Scaling radius of the lens. *Unit: arcsec* x: ArrayLike x-coordinates in the lens plane. *Unit: arcsec* y: ArrayLike y-coordinates in the lens plane. *Unit: arcsec* d_l: ArrayLike Distance to the lens. *Unit: Mpc* critical_surface_density: ArrayLike Critical surface density of the universe at the lens redshift. *Unit: Msun / Mpc^2* s: float Softening parameter to prevent numerical instabilities. *Unit: arcsec* """ x, y = translate_rotate(x, y, x0, y0) R_squared = x**2 + y**2 + s coeff = convergence_0_pseudo_jaffe(mass, Rc, Rs, d_l, critical_surface_density) * Rc * Rs / (Rs - Rc) # fmt: skip return coeff * (1 / backend.sqrt(Rc**2 + R_squared) - 1 / backend.sqrt(Rs**2 + R_squared)) # fmt: skip