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.PointLens — Type
A point-like lens.
Properties
z: the lens redshiftx₀: the lens positionrₑ: the lens einstein radius
Internal members
rₑ²: the square ofrₑ
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)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.GaussianLens — Type
A spherical lens with a Gaussian mass profile.
Properties
z: the lens redshiftx₀: the lens positionrₑ: the lens Einstein radiuss: the lens scale radius
Internal Members
b: the lens strengths⁻²: 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)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.SISLens — Type
A singular isothermal sphere lens.
Properties
z: the lens redshiftx₀: 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)Gravity.NISLens — Type
A non-singular isothermal sphere lens.
Properties
z: the lens redshiftx₀: the lens positionσ: the lens velocity dispersion in km/ss: the lens core radius
Internal Members
b: the lens strength, corresponding to the Einstein radius at z = ∞s²: 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.
Gravity.NIELens — Type
A non-singular isothermal ellipsoidal lens.
Properties
z: the lens redshiftx₀: the lens positionσ: the lens velocity dispersion in km/ss: the lens core radiusq: the axis ratio, defined as $q = b / a$, whereaandbare 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 timesf = √qs²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.
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.JaffeSphLens — Type
A non-singular pseudo-Jaffe spherical lens.
Properties
z: the lens redshiftx₀: the lens positionσ: the lens velocity dispersion in km/ss: the lens core radiusa: the lens truncation radius
Internal members
b: the lens strength, corresponding to the Einstein radius at z = ∞s²: the lens core radius squareda²: 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.
Gravity.JaffeEllLens — Type
A non-singular pseudo-Jaffe ellipsoidal lens.
Properties
z: the lens redshiftx₀: the lens positionσ: the lens velocity dispersion in km/ss: the lens core radiusa: the truncation radiusq: the axis ratio, defined as $q = b / a$, whereaandbare 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 timesf = √qs²f²: the lens core radius squaredaf: the lens truncation radius timesf = √qa²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.
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.EllipticalLens — Type
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 redshiftx₀: the lens positionq: the axis ratio, defined as $q = b / a$, whereaandbare 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 1s: lens scale factor, by default 1lens: 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))
trueGravity.EllipticalPotLens — Type
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 redshiftx₀: the lens positionq: the axis ratio, defined as $q = b / a$, whereaandbare 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 1s: lens scale factor, by default 1lens: an instance of [SphericalSingleLens], the circular lens to squeeze
Internal members
s²: the square ofssinθₑ: 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))
falsePower laws
Gravity.PowSphLens — Type
A (singular) power-law spherical lens.
Properties
z: the lens redshiftx₀: the lens positionrₑ: the Einstein radiusα: the slope of the mass profile: must be between 0 and 2
Internal Members
rₑ²⁻ᵅ: the Einstein radius to the power2-α
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.
Gravity.PowSoftSphLens — Type
A non-singular (softened) power-law spherical lens.
Properties
z: the lens redshiftx₀: the lens positionrₑ: the Einstein radius for a singular models: 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 -αs²: the lens core radius squaredsᵅ: 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.
Other lens models
Gravity.SersicSphLens — Type
A spherical lens following a Sersic profile.
Properties
z: the lens redshiftx₀: the lens positionb: the lens strengthr₂: the profile half-light radiusn: the Sersic index
Internal Members
rₛ: the profile scale lengthrₛ²: the profile scale length squaredΓ: a precomputed quantity (internal use only)
Constructors
SersicSphLens(z, x₀, b, r₂, n)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.
Gravity.HernquistSphLens — Type
A spherical lens following a Hernquist profile.
Properties
z: the lens redshiftx₀: the lens positionb: the lens strengthr₂: the profile half-light radius
Internal Member
rₛ: the profile scale lengthrₛ²: the profile scale length squared
Constructors
HernquistSphLens(z, x₀, b, r₂)Gravity.NFWSphLens — Type
A spherical lens following an NFW profile.
Properties
z: the lens redshiftx₀: the lens positionb: the lens strengthrₛ: the profile scale length
Internal Member
rₛ²: the profile scale length squared
Constructors
NFWSphLens(z, x₀, b, rₛ)External perturbation
An external perturbation (typically, an external shear) is often needed to model external, distance perturbations.
Gravity.PerturbLens — Type
An external, second order perturbationl lens.
Members
z: the lens redshiftx₀: the lens centerM: 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.
Gravity.TorusLens — Type
A special torus-shaped test lens.
Members
z: the lens redshiftx₀: the lens centerM: the constant magnification matrixd: the torus scale length
Constructor
TorusLens(z, x₀, M, d, k)