Source code for caustics.lenses.func.external_shear
from ...backend_obj import backend
from ...utils import translate_rotate
[docs]
def reduced_deflection_angle_external_shear(x0, y0, gamma_1, gamma_2, x, y):
"""
Compute the reduced deflection angles for an external shear field. Here we
use the Meneghetti lecture notes and take derivatives of equation 3.80
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*
gamma_1: ArrayLike
The shear component in the x-direction.
*Unit: unitless*
gamma_2: ArrayLike
The shear component in the y-direction.
*Unit: unitless*
x: ArrayLike
x-coordinates in the lens plane.
*Unit: arcsec*
y: ArrayLike
y-coordinates in the lens plane.
*Unit: arcsec*
Returns
-------
x_component: ArrayLike
Deflection Angle in the x-direction.
*Unit: arcsec*
y_component: ArrayLike
Deflection Angle in the y-direction.
*Unit: arcsec*
"""
# Derivatives of Meneghetti eq 3.80
x, y = translate_rotate(x, y, x0, y0)
ax = gamma_1 * x + gamma_2 * y
ay = gamma_2 * x - gamma_1 * y
return ax, ay
[docs]
def potential_external_shear(x0, y0, gamma_1, gamma_2, x, y):
"""
Compute the lensing potential for an external shear field. Here we use the
Meneghetti lecture notes equation 3.80
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*
gamma_1: ArrayLike
The shear component in the x-direction.
*Unit: unitless*
gamma_2: ArrayLike
The shear component in the y-direction.
*Unit: unitless*
x: ArrayLike
x-coordinates in the lens plane.
*Unit: arcsec*
y: ArrayLike
y-coordinates in the lens plane.
*Unit: arcsec*
Returns
-------
ArrayLike
The lensing potential.
*Unit: arcsec^2*
"""
x, y = translate_rotate(x, y, x0, y0)
return 0.5 * gamma_1 * (x**2 - y**2) + gamma_2 * x * y
[docs]
def gamma_phi_to_gamma1(gamma, phi):
"""
Convert the shear magnitude and angle to the gamma_1 component.
Parameters
----------
gamma: ArrayLike
The shear magnitude.
*Unit: unitless*
phi: ArrayLike
The shear angle.
*Unit: radians*
Returns
-------
ArrayLike
The gamma_1 component of the shear.
*Unit: unitless*
"""
return gamma * backend.cos(2 * phi)
[docs]
def gamma_phi_to_gamma2(gamma, phi):
"""
Convert the shear magnitude and angle to the gamma_2 component.
Parameters
----------
gamma: ArrayLike
The shear magnitude.
*Unit: unitless*
phi: ArrayLike
The shear angle.
*Unit: radians*
Returns
-------
ArrayLike
The gamma_2 component of the shear.
*Unit: unitless*
"""
return gamma * backend.sin(2 * phi)