Lens types

class glow.lenses.Psi_SIS(p_phys={}, p_prec={})

Bases: PsiAxisym

Lens object for the singular isothermal sphere (SIS).

Additional information: theory, default parameters.

Parameters:
p_physdict

Physical parameters, with keys:

  • psi0 (float) – Normalization of the lens.

Attributes:
asymp_indexfloat

0.5

asymp_amplitudefloat

\(\psi_0/\sqrt{2}\)

Methods

ddpsi_ddx(x)

Second derivative of the lensing potential.

default_params()

Initialize the default parameters.

dpsi_dx(x)

First derivative of the lensing potential.

psi_x(x)

Lensing potential.

default_params()

Initialize the default parameters.

Returns:
p_physdict

Default physical parameters.

p_precdict

Empty dictionary.

psi_x(x)

Lensing potential.

\[\psi(x) = \psi_0 x\]
dpsi_dx(x)

First derivative of the lensing potential.

\[\psi'(x) = \psi_0\]
ddpsi_ddx(x)

Second derivative of the lensing potential.

\[\psi''(x) = 0\]
class glow.lenses.Psi_CIS(p_phys={}, p_prec={})

Bases: PsiAxisym

Lens object for the cored isothermal sphere (CIS).

Additional information: theory, default parameters.

Parameters:
p_physdict

Physical parameters, with keys:

  • psi0 (float) – Normalization of the lens.

  • rc (float) – Core radius.

Attributes:
asymp_indexfloat

0.5

asymp_amplitudefloat

\(\psi_0/\sqrt{2}\)

Methods

check_input()

Check that the core radius is not negative.

ddpsi_ddx(x)

Second derivative of the lensing potential.

default_params()

Initialize the default parameters.

dpsi_dx(x)

First derivative of the lensing potential.

psi_x(x)

Lensing potential.

default_params()

Initialize the default parameters.

Returns:
p_physdict

Default physical parameters.

p_precdict

Empty dictionary.

check_input()

Check that the core radius is not negative.

Raises:
LensException
psi_x(x)

Lensing potential.

\[\begin{split}\begin{align} r &\equiv \sqrt{x^2 + r_c^2}\\ \psi(x) &= \psi_0 r + \psi_0 r_c\log\left(\frac{2r_c}{r+r_c}\right) \end{align}\end{split}\]
dpsi_dx(x)

First derivative of the lensing potential.

\[\begin{split}\begin{align} r &\equiv \sqrt{x^2 + r_c^2}\\ \psi'(x) &= \psi_0\frac{x}{r}\left(1 - \frac{r_c}{r + r_c}\right) \end{align}\end{split}\]
ddpsi_ddx(x)

Second derivative of the lensing potential.

\[\begin{split}\begin{align} r &\equiv \sqrt{x^2 + r_c^2}\\ R &\equiv (x/r)^2\\ \psi''(x) &= \psi_0\frac{r_cR}{(r + r_c)^2} + \psi_0\left(1-\frac{r_c}{R + r_c}\right)\frac{1-R}{r} \end{align}\end{split}\]
class glow.lenses.Psi_PointLens(p_phys={}, p_prec={})

Bases: PsiAxisym

Lens object for the point lens.

Additional information: theory, default parameters.

Parameters:
p_physdict

Physical parameters, with keys:

  • psi0 (float) – Normalization of the lens.

p_precdict

Precision parameters, with keys:

  • xc (float) – Point mass regularization (Plummer sphere).

Attributes:
asymp_indexfloat
asymp_amplitudefloat

\(\psi_0/2\)

Methods

ddpsi_ddx(x)

Second derivative of the lensing potential.

default_params()

Initialize the default parameters.

dpsi_dx(x)

First derivative of the lensing potential.

psi_x(x)

Lensing potential.

default_params()

Initialize the default parameters.

Returns:
p_physdict

Default physical parameters.

p_precdict

Default precision parameters.

psi_x(x)

Lensing potential.

\[\psi(x) = \frac{1}{2}\psi_0\log(x^2 + x_c^2)\]
dpsi_dx(x)

First derivative of the lensing potential.

\[\psi'(x) = \frac{\psi_0 x}{x^2 + x_c^2}\]
ddpsi_ddx(x)

Second derivative of the lensing potential.

\[\psi''(x) = \psi_0\frac{x_c^2-x^2}{(x_c^2 + x^2)^2}\]
class glow.lenses.Psi_Ball(p_phys={}, p_prec={})

Bases: PsiAxisym

Lens object for the uniform density sphere.

Additional information: theory, default parameters.

Parameters:
p_physdict

Physical parameters, with keys:

  • psi0 (float) – Normalization of the lens.

  • b (float) – Radius of the sphere.

Attributes:
asymp_indexfloat
asymp_amplitudefloat

\(\psi_0/2\)

Methods

check_input()

Check that the radius is positive.

ddpsi_ddx(x)

Second derivative of the lensing potential.

ddpsi_small_x(x)

Second derivative of the lensing potential inside the sphere.

default_params()

Initialize the default parameters.

dpsi_dx(x)

First derivative of the lensing potential.

dpsi_small_x(x)

First derivative of the lensing potential inside the sphere.

psi_small_x(x)

Lensing potential inside the sphere.

psi_x(x)

Lensing potential.

default_params()

Initialize the default parameters.

Returns:
p_physdict

Default physical parameters.

p_precdict

Empty dictionary.

check_input()

Check that the radius is positive.

Raises:
LensException
psi_small_x(x)

Lensing potential inside the sphere.

\[\psi(x) = \psi_0\log(b(1+X)) - \psi_0X(1+X^2/3)\ ,\quad x<b\]

with \(X\equiv\sqrt{1-(x/b)^2}\).

psi_x(x)

Lensing potential.

Piece together the lensing potential inside the sphere, psi_small_x(), and outside, Psi_PointLens.psi_x().

dpsi_small_x(x)

First derivative of the lensing potential inside the sphere.

\[\psi'(x) = \psi_0\frac{x}{b^2}\left(1+\frac{X^2}{1+X}\right)\ ,\quad x<b\]

with \(X\equiv\sqrt{1-(x/b)^2}\).

dpsi_dx(x)

First derivative of the lensing potential.

Piece together the derivative inside the sphere, dpsi_small_x(), and outside, Psi_PointLens.dpsi_dx().

ddpsi_small_x(x)

Second derivative of the lensing potential inside the sphere.

\[\psi''(x) = \psi_0\frac{2X^2 + 2X - 1}{b^2(1+X)}\ ,\quad x<b\]

with \(X\equiv\sqrt{1-(x/b)^2}\).

ddpsi_ddx(x)

Second derivative of the lensing potential.

Piece together the derivative inside the sphere, ddpsi_small_x(), and outside, Psi_PointLens.ddpsi_ddx().

class glow.lenses.Psi_NFW(p_phys={}, p_prec={})

Bases: PsiAxisym

Lens object for the Navarro-Frenk-White (NFW) profile.

Additional information: theory, default parameters.

Parameters:
p_physdict

Physical parameters, with keys:

  • psi0 (float) – Normalization of the lens.

  • xs (float) – Rescaled NFW radius.

p_precdict

Precision parameters, with keys:

  • eps_soft (float) – Softening factor.

  • eps_NFW (float) – Switch on Taylor expansion when \(x/x_s < \epsilon_\text{NFW}\).

Methods

F_nfw_large_x(x)

Auxiliary NFW function for radius larger than 1.

F_nfw_small_x(x)

Auxiliary NFW function for radius smaller than 1.

F_nfw_v(x)

Auxiliary NFW function for any value of the radius.

ddpsi_ddx(x)

Second derivative of the lensing potential.

ddpsi_ddx_large_u(x)

Second derivative of the lensing potential for large values of \(x/x_s\).

ddpsi_ddx_small_u(x)

Expansion of ddpsi_ddx_large_u() for \(x/x_s\ll 1\).

default_params()

Initialize the default parameters.

dpsi_dx(x)

First derivative of the lensing potential.

dpsi_dx_large_u(x)

First derivative of the lensing potential for large values of \(x/x_s\).

dpsi_dx_small_u(x)

Expansion of dpsi_dx_large_u() for \(x/x_s\ll 1\).

psi_large_u(x)

Lensing potential for large values of \(x/x_s\).

psi_small_u(x)

Expansion of psi_large_u() for \(x/x_s\ll 1\).

psi_x(x)

Lensing potential.

default_params()

Initialize the default parameters.

Returns:
p_physdict

Default physical parameters.

p_precdict

Default precision parameters.

F_nfw_large_x(x)

Auxiliary NFW function for radius larger than 1.

\[\mathcal{F}(x) = \frac{1}{\sqrt{x^2-1}}\arctan\left(\sqrt{x^2-1}\right), \quad x>1\]
F_nfw_small_x(x)

Auxiliary NFW function for radius smaller than 1.

\[\mathcal{F}(x) = \frac{1}{\sqrt{1-x^2}}\text{arctanh}\left(\sqrt{1-x^2}\right), \quad x<1\]
F_nfw_v(x)

Auxiliary NFW function for any value of the radius.

Piece together F_nfw_large_x() and F_nfw_xmall_x().

\[\begin{split}\mathcal{F}(x) = \begin{cases} \mathcal{F}_\text{large}(x) & x > 1+\epsilon\\ \mathcal{F}_\text{small}(x) & x < 1-\epsilon\\ 1 + 2|x-1| & \text{otherwise} \end{cases}\end{split}\]

where \(\epsilon\) is set by p_phys['epsilon_soft'].

psi_large_u(x)

Lensing potential for large values of \(x/x_s\).

This is the analytical expression of the lensing potential. The actual potential used in the code combines this one with an approximation for small radius in psi_x().

\[\psi(x) = \frac{1}{2}\psi_0\left(\log^2(u/2) + (u^2-1)\mathcal{F}^2(u)\right)\]

with \(u\equiv x/x_s\).

dpsi_dx_large_u(x)

First derivative of the lensing potential for large values of \(x/x_s\).

This is the analytical expression. The actual potential used in the code combines this one with an approximation for small radius in dpsi_dx().

\[\psi'(x) = \frac{\psi_0}{x_su}\left(\log(u/2) + \mathcal{F}(u)\right)\]

with \(u\equiv x/x_s\).

ddpsi_ddx_large_u(x)

Second derivative of the lensing potential for large values of \(x/x_s\).

This is the analytical expression. The actual potential used in the code combines this one with an approximation for small radius in ddpsi_ddx().

\[\psi''(x) = -\frac{\psi_0}{x_s^2u^2}\left(\log(u/2) + \frac{u^2 + \mathcal{F}(u)(1-2u^2)}{1-u^2}\right)\]

with \(u\equiv x/x_s\).

psi_small_u(x)

Expansion of psi_large_u() for \(x/x_s\ll 1\).

dpsi_dx_small_u(x)

Expansion of dpsi_dx_large_u() for \(x/x_s\ll 1\).

ddpsi_ddx_small_u(x)

Expansion of ddpsi_ddx_large_u() for \(x/x_s\ll 1\).

psi_x(x)

Lensing potential.

Piece together psi_large_u() and psi_small_u().

\[\begin{split}\psi(x) = \begin{cases} \psi_\text{large}(x) & x > \epsilon_\text{NFW}\\ \psi_\text{small}(x) & x \leq \epsilon_\text{NFW} \end{cases}\end{split}\]

where \(\epsilon_\text{NFW}\) is set by p_phys['epsilon_NFW'].

dpsi_dx(x)

First derivative of the lensing potential.

Piece together dpsi_large_u() and dpsi_small_u().

\[\begin{split}\psi'(x) = \begin{cases} \psi'_\text{large}(x) & x > \epsilon_\text{NFW}\\ \psi'_\text{small}(x) & x \leq \epsilon_\text{NFW} \end{cases}\end{split}\]

where \(\epsilon_\text{NFW}\) is set by p_phys['epsilon_NFW'].

ddpsi_ddx(x)

Second derivative of the lensing potential.

Piece together ddpsi_large_u() and ddpsi_small_u().

\[\begin{split}\psi''(x) = \begin{cases} \psi''_\text{large}(x) & x > \epsilon_\text{NFW}\\ \psi''_\text{small}(x) & x \leq \epsilon_\text{NFW} \end{cases}\end{split}\]

where \(\epsilon_\text{NFW}\) is set by p_phys['epsilon_NFW'].

class glow.lenses.Psi_tSIS(p_phys={}, p_prec={})

Bases: PsiAxisym

Lens object for the truncated singular isothermal sphere (tSIS).

Additional information: theory, default parameters.

Parameters:
p_physdict

Physical parameters, with keys:

  • psi0 (float) – Normalization of the lens.

  • xb (float) – radius.

Methods

check_input()

Check that the radius is not negative.

ddpsi_ddx(x)

Second derivative of the lensing potential.

default_params()

Initialize the default parameters.

dpsi_dx(x)

First derivative of the lensing potential.

psi_x(x)

Lensing potential.

default_params()

Initialize the default parameters.

Returns:
p_physdict

Default physical parameters.

p_precdict

Empty dictionary.

check_input()

Check that the radius is not negative.

Raises:
LensException
psi_x(x)

Lensing potential.

\[\begin{split}\begin{align} u &\equiv x/x_b\\ \psi(x) &= \psi_0 x\left(\text{erfc}(u) + \frac{1-\text{e}^{-u^2}}{u\sqrt{\pi}} +\frac{1}{2u\sqrt{\pi}}\left[2\log(u) + E_1(u^2) + \gamma_E\right]\right) \end{align}\end{split}\]
dpsi_dx(x)

First derivative of the lensing potential.

\[\begin{split}\begin{align} u &\equiv x/x_b\\ \psi'(x) &= \psi_0\left(\text{erfc}(u) + \frac{1-\text{e}^{-u^2}}{u\sqrt{\pi}}\right) \end{align}\end{split}\]
ddpsi_ddx(x)

Second derivative of the lensing potential.

\[\begin{split}\begin{align} u &\equiv x/x_b\\ \psi''(x) &= -\frac{\psi_0}{x_b\sqrt{\pi}}\frac{1-\text{e}^{-u^2}}{u^2} \end{align}\end{split}\]
class glow.lenses.Psi_eSIS(p_phys={}, p_prec={})

Bases: PsiGeneral

Lens object for the elliptical SIS (eSIS).

Additional information: theory, default parameters.

Parameters:
p_physdict

Physical parameters, with keys:

  • psi0 (float) – Normalization of the lens.

  • q (float) – Ellipticity parameter.

  • alpha (float) – Orientation angle.

  • xc1 (float) – Location in the x1 axis.

  • xc2 (float) – Location in the x2 axis.

Attributes:
asymp_indexfloat

0.5

asymp_amplitudefloat

\(\psi_0/\sqrt{2}\)

Methods

ddpsi_vec(x1, x2)

Hessian of the lensing potential.

ddpsi_vec_a0(x1, x2)

Second derivatives of the lensing potential (zero angle).

default_params()

Initialize the default parameters.

dpsi_vec(x1, x2)

Gradient of the lensing potential.

dpsi_vec_a0(x1, x2)

First derivatives of the lensing potential (zero angle).

psi(x1, x2)

Lensing potential.

psi_a0(x1, x2)

Lensing potential (zero angle).

rotate_grad(f1, f2)

Rotation of a gradient.

rotate_hessian(h11, h12, h22)

Rotation of a Hessian.

rotate_vector(x1, x2)

Rotation of a vector.

default_params()

Initialize the default parameters.

Returns:
p_physdict

Default physical parameters.

p_precdict

Empty dictionary.

rotate_vector(x1, x2)

Rotation of a vector.

Linear transformation defined as

\[\begin{split}x'_1 &= \cos\alpha\,x_1 - \sin\alpha\,x_2\\ x'_2 &= \sin\alpha\,x_1 + \cos\alpha\,x_2\end{split}\]
Parameters:
x1, x2float or array

Input vector.

Returns:
xx1float or array

\(x'_1\)

xx2float or array

\(x'_2\)

rotate_grad(f1, f2)

Rotation of a gradient.

Linear transformation defined as

\[\begin{split}f'_1 &= \cos\alpha\,f_1 + \sin\alpha\,f_2\\ f'_2 &= -\sin\alpha\,f_1 + \cos\alpha\,f_2\end{split}\]
Parameters:
f1, f2float or array

Input vector.

Returns:
ff1float or array

\(f'_1\)

ff2float or array

\(f'_2\)

rotate_hessian(h11, h12, h22)

Rotation of a Hessian.

Linear transformation defined as

\[\begin{split}A &\equiv 2\cos\alpha\sin\alpha\,h_{12}\\ B &\equiv \sin\alpha (h_{11} - h_{22})\\ h'_{11} &= h_{11} + A - \sin\alpha\,B\\ h'_{12} &= h_{12}(1-2\sin^2\alpha) - \cos\alpha\,B\\ h'_{22} &= h_{22} - A + \sin\alpha\,B\end{split}\]
Parameters:
h11, h12, h22float or array

Input vector.

Returns:
hh11float or array

\(h'_{11}\)

hh12float or array

\(h'_{12}\)

hh22float or array

\(h'_{22}\)

psi_a0(x1, x2)

Lensing potential (zero angle).

\[\psi_{\alpha=0}=\sqrt{x_1^2 + x_2^2/q^2}\]
dpsi_vec_a0(x1, x2)

First derivatives of the lensing potential (zero angle).

\[\begin{split}\begin{align} \partial_{1}\psi_{\alpha=0} &= \psi_0 x_1/X\\ \partial_{2}\psi_{\alpha=0} &= \psi_0 x_2/X/q^2 \end{align}\end{split}\]

with \(X \equiv \sqrt{x_1^2 + x^2_2/q^2}\).

ddpsi_vec_a0(x1, x2)

Second derivatives of the lensing potential (zero angle).

\[\begin{split}\begin{align} \partial_{11}\psi_{\alpha=0} &= \psi_0(1-r_1^2)/X\\ \partial_{12}\psi_{\alpha=0} &= -\psi_0r_1r_2/X\\ \partial_{22}\psi_{\alpha=0} &= \psi_0(1/q^2-r_2^2)/X \end{align}\end{split}\]

with \(X \equiv \sqrt{x_1^2 + x^2_2/q^2}\), \(r_{1}\equiv x_{1}/X\) and \(r_{2}\equiv x_{2}/X/q^2\).

psi(x1, x2)

Lensing potential.

Defining the transformed coordinates \(\pmb{\tilde{x}}\equiv R(\alpha)(\pmb{x}-\pmb{x_c})\) where \(R(\alpha)\) is the rotation defined in rotate_vector(), we can write the lensing potential from psi_a0() as

\[\psi(x_1, x_2) = \psi_{\alpha=0}(\tilde{x}_1, \tilde{x}_2)\]
dpsi_vec(x1, x2)

Gradient of the lensing potential.

Defining the transformed coordinates \(\pmb{\tilde{x}}\equiv R(\alpha)(\pmb{x}-\pmb{x_c})\) where \(R(\alpha)\) is the rotation defined in rotate_vector(), we can write the first derivatives of the potential from dpsi_a0() as

\[\begin{split}\begin{align} \pmb{g} &\equiv \pmb{\nabla}\psi(\pmb{x})\\ \pmb{\tilde{g}} &\equiv \pmb{\nabla}\psi_{\alpha=0}(\tilde{\pmb{x}})\\ \pmb{g} &= R_g(\alpha)\pmb{\tilde{g}} \end{align}\end{split}\]

where the linear transformation \(R_g\) is defined in rotate_grad().

ddpsi_vec(x1, x2)

Hessian of the lensing potential.

Defining the transformed coordinates \(\pmb{\tilde{x}}\equiv R(\alpha)(\pmb{x}-\pmb{x_c})\) where \(R(\alpha)\) is the rotation defined in rotate_vector(), we can write the second derivatives of the potential from ddpsi_a0() as

\[\begin{split}\begin{align} \pmb{h} &\equiv (\partial_{11}\psi,\,\partial_{12}\psi,\,\partial_{22}\psi)(\pmb{x})\\ \pmb{\tilde{h}} &\equiv (\partial_{11}\psi_{\alpha=0},\, \partial_{12}\psi_{\alpha=0},\,\partial_{22}\psi_{\alpha=0})(\pmb{\tilde{x}})\\ \pmb{h} &= R_h(\alpha)\pmb{\tilde{h}} \end{align}\end{split}\]

where the linear transformation \(R_h\) is defined in rotate_hessian().

class glow.lenses.Psi_Ext(p_phys={}, p_prec={})

Bases: PsiGeneral

Lens object for an external field (convergence & shear).

Additional information: theory, default parameters.

Parameters:
p_physdict, optional

Physical parameters, with keys:

  • kappa (float) – Convergence.

  • gamma1 (float) – Shear along x1.

  • gamma2 (float) – Shear along x2.

Attributes:
kappafloat

Convergence of the lens.

gamma1float

Shear along x1 of the lens.

gamma2float

Shear along x2 of the lens.

Methods

ddpsi_vec(x1, x2)

Second derivatives of the lensing potential.

default_params()

Initialize the default parameters.

dpsi_vec(x1, x2)

First derivatives of the lensing potential.

psi(x1, x2)

Lensing potential.

default_params()

Initialize the default parameters.

Returns:
p_physdict

Default physical parameters.

p_precdict

Empty dictionary.

psi(x1, x2)

Lensing potential.

\[\begin{align} \psi(x_1, x_2) &= \kappa (x_1^2+x_2^2)/2 + \gamma_1(x_1^2-x_2^2)/2 + \gamma_2x_1x_2 \end{align}\]
dpsi_vec(x1, x2)

First derivatives of the lensing potential.

\[\begin{split}\begin{align} \partial_{1}\psi &= \kappa x_1 + \gamma_1 x_1 + \gamma_2 x_2\\ \partial_{2}\psi &= \kappa x_2 - \gamma_1 x_2 + \gamma_2 x_1 \end{align}\end{split}\]
ddpsi_vec(x1, x2)

Second derivatives of the lensing potential.

\[\begin{split}\begin{align} \partial_{11}\psi &= \kappa + \gamma_1\\ \partial_{12}\psi &= \gamma_2\\ \partial_{22}\psi &= \kappa - \gamma_1 \end{align}\end{split}\]