jaxtronomy.LensModel.Profiles package

Submodules

jaxtronomy.LensModel.Profiles.convergence module

class Convergence(*args, **kwargs)[source]

Bases: LensProfileBase

A single mass sheet (external convergence)

model_name = 'CONVERGENCE'
param_names = ['kappa', 'ra_0', 'dec_0']
lower_limit_default = {'dec_0': -100, 'kappa': -10, 'ra_0': -100}
upper_limit_default = {'dec_0': 100, 'kappa': 10, 'ra_0': 100}
static function(x, y, kappa, ra_0=0, dec_0=0)[source]

Lensing potential.

Parameters:
  • x – x-coordinate

  • y – y-coordinate

  • kappa – (external) convergence

Returns:

lensing potential

static derivatives(x, y, kappa, ra_0=0, dec_0=0)[source]

Deflection angle.

Parameters:
  • x – x-coordinate

  • y – y-coordinate

  • kappa – (external) convergence

Returns:

deflection angles (first order derivatives)

static hessian(x, y, kappa, ra_0=0, dec_0=0)[source]

Hessian matrix.

Parameters:
  • x – x-coordinate

  • y – y-coordinate

  • kappa – external convergence

  • ra_0 – zero point of polynomial expansion (no deflection added)

  • dec_0 – zero point of polynomial expansion (no deflection added)

Returns:

second order derivatives f_xx, f_xy, f_yx, f_yy

jaxtronomy.LensModel.Profiles.cored_steep_ellipsoid module

class CSE(axis='product_avg')[source]

Bases: LensProfileBase

Cored steep ellipsoid (CSE) :param axis: ‘major’ or ‘product_avg’ ; whether to evaluate corresponding to r= major axis or r= sqrt(ab) source: Keeton and Kochanek (1998) Oguri 2021: https://arxiv.org/pdf/2106.11464.pdf

\[\kappa(u;s) = \frac{A}{2(s^2 + \xi^2)^{3/2}}\]

with

\[\xi(x, y) = \sqrt{x^2 + \frac{y^2}{q^2}}\]
param_names = ['a', 's', 'e1', 'e2', 'center_x', 'center_y']
lower_limit_default = {'a': -1000, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 's': 0}
upper_limit_default = {'a': 1000, 'center_x': -100, 'center_y': -100, 'e1': 0.5, 'e2': 0.5, 's': 10000}
__init__(axis='product_avg')[source]
function(x, y, a, s, e1, e2, center_x, center_y)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a – lensing strength

  • s – core radius

  • e1 – eccentricity

  • e2 – eccentricity

  • center_x – center of profile

  • center_y – center of profile

Returns:

lensing potential

derivatives(x, y, a, s, e1, e2, center_x, center_y)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a – lensing strength

  • s – core radius

  • e1 – eccentricity

  • e2 – eccentricity

  • center_x – center of profile

  • center_y – center of profile

Returns:

deflection in x- and y-direction

hessian(x, y, a, s, e1, e2, center_x, center_y)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a – lensing strength

  • s – core radius

  • e1 – eccentricity

  • e2 – eccentricity

  • center_x – center of profile

  • center_y – center of profile

Returns:

hessian elements f_xx, f_xy, f_yx, f_yy

class CSEMajorAxis(*args, **kwargs)[source]

Bases: LensProfileBase

Cored steep ellipsoid (CSE) along the major axis source: Keeton and Kochanek (1998) Oguri 2021: https://arxiv.org/pdf/2106.11464.pdf

\[\kappa(u;s) = \frac{A}{2(s^2 + \xi^2)^{3/2}}\]

with

\[\xi(x, y) = \sqrt{x^2 + \frac{y^2}{q^2}}\]
param_names = ['a', 's', 'q', 'center_x', 'center_y']
lower_limit_default = {'a': -1000, 'center_x': -100, 'center_y': -100, 'q': 0.001, 's': 0}
upper_limit_default = {'a': 1000, 'center_x': -100, 'center_y': -100, 'q': 0.99999, 's': 10000}
static function(x, y, a, s, q)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a – lensing strength

  • s – core radius

  • q – axis ratio

Returns:

lensing potential

static derivatives(x, y, a, s, q)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a – lensing strength

  • s – core radius

  • q – axis ratio

Returns:

deflection in x- and y-direction

static hessian(x, y, a, s, q)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a – lensing strength

  • s – core radius

  • q – axis ratio

Returns:

hessian elements f_xx, f_xy, f_yx, f_yy

class CSEMajorAxisSet[source]

Bases: LensProfileBase

A set of CSE profiles along a joint center and axis.

__init__()[source]
static function(x, y, a_list, s_list, q)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a_list – list or array of lensing strength

  • s_list – list or array of core radius

  • q – axis ratio

Returns:

lensing potential

static derivatives(x, y, a_list, s_list, q)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a_list – list or array of lensing strength

  • s_list – list or array of core radius

  • q – axis ratio

Returns:

deflection in x- and y-direction

static hessian(x, y, a_list, s_list, q)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a_list – list or array of lensing strength

  • s_list – list or array of core radius

  • q – axis ratio

Returns:

hessian elements f_xx, f_xy, f_yx, f_yy

class CSEProductAvg[source]

Bases: LensProfileBase

Cored steep ellipsoid (CSE) evaluated at the product-averaged radius sqrt(ab), such that mass is not changed when increasing ellipticity.

Same as CSEMajorAxis but evaluated at r=sqrt(q)*r_original

Keeton and Kochanek (1998) Oguri 2021: https://arxiv.org/pdf/2106.11464.pdf

\[\kappa(u;s) = \frac{A}{2(s^2 + \xi^2)^{3/2}}\]

with

\[\xi(x, y) = \sqrt{qx^2 + \frac{y^2}{q}}\]
param_names = ['a', 's', 'q', 'center_x', 'center_y']
lower_limit_default = {'a': -1000, 'center_x': -100, 'center_y': -100, 'q': 0.001, 's': 0}
upper_limit_default = {'a': 1000, 'center_x': -100, 'center_y': -100, 'q': 0.99999, 's': 10000}
__init__()[source]
static function(x, y, a, s, q)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a – lensing strength

  • s – core radius

  • q – axis ratio

Returns:

lensing potential

static derivatives(x, y, a, s, q)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a – lensing strength

  • s – core radius

  • q – axis ratio

Returns:

deflection in x- and y-direction

static hessian(x, y, a, s, q)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a – lensing strength

  • s – core radius

  • q – axis ratio

Returns:

hessian elements f_xx, f_xy, f_yx, f_yy

class CSEProductAvgSet[source]

Bases: LensProfileBase

A set of CSE profiles along a joint center and axis.

__init__()[source]
static function(x, y, a_list, s_list, q)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a_list – list or array of lensing strength

  • s_list – list or array of core radius

  • q – axis ratio

Returns:

lensing potential

static derivatives(x, y, a_list, s_list, q)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a_list – list or array of lensing strength

  • s_list – list or array of core radius

  • q – axis ratio

Returns:

deflection in x- and y-direction

static hessian(x, y, a_list, s_list, q)[source]
Parameters:
  • x – coordinate in image plane (angle)

  • y – coordinate in image plane (angle)

  • a_list – list or array of lensing strength

  • s_list – list or array of core radius

  • q – axis ratio

Returns:

hessian elements f_xx, f_xy, f_yx, f_yy

jaxtronomy.LensModel.Profiles.epl module

class EPL(b=0, t=0, q=0, phi=0, static=False)[source]

Bases: LensProfileBase

Elliptical Power Law mass profile.

\[\kappa(x, y) = \frac{3-\gamma}{2} \left(\frac{\theta_{E}}{\sqrt{q x^2 + y^2/q}} \right)^{\gamma-1}\]

with \(\theta_{E}\) is the (circularized) Einstein radius, \(\gamma\) is the negative power-law slope of the 3D mass distributions, \(q\) is the minor/major axis ratio, and \(x\) and \(y\) are defined in a coordinate system aligned with the major and minor axis of the lens.

In terms of eccentricities, this profile is defined as

\[\kappa(r) = \frac{3-\gamma}{2} \left(\frac{\theta'_{E}}{r \sqrt{1 - e*\cos(2*\phi)}} \right)^{\gamma-1}\]

with \(\epsilon\) is the ellipticity defined as

\[\epsilon = \frac{1-q^2}{1+q^2}\]

And an Einstein radius \(\theta'_{\rm E}\) related to the definition used is

\[\left(\frac{\theta'_{\rm E}}{\theta_{\rm E}}\right)^{2} = \frac{2q}{1+q^2}.\]

The mathematical form of the calculation is presented by Tessore & Metcalf (2015), https://arxiv.org/abs/1507.01819. The current implementation is using hyperbolic functions. The paper presents an iterative calculation scheme, converging in few iterations to high precision and accuracy.

A (faster) implementation of the same model using numba is accessible as ‘EPL_NUMBA’ with the iterative calculation scheme. An alternative implementation of the same model using a fortran code FASTELL is implemented as ‘PEMD’ profile.

param_names = ['theta_E', 'gamma', 'e1', 'e2', 'center_x', 'center_y']
lower_limit_default = {'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'gamma': 1.5, 'theta_E': 0}
upper_limit_default = {'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'gamma': 2.5, 'theta_E': 100}
__init__(b=0, t=0, q=0, phi=0, static=False)[source]
param_conv(theta_E, gamma, e1, e2)[source]

Converts parameters as defined in this class to the parameters used in the EPLMajorAxis() class.

Parameters:
  • theta_E – Einstein radius as defined in the profile class

  • gamma – negative power-law slope

  • e1 – eccentricity modulus

  • e2 – eccentricity modulus

Returns:

b, t, q, phi_G

set_static(theta_E, gamma, e1, e2, center_x=0, center_y=0)[source]
Parameters:
  • theta_E – Einstein radius

  • gamma – power law slope

  • e1 – eccentricity component

  • e2 – eccentricity component

  • center_x – profile center

  • center_y – profile center

Returns:

self variables set

set_dynamic()[source]
Returns:

function(x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0)[source]
Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – power law slope

  • e1 – eccentricity component

  • e2 – eccentricity component

  • center_x – profile center

  • center_y – profile center

Returns:

lensing potential

derivatives(x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0)[source]
Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – power law slope

  • e1 – eccentricity component

  • e2 – eccentricity component

  • center_x – profile center

  • center_y – profile center

Returns:

alpha_x, alpha_y

hessian(x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0)[source]
Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – power law slope

  • e1 – eccentricity component

  • e2 – eccentricity component

  • center_x – profile center

  • center_y – profile center

Returns:

f_xx, f_xy, f_yx, f_yy

mass_3d_lens(r, theta_E, gamma, e1=None, e2=None)[source]

Computes the spherical power-law mass enclosed (with SPP routine)

Parameters:
  • r – radius within the mass is computed

  • theta_E – Einstein radius

  • gamma – power-law slope

  • e1 – eccentricity component (not used)

  • e2 – eccentricity component (not used)

Returns:

mass enclosed a 3D radius r.

density_lens(r, theta_E, gamma, e1=None, e2=None)[source]

Computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

Parameters:
  • r – radius within the mass is computed

  • theta_E – Einstein radius

  • gamma – power-law slope

  • e1 – eccentricity component (not used)

  • e2 – eccentricity component (not used)

Returns:

mass enclosed a 3D radius r

class EPLMajorAxis(*args, **kwargs)[source]

Bases: LensProfileBase

This class contains the function and the derivatives of the elliptical power law.

\[\kappa = (2-t)/2 * \left[\frac{b}{\sqrt{q^2 x^2 + y^2}}\right]^t\]

where with \(t = \gamma - 1\) (from EPL class) being the projected power-law slope of the convergence profile, critical radius b, axis ratio q.

Tessore & Metcalf (2015), https://arxiv.org/abs/1507.01819

param_names = ['b', 't', 'q', 'center_x', 'center_y']
hyp2f1_fastest(b, c, z, *, nmax=10)

Equation 8 from J.L. Lopez and N.M. Temme, “New series expansions of the Gauss hypergeometric function”, Adv Comput Math 39, 349-365 (2013). https://link.springer.com/content/pdf/10.1007/s10444-012-9283-y.pdf

This series expansion converges whenever Re(z) < 1, and does not have any restrictions on a, b, or c. The downside is that this series converges slowly for |z| -> infty, so nmax needs to be higher for an accurate result. This series expansion coverges a bit faster than the standard series expansion when z is in the unit disk.

hyp2f1_faster(b, c, z, *, nmax=20)

Equation 8 from J.L. Lopez and N.M. Temme, “New series expansions of the Gauss hypergeometric function”, Adv Comput Math 39, 349-365 (2013). https://link.springer.com/content/pdf/10.1007/s10444-012-9283-y.pdf

This series expansion converges whenever Re(z) < 1, and does not have any restrictions on a, b, or c. The downside is that this series converges slowly for |z| -> infty, so nmax needs to be higher for an accurate result. This series expansion coverges a bit faster than the standard series expansion when z is in the unit disk.

hyp2f1_fast(b, c, z, *, nmax=35)

Equation 8 from J.L. Lopez and N.M. Temme, “New series expansions of the Gauss hypergeometric function”, Adv Comput Math 39, 349-365 (2013). https://link.springer.com/content/pdf/10.1007/s10444-012-9283-y.pdf

This series expansion converges whenever Re(z) < 1, and does not have any restrictions on a, b, or c. The downside is that this series converges slowly for |z| -> infty, so nmax needs to be higher for an accurate result. This series expansion coverges a bit faster than the standard series expansion when z is in the unit disk.

hyp2f1_norm(b, c, z, *, nmax=50)

Equation 8 from J.L. Lopez and N.M. Temme, “New series expansions of the Gauss hypergeometric function”, Adv Comput Math 39, 349-365 (2013). https://link.springer.com/content/pdf/10.1007/s10444-012-9283-y.pdf

This series expansion converges whenever Re(z) < 1, and does not have any restrictions on a, b, or c. The downside is that this series converges slowly for |z| -> infty, so nmax needs to be higher for an accurate result. This series expansion coverges a bit faster than the standard series expansion when z is in the unit disk.

hyp2f1_slow(b, c, z, *, nmax=100)

Equation 8 from J.L. Lopez and N.M. Temme, “New series expansions of the Gauss hypergeometric function”, Adv Comput Math 39, 349-365 (2013). https://link.springer.com/content/pdf/10.1007/s10444-012-9283-y.pdf

This series expansion converges whenever Re(z) < 1, and does not have any restrictions on a, b, or c. The downside is that this series converges slowly for |z| -> infty, so nmax needs to be higher for an accurate result. This series expansion coverges a bit faster than the standard series expansion when z is in the unit disk.

hyp2f1_slower(b, c, z, *, nmax=200)

Equation 8 from J.L. Lopez and N.M. Temme, “New series expansions of the Gauss hypergeometric function”, Adv Comput Math 39, 349-365 (2013). https://link.springer.com/content/pdf/10.1007/s10444-012-9283-y.pdf

This series expansion converges whenever Re(z) < 1, and does not have any restrictions on a, b, or c. The downside is that this series converges slowly for |z| -> infty, so nmax needs to be higher for an accurate result. This series expansion coverges a bit faster than the standard series expansion when z is in the unit disk.

hyp2f1_slowest(b, c, z, *, nmax=500)

Equation 8 from J.L. Lopez and N.M. Temme, “New series expansions of the Gauss hypergeometric function”, Adv Comput Math 39, 349-365 (2013). https://link.springer.com/content/pdf/10.1007/s10444-012-9283-y.pdf

This series expansion converges whenever Re(z) < 1, and does not have any restrictions on a, b, or c. The downside is that this series converges slowly for |z| -> infty, so nmax needs to be higher for an accurate result. This series expansion coverges a bit faster than the standard series expansion when z is in the unit disk.

hyp2f1_func_list = [functools.partial(<PjitFunction of <function hyp2f1_lopez_temme_8>>, nmax=10), functools.partial(<PjitFunction of <function hyp2f1_lopez_temme_8>>, nmax=20), functools.partial(<PjitFunction of <function hyp2f1_lopez_temme_8>>, nmax=35), functools.partial(<PjitFunction of <function hyp2f1_lopez_temme_8>>, nmax=50), functools.partial(<PjitFunction of <function hyp2f1_lopez_temme_8>>, nmax=100), functools.partial(<PjitFunction of <function hyp2f1_lopez_temme_8>>, nmax=200), functools.partial(<PjitFunction of <function hyp2f1_lopez_temme_8>>, nmax=500), <function EPLMajorAxis.<lambda>>]
static function(x, y, b, t, q)[source]

Returns the lensing potential.

Parameters:
  • x – x-coordinate in image plane relative to center (major axis)

  • y – y-coordinate in image plane relative to center (minor axis)

  • b – critical radius

  • t – projected power-law slope

  • q – axis ratio

Returns:

lensing potential

static derivatives(x, y, b, t, q)[source]

Returns the deflection angles.

Parameters:
  • x – x-coordinate in image plane relative to center (major axis)

  • y – y-coordinate in image plane relative to center (minor axis)

  • b – critical radius

  • t – projected power-law slope

  • q – axis ratio

Returns:

f_x, f_y

static hessian(x, y, b, t, q)[source]

Hessian matrix of the lensing potential.

Parameters:
  • x – x-coordinate in image plane relative to center (major axis)

  • y – y-coordinate in image plane relative to center (minor axis)

  • b – critical radius

  • t – projected power-law slope

  • q – axis ratio

Returns:

f_xx, f_yy, f_xy

class EPLQPhi(*args, **kwargs)[source]

Bases: LensProfileBase

Class to model a EPL sampling over q and phi instead of e1 and e2.

param_names = ['theta_E', 'gamma', 'q', 'phi', 'center_x', 'center_y']
lower_limit_default = {'center_x': -100, 'center_y': -100, 'gamma': 1.5, 'phi': -3.141592653589793, 'q': 0, 'theta_E': 0}
upper_limit_default = {'center_x': 100, 'center_y': 100, 'gamma': 2.5, 'phi': 3.141592653589793, 'q': 1, 'theta_E': 100}
static function(x, y, theta_E, gamma, q, phi, center_x=0, center_y=0)[source]
Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – power law slope

  • q – axis ratio

  • phi – position angle

  • center_x – profile center

  • center_y – profile center

Returns:

lensing potential

static derivatives(x, y, theta_E, gamma, q, phi, center_x=0, center_y=0)[source]
Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – power law slope

  • q – axis ratio

  • phi – position angle

  • center_x – profile center

  • center_y – profile center

Returns:

alpha_x, alpha_y

static hessian(x, y, theta_E, gamma, q, phi, center_x=0, center_y=0)[source]
Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – power law slope

  • q – axis ratio

  • phi – position angle

  • center_x – profile center

  • center_y – profile center

Returns:

f_xx, f_xy, f_yx, f_yy

static mass_3d_lens(r, theta_E, gamma, q=None, phi=None)[source]

Computes the spherical power-law mass enclosed (with SPP routine).

Parameters:
  • r – radius within the mass is computed

  • theta_E – Einstein radius

  • gamma – power-law slope

  • q – axis ratio (not used)

  • phi – position angle (not used)

Returns:

mass enclosed a 3D radius r.

static density_lens(r, theta_E, gamma, q=None, phi=None)[source]

Computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

Parameters:
  • r – radius within the mass is computed

  • theta_E – Einstein radius

  • gamma – power-law slope

  • q – axis ratio (not used)

  • phi – position angle (not used)

Returns:

mass enclosed a 3D radius r

jaxtronomy.LensModel.Profiles.epl_multipole_m1m3m4 module

class EPL_MULTIPOLE_M1M3M4(*args, **kwargs)[source]

Bases: LensProfileBase

EPL (Elliptical Power Law) mass profile combined with three circular multipole terms of order m=1, m=3 and m=4 (exact for axis ratio =1).

Reference to the implementation: https://ui.adsabs.harvard.edu/abs/2022A%26A…659A.127V/abstract

See also documentation of EPL_BOXYDIKSY CLASS, lenstronomy.LensModel.Profiles.epl and lenstronomy.LensModel.Profiles.multipole for details. For an example of using all three circular multipoles together, see e.g. https://ui.adsabs.harvard.edu/abs/2024arXiv241012987L/abstract

Parameters:
  • theta_E – Einstein radius

  • gamma – negative power-law slope of the 3D mass distributions

  • e1 – eccentricity. For details, read lenstronomy.Util.param_util.phi_q2_ellipticity document.

  • e2 – eccentricity. For details, read lenstronomy.Util.param_util.phi_q2_ellipticity document.

  • a1_a – amplitude of the m=1 mutipole perturbation

  • delta_phi_m1 – orientation of the m=1 multipole perturbation relative to EPL

  • center_x – center of distortion

  • center_y – center of distortion

  • a3_a – Strength of the deviation from elliptical isodensity contours caused by the multipole term of order 3 translated into the multipole strength from the MULTIPOLE class through a rescaling by theta_E / sqrt(q). The rescaling preserves the shape of the isodensity contours such that a3_a produces the same shape regardless of theta_E or q.

  • delta_phi_m3 – angle of the m=3 multipole profile relative to the position angle of the EPL profile

  • a4_a – Strength of the deviation from elliptical isodensity contours caused by the multipole term of order 3 translated into the multipole strength from the MULTIPOLE class through a rescaling by theta_E / sqrt(q). Profile is disky when a4_a>0 and boxy when a4_a<0 for phi_m_a4a=0.0.

  • delta_phi_m4 – angle of the m=4 multipole profile relative to the position angle of the EPL profile

param_names = ['theta_E', 'gamma', 'e1', 'e2', 'center_x', 'center_y', 'a1_a', 'delta_phi_m1', 'a3_a', 'delta_phi_m3', 'a4_a', 'delta_phi_m4']
lower_limit_default = {'a1_a': -0.2, 'a3_a': -0.2, 'a4_a': -0.2, 'center_x': -100, 'center_y': -100, 'delta_phi_m1': -3.141592653589793, 'delta_phi_m3': -0.5235987755982988, 'delta_phi_m4': -0.39269908169872414, 'e1': -0.5, 'e2': -0.5, 'gamma': 1.5, 'theta_E': 0}
upper_limit_default = {'a1_a': 0.2, 'a3_a': 0.2, 'a4_a': 0.2, 'center_x': 100, 'center_y': 100, 'delta_phi_m1': 3.141592653589793, 'delta_phi_m3': 0.5235987755982988, 'delta_phi_m4': 0.39269908169872414, 'e1': 0.5, 'e2': 0.5, 'gamma': 2.5, 'theta_E': 100}
epl = <jaxtronomy.LensModel.Profiles.epl.EPL object>
multipole = <jaxtronomy.LensModel.Profiles.multipole.Multipole object>
static function(x, y, theta_E, gamma, e1, e2, a1_a, delta_phi_m1, a3_a, delta_phi_m3, a4_a, delta_phi_m4, center_x=0, center_y=0)[source]

Computes the gravitational potential in units of theta_E^2.

Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – log-slope of EPL mass profile

  • e1 – ellipticity of EPL profile (along 1st axis)

  • e2 – ellipticity of EPL profile (along 2nd axis)

  • a1_a – amplitude of the m=1 mutipole perturbation

  • delta_phi_m1 – orientation of the m=1 multipole perturbation relative to EPL

  • a3_a – amplitude of the m=3 multiple deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE profile by a scaling theta_E / sqrt(q)

  • delta_phi_m3 – orientation of the m=3 profile relative to the position angle of the EPL profile

  • a4_a – amplitude of the m=4 multipole deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE profile by a scaling theta_E / sqrt(q)

  • delta_phi_m4 – orientation of the m=4 profile relative to the position angle of the EPL profile

  • center_x – center of the profile

  • center_y – center of the profile

Returns:

lensing potential.

static derivatives(x, y, theta_E, gamma, e1, e2, a1_a, delta_phi_m1, a3_a, delta_phi_m3, a4_a, delta_phi_m4, center_x=0, center_y=0)[source]

Computes the derivatives of the potential (deflection angles)in units of theta_E.

Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – log-slope of EPL mass profile

  • e1 – ellipticity of EPL profile (along 1st axis)

  • e2 – ellipticity of EPL profile (along 2nd axis)

  • a1_a – amplitude of the m=1 mutipole perturbation

  • delta_phi_m1 – orientation of the m=1 multipole perturbation relative to EPL

  • a3_a – amplitude of the m=3 multiple deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE profile by a scaling theta_E / sqrt(q)

  • delta_phi_m3 – orientation of the m=3 profile relative to the position angle of the EPL profile

  • a4_a – amplitude of the m=4 multipole deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE profile by a scaling theta_E / sqrt(q)

  • delta_phi_m4 – orientation of the m=4 profile relative to the position angle of the EPL profile

  • center_x – center of the profile

  • center_y – center of the profile

Returns:

alpha_x, alpha_y.

static hessian(x, y, theta_E, gamma, e1, e2, a1_a, delta_phi_m1, a3_a, delta_phi_m3, a4_a, delta_phi_m4, center_x=0, center_y=0)[source]

Computes the components of the hessian matrix (second derivatives of the potential)

Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – log-slope of EPL mass profile

  • e1 – ellipticity of EPL profile (along 1st axis)

  • e2 – ellipticity of EPL profile (along 2nd axis)

  • a1_a – amplitude of the m=1 mutipole perturbation

  • delta_phi_m1 – orientation of the m=1 multipole perturbation relative to EPL

  • a3_a – amplitude of the m=3 multiple deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE profile by a scaling theta_E / sqrt(q)

  • delta_phi_m3 – orientation of the m=3 profile relative to the position angle of the EPL profile

  • a4_a – amplitude of the m=4 multipole deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE profile by a scaling theta_E / sqrt(q)

  • delta_phi_m4 – orientation of the m=4 profile relative to the position angle of the EPL profile

  • center_x – center of the profile

  • center_y – center of the profile

Returns:

f_xx, f_xy, f_yx, f_yy.

class EPL_MULTIPOLE_M1M3M4_ELL(*args, **kwargs)[source]

Bases: LensProfileBase

EPL (Elliptical Power Law) mass profile combined with three elliptical multipole terms of order m=1, m=3 and m=4 (exact for general axis ratio q).

See also documentation of EPL_BOXYDIKSY CLASS, lenstronomy.LensModel.Profiles.epl and lenstronomy.LensModel.Profiles.multipole for details.

param_names = ['theta_E', 'gamma', 'e1', 'e2', 'center_x', 'center_y', 'a1_a', 'delta_phi_m1', 'a3_a', 'delta_phi_m3', 'a4_a', 'delta_phi_m4']
lower_limit_default = {'a1_a': -0.2, 'a3_a': -0.2, 'a4_a': -0.2, 'center_x': -100, 'center_y': -100, 'delta_phi_m1': -3.141592653589793, 'delta_phi_m3': -0.5235987755982988, 'delta_phi_m4': -0.39269908169872414, 'e1': -0.5, 'e2': -0.5, 'gamma': 1.5, 'theta_E': 0}
upper_limit_default = {'a1_a': 0.2, 'a3_a': 0.2, 'a4_a': 0.2, 'center_x': 100, 'center_y': 100, 'delta_phi_m1': 3.141592653589793, 'delta_phi_m3': 0.5235987755982988, 'delta_phi_m4': 0.39269908169872414, 'e1': 0.5, 'e2': 0.5, 'gamma': 2.5, 'theta_E': 100}
epl = <jaxtronomy.LensModel.Profiles.epl.EPL object>
multipole = <jaxtronomy.LensModel.Profiles.multipole.EllipticalMultipole object>
static function(x, y, theta_E, gamma, e1, e2, a1_a, delta_phi_m1, a3_a, delta_phi_m3, a4_a, delta_phi_m4, center_x=0, center_y=0)[source]

Computes the gravitational potential in units of theta_E^2.

Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – log-slope of EPL mass profile

  • e1 – ellipticity of EPL profile (along 1st axis)

  • e2 – ellipticity of EPL profile (along 2nd axis)

  • a1_a – amplitude of the m=1 mutipole perturbation from pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m1 – orientation of the m=1 multipole perturbation relative to EPL

  • a3_a – amplitude of the m=3 multiple deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m3 – orientation of the m=3 profile relative to the position angle of the EPL profile

  • a4_a – amplitude of the m=4 multipole deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m4 – orientation of the m=4 profile relative to the position angle of the EPL profile

  • center_x – center of the profile

  • center_y – center of the profile

Returns:

lensing potential.

static derivatives(x, y, theta_E, gamma, e1, e2, a1_a, delta_phi_m1, a3_a, delta_phi_m3, a4_a, delta_phi_m4, center_x=0, center_y=0)[source]

Computes the derivatives of the potential (deflection angles)in units of theta_E.

Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – log-slope of EPL mass profile

  • e1 – ellipticity of EPL profile (along 1st axis)

  • e2 – ellipticity of EPL profile (along 2nd axis)

  • a1_a – amplitude of the m=1 mutipole perturbationfrom pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m1 – orientation of the m=1 multipole perturbation relative to EPL

  • a3_a – amplitude of the m=3 multiple deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m3 – orientation of the m=3 profile relative to the position angle of the EPL profile

  • a4_a – amplitude of the m=4 multipole deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m4 – orientation of the m=4 profile relative to the position angle of the EPL profile

  • center_x – center of the profile

  • center_y – center of the profile

Returns:

alpha_x, alpha_y

static hessian(x, y, theta_E, gamma, e1, e2, a1_a, delta_phi_m1, a3_a, delta_phi_m3, a4_a, delta_phi_m4, center_x=0, center_y=0)[source]

Computes the components of the hessian matrix (second derivatives of the potential)

Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – log-slope of EPL mass profile

  • e1 – ellipticity of EPL profile (along 1st axis)

  • e2 – ellipticity of EPL profile (along 2nd axis)

  • a1_a – amplitude of the m=1 mutipole perturbation from pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m1 – orientation of the m=1 multipole perturbation relative to EPL

  • a3_a – amplitude of the m=3 multiple deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m3 – orientation of the m=3 profile relative to the position angle of the EPL profile

  • a4_a – amplitude of the m=4 multipole deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m4 – orientation of the m=4 profile relative to the position angle of the EPL profile

  • center_x – center of the profile

  • center_y – center of the profile

Returns:

f_xx, f_xy, f_yx, f_yy.

jaxtronomy.LensModel.Profiles.epl_multipole_m3m4 module

class EPL_MULTIPOLE_M3M4(*args, **kwargs)[source]

Bases: LensProfileBase

EPL (Elliptical Power Law) mass profile combined with two circular multipole terms of order m=3 and m=4 (exact for axis ratio =1).

Reference to the implementation: https://ui.adsabs.harvard.edu/abs/2022A%26A…659A.127V/abstract

See also documentation of EPL_BOXYDIKSY CLASS, lenstronomy.LensModel.Profiles.epl and lenstronomy.LensModel.Profiles.multipole for details.

param_names = ['theta_E', 'gamma', 'e1', 'e2', 'center_x', 'center_y', 'a3_a', 'delta_phi_m3', 'a4_a', 'delta_phi_m4']
lower_limit_default = {'a3_a': -0.2, 'a4_a': -0.2, 'center_x': -100, 'center_y': -100, 'delta_phi_m3': -0.5235987755982988, 'delta_phi_m4': -0.39269908169872414, 'e1': -0.5, 'e2': -0.5, 'gamma': 1.5, 'theta_E': 0}
upper_limit_default = {'a3_a': 0.2, 'a4_a': 0.2, 'center_x': 100, 'center_y': 100, 'delta_phi_m3': 0.5235987755982988, 'delta_phi_m4': 0.39269908169872414, 'e1': 0.5, 'e2': 0.5, 'gamma': 2.5, 'theta_E': 100}
epl = <jaxtronomy.LensModel.Profiles.epl.EPL object>
multipole = <jaxtronomy.LensModel.Profiles.multipole.Multipole object>
static function(x, y, theta_E, gamma, e1, e2, a3_a, delta_phi_m3, a4_a, delta_phi_m4, center_x=0, center_y=0)[source]

Computes the gravitational potential in units of theta_E^2.

Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – log-slope of EPL mass profile

  • e1 – ellipticity of EPL profile (along 1st axis)

  • e2 – ellipticity of EPL profile (along 2nd axis)

  • a3_a – amplitude of the m=3 multiple deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE profile by a scaling theta_E / sqrt(q)

  • delta_phi_m3 – orientation of the m=3 profile relative to the position angle of the EPL profile

  • a4_a – amplitude of the m=4 multipole deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE profile by a scaling theta_E / sqrt(q)

  • delta_phi_m4 – orientation of the m=4 profile relative to the position angle of the EPL profile

  • center_x – center of the profile

  • center_y – center of the profile

Returns:

lensing potential.

static derivatives(x, y, theta_E, gamma, e1, e2, a3_a, delta_phi_m3, a4_a, delta_phi_m4, center_x=0, center_y=0)[source]

Computes the derivatives of the potential (deflection angles)in units of theta_E.

Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – log-slope of EPL mass profile

  • e1 – ellipticity of EPL profile (along 1st axis)

  • e2 – ellipticity of EPL profile (along 2nd axis)

  • a3_a – amplitude of the m=3 multiple deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE profile by a scaling theta_E / sqrt(q)

  • delta_phi_m3 – orientation of the m=3 profile relative to the position angle of the EPL profile

  • a4_a – amplitude of the m=4 multipole deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE profile by a scaling theta_E / sqrt(q)

  • delta_phi_m4 – orientation of the m=4 profile relative to the position angle of the EPL profile

  • center_x – center of the profile

  • center_y – center of the profile

Returns:

alpha_x, alpha_y.

static hessian(x, y, theta_E, gamma, e1, e2, a3_a, delta_phi_m3, a4_a, delta_phi_m4, center_x=0, center_y=0)[source]

Computes the components of the hessian matrix (second derivatives of the potential)

Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – log-slope of EPL mass profile

  • e1 – ellipticity of EPL profile (along 1st axis)

  • e2 – ellipticity of EPL profile (along 2nd axis)

  • a3_a – amplitude of the m=3 multiple deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE profile by a scaling theta_E / sqrt(q)

  • delta_phi_m3 – orientation of the m=3 profile relative to the position angle of the EPL profile

  • a4_a – amplitude of the m=4 multipole deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE profile by a scaling theta_E / sqrt(q)

  • delta_phi_m4 – orientation of the m=4 profile relative to the position angle of the EPL profile

  • center_x – center of the profile

  • center_y – center of the profile

Returns:

f_xx, f_xy, f_yx, f_yy.

class EPL_MULTIPOLE_M3M4_ELL(*args, **kwargs)[source]

Bases: LensProfileBase

EPL (Elliptical Power Law) mass profile combined with two elliptical multipole terms of order m=3 and m=4 (exact for general axis ratio q).

See also documentation of EPL_BOXYDIKSY CLASS, lenstronomy.LensModel.Profiles.epl and lenstronomy.LensModel.Profiles.multipole for details.

param_names = ['theta_E', 'gamma', 'e1', 'e2', 'center_x', 'center_y', 'a3_a', 'delta_phi_m3', 'a4_a', 'delta_phi_m4']
lower_limit_default = {'a3_a': -0.2, 'a4_a': -0.2, 'center_x': -100, 'center_y': -100, 'delta_phi_m3': -0.5235987755982988, 'delta_phi_m4': -0.39269908169872414, 'e1': -0.5, 'e2': -0.5, 'gamma': 1.5, 'theta_E': 0}
upper_limit_default = {'a3_a': 0.2, 'a4_a': 0.2, 'center_x': 100, 'center_y': 100, 'delta_phi_m3': 0.5235987755982988, 'delta_phi_m4': 0.39269908169872414, 'e1': 0.5, 'e2': 0.5, 'gamma': 2.5, 'theta_E': 100}
epl = <jaxtronomy.LensModel.Profiles.epl.EPL object>
multipole = <jaxtronomy.LensModel.Profiles.multipole.EllipticalMultipole object>
static function(x, y, theta_E, gamma, e1, e2, a3_a, delta_phi_m3, a4_a, delta_phi_m4, center_x=0, center_y=0)[source]

Computes the gravitational potential in units of theta_E^2.

Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – log-slope of EPL mass profile

  • e1 – ellipticity of EPL profile (along 1st axis)

  • e2 – ellipticity of EPL profile (along 2nd axis)

  • a3_a – amplitude of the m=3 multiple deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m3 – orientation of the m=3 profile relative to the position angle of the EPL profile

  • a4_a – amplitude of the m=4 multipole deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m4 – orientation of the m=4 profile relative to the position angle of the EPL profile

  • center_x – center of the profile

  • center_y – center of the profile

Returns:

lensing potential.

static derivatives(x, y, theta_E, gamma, e1, e2, a3_a, delta_phi_m3, a4_a, delta_phi_m4, center_x=0, center_y=0)[source]

Computes the derivatives of the potential (deflection angles)in units of theta_E.

Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – log-slope of EPL mass profile

  • e1 – ellipticity of EPL profile (along 1st axis)

  • e2 – ellipticity of EPL profile (along 2nd axis)

  • a3_a – amplitude of the m=3 multiple deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m3 – orientation of the m=3 profile relative to the position angle of the EPL profile

  • a4_a – amplitude of the m=4 multipole deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m4 – orientation of the m=4 profile relative to the position angle of the EPL profile

  • center_x – center of the profile

  • center_y – center of the profile

Returns:

alpha_x, alpha_y.

static hessian(x, y, theta_E, gamma, e1, e2, a3_a, delta_phi_m3, a4_a, delta_phi_m4, center_x=0, center_y=0)[source]

Computes the components of the hessian matrix (second derivatives of the potential)

Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • gamma – log-slope of EPL mass profile

  • e1 – ellipticity of EPL profile (along 1st axis)

  • e2 – ellipticity of EPL profile (along 2nd axis)

  • a3_a – amplitude of the m=3 multiple deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m3 – orientation of the m=3 profile relative to the position angle of the EPL profile

  • a4_a – amplitude of the m=4 multipole deviation from pure elliptical shape related to the physical amplitude of the MULTIPOLE_ELL profile by a scaling theta_E

  • delta_phi_m4 – orientation of the m=4 profile relative to the position angle of the EPL profile

  • center_x – center of the profile

  • center_y – center of the profile

Returns:

f_xx, f_xy, f_yx, f_yy.

jaxtronomy.LensModel.Profiles.gaussian module

class Gaussian(*args, **kwargs)[source]

Bases: LensProfileBase

This class contains functions to evaluate a Gaussian convergence and calculates its derivative and hessian matrix.

param_names = ['amp', 'sigma', 'center_x', 'center_y']
lower_limit_default = {'amp': 0, 'center_x': -100, 'center_y': -100, 'sigma': 0}
upper_limit_default = {'amp': 100, 'center_x': 100, 'center_y': 100, 'sigma': 100}
ds = 1e-05
static function(x, y, amp, sigma, center_x=0, center_y=0)[source]

Returns potential for a Gaussian convergence.

Parameters:
  • x – x position

  • y – y position

  • amp – 2d amplitude of Gaussian

  • sigma – standard deviation of Gaussian

  • center_x – x position of the center of the lens

  • center_y – y position of the center of the lens

static derivatives(x, y, amp, sigma, center_x=0, center_y=0)[source]

Returns df/dx and df/dy of the function.

Parameters:
  • x – x position

  • y – y position

  • amp – 2d amplitude of Gaussian

  • sigma – standard deviation of Gaussian

  • center_x – x position of the center of the lens

  • center_y – y position of the center of the lens

static hessian(x, y, amp, sigma, center_x=0, center_y=0)[source]

Returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2.

Parameters:
  • x – x position

  • y – y position

  • amp – 2d amplitude of Gaussian

  • sigma – standard deviation of Gaussian

  • center_x – x position of the center of the lens

  • center_y – y position of the center of the lens

static density(r, amp, sigma)[source]

3d mass density as a function of radius r.

Parameters:
  • r – radius

  • amp – 3d amplitude of Gaussian

  • sigma – standard deviation of Gaussian

static density_2d(x, y, amp, sigma, center_x=0, center_y=0)[source]

Projected 2d density at position (x,y)

Parameters:
  • x – x position

  • y – y position

  • amp – 3d amplitude of Gaussian

  • sigma – standard deviation of Gaussian

  • center_x – x position of the center of the lens

  • center_y – y position of the center of the lens

static mass_2d(R, amp, sigma)[source]

Mass enclosed in a circle of radius R when projected into 2d.

Parameters:
  • R – projected radius

  • amp – 3d amplitude of Gaussian

  • sigma – standard deviation of Gaussian

static mass_2d_lens(R, amp, sigma)[source]

Mass enclosed in a circle of radius R when projected into 2d.

Parameters:
  • R – projected radius

  • amp – 2d amplitude of Gaussian

  • sigma – standard deviation of Gaussian

static alpha_abs(R, amp, sigma)[source]

Absolute value of the deflection.

Parameters:
  • R – radius projected into 2d

  • amp – 2d amplitude of Gaussian

  • sigma – standard deviation of Gaussian

static d_alpha_dr(R, amp, sigma_x, sigma_y)[source]

Derivative of deflection angle w.r.t r.

Parameters:
  • R – radius projected into 2d

  • amp – 2d amplitude of Gaussian

  • sigma_x – standard deviation of Gaussian in x direction

  • sigma_y – standard deviation of Gaussian in y direction

static mass_3d(R, amp, sigma)[source]

Mass enclosed within a 3D sphere of projected radius R given a lens parameterization with angular units. The input parameter amp is the 3d amplitude.

Parameters:
  • R – radius projected into 2d

  • amp – 3d amplitude of Gaussian

  • sigma – standard deviation of Gaussian

static mass_3d_lens(R, amp, sigma)[source]

Mass enclosed within a 3D sphere of projected radius R given a lens parameterization with angular units. The input parameters are identical as for the derivatives definition. (optional definition)

Parameters:
  • R – radius projected into 2d

  • amp – 2d amplitude of Gaussian

  • sigma – standard deviation of Gaussian

jaxtronomy.LensModel.Profiles.gaussian_potential module

class GaussianPotential(*args, **kwargs)[source]

Bases: LensProfileBase

This class contains functions to evaluate a Gaussian potential and calculates its derivative and hessian matrix.

param_names = ['amp', 'sigma_x', 'sigma_y', 'center_x', 'center_y']
lower_limit_default = {'amp': 0, 'center_x': -100, 'center_y': -100, 'sigma_x': 0, 'sigma_y': 0}
upper_limit_default = {'amp': 100, 'center_x': 100, 'center_y': 100, 'sigma_x': 100, 'sigma_y': 100}
static function(x, y, amp, sigma_x, sigma_y, center_x=0, center_y=0)[source]

Returns Gaussian.

Parameters:
  • x – x position

  • y – y position

  • amp – amplitude of Gaussian

  • sigma_x – standard deviation of Gaussian in the x direction

  • sigma_y – standard deviation of Gaussian in the y direction

  • center_x – x position of the center of the lens

  • center_y – y position of the center of the lens

static derivatives(x, y, amp, sigma_x, sigma_y, center_x=0, center_y=0)[source]

Returns df/dx and df/dy of the function.

Parameters:
  • x – x position

  • y – y position

  • amp – amplitude of Gaussian

  • sigma_x – standard deviation of Gaussian in the x direction

  • sigma_y – standard deviation of Gaussian in the y direction

  • center_x – x position of the center of the lens

  • center_y – y position of the center of the lens

static hessian(x, y, amp, sigma_x, sigma_y, center_x=0, center_y=0)[source]

Returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2.

Parameters:
  • x – x position

  • y – y position

  • amp – amplitude of Gaussian

  • sigma_x – standard deviation of Gaussian in the x direction

  • sigma_y – standard deviation of Gaussian in the y direction

  • center_x – x position of the center of the lens

  • center_y – y position of the center of the lens

jaxtronomy.LensModel.Profiles.hernquist module

class Hernquist(*args, **kwargs)[source]

Bases: LensProfileBase

Class to compute the Hernquist 1990 model, which is in 3d: rho(r) = rho0 / (r/Rs * (1 + (r/Rs))**3)

in lensing terms, the normalization parameter ‘sigma0’ is defined such that the deflection at projected RS leads to alpha = 2./3 * Rs * sigma0

Examples for converting angular to physical mass units

>>> from lenstronomy.Cosmo.lens_cosmo import LensCosmo
>>> from astropy.cosmology import FlatLambdaCDM
>>> cosmo = FlatLambdaCDM(H0=70, Om0=0.3, Ob0=0.05)
>>> lens_cosmo = LensCosmo(z_lens=0.5, z_source=1.5, cosmo=cosmo)

Here we compute the angular scale of Rs on the sky (in arc seconds) and the deflection the normalization sigma0 from the total stellar mass in M_sol and Rs in [Mpc]:

>>> sigma0, rs_angle = lens_cosmo.hernquist_phys2angular(mass=10**11, rs=0.02)

And here we perform the inverse calculation given Rs_angle and alpha_Rs to return the physical halo properties.

>>> m_tot, rs = lens_cosmo.hernquist_angular2phys(sigma0=sigma0 rs_angle=rs_angle)

The lens model calculation uses angular units as arguments! So to execute a deflection angle calculation one uses

>>> from jaxtronomy.LensModel.Profiles.hernquist import Hernquist
>>> hernquist = Hernquist()
>>> alpha_x, alpha_y = hernquist.derivatives(x=1, y=1, Rs=rs_angle, sigma0=sigma0, center_x=0, center_y=0)
param_names = ['sigma0', 'Rs', 'center_x', 'center_y']
lower_limit_default = {'Rs': 0, 'center_x': -100, 'center_y': -100, 'sigma0': 0}
upper_limit_default = {'Rs': 100, 'center_x': 100, 'center_y': 100, 'sigma0': 100}
static density(r, rho0, Rs)[source]

Computes the 3-d density.

Parameters:
  • r – 3-d radius

  • rho0 – density normalization

  • Rs – Hernquist radius

Returns:

density at radius r

static density_lens(r, sigma0, Rs)[source]

Density as a function of 3d radius in lensing parameters This function converts the lensing definition sigma0 into the 3d density.

Parameters:
  • r – 3d radius

  • sigma0 – rho0 * Rs (units of projected density)

  • Rs – Hernquist radius

Returns:

enclosed mass in 3d

static density_2d(x, y, rho0, Rs, center_x=0, center_y=0)[source]

Projected density along the line of sight at coordinate (x, y)

Parameters:
  • x – x-coordinate

  • y – y-coordinate

  • rho0 – density normalization

  • Rs – Hernquist radius

  • center_x – x-center of the profile

  • center_y – y-center of the profile

Returns:

projected density

static mass_3d(r, rho0, Rs)[source]

Mass enclosed a 3d sphere or radius r.

Parameters:
  • r – 3-d radius within the mass is integrated (same distance units as density definition)

  • rho0 – density normalization

  • Rs – Hernquist radius

Returns:

enclosed mass

static mass_3d_lens(r, sigma0, Rs)[source]

Mass enclosed a 3d sphere or radius r for lens parameterisation This function converts the lensing definition sigma0 into the 3d density.

Parameters:
  • r – radius

  • sigma0 – rho0 * Rs (units of projected density)

  • Rs – Hernquist radius

Returns:

enclosed mass in 3d

static mass_2d(r, rho0, Rs)[source]

Mass enclosed projected 2d sphere of radius r.

Parameters:
  • r – projected radius

  • rho0 – density normalization

  • Rs – Hernquist radius

Returns:

mass enclosed 2d projected radius

static mass_2d_lens(r, sigma0, Rs)[source]

Mass enclosed projected 2d sphere of radius r Same as mass_2d but with ijnput normalization in units of projected density.

Parameters:
  • r – projected radius

  • sigma0 – rho0 * Rs (units of projected density)

  • Rs – Hernquist radius

Returns:

mass enclosed 2d projected radius

static mass_tot(rho0, Rs)[source]

Total mass within the profile.

Parameters:
  • rho0 – density normalization

  • Rs – Hernquist radius

Returns:

total mass within profile

static function(x, y, sigma0, Rs, center_x=0, center_y=0)[source]

Lensing potential.

Parameters:
  • x – x-coordinate position (units of angle)

  • y – y-coordinate position (units of angle)

  • sigma0 – normalization parameter defined such that the deflection at projected RS leads to alpha = 2./3 * Rs * sigma0

  • Rs – Hernquist radius in units of angle

  • center_x – x-center of the profile (units of angle)

  • center_y – y-center of the profile (units of angle)

Returns:

lensing potential at (x,y)

static derivatives(x, y, sigma0, Rs, center_x=0, center_y=0)[source]
Parameters:
  • x – x-coordinate position (units of angle)

  • y – y-coordinate position (units of angle)

  • sigma0 – normalization parameter defined such that the deflection at projected RS leads to alpha = 2./3 * Rs * sigma0

  • Rs – Hernquist radius in units of angle

  • center_x – x-center of the profile (units of angle)

  • center_y – y-center of the profile (units of angle)

Returns:

derivative of function (deflection angles in x- and y-direction)

static hessian(x, y, sigma0, Rs, center_x=0, center_y=0)[source]

Hessian terms of the function.

Parameters:
  • x – x-coordinate position (units of angle)

  • y – y-coordinate position (units of angle)

  • sigma0 – normalization parameter defined such that the deflection at projected RS leads to alpha = 2./3 * Rs * sigma0

  • Rs – Hernquist radius in units of angle

  • center_x – x-center of the profile (units of angle)

  • center_y – y-center of the profile (units of angle)

Returns:

df/dxdx, df/dxdy, df/dydx, df/dydy

static rho2sigma(rho0, Rs)[source]

Converts 3d density into 2d projected density parameter.

Parameters:
  • rho0 – 3d density normalization of Hernquist model

  • Rs – Hernquist radius

Returns:

sigma0 defined quantity in projected units

static sigma2rho(sigma0, Rs)[source]

Converts projected density parameter (in units of deflection) into 3d density parameter.

Parameters:
  • sigma0 – density defined quantity in projected units

  • Rs – Hernquist radius

Returns:

rho0 the 3d density normalization of Hernquist model

static grav_pot(x, y, rho0, Rs, center_x=0, center_y=0)[source]

#TODO decide whether these functions are needed or not

gravitational potential (modulo 4 pi G and rho0 in appropriate units) :param x: x-coordinate position (units of angle) :param y: y-coordinate position (units of angle) :param rho0: density normalization parameter of Hernquist profile :param Rs: Hernquist radius in units of angle :param center_x: x-center of the profile (units of angle) :param center_y: y-center of the profile (units of angle) :return: gravitational potential at projected radius

jaxtronomy.LensModel.Profiles.hernquist_ellipse_cse module

class HernquistEllipseCSE[source]

Bases: LensProfileBase

This class contains functions for the elliptical Hernquist profile.

Ellipticity is defined in the convergence. Approximation with CSE profile introduced by Oguri 2021: https://arxiv.org/pdf/2106.11464.pdf

param_names = ['sigma0', 'Rs', 'e1', 'e2', 'center_x', 'center_y']
lower_limit_default = {'Rs': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'sigma0': 0}
upper_limit_default = {'Rs': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'sigma0': 100}
__init__()[source]
static function(x, y, sigma0, Rs, e1, e2, center_x=0, center_y=0)[source]

Returns double integral of NFW profile.

static derivatives(x, y, sigma0, Rs, e1, e2, center_x=0, center_y=0)[source]

Returns df/dx and df/dy of the function (integral of NFW)

static hessian(x, y, sigma0, Rs, e1, e2, center_x=0, center_y=0)[source]

Returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2.

static density(r, rho0, Rs, e1=0, e2=0)[source]

Computes the 3-d density.

Parameters:
  • r – 3-d radius

  • rho0 – density normalization

  • Rs – Hernquist radius

Returns:

density at radius r

static density_lens(r, sigma0, Rs, e1=0, e2=0)[source]

Density as a function of 3d radius in lensing parameters This function converts the lensing definition sigma0 into the 3d density.

Parameters:
  • r – 3d radius

  • sigma0 – rho0 * Rs (units of projected density)

  • Rs – Hernquist radius

Returns:

enclosed mass in 3d

static density_2d(x, y, rho0, Rs, e1=0, e2=0, center_x=0, center_y=0)[source]

Projected density along the line of sight at coordinate (x, y)

Parameters:
  • x – x-coordinate

  • y – y-coordinate

  • rho0 – density normalization

  • Rs – Hernquist radius

  • center_x – x-center of the profile

  • center_y – y-center of the profile

Returns:

projected density

static mass_2d_lens(r, sigma0, Rs, e1=0, e2=0)[source]

Mass enclosed projected 2d sphere of radius r Same as mass_2d but with input normalization in units of projected density.

Parameters:
  • r – projected radius

  • sigma0 – rho0 * Rs (units of projected density)

  • Rs – Hernquist radius

Returns:

mass enclosed 2d projected radius

static mass_2d(r, rho0, Rs, e1=0, e2=0)[source]

Mass enclosed projected 2d sphere of radius r.

Parameters:
  • r – projected radius

  • rho0 – density normalization

  • Rs – Hernquist radius

Returns:

mass enclosed 2d projected radius

static mass_3d(r, rho0, Rs, e1=0, e2=0)[source]

Mass enclosed a 3d sphere or radius r.

Parameters:
  • r – 3-d radius within the mass is integrated (same distance units as density definition)

  • rho0 – density normalization

  • Rs – Hernquist radius

Returns:

enclosed mass

static mass_3d_lens(r, sigma0, Rs, e1=0, e2=0)[source]

Mass enclosed a 3d sphere or radius r in lensing parameterization.

Parameters:
  • r – 3-d radius within the mass is integrated (same distance units as density definition)

  • sigma0 – rho0 * Rs (units of projected density)

  • Rs – Hernquist radius

Returns:

enclosed mass

jaxtronomy.LensModel.Profiles.multipole module

class Multipole(*args, **kwargs)[source]

Bases: LensProfileBase

This class contains a CIRCULAR multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf, Equation B12 Only the q=1 case (ie., circular symmetry) makes this definition consistent with interpretation of multipoles as a deformation of the isophotes with an order m symmetry (eg., disky/boxy in the m=4 case).

m : int, multipole order, m>=1 a_m : float, multipole strength phi_m : float, multipole orientation in radian

param_names = ['m', 'a_m', 'phi_m', 'center_x', 'center_y', 'r_E']
lower_limit_default = {'a_m': 0, 'center_x': -100, 'center_y': -100, 'm': 1, 'phi_m': -3.141592653589793, 'r_E': 0}
upper_limit_default = {'a_m': 100, 'center_x': 100, 'center_y': 100, 'm': 100, 'phi_m': 3.141592653589793, 'r_E': 100}
static function(x, y, m, a_m, phi_m, center_x=0, center_y=0, r_E=1)[source]

Lensing potential of multipole contribution (for 1 component with m>=1) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf

Parameters:
  • x – x-coordinate to evaluate function

  • y – y-coordinate to evaluate function

  • m – int, multipole order, m>=1

  • a_m – float, multipole strength

  • phi_m – float, multipole orientation in radian

  • center_x – x-position

  • center_y – y-position

  • r_E – float, normalizing radius (only used for the m=1, Einstein radius by default)

Returns:

lensing potential

static derivatives(x, y, m, a_m, phi_m, center_x=0, center_y=0, r_E=1)[source]

Deflection of a multipole contribution (for 1 component with m>=1) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf Equation B12

Parameters:
  • x – x-coordinate to evaluate function

  • y – y-coordinate to evaluate function

  • m – int, multipole order, m>=1

  • a_m – float, multipole strength

  • phi_m – float, multipole orientation in radian

  • center_x – x-position

  • center_y – y-position

  • r_E – float, normalizing radius (only used for the m=1, Einstein radius by default)

Returns:

deflection angles alpha_x, alpha_y

static hessian(x, y, m, a_m, phi_m, center_x=0, center_y=0, r_E=1)[source]

Hessian of a multipole contribution (for 1 component with m>=1) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf

Parameters:
  • x – x-coordinate to evaluate function

  • y – y-coordinate to evaluate function

  • m – int, multipole order, m>=1

  • a_m – float, multipole strength

  • phi_m – float, multipole orientation in radian

  • center_x – x-position

  • center_y – y-position

  • r_E – float, normalizing radius (not used for Hessian)

Returns:

f_xx, f_xy, f_yx, f_yy

class EllipticalMultipole(*args, **kwargs)[source]

Bases: LensProfileBase

This class contains a multipole contribution that encode deviations from the elliptical isodensity contours of a SIE with any axis ratio q.

This uses the definitions from Paugnat & Gilman (2025): “Elliptical multipoles for gravitational lenses”

m : int, multipole order, (m=1, m=3 or m=4) a_m : float, multipole strength phi_m : float, multipole orientation in radian q : axis ratio of the reference ellipses

param_names = ['m', 'a_m', 'phi_m', 'q', 'center_x', 'center_y', 'r_E']
lower_limit_default = {'a_m': 0, 'center_x': -100, 'center_y': -100, 'm': 1, 'phi_m': -3.141592653589793, 'q': 0.001, 'r_E': 0}
upper_limit_default = {'a_m': 100, 'center_x': 100, 'center_y': 100, 'm': 100, 'phi_m': 3.141592653589793, 'q': 1, 'r_E': 100}
static function(x, y, m, a_m, phi_m, q, center_x=0, center_y=0, r_E=1)[source]

Lensing potential of multipole contribution (for 1 component with m=1, m=3 or m=4)

Parameters:
  • x – x-coordinate to evaluate function

  • y – y-coordinate to evaluate function

  • m – int, multipole order (m=1, m=3 or m=4)

  • a_m – float, multipole strength

  • phi_m – float, multipole orientation in radian

  • center_x – x-position

  • center_y – y-position

  • r_E – float, normalizing radius (only used for odd m, Einstein radius by default)

Returns:

lensing potential

static derivatives(x, y, m, a_m, phi_m, q, center_x=0, center_y=0, r_E=1)[source]

Deflection of a multipole contribution (for 1 component with m=1, m=3 or m=4)

Parameters:
  • x – x-coordinate to evaluate function

  • y – y-coordinate to evaluate function

  • m – int, multipole order (m=1, m=3 or m=4)

  • a_m – float, multipole strength

  • phi_m – float, multipole orientation in radian

  • center_x – x-position

  • center_y – y-position

  • r_E – float, normalizing radius (only used for odd m, Einstein radius by default)

Returns:

deflection angles alpha_x, alpha_y

static hessian(x, y, m, a_m, phi_m, q, center_x=0, center_y=0, r_E=1)[source]

Hessian of a multipole contribution (for 1 component with m=1, m=3 or m=4)

Parameters:
  • x – x-coordinate to evaluate function

  • y – y-coordinate to evaluate function

  • m – int, multipole order (m=1, m=3 or m=4)

  • a_m – float, multipole strength

  • phi_m – float, multipole orientation in radian

  • center_x – x-position

  • center_y – y-position

  • r_E – float, normalizing radius (not used for Hessian)

Returns:

f_xx, f_xy, f_yx, f_yy

jaxtronomy.LensModel.Profiles.nfw module

class NFW(interpol=False, **kwargs)[source]

Bases: LensProfileBase

This class contains functions concerning the NFW profile.

relation are: R_200 = c * Rs The definition of ‘Rs’ is in angular (arc second) units and the normalization is put in with regard to a deflection angle at ‘Rs’ - ‘alpha_Rs’. To convert a physical mass and concentration definition into those lensing quantities for a specific redshift configuration and cosmological model, you can find routines in lenstronomy.Cosmo.lens_cosmo.py

Examples for converting angular to physical mass units

>>> from lenstronomy.Cosmo.lens_cosmo import LensCosmo
>>> from astropy.cosmology import FlatLambdaCDM
>>> cosmo = FlatLambdaCDM(H0=70, Om0=0.3, Ob0=0.05)
>>> lens_cosmo = LensCosmo(z_lens=0.5, z_source=1.5, cosmo=cosmo)

Here we compute the angular scale of Rs on the sky (in arc seconds) and the deflection angle at Rs (in arc seconds):

>>> Rs_angle, alpha_Rs = lens_cosmo.nfw_physical2angle(M=10**13, c=6)

And here we perform the inverse calculation given Rs_angle and alpha_Rs to return the physical halo properties.

>>> rho0, Rs, c, r200, M200 = lens_cosmo.nfw_angle2physical(Rs_angle=Rs_angle, alpha_Rs=alpha_Rs)

The lens model calculation uses angular units as arguments! So to execute a deflection angle calculation one uses

>>> from lenstronomy.LensModel.Profiles.nfw import NFW
>>> nfw = NFW()
>>> alpha_x, alpha_y = nfw.derivatives(x=1, y=1, Rs=Rs_angle, alpha_Rs=alpha_Rs, center_x=0, center_y=0)
profile_name = 'NFW'
param_names = ['Rs', 'alpha_Rs', 'center_x', 'center_y']
lower_limit_default = {'Rs': 0, 'alpha_Rs': 0, 'center_x': -100, 'center_y': -100}
upper_limit_default = {'Rs': 100, 'alpha_Rs': 10, 'center_x': 100, 'center_y': 100}
__init__(interpol=False, **kwargs)[source]
Parameters:
  • interpol – bool, if True, interpolates the functions F(), g() and h()

  • num_interp_X – int (only considered if interpol=True), number of interpolation elements in units of r/r_s

  • max_interp_X – float (only considered if interpol=True), maximum r/r_s value to be interpolated (returning zeros outside)

static function(x, y, Rs, alpha_Rs, center_x=0, center_y=0)[source]
Parameters:
  • x – angular position (normally in units of arc seconds)

  • y – angular position (normally in units of arc seconds)

  • Rs – turn over point in the slope of the NFW profile in angular unit

  • alpha_Rs – deflection (angular units) at projected Rs

  • center_x – center of halo (in angular units)

  • center_y – center of halo (in angular units)

Returns:

lensing potential

static derivatives(x, y, Rs, alpha_Rs, center_x=0, center_y=0)[source]

Returns df/dx and df/dy of the function (integral of NFW), which are the deflection angles.

Parameters:
  • x – angular position (normally in units of arc seconds)

  • y – angular position (normally in units of arc seconds)

  • Rs – turn over point in the slope of the NFW profile in angular unit

  • alpha_Rs – deflection (angular units) at projected Rs

  • center_x – center of halo (in angular units)

  • center_y – center of halo (in angular units)

Returns:

deflection angle in x, deflection angle in y

static hessian(x, y, Rs, alpha_Rs, center_x=0, center_y=0)[source]
Parameters:
  • x – angular position (normally in units of arc seconds)

  • y – angular position (normally in units of arc seconds)

  • Rs – turn over point in the slope of the NFW profile in angular unit

  • alpha_Rs – deflection (angular units) at projected Rs

  • center_x – center of halo (in angular units)

  • center_y – center of halo (in angular units)

Returns:

Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

static density(R, Rs, rho0)[source]

Three-dimensional NFW profile.

Parameters:
  • R (float/numpy array) – radius of interest

  • Rs (float) – scale radius

  • rho0 (float) – density normalization (characteristic density)

Returns:

rho(R) density

static density_lens(r, Rs, alpha_Rs)[source]

Computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

Parameters:
  • r – 3d radios

  • Rs – turn-over radius of NFW profile

  • alpha_Rs – deflection at Rs

Returns:

density rho(r)

static density_2d(x, y, Rs, rho0, center_x=0, center_y=0)[source]

Projected two-dimensional NFW profile (kappa)

Parameters:
  • x – x-coordinate

  • y – y-coordinate

  • Rs (float) – scale radius

  • rho0 (float) – density normalization (characteristic density)

  • center_x – x-centroid position

  • center_y – y-centroid position

Returns:

Epsilon(R) projected density at radius R

static mass_3d(r, Rs, rho0)[source]

Mass enclosed a 3d sphere of radius r.

Parameters:
  • r – 3d radius

  • Rs – scale radius

  • rho0 – density normalization (characteristic density)

Returns:

M(<r)

static mass_3d_lens(r, Rs, alpha_Rs)[source]

Mass enclosed a 3d sphere of radius r. This function takes as input the lensing parameterization.

Parameters:
  • r – 3d radius

  • Rs – scale radius

  • alpha_Rs – deflection (angular units) at projected Rs

Returns:

M(<r)

static mass_2d(R, Rs, rho0)[source]

Mass enclosed a 2d cylinder of projected radius R.

Parameters:
  • R – projected radius

  • Rs – scale radius

  • rho0 – density normalization (characteristic density)

Returns:

mass in cylinder.

static mass_2d_lens(R, Rs, alpha_Rs)[source]
Parameters:
  • R – projected radius

  • Rs – scale radius

  • alpha_Rs – deflection (angular units) at projected Rs

Returns:

mass enclosed 2d cylinder <R

static nfw_potential(R, Rs, rho0)[source]

Lensing potential of NFW profile (Sigma_crit D_OL**2)

Parameters:
  • R (float/numpy array) – radius of interest

  • Rs (float) – scale radius

  • rho0 (float) – density normalization (characteristic density)

Returns:

Epsilon(R) projected density at radius R

static nfw_alpha(R, Rs, rho0, ax_x, ax_y)[source]

Deflection angle of NFW profile (times Sigma_crit D_OL) along the projection to coordinate ‘axis’.

Parameters:
  • R (float/numpy array) – radius of interest

  • Rs (float) – scale radius

  • rho0 (float) – density normalization (characteristic density)

  • ax_x (same as R) – projection to either x- or y-axis

  • ax_y (same as R) – projection to either x- or y-axis

Returns:

Epsilon(R) projected density at radius R

static nfw_gamma(R, Rs, rho0, ax_x, ax_y)[source]

Shear gamma of NFW profile (times Sigma_crit) along the projection to coordinate ‘axis’.

Parameters:
  • R (float/numpy array) – radius of interest

  • Rs (float) – scale radius

  • rho0 (float) – density normalization (characteristic density)

  • ax_x (same as R) – projection to either x- or y-axis

  • ax_y (same as R) – projection to either x- or y-axis

Returns:

Epsilon(R) projected density at radius R

static F(X)[source]

Analytic solution of the projection integral.

Parameters:

X (float >0) – R/Rs

static g(X)[source]

Analytic solution of integral for NFW profile to compute deflection angle and gamma.

Parameters:

X (float >0) – R/Rs

static h(X)[source]

Analytic solution of integral for NFW profile to compute the potential.

Parameters:

X (float >0) – R/Rs

static alpha2rho0(alpha_Rs, Rs)[source]

Convert angle at Rs into rho0.

Parameters:
  • alpha_Rs – deflection angle at RS

  • Rs – scale radius

Returns:

density normalization (characteristic density)

static rho02alpha(rho0, Rs)[source]

Convert rho0 to angle at Rs.

Parameters:
  • rho0 – density normalization (characteristic density)

  • Rs – scale radius

Returns:

deflection angle at RS

jaxtronomy.LensModel.Profiles.nfw_ellipse_cse module

class NFW_ELLIPSE_CSE(high_accuracy=True)[source]

Bases: LensProfileBase

this class contains functions concerning the NFW profile with an ellipticity defined in the convergence parameterization of alpha_Rs and Rs is the same as for the spherical NFW profile Approximation with CSE profile introduced by Oguri 2021: https://arxiv.org/pdf/2106.11464.pdf Match to NFW using CSEs is approximate: kappa matches to ~1-2%

relation are: R_200 = c * Rs

profile_name = 'NFW_ELLIPSE_CSE'
param_names = ['Rs', 'alpha_Rs', 'e1', 'e2', 'center_x', 'center_y']
lower_limit_default = {'Rs': 0, 'alpha_Rs': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5}
upper_limit_default = {'Rs': 100, 'alpha_Rs': 10, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5}
__init__(high_accuracy=True)[source]
Parameters:

high_accuracy (boolean) – if True uses a more accurate larger set of CSE profiles (see Oguri 2021)

function(x, y, Rs, alpha_Rs, e1, e2, center_x=0, center_y=0)[source]

Returns elliptically distorted NFW lensing potential.

Parameters:
  • x – angular position (normally in units of arc seconds)

  • y – angular position (normally in units of arc seconds)

  • Rs – turn over point in the slope of the NFW profile in angular unit

  • alpha_Rs – deflection (angular units) at projected Rs

  • e1 – eccentricity component in x-direction

  • e2 – eccentricity component in y-direction

  • center_x – center of halo (in angular units)

  • center_y – center of halo (in angular units)

Returns:

lensing potential

derivatives(x, y, Rs, alpha_Rs, e1, e2, center_x=0, center_y=0)[source]

Returns df/dx and df/dy of the function, calculated as an elliptically distorted deflection angle of the spherical NFW profile.

Parameters:
  • x – angular position (normally in units of arc seconds)

  • y – angular position (normally in units of arc seconds)

  • Rs – turn over point in the slope of the NFW profile in angular unit

  • alpha_Rs – deflection (angular units) at projected Rs

  • e1 – eccentricity component in x-direction

  • e2 – eccentricity component in y-direction

  • center_x – center of halo (in angular units)

  • center_y – center of halo (in angular units)

Returns:

deflection in x-direction, deflection in y-direction

hessian(x, y, Rs, alpha_Rs, e1, e2, center_x=0, center_y=0)[source]

Returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy the calculation is performed as a numerical differential from the deflection field. Analytical relations are possible.

Parameters:
  • x – angular position (normally in units of arc seconds)

  • y – angular position (normally in units of arc seconds)

  • Rs – turn over point in the slope of the NFW profile in angular unit

  • alpha_Rs – deflection (angular units) at projected Rs

  • e1 – eccentricity component in x-direction

  • e2 – eccentricity component in y-direction

  • center_x – center of halo (in angular units)

  • center_y – center of halo (in angular units)

Returns:

d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

mass_3d_lens(r, Rs, alpha_Rs, e1=1, e2=0)[source]
Parameters:
  • r – radius (in angular units)

  • Rs

  • alpha_Rs

  • e1

  • e2

Returns:

jaxtronomy.LensModel.Profiles.nie module

class NIE(b=0, s=0, q=0, phi=0, static=False)[source]

Bases: LensProfileBase

Non-singular isothermal ellipsoid (NIE)

\[\kappa = \theta_E/2 \left[s^2_{scale} + qx^2 + y^2/q]−1/2\]
param_names = ['theta_E', 'e1', 'e2', 's_scale', 'center_x', 'center_y']
lower_limit_default = {'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 's_scale': 0, 'theta_E': 0}
upper_limit_default = {'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 's_scale': 100, 'theta_E': 10}
__init__(b=0, s=0, q=0, phi=0, static=False)[source]
function(x, y, theta_E, e1, e2, s_scale, center_x=0, center_y=0)[source]
Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • e1 – eccentricity component

  • e2 – eccentricity component

  • s_scale – smoothing scale

  • center_x – profile center

  • center_y – profile center

Returns:

lensing potential

derivatives(x, y, theta_E, e1, e2, s_scale, center_x=0, center_y=0)[source]
Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • e1 – eccentricity component

  • e2 – eccentricity component

  • s_scale – smoothing scale

  • center_x – profile center

  • center_y – profile center

Returns:

alpha_x, alpha_y

hessian(x, y, theta_E, e1, e2, s_scale, center_x=0, center_y=0)[source]
Parameters:
  • x – x-coordinate in image plane

  • y – y-coordinate in image plane

  • theta_E – Einstein radius

  • e1 – eccentricity component

  • e2 – eccentricity component

  • s_scale – smoothing scale

  • center_x – profile center

  • center_y – profile center

Returns:

f_xx, f_xy, f_yx, f_yy

density_lens(r, theta_E, e1, e2, s_scale, center_x=0, center_y=0)[source]

3d mass density at 3d radius r. This function assumes spherical symmetry/ignoring the eccentricity.

Parameters:
  • r – 3d radius

  • theta_E – Einstein radius

  • e1 – eccentricity component

  • e2 – eccentricity component

  • s_scale – smoothing scale

  • center_x – profile center

  • center_y – profile center

Returns:

3d mass density at 3d radius r

mass_3d_lens(r, theta_E, e1, e2, s_scale, center_x=0, center_y=0)[source]

Mass enclosed a 3d radius r. This function assumes spherical symmetry/ignoring the eccentricity.

Parameters:
  • r – 3d radius

  • theta_E – Einstein radius

  • e1 – eccentricity component

  • e2 – eccentricity component

  • s_scale – smoothing scale

  • center_x – profile center

  • center_y – profile center

Returns:

3d mass density at 3d radius r

param_conv(theta_E, e1, e2, s_scale)[source]
set_static(theta_E, e1, e2, s_scale, center_x=0, center_y=0)[source]
Parameters:
  • theta_E – Einstein radius

  • e1 – eccentricity component

  • e2 – eccentricity component

  • s_scale – smoothing scale

  • center_x – profile center

  • center_y – profile center

Returns:

self variables set

set_dynamic()[source]
Returns:

class NIEMajorAxis[source]

Bases: LensProfileBase

This class contains the function and the derivatives of the non-singular isothermal ellipse. See Keeton and Kochanek 1998, https://arxiv.org/pdf/astro-ph/9705194.pdf

\[\kappa = b * (q2(s2 + x2) + y2􏰉)^{−1/2}`\]
param_names = ['b', 's', 'q', 'center_x', 'center_y']
__init__()[source]
static function(x, y, b, s, q)[source]
static derivatives(x, y, b, s, q)[source]

Returns df/dx and df/dy of the function.

static hessian(x, y, b, s, q)[source]

Returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2.

static kappa(x, y, b, s, q)[source]

convergence.

Parameters:
  • x – major axis coordinate

  • y – minor axis coordinate

  • b – normalization

  • s – smoothing scale

  • q – axis ratio

Returns:

convergence

jaxtronomy.LensModel.Profiles.pseudo_jaffe module

class PseudoJaffe(*args, **kwargs)[source]

Bases: LensProfileBase

class to compute the DUAL PSEUDO ISOTHERMAL MASS DISTRIBUTION based on Eliasdottir (2007) https://arxiv.org/pdf/0710.5636.pdf Appendix A

Module name: ‘PJAFFE’;

An alternative name is dPIED (in the elliptical scenario)

This profile is for the spherical case. For an elliptical version, use “PJAFFE_ELLIPSE” (ellipticitly in the potential) # TODO: add/revise name once ellipticity in the mass is available

The 3D density distribution is

\[\rho(r) = \frac{\rho_0}{(1+r^2/Ra^2)(1+r^2/Rs^2)}\]

with \(Rs > Ra\).

The projected density is

\[\Sigma(R) = \Sigma_0 \frac{Ra Rs}{Rs-Ra}\left(\frac{1}{\sqrt{Ra^2+R^2}} - \frac{1}{\sqrt{Rs^2+R^2}} \right)\]

with

\[\Sigma_0 = \pi \rho_0 \frac{Ra Rs}{Rs + Ra}\]

In the lensing parameterization,

\[\sigma_0 = \frac{\Sigma_0}{\Sigma_{\rm crit}}\]
param_names = ['sigma0', 'Ra', 'Rs', 'center_x', 'center_y']
lower_limit_default = {'Ra': 0, 'Rs': 0, 'center_x': -100, 'center_y': -100, 'sigma0': 0}
upper_limit_default = {'Ra': 100, 'Rs': 100, 'center_x': 100, 'center_y': 100, 'sigma0': 10}
static density(r, rho0, Ra, Rs)[source]

Computes the density.

Parameters:
  • r – radial distance from the center (in 3D)

  • rho0 – density normalization (see class documentation above)

  • Ra – core radius

  • Rs – transition radius from logarithmic slope -2 to -4

Returns:

density at r

static density_2d(x, y, rho0, Ra, Rs, center_x=0, center_y=0)[source]

Projected density.

Parameters:
  • x – projected coordinate on the sky

  • y – projected coordinate on the sky

  • rho0 – density normalization (see class documentation above)

  • Ra – core radius

  • Rs – transition radius from logarithmic slope -2 to -4

  • center_x – center of profile

  • center_y – center of profile

Returns:

projected density

static mass_3d(r, rho0, Ra, Rs)[source]

Mass enclosed a 3d sphere or radius r.

Parameters:
  • r – radial distance from the center (in 3D)

  • rho0 – density normalization (see class documentation above)

  • Ra – core radius

  • Rs – transition radius from logarithmic slope -2 to -4

Returns:

M(<r)

static mass_3d_lens(r, sigma0, Ra, Rs)[source]

Mass enclosed a 3d sphere or radius r given a lens parameterization with angular units.

Parameters:
  • r – radial distance from the center (in 3D)

  • sigma0 – density normalization (see class documentation above)

  • Ra – core radius

  • Rs – transition radius from logarithmic slope -2 to -4

Returns:

M(<r) in angular units (modulo critical mass density)

static mass_2d(r, rho0, Ra, Rs)[source]

Mass enclosed projected 2d sphere of radius r.

Parameters:
  • r – radial distance from the center in projection

  • rho0 – density normalization (see class documentation above)

  • Ra – core radius

  • Rs – transition radius from logarithmic slope -2 to -4

Returns:

Sigma(<r)

static mass_tot(rho0, Ra, Rs)[source]

Total mass within the profile.

Parameters:
  • rho0 – density normalization (see class documentation above)

  • Ra – core radius

  • Rs – transition radius from logarithmic slope -2 to -4

Returns:

total mass

static grav_pot(r, rho0, Ra, Rs)[source]

Gravitational potential (modulo 4 pi G and rho0 in appropriate units)

Parameters:
  • r – radial distance from the center (in 3D)

  • rho0 – density normalization (see class documentation above)

  • Ra – core radius

  • Rs – transition radius from logarithmic slope -2 to -4

Returns:

gravitational potential (modulo 4 pi G and rho0 in appropriate units)

static function(x, y, sigma0, Ra, Rs, center_x=0, center_y=0)[source]

Lensing potential.

Parameters:
  • x – projected coordinate on the sky

  • y – projected coordinate on the sky

  • sigma0 – sigma0/sigma_crit (see class documentation above)

  • Ra – core radius (see class documentation above)

  • Rs – transition radius from logarithmic slope -2 to -4 (see class documentation above)

  • center_x – center of profile

  • center_y – center of profile

Returns:

lensing potential

static derivatives(x, y, sigma0, Ra, Rs, center_x=0, center_y=0)[source]

Deflection angles.

Parameters:
  • x – projected coordinate on the sky

  • y – projected coordinate on the sky

  • sigma0 – sigma0/sigma_crit (see class documentation above)

  • Ra – core radius (see class documentation above)

  • Rs – transition radius from logarithmic slope -2 to -4 (see class documentation above)

  • center_x – center of profile

  • center_y – center of profile

Returns:

f_x, f_y

static hessian(x, y, sigma0, Ra, Rs, center_x=0, center_y=0)[source]

Hessian of lensing potential.

Parameters:
  • x – projected coordinate on the sky

  • y – projected coordinate on the sky

  • sigma0 – sigma0/sigma_crit (see class documentation above)

  • Ra – core radius (see class documentation above)

  • Rs – transition radius from logarithmic slope -2 to -4 (see class documentation above)

  • center_x – center of profile

  • center_y – center of profile

Returns:

f_xx, f_xy, f_yx, f_yy

static rho2sigma(rho0, Ra, Rs)[source]

Converts 3d density into 2d projected density parameter, Equation A4 in Eliasdottir (2007)

Parameters:
  • rho0 – density normalization

  • Ra – core radius (see class documentation above)

  • Rs – transition radius from logarithmic slope -2 to -4 (see class documentation above)

Returns:

projected density normalization

static sigma2rho(sigma0, Ra, Rs)[source]

Inverse of rho2sigma()

Parameters:
  • sigma0 – projected density normalization

  • Ra – core radius (see class documentation above)

  • Rs – transition radius from logarithmic slope -2 to -4 (see class documentation above)

Returns:

3D density normalization

jaxtronomy.LensModel.Profiles.pseudo_jaffe_ellipse_potential module

class PseudoJaffeEllipsePotential(*args, **kwargs)[source]

Bases: LensProfileBase

class to compute the DUAL PSEUDO ISOTHERMAL ELLIPTICAL MASS DISTRIBUTION based on Eliasdottir (2007) https://arxiv.org/pdf/0710.5636.pdf Appendix A with the ellipticity implemented in the potential

Module name: ‘PJAFFE_ELLIPSE’;

An alternative name is dPIED.

The 3D density distribution is

\[\rho(r) = \frac{\rho_0}{(1+r^2/Ra^2)(1+r^2/Rs^2)}\]

with \(Rs > Ra\).

The projected density is

\[\Sigma(R) = \Sigma_0 \frac{Ra Rs}{Rs-Ra}\left(\frac{1}{\sqrt{Ra^2+R^2}} - \frac{1}{\sqrt{Rs^2+R^2}} \right)\]

with

\[\Sigma_0 = \pi \rho_0 \frac{Ra Rs}{Rs + Ra}\]

In the lensing parameterization,

\[\sigma_0 = \frac{\Sigma_0}{\Sigma_{\rm crit}}\]
param_names = ['sigma0', 'Ra', 'Rs', 'e1', 'e2', 'center_x', 'center_y']
lower_limit_default = {'Ra': 0, 'Rs': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'sigma0': 0}
upper_limit_default = {'Ra': 100, 'Rs': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'sigma0': 10}
spherical = <jaxtronomy.LensModel.Profiles.pseudo_jaffe.PseudoJaffe object>
static function(x, y, sigma0, Ra, Rs, e1, e2, center_x=0, center_y=0)[source]

Returns double integral of NFW profile.

static derivatives(x, y, sigma0, Ra, Rs, e1, e2, center_x=0, center_y=0)[source]

Returns df/dx and df/dy of the function (integral of NFW)

static hessian(x, y, sigma0, Ra, Rs, e1, e2, center_x=0, center_y=0)[source]

Returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2.

static mass_3d_lens(r, sigma0, Ra, Rs, e1=0, e2=0)[source]
Parameters:
  • r

  • sigma0

  • Ra

  • Rs

  • e1

  • e2

Returns:

jaxtronomy.LensModel.Profiles.sersic_utils module

class SersicUtil(smoothing=0.0001, sersic_major_axis=False)[source]

Bases: object

__init__(smoothing=0.0001, sersic_major_axis=False)[source]
Parameters:
  • smoothing – smoothing scale of the innermost part of the profile (for numerical reasons)

  • sersic_major_axis – boolean; if True, defines the half-light radius of the Sersic light profile along the semi-major axis (which is the Galfit convention) if False, uses the product average of semi-major and semi-minor axis as the convention (default definition for all light profiles in lenstronomy other than the Sersic profile)

k_bn(n, Re)[source]

Returns normalisation of the sersic profile such that Re is the half light radius given n_sersic slope.

Parameters:
  • n – Sersic index

  • Re – the desired half light radius

k_Re(n, k)[source]

Returns the half light radius given the n_sersic slope and normalization of the sersic profile.

Parameters:
  • n – Sersic index

  • k – normalization of the sersic profile

static b_n(n)[source]

B(n) computation. This is the approximation of the exact solution to the relation, 2*incomplete_gamma_function(2n; b_n) = Gamma_function(2*n).

Parameters:

n – the sersic index

Returns:

b(n)

get_distance_from_center(x, y, e1, e2, center_x, center_y)[source]

Get the distance from the center of Sersic, accounting for orientation and axis ratio.

Parameters:
  • x – position

  • y – position

  • e1 – eccentricity

  • e2 – eccentricity

  • center_x – center x of sersic

  • center_y – center y of sersic

Returns:

distance from center of Sersic

alpha_abs(x, y, n_sersic, r_eff, k_eff, center_x=0, center_y=0)[source]

Returns the absolute value of the deflection angle.

Parameters:
  • x – position

  • y – position

  • n_sersic – Sersic index

  • r_eff – projected half light radius

  • k_eff – convergence at half light radius

  • center_x – position of the center of the source

  • center_y – position of the center of the source

Returns:

absolute value of deflection angle

d_alpha_dr(x, y, n_sersic, r_eff, k_eff, center_x=0, center_y=0)[source]

Returns the derivative of the deflection angle w.r.t radius.

Parameters:
  • x – position

  • y – position

  • n_sersic – Sersic index

  • r_eff – projected half light radius

  • k_eff – convergence at half light radius

  • center_x – position of the center of the source

  • center_y – position of the center of the source

Returns:

derivative of deflection angle w.r.t radius

density(x, y, n_sersic, r_eff, k_eff, center_x=0, center_y=0)[source]

De-projection of the Sersic profile based on Prugniel & Simien (1997) :return:

total_flux(amp, R_sersic, n_sersic, e1=0, e2=0, **kwargs)[source]

Computes analytical integral to compute total flux of the Sersic profile.

Parameters:
  • amp – amplitude parameter in Sersic function (surface brightness at R_sersic

  • R_sersic – half-light radius in semi-major axis

  • n_sersic – Sersic index

  • e1 – eccentricity

  • e2 – eccentricity

Returns:

Analytic integral of the total flux of the Sersic profile

jaxtronomy.LensModel.Profiles.shear module

class Shear(*args, **kwargs)[source]

Bases: LensProfileBase

Class for external shear gamma1, gamma2 expression.

param_names = ['gamma1', 'gamma2', 'ra_0', 'dec_0']
lower_limit_default = {'dec_0': -100, 'gamma1': -0.5, 'gamma2': -0.5, 'ra_0': -100}
upper_limit_default = {'dec_0': 100, 'gamma1': 0.5, 'gamma2': 0.5, 'ra_0': 100}
static function(x, y, gamma1, gamma2, ra_0=0, dec_0=0)[source]
Parameters:
  • x – x-coordinate (angle)

  • y – y0-coordinate (angle)

  • gamma1 – shear component

  • gamma2 – shear component

  • ra_0 – x/ra position where shear deflection is 0

  • dec_0 – y/dec position where shear deflection is 0

Returns:

lensing potential

static derivatives(x, y, gamma1, gamma2, ra_0=0, dec_0=0)[source]
Parameters:
  • x – x-coordinate (angle)

  • y – y0-coordinate (angle)

  • gamma1 – shear component

  • gamma2 – shear component

  • ra_0 – x/ra position where shear deflection is 0

  • dec_0 – y/dec position where shear deflection is 0

Returns:

deflection angles

static hessian(x, y, gamma1, gamma2, ra_0=0, dec_0=0)[source]
Parameters:
  • x – x-coordinate (angle)

  • y – y0-coordinate (angle)

  • gamma1 – shear component

  • gamma2 – shear component

  • ra_0 – x/ra position where shear deflection is 0

  • dec_0 – y/dec position where shear deflection is 0

Returns:

f_xx, f_xy, f_yx, f_yy

class ShearGammaPsi[source]

Bases: LensProfileBase

class to model a shear field with shear strength and direction. The translation ot the cartesian shear distortions is as follow:

\[\gamma_1 = \gamma_{ext} \cos(2 \phi_{ext}) \gamma_2 = \gamma_{ext} \sin(2 \phi_{ext})\]
param_names = ['gamma_ext', 'psi_ext', 'ra_0', 'dec_0']
lower_limit_default = {'dec_0': -100, 'gamma_ext': 0, 'psi_ext': -3.141592653589793, 'ra_0': -100}
upper_limit_default = {'dec_0': 100, 'gamma_ext': 1, 'psi_ext': 3.141592653589793, 'ra_0': 100}
__init__()[source]
static function(x, y, gamma_ext, psi_ext, ra_0=0, dec_0=0)[source]
Parameters:
  • x – x-coordinate (angle)

  • y – y0-coordinate (angle)

  • gamma_ext – shear strength

  • psi_ext – shear angle (radian)

  • ra_0 – x/ra position where shear deflection is 0

  • dec_0 – y/dec position where shear deflection is 0

Returns:

static derivatives(x, y, gamma_ext, psi_ext, ra_0=0, dec_0=0)[source]
static hessian(x, y, gamma_ext, psi_ext, ra_0=0, dec_0=0)[source]
class ShearReduced[source]

Bases: LensProfileBase

Reduced shear distortions \(\gamma' = \gamma / (1-\kappa)\). This distortion keeps the magnification as unity and, thus, does not change the size of apparent objects. To keep the magnification at unity, it requires.

\[(1-\kappa)^2) - \gamma_1^2 - \gamma_2^ = 1\]

Thus, for given pair of reduced shear \((\gamma'_1, \gamma'_2)\), an additional convergence term is calculated and added to the lensing distortions.

param_names = ['gamma1', 'gamma2', 'ra_0', 'dec_0']
lower_limit_default = {'dec_0': -100, 'gamma1': -0.5, 'gamma2': -0.5, 'ra_0': -100}
upper_limit_default = {'dec_0': 100, 'gamma1': 0.5, 'gamma2': 0.5, 'ra_0': 100}
__init__()[source]
static kappa_reduced(gamma1, gamma2)[source]

Compute convergence such that magnification is unity.

Parameters:
  • gamma1 – reduced shear

  • gamma2 – reduced shear

Returns:

kappa

static function(x, y, gamma1, gamma2, ra_0=0, dec_0=0)[source]
Parameters:
  • x – x-coordinate (angle)

  • y – y0-coordinate (angle)

  • gamma1 – shear component

  • gamma2 – shear component

  • ra_0 – x/ra position where shear deflection is 0

  • dec_0 – y/dec position where shear deflection is 0

Returns:

lensing potential

static derivatives(x, y, gamma1, gamma2, ra_0=0, dec_0=0)[source]
Parameters:
  • x – x-coordinate (angle)

  • y – y0-coordinate (angle)

  • gamma1 – shear component

  • gamma2 – shear component

  • ra_0 – x/ra position where shear deflection is 0

  • dec_0 – y/dec position where shear deflection is 0

Returns:

deflection angles

static hessian(x, y, gamma1, gamma2, ra_0=0, dec_0=0)[source]
Parameters:
  • x – x-coordinate (angle)

  • y – y0-coordinate (angle)

  • gamma1 – shear component

  • gamma2 – shear component

  • ra_0 – x/ra position where shear deflection is 0

  • dec_0 – y/dec position where shear deflection is 0

Returns:

f_xx, f_xy, f_yx, f_yy

jaxtronomy.LensModel.Profiles.sie module

class SIE(s_scale=1e-10, gamma=2, NIE=True)[source]

Bases: LensProfileBase

Class for singular isothermal ellipsoid (SIS with ellipticity)

\[\kappa(x, y) = \frac{1}{2} \left(\frac{\theta_{E}}{\sqrt{q x^2 + y^2/q}} \right)\]

with \(\theta_{E}\) is the (circularized) Einstein radius, \(q\) is the minor/major axis ratio, and \(x\) and \(y\) are defined in a coordinate system aligned with the major and minor axis of the lens.

In terms of eccentricities, this profile is defined as

\[\kappa(r) = \frac{1}{2} \left(\frac{\theta'_{E}}{r \sqrt{1 − e*\cos(2*\phi)}} \right)\]

with \(\epsilon\) is the ellipticity defined as

\[\epsilon = \frac{1-q^2}{1+q^2}\]

And an Einstein radius \(\theta'_{\rm E}\) related to the definition used is

\[\left(\frac{\theta'_{\rm E}}{\theta_{\rm E}}\right)^{2} = \frac{2q}{1+q^2}.\]
param_names = ['theta_E', 'e1', 'e2', 'center_x', 'center_y']
lower_limit_default = {'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'theta_E': 0}
upper_limit_default = {'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'theta_E': 100}
__init__(s_scale=1e-10, gamma=2, NIE=True)[source]
Parameters:

NIE – bool, if True, is using the NIE analytic model. Otherwise it uses EPL

function(x, y, theta_E, e1, e2, center_x=0, center_y=0)[source]
Parameters:
  • x – x-coordinate (angular coordinates)

  • y – y-coordinate (angular coordinates)

  • theta_E – Einstein radius

  • e1 – eccentricity

  • e2 – eccentricity

  • center_x – centroid

  • center_y – centroid

Returns:

derivatives(x, y, theta_E, e1, e2, center_x=0, center_y=0)[source]
Parameters:
  • x – x-coordinate (angular coordinates)

  • y – y-coordinate (angular coordinates)

  • theta_E – Einstein radius

  • e1 – eccentricity

  • e2 – eccentricity

  • center_x – centroid

  • center_y – centroid

Returns:

hessian(x, y, theta_E, e1, e2, center_x=0, center_y=0)[source]
Parameters:
  • x – x-coordinate (angular coordinates)

  • y – y-coordinate (angular coordinates)

  • theta_E – Einstein radius

  • e1 – eccentricity

  • e2 – eccentricity

  • center_x – centroid

  • center_y – centroid

Returns:

static theta2rho(theta_E)[source]

Converts projected density parameter (in units of deflection) into 3d density parameter.

Parameters:

theta_E

Returns:

static mass_3d(r, rho0, e1=0, e2=0)[source]

Mass enclosed a 3d sphere or radius r.

Parameters:
  • r – radius in angular units

  • rho0 – density at angle=1

Returns:

mass in angular units

mass_3d_lens(r, theta_E, e1=0, e2=0)[source]

Mass enclosed a 3d sphere or radius r given a lens parameterization with angular units.

Parameters:
  • r – radius in angular units

  • theta_E – Einstein radius

Returns:

mass in angular units

mass_2d(r, rho0, e1=0, e2=0)[source]

Mass enclosed projected 2d sphere of radius r.

Parameters:
  • r

  • rho0

  • e1

  • e2

Returns:

mass_2d_lens(r, theta_E, e1=0, e2=0)[source]
Parameters:
  • r

  • theta_E

  • e1

  • e2

Returns:

grav_pot(x, y, rho0, e1=0, e2=0, center_x=0, center_y=0)[source]

Gravitational potential (modulo 4 pi G and rho0 in appropriate units)

Parameters:
  • x

  • y

  • rho0

  • e1

  • e2

  • center_x

  • center_y

Returns:

density_lens(r, theta_E, e1=0, e2=0)[source]

Computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

Parameters:
  • r – radius in angles

  • theta_E – Einstein radius

  • e1 – eccentricity component

  • e2 – eccentricity component

Returns:

density

static density(r, rho0, e1=0, e2=0)[source]

Computes the density.

Parameters:
  • r – radius in angles

  • rho0 – density at angle=1

Returns:

density at r

static density_2d(x, y, rho0, e1=0, e2=0, center_x=0, center_y=0)[source]

Projected density.

Parameters:
  • x

  • y

  • rho0

  • e1

  • e2

  • center_x

  • center_y

Returns:

jaxtronomy.LensModel.Profiles.sis module

class SIS(*args, **kwargs)[source]

Bases: LensProfileBase

This class contains the function and the derivatives of the Singular Isothermal Sphere.

\[\kappa(x, y) = \frac{1}{2} \left(\frac{\theta_{E}}{\sqrt{x^2 + y^2}} \right)\]

with \(\theta_{E}\) is the Einstein radius,

param_names = ['theta_E', 'center_x', 'center_y']
lower_limit_default = {'center_x': -100, 'center_y': -100, 'theta_E': 0}
upper_limit_default = {'center_x': 100, 'center_y': 100, 'theta_E': 100}
static function(x, y, theta_E, center_x=0, center_y=0)[source]
static derivatives(x, y, theta_E, center_x=0, center_y=0)[source]

Returns df/dx and df/dy of the function.

static hessian(x, y, theta_E, center_x=0, center_y=0)[source]

Returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2.

static rho2theta(rho0)[source]

Converts 3d density into 2d projected density parameter :param rho0:

Returns:

static theta2rho(theta_E)[source]

Converts projected density parameter (in units of deflection) into 3d density parameter :param theta_E: Einstein radius :return:

static mass_3d(r, rho0)[source]

Mass enclosed a 3d sphere or radius r :param r: radius in angular units :param rho0: density at angle=1 :return: mass in angular units.

static mass_3d_lens(r, theta_E)[source]

Mass enclosed a 3d sphere or radius r given a lens parameterization with angular units.

Parameters:
  • r – radius in angular units

  • theta_E – Einstein radius

Returns:

mass in angular units

static mass_2d(r, rho0)[source]

Mass enclosed projected 2d sphere of radius r :param r:

Parameters:

rho0

Returns:

static mass_2d_lens(r, theta_E)[source]
Parameters:
  • r – radius

  • theta_E – Einstein radius

Returns:

mass within a radius in projection

static grav_pot(x, y, rho0, center_x=0, center_y=0)[source]

Gravitational potential (modulo 4 pi G and rho0 in appropriate units) :param x:

Parameters:
  • y

  • rho0

  • center_x

  • center_y

Returns:

static density(r, rho0)[source]

Computes the density :param r: radius in angles :param rho0: density at angle=1 :return: density at r.

static density_lens(r, theta_E)[source]

Computes the density at 3d radius r given lens model parameterization. The integral in projected in units of angles (i.e. arc seconds) results in the convergence quantity.

Parameters:
  • r – 3d radius

  • theta_E – Einstein radius

Returns:

density(r)

static density_2d(x, y, rho0, center_x=0, center_y=0)[source]

Projected density :param x:

Parameters:
  • y

  • rho0

  • center_x

  • center_y

Returns:

jaxtronomy.LensModel.Profiles.spp module

class SPP(*args, **kwargs)[source]

Bases: LensProfileBase

Class for circular power-law mass distribution.

param_names = ['theta_E', 'gamma', 'center_x', 'center_y']
lower_limit_default = {'center_x': -100, 'center_y': -100, 'gamma': 1.5, 'theta_E': 0}
upper_limit_default = {'center_x': 100, 'center_y': 100, 'gamma': 2.5, 'theta_E': 100}
static function(x, y, theta_E, gamma, center_x=0, center_y=0)[source]
Parameters:
  • x (array of size (n)) – set of x-coordinates

  • y (array of size (n)) – set of y-coordinates

  • theta_E (float.) – Einstein radius of lens

  • gamma (<2 float) – power law slope of mass profile

Returns:

function

Raises:

AttributeError, KeyError

static derivatives(x, y, theta_E, gamma, center_x=0.0, center_y=0.0)[source]
static hessian(x, y, theta_E, gamma, center_x=0.0, center_y=0.0)[source]
static rho2theta(rho0, gamma)[source]

Converts 3d density into 2d projected density parameter.

Parameters:
  • rho0

  • gamma

Returns:

static theta2rho(theta_E, gamma)[source]

Converts projected density parameter (in units of deflection) into 3d density parameter.

Parameters:
  • theta_E

  • gamma

Returns:

static mass_3d(r, rho0, gamma)[source]

Mass enclosed a 3d sphere or radius r.

Parameters:
  • r

  • rho0

  • gamma

Returns:

static mass_3d_lens(r, theta_E, gamma)[source]
Parameters:
  • r

  • theta_E

  • gamma

Returns:

static mass_2d(r, rho0, gamma)[source]

Mass enclosed projected 2d sphere of radius r.

Parameters:
  • r

  • rho0

  • gamma

Returns:

static mass_2d_lens(r, theta_E, gamma)[source]
Parameters:
  • r – projected radius

  • theta_E – Einstein radius

  • gamma – power-law slope

Returns:

2d projected radius enclosed

static grav_pot(x, y, rho0, gamma, center_x=0, center_y=0)[source]

Gravitational potential (modulo 4 pi G and rho0 in appropriate units)

Parameters:
  • x

  • y

  • rho0

  • gamma

  • center_x

  • center_y

Returns:

static density(r, rho0, gamma)[source]

Computes the density.

Parameters:
  • r

  • rho0

  • gamma

Returns:

static density_lens(r, theta_E, gamma)[source]

Computes the density at 3d radius r given lens model parameterization.

The integral in projected in units of angles (i.e. arc seconds) results in the convergence quantity.

static density_2d(x, y, rho0, gamma, center_x=0, center_y=0)[source]

Projected density.

Parameters:
  • x

  • y

  • rho0

  • gamma

  • center_x

  • center_y

Returns:

jaxtronomy.LensModel.Profiles.tnfw module

class TNFW(*args, **kwargs)[source]

Bases: LensProfileBase

This class contains functions concerning the truncated NFW profile with a truncation function (r_trunc^2)*(r^2+r_trunc^2)

density equation is:

\[\rho(r) = \frac{r_\text{trunc}^2}{r^2+r_\text{trunc}^2}\frac{\rho_0(\alpha_{R_s})}{r/R_s(1+r/R_s)^2}\]

relation are: R_200 = c * Rs

profile_name = 'TNFW'
param_names = ['Rs', 'alpha_Rs', 'r_trunc', 'center_x', 'center_y']
lower_limit_default = {'Rs': 0, 'alpha_Rs': 0, 'center_x': -100, 'center_y': -100, 'r_trunc': 0}
upper_limit_default = {'Rs': 100, 'alpha_Rs': 10, 'center_x': 100, 'center_y': 100, 'r_trunc': 100}
static function(x, y, Rs, alpha_Rs, r_trunc, center_x=0, center_y=0)[source]
Parameters:
  • x – angular position

  • y – angular position

  • Rs – angular turn over point

  • alpha_Rs – deflection at Rs

  • r_trunc – truncation radius

  • center_x – center of halo

  • center_y – center of halo

Returns:

lensing potential

static derivatives(x, y, Rs, alpha_Rs, r_trunc, center_x=0, center_y=0)[source]

Returns df/dx and df/dy of the function (integral of TNFW), which are the deflection angles.

Parameters:
  • x – angular position (normally in units of arc seconds)

  • y – angular position (normally in units of arc seconds)

  • Rs – turn over point in the slope of the NFW profile in angular unit

  • alpha_Rs – deflection (angular units) at projected Rs

  • r_trunc – truncation radius (angular units)

  • center_x – center of halo (in angular units)

  • center_y – center of halo (in angular units)

Returns:

deflection angle in x, deflection angle in y

static hessian(x, y, Rs, alpha_Rs, r_trunc, center_x=0, center_y=0)[source]

Returns d^2f/dx^2, d^2f/dxdy, d^2f/dydx, d^2f/dy^2 of the TNFW potential f.

Parameters:
  • x – angular position (normally in units of arc seconds)

  • y – angular position (normally in units of arc seconds)

  • Rs – turn over point in the slope of the NFW profile in angular unit

  • alpha_Rs – deflection (angular units) at projected Rs

  • r_trunc – truncation radius (angular units)

  • center_x – center of halo (in angular units)

  • center_y – center of halo (in angular units)

Returns:

Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy

static density(r, Rs, rho0, r_trunc)[source]

Three dimensional truncated NFW profile.

Parameters:
  • r (float/numpy array) – radius of interest

  • Rs (float > 0) – scale radius

  • r_trunc (float > 0) – truncation radius (angular units)

Returns:

rho(r) density

static density_2d(x, y, Rs, rho0, r_trunc, center_x=0, center_y=0)[source]

Projected two dimensional NFW profile (kappa*Sigma_crit)

Parameters:
  • R (float/numpy array) – projected radius of interest

  • Rs (float) – scale radius

  • rho0 (float) – density normalization (characteristic density)

  • r_trunc (float > 0) – truncation radius (angular units)

Returns:

Epsilon(R) projected density at radius R

static mass_2d(R, Rs, rho0, r_trunc)[source]

Analytic solution of the projection integral (convergence)

Parameters:
  • R – projected radius

  • Rs – scale radius

  • rho0 – density normalization (characteristic density)

  • r_trunc – truncation radius (angular units)

Returns:

mass enclosed 2d projected cylinder

static mass_3d(r, Rs, rho0, r_trunc)[source]

Mass enclosed a 3d sphere or radius r.

Parameters:
  • r – 3d radius

  • Rs – scale radius

  • rho0 – density normalization (characteristic density)

  • r_trunc – truncation radius (angular units)

Returns:

M(<r)

static tnfw_potential(R, Rs, rho0, r_trunc)[source]

Lensing potential of truncated NFW profile.

Parameters:
  • R (float/numpy array) – radius of interest

  • Rs (float) – scale radius

  • rho0 (float) – density normalization (characteristic density)

  • r_trunc (float > 0) – truncation radius (angular units)

Returns:

lensing potential

static tnfw_alpha(R, Rs, rho0, r_trunc, ax_x, ax_y)[source]

Deflection angle of TNFW profile along the projection to coordinate axis.

Parameters:
  • R (float/numpy array) – radius of interest

  • Rs (float) – scale radius

  • rho0 (float) – density normalization (characteristic density)

  • r_trunc (float > 0) – truncation radius (angular units)

  • axis (same as R) – projection to either x- or y-axis

Returns:

static tnfw_gamma(R, Rs, rho0, r_trunc, ax_x, ax_y)[source]

Shear gamma of TNFW profile (times Sigma_crit) along the projection to coordinate ‘axis’.

Parameters:
  • R (float/numpy array) – radius of interest

  • Rs (float) – scale radius

  • rho0 (float) – density normalization (characteristic density)

  • r_trunc (float > 0) – truncation radius (angular units)

  • axis (same as R) – projection to either x- or y-axis

Returns:

static F(x)[source]

Classic NFW function in terms of arctanh and arctan.

Parameters:

x – r/Rs

Returns:

static alpha2rho0(alpha_Rs, Rs)[source]

Convert angle at Rs into rho0; neglects the truncation.

Parameters:
  • alpha_Rs – deflection angle at RS

  • Rs – scale radius

Returns:

density normalization (characteristic density)

static rho02alpha(rho0, Rs)[source]

Convert rho0 to angle at Rs; neglects the truncation.

Parameters:
  • rho0 – density normalization (characteristic density)

  • Rs – scale radius

Returns:

deflection angle at RS

Module contents