Lens models

General notes

Lens models are divided into two main classes: spherical lenses, i.e. lenses having axially-symmetric profiles, and elliptical lenses. Generally, computations with spherical lenses are significantly faster than the ones for elliptical lenses. This is particularly true for lens models that do not admit analytical expressions for the elliptical profile, so that one needs to result to integration methods (see Gravity.EllipticalLens) or, to lesser degree, elliptical potentials (see Gravity.EllipticalPotLens).

Typically, the parameters associated to the various lens models are pure numbers (without units). In some cases, different forms for the constructors are accepted: for example, the strength of a point lens can be measured in terms of the associated Einstein radius, or in terms of its mass. If one uses dimensional parameters, it is generally necessary to specify the cosmological model in the constructor.

All lens models admits also lensing constructors: these need to be used when building a multi-plane LensSystem and one wants to use observed parameters for lenses located in behind the first plane (and therefore subject to lensing effects). All lensing constructors have, as parameters, the LensSystem, the SourceCoeff associated to the lens plane where the new lens is located, followed by all lens parameters. These special constructors also require the use of keywords associated to scaling parameters, i.e. exponents associated to the scalar magnification that affects the lens plane. Sensible defaults for the scaling parameters are provided: in particular, it is assumed that velocity dispersion measurements are not affected by lensing magnification, while measurements of the lens Einstein radius is (with power unity).

Point Lens

Probably the simplest lens model one can imagine.

Gravity.PointLensType

A point-like lens.

Properties

  • z: the lens redshift
  • x₀: the lens position
  • rₑ: the lens einstein radius

Internal members

  • rₑ²: the square of rₑ

Constructor

PointLens(z, x₀, rₑ)

Example

julia> using Unitful, UnitfulAstro
julia> l = Gravity.PointLens(0.4, SPoint(2.3, 1.2), 1.0)
PointLens{Float64}(0.4, [2.3, 1.2], 3.8879231331490063, 15.115946289275186)
source

Gaussian Lens

A lens with a Gaussian profile: can be useful to represents arbitrary extended mass distributions which have been decomposed as a Gaussian mixture.

Gravity.GaussianLensType

A spherical lens with a Gaussian mass profile.

Properties

  • z: the lens redshift
  • x₀: the lens position
  • rₑ: the lens Einstein radius
  • s: the lens scale radius

Internal Members

  • b: the lens strength
  • s⁻²: the lens core radius squared

Mass distribution

The dimensionless projected mass distribution is of the form

\[\kappa(r) = b \exp{-r^2 / (2 s^2)} \; .\]

Constructors

GaussianLens(z, x₀, rₑ, s)
source

Isothermal models

One of the most useful lensing models are the ones based on the isothermal assumption. The code defines different isothermal lens models, depending on their symmetry and on the presence of a core.

Gravity.SISLensType

A singular isothermal sphere lens.

Properties

  • z: the lens redshift
  • x₀: the lens position
  • σ: the lens velocity dispersion in km/s

Internal members

  • b: the lens strength, corresponding to the Einstein radius at z = ∞

Mass distribution

The dimensionless projected mass distribution is of the form

\[\kappa(r) = \frac{b}{2r} \; ,\]

where the lens strength is

\[b = 4\pi\left(\frac{\sigma}{c}\right)^2 \frac{D_\mathrm{ls}}{D_\mathrm{s}} \; .\]

Here $\sigma$ is the lens velocity dispersion, while $D_\mathrm{ls}$ and $D_\mathrm{s}$ are the lens-source and observer-source angular diameter distances.

Constructor

SISLens(z, x₀, σ)

The constructor uses the lens velocity dispersion σ to compute the lens strength b. The velocity dispersion must be expressed in units of km/s.

See also: NISLens, NIELens, JaffeSphLens, JaffeEllLens.

Example

julia> using Unitful, UnitfulAstro
julia> l = Gravity.SISLens(0.4, SPoint(2.3, 1.2), 220.0)
PointLens{Float64}(0.4, [2.3, 1.2], 15.115946289275186)
source
Gravity.NISLensType

A non-singular isothermal sphere lens.

Properties

  • z: the lens redshift
  • x₀: the lens position
  • σ: the lens velocity dispersion in km/s
  • s: the lens core radius

Internal Members

  • b: the lens strength, corresponding to the Einstein radius at z = ∞
  • : the lens core radius squared

Mass distribution

The dimensionless projected mass distribution is of the form

\[\kappa(r) = \frac{b}{2\sqrt{r^2 + s^2}} \; ,\]

where the lens strength is associated with the Einstein radius

\[\theta_\mathrm{E} = 4\pi\left(\frac{\sigma}{c}\right)^2 \frac{D_\mathrm{ls}}{D_\mathrm{s}} \; .\]

for a source with $D_\mathrm{ls} / D_\mathrm{s} = 1$. Here $\sigma$ is the lens velocity dispersion, while $D_{\rm ls}$ and $D_{\rm s}$ are the lens-source and observer-source angular diameter distances.

Constructors

NISLens(z, x₀, σ, s)

The constructor uses the lens velocity dispersion σ to compute the lens strength b. The velocity dispersion must be expressed in units of km/s.

See also: SISLens, NIELens, JaffeSphLens, JaffeEllLens.

source
Gravity.NIELensType

A non-singular isothermal ellipsoidal lens.

Properties

  • z: the lens redshift
  • x₀: the lens position
  • σ: the lens velocity dispersion in km/s
  • s: the lens core radius
  • q: the axis ratio, defined as $q = b / a$, where a and b are the two semi-axes (with a ≥ b).
  • θₑ: the lens position angle, counted clockwise from the top (North to West in astronomical sense).

Internal members

  • b: the lens strength, corresponding to the Einstein radius at z = ∞
  • sf: the lens core times f = √q
  • s²f²: the lens core radius squared
  • ε: ellipticity, computed as $\varepsilon = \sqrt{1 - q^2}$
  • sinθₑ: sine of θₑ
  • cosθₑ: cosine of θₑ

Mass distribution

The dimensionless projected mass distribution is of the form

\[\kappa(r) = \frac{b}{2\sqrt{r^2 + s^2}} \; ,\]

where $r$ is an elliptical radius. The lens strength is associated with a pseudo Einstein radius

\[\theta_\mathrm{E} = 4\pi\left(\frac{\sigma}{c}\right)^2 \frac{D_\mathrm{ls}}{D_\mathrm{s}} \sqrt{q} \; .\]

for a source with $D_\mathrm{ls} / D_\mathrm{s} = 1$. Here $\sigma$ is the lens velocity dispersion, while $D_{\rm ls}$ and $D_{\rm s}$ are the lens-source and observer-source angular diameter distances.

Constructors

NIELens(z, x₀, σ, s, q, θₑ)

The constructor uses the lens velocity dispersion σ to compute the lens strength b. The velocity dispersion must be expressed in units of km/s.

See also: SISLens, NISLens, JaffeSphLens, JaffeEllLens.

source

One problem with the isothermal models is that their total mass is undefined (formally infinite), because of the $1/r$ dependence of the project mass density. A solution is to define a pseudo-Jaffe model, obtained as difference of two isothermal models.

Gravity.JaffeSphLensType

A non-singular pseudo-Jaffe spherical lens.

Properties

  • z: the lens redshift
  • x₀: the lens position
  • σ: the lens velocity dispersion in km/s
  • s: the lens core radius
  • a: the lens truncation radius

Internal members

  • b: the lens strength, corresponding to the Einstein radius at z = ∞
  • : the lens core radius squared
  • : the lens truncation radius squared

Mass distribution

The dimensionless projected mass distribution is of the form

\[\kappa(r) = \frac{b}{2} \biggl( \frac{1}{\sqrt{r^2 + s^2}} - \frac{1}{\sqrt{r^2 + a^2}} \biggr) \; ,\]

where $r$ is the radius. The lens strength is equivalent to the Einstein radius

\[\theta_\mathrm{E} = 4\pi\left(\frac{\sigma}{c}\right)^2 \frac{D_\mathrm{ls}}{D_\mathrm{s}}\]

for a source with $D_\mathrm{ls} / D_\mathrm{s} = 1$. Here $\sigma$ is the lens velocity dispersion, while $D_{\rm ls}$ and $D_{\rm s}$ are the lens-source and observer-source angular diameter distances.

Constructors

JaffeSphLens(z, x₀, σ, s, a [, defaultcontext])

The constructor uses the lens velocity dispersion σ to compute the lens strength b. The velocity dispersion must be expressed in units of km/s.

See also: NISLens, JaffeEllLens.

source
Gravity.JaffeEllLensType

A non-singular pseudo-Jaffe ellipsoidal lens.

Properties

  • z: the lens redshift
  • x₀: the lens position
  • σ: the lens velocity dispersion in km/s
  • s: the lens core radius
  • a: the truncation radius
  • q: the axis ratio, defined as $q = b / a$, where a and b are the two semi-axes (with a ≥ b).
  • θₑ: the lens position angle, counted clockwise from the top (North to West in astronomical sense).

Internal members

  • b: the lens strength, corresponding to the Einstein radius at z = ∞
  • sf: the lens core times f = √q
  • s²f²: the lens core radius squared
  • af: the lens truncation radius times f = √q
  • a²f²: the lens truncation radius squared
  • ε: ellipticity, automatically computed as $\varepsilon = \sqrt{1 - q^2}$
  • sinθₑ: sine of θₑ
  • cosθₑ: cosine of θₑ

Constructors

JaffeEllLens(z, x₀, σ, s, a, q, θₑ)

The constructor uses the lens velocity dispersion σ to compute the lens strength b. The velocity dispersion must be expressed in units of km/s.

See also: NIELens, JaffeSphLens.

source

Generic elliptical lenses

Many elliptical models do not have analytic expressions for the deflection angle and other related quantities. One, however, can take a (spherical) lens model and transform it into an elliptical one by using one of the two methods described below.

Gravity.EllipticalLensType

An ellipsoidal lens built on top of a spherical model.

This object is able to transform any SphericalSingleLens into a corresponding lens with elliptical mass distribution. This process involves the use of one-dimensional integrals for the computation of the lensing potential, deflection, and lensing jacobian. The integration is performed using Gaussian quadrature with a fixed number of points.

Properties

  • z: the lens redshift
  • x₀: the lens position
  • q: the axis ratio, defined as $q = b / a$, where a and b are the two semiaxes (with a ≥ b).
  • θₑ: the lens position angle, computed clockwise from the top (North to West in astronomical sense).
  • b: lens strength factor, by default 1
  • s: lens scale factor, by default 1
  • lens: an instance of [SphericalSingleLens], the circular lens to squeeze

Internal members

  • sinθₑ: sine of θₑ (automatically computed)
  • cosθₑ: cosine of θₑ (automatically computed)
  • uᵢ, wᵢ, dᵢ, dᵢ²: arrays with the coefficients used for the Gaussian quadrature (automatically computed)

Constructors

EllipticalLens(lens, q, θₑ, b=1, s=1; npoints=1024)

Build an elliptical lens and computes the coefficients for the elliptical quadrature. The exact quadrature method used depends on the inner slope of the lens, as indicated by innerslope: in particular, Gauss-Legendre is used for a vanishing inner slope, and Gauss-Jacobi in all other cases.

The coefficient b is used as a multiplicative term in the lens mass density; the coefficient s is used as a multiplicative term in the lens scale.

See also: EllipticalPotLens.

Example

julia> using Unitful, UnitfulAstro
julia> q = 0.7
julia> l0 = Gravity.NISLens(0.4, SPoint(2.3, 1.2), 800.0, 1.2);
julia> l1 = Gravity.EllipticalLens(l0, q, 1.0);
julia> l2 = Gravity.NIELens(0.4, SPoint(2.3, 1.2), 800.0 * q^0.25, 1.2 * sqrt(q), q, 1.0);
julia> Gravity.deflection(l1, SPoint(3.0, 2.0)) ≈ Gravity.deflection(l2, SPoint(3.0, 2.0))
true
source
Gravity.EllipticalPotLensType

A lens with elliptical potential built on top of a spherical model.

This object is able to transform any SphericalSingleLens into a corresponding lens with elliptical potential. This process, contrary to the one implemented by EllipticalLens, does not involve the use of one-dimensional integrals for the computation of the lensing potential, deflection, and lensing jacobian. As a result the code will be much faster, at the price of possibly unphysical mass distributions.

Properties

  • z: the lens redshift
  • x₀: the lens position
  • q: the axis ratio, defined as $q = b / a$, where a and b are the two semiaxes (with a ≥ b).
  • θₑ: the lens position angle, computed clockwise from the top (North to West in astronomical sense).
  • b: lens strength factor, by default 1
  • s: lens scale factor, by default 1
  • lens: an instance of [SphericalSingleLens], the circular lens to squeeze

Internal members

  • : the square of s
  • sinθₑ: sine of θₑ (automatically computed)
  • cosθₑ: cosine of θₑ (automatically computed)

Constructors

EllipticalPotLens(l, q, θₑ, b=1, s=1)

See also: EllipticalLens.

Example

julia> using Unitful, UnitfulAstro
julia> q = 0.7
julia> l0 = Gravity.NISLens(0.4, SPoint(2.3, 1.2), 800.0, 1.2);
julia> l1 = Gravity.EllipticalPotLens(l0, q, 1.0);
julia> l2 = Gravity.NIELens(0.4, SPoint(2.3, 1.2), 800.0 * q^0.25, 1.2 * sqrt(q), q, 1.0);
julia> Gravity.deflection(l1, SPoint(3.0, 2.0)) ≈ Gravity.deflection(l2, SPoint(3.0, 2.0))
false
source

Power laws

Gravity.PowSphLensType

A (singular) power-law spherical lens.

Properties

  • z: the lens redshift
  • x₀: the lens position
  • rₑ: the Einstein radius
  • α: the slope of the mass profile: must be between 0 and 2

Internal Members

  • rₑ²⁻ᵅ: the Einstein radius to the power 2-α

Note that the lens mass density is proportional to $\kappa(r) \propto r^{\alpha - 2}$. Therefore, when α = 1 this model is equivalent to a SISLens.

Constructors

PowSphLens(z, x₀, b, α)

See also: PowSoftSphLens.

source
Gravity.PowSoftSphLensType

A non-singular (softened) power-law spherical lens.

Properties

  • z: the lens redshift
  • x₀: the lens position
  • rₑ: the Einstein radius for a singular model
  • s: the lens core radius
  • α: the slope of the mass profile, which must be between 0 and 2

Internal Members

  • rₑ²⁻ᵅ: rₑ to the power 2 - α
  • : the lens core radius squared
  • sᵅ: the lens core radius to the power α
  • Ψ: a normalizing constant (only used for the lensing potential) automatically computed in terms of α

This lens model has a mass density proportional to ``\kappa(r) \propto (r^2

  • s^2)^{\alpha/2 - 1}`. Therefore, whenα = 1` this model is equivalent to

a NISLens. The coefficient α used as a member is linked to γ of Glafic by α = 3 - γ; we use here instead the convesion of Keeton's GravLens software.

Note that rₑ here does not correspond to the Einstein radius of the lens model, but to the Einstein radius of the singular model that would be obtained by setting s = 0. We could have defined rₑ as the true Einstein radius, but that would have restricted the range of parameters of the mode. In fact, a non-singular power law model, for large core radii, will have a vanishing Einstein radious (cfg. the NISLens).

Constructors

PowSoftSphLens(z, x₀, b, s, α)

See also: PowSphLens.

source

Other lens models

Gravity.SersicSphLensType

A spherical lens following a Sersic profile.

Properties

  • z: the lens redshift
  • x₀: the lens position
  • b: the lens strength
  • r₂: the profile half-light radius
  • n: the Sersic index

Internal Members

  • rₛ: the profile scale length
  • rₛ²: the profile scale length squared
  • Γ: a precomputed quantity (internal use only)

Constructors

SersicSphLens(z, x₀, b, r₂, n)
Warning

The implementation of this lensing profile requires the use of the incomplete gamma function gamma_inc. Unfortunately, at the moment ForwardDiff (and other automatic differentiation packages) cannot deal with this function, since its dual with respect to the various arguments is not implemented. This de-facto prevents the use of derivative-based Monte-Carlo methods with this kind of lens.

source
Gravity.HernquistSphLensType

A spherical lens following a Hernquist profile.

Properties

  • z: the lens redshift
  • x₀: the lens position
  • b: the lens strength
  • r₂: the profile half-light radius

Internal Member

  • rₛ: the profile scale length
  • rₛ²: the profile scale length squared

Constructors

HernquistSphLens(z, x₀, b, r₂)
source
Gravity.NFWSphLensType

A spherical lens following an NFW profile.

Properties

  • z: the lens redshift
  • x₀: the lens position
  • b: the lens strength
  • rₛ: the profile scale length

Internal Member

  • rₛ²: the profile scale length squared

Constructors

NFWSphLens(z, x₀, b, rₛ)
source

External perturbation

An external perturbation (typically, an external shear) is often needed to model external, distance perturbations.

Gravity.PerturbLensType

An external, second order perturbationl lens.

Members

  • z: the lens redshift
  • x₀: the lens center
  • M: a matrix representing the lens perturmbation

Constructors

PerturbLens(z, x₀, M)
Shear(z, x₀, γ)
Shear(z, x₀, |γ|, ϑ)
Convergence(z, x₀, κ)

Different constructors create different kind of perturbations: an external shear one (specified as a 2-vector, or in polar coordinates), a convergence, or a general one.

source
Gravity.TorusLensType

A special torus-shaped test lens.

Members

  • z: the lens redshift
  • x₀: the lens center
  • M: the constant magnification matrix
  • d: the torus scale length

Constructor

TorusLens(z, x₀, M, d, k)
source