Lenses

The Lenses module is the interface between the user and various lens models. The user will call functions from this module to compute various lensing quantities. For examples on how to use this module and various functions within it, see Basic-Example-2, Basic-Example-3 and Basic-Example-4.

Note

Keeping in mind that most of the astrophysical scenario (primarily strong lensing by galaxies or galaxy clusters), the Einstein angle is ~[0.1, 50] arcseconds, the default input coordinate units are arcseconds. This is not suitable for microlensing studies requiring micro- to milli-arcsecond resolutions, and users should use the Microlens (yet to be implemented) module in such cases.

In addition, potential, deflection, and jacobian are calculate assuming that the source is at infinity, i.e., $a_{\rm dis} = D_{ds} / D_s = 1$. Hence, various follow-up calculations require providing $a_{\rm dis}$ as an input.

LensFactory.Lenses.get_meshgrid — Function
get_meshgrid(θx::Real, θy::Real, dθ::Real) --> Tuple(Matrix{<:Real}, Matrix{<:Real})

Generate a meshgrid of coordinates on which various quantities can be evaluated. At present, this function only generates square pixels.

Arguments

  • θx: Half-size of the grid in x-direction (in $\rm \mathbf{arcseconds}$)
  • θy: Half-size of the grid in y-direction (in $\rm \mathbf{arcseconds}$)
  • dθ: Pixel size (in $\rm \mathbf{arcseconds}$)

Returns

  • grid_x: x-coordinates of the grid (in $\rm \mathbf{arcseconds}$)
  • grid_y: y-coordinates of the grid (in $\rm \mathbf{arcseconds}$)
source
LensFactory.Lenses.get_critical_density — Function
get_critical_density(D_d::Real, D_ds::Real, D_s::Real; 
                     unit::Symbol=:kg_m2) --> Real

Calculate the critical surface density,

\[Σ_{\rm cr} = \frac{c^2}{4 π {\rm G}} \frac{D_s}{D_d D_{ds}}.\]

Arguments

  • D_d : Angular diameter distance to the lens (in $\rm \mathbf{meters}$)
  • D_ds: Angular diameter distance to the source (in $\rm \mathbf{meters}$)
  • D_s : Angular diameter distance to the lens (in $\rm \mathbf{meters}$)

Keyword Arguments

  • unit = :kg_m2: Output units of the critical surface density.
    • :kg_m2 $\Rightarrow{\rm \mathbf{kg/m^2}}$
    • :msun_pc2 $\Rightarrow{\rm \mathbf{M_⊙/pc^2}}$
    • :msun_arcsec2 $\Rightarrow{\rm \mathbf{M_⊙/arcsec^2}}$

Returns

  • Σ_cr::Real: Critical surface density in the requested unit
source
LensFactory.Lenses.get_potential — Function
get_potential(lens::AbstractLens, θx::T, θy::T) where T <: Real --> Real
source
get_potential(lens::AbstractLens, θx::T, θy::T) where T <: ROA --> ROA

Calculate lensing potential at the given angular coordinates for the given lens model,

\[ψ(\pmb{θ}) = \frac{4{\rm G}}{\rm c^2} \frac{1}{D_d} \int_{\mathbb{R}^2} d^2 \pmb{θ}' \, Σ(\pmb{θ}') \, \ln|\pmb{θ} - \pmb{θ'}|,\]

where $Σ(\pmb{θ})$ is in units of $\rm{\mathbf{kg/arcsec^2}}$.

Arguments

  • lens: Lens model.
  • θx : x-coordinate(s) (in $\rm \mathbf{arcseconds}$).
  • θy : y-coordinate(s) (in $\rm \mathbf{arcseconds}$).

Returns

  • ψ : Lensing potential at the given angular coordinate(s).
source
LensFactory.Lenses.get_deflection — Function
get_deflection(lens::AbstractLens, θx::T, θy::T) where T <: Real --> Real
source
get_deflection(lens::AbstractLens, θx::T, θy::T) where T <: ROA --> Tuple{ROA, ROA}

Calculate (vector) deflection angle at the given angular coordinate(s) for a given lens model,

\[\pmb{α}(\pmb{θ}) = \pmb{∇} ψ(\pmb{θ}) = \frac{4{\rm G}}{\rm c^2} \frac{1}{D_d} \int_{\mathbb{R}^2} d^2 \pmb{θ}' \, Σ(\pmb{θ}') \frac{\pmb{θ} - \pmb{θ}'}{|\pmb{θ} - \pmb{θ}'|^2}.\]

Arguments

  • lens: Lens model.
  • θx : x-coordinate(s) (in $\rm \mathbf{arcseconds}$).
  • θy : y-coordinate(s) (in $\rm \mathbf{arcseconds}$).

Returns

  • αx : x-component of the deflection angle (in $\rm \mathbf{arcseconds}$).
  • αy : y-component of the deflection angle (in $\rm \mathbf{arcseconds}$).
source
LensFactory.Lenses.get_jacobian — Function
get_jacobian(lens::AbstractLens, θx::T, θy::T) where T <: Real --> Tuple{Real, Real, Real}
source
get_jacobian(lens::AbstractLens, θx::T, θy::T) where T <: ROA --> Tuple(ROA, ROA, ROA)

Calculate jacobian (i.e., deformation tensor) of the lens mapping for a given lens model,

\[\mathbb{A}(\pmb{θ}) = \begin{pmatrix} ψ_{xx} & ψ_{xy} \\ ψ_{xy} & ψ_{yy} \end{pmatrix}.\]

Since the jacobian is symmetric (for single lens plane), only three components are returned, i.e., $(ψ_{xx}, ψ_{yy}, ψ_{xy})$.

Arguments

  • lens: Lens model.
  • θx : x-coordinate(s) (in $\rm \mathbf{arcseconds}$).
  • θy : y-coordinate(s) (in $\rm \mathbf{arcseconds}$).

Returns

  • ψxx : xx-component of the jacobian.
  • ψyy : yy-component of the jacobian.
  • ψxy : xy-component of the jacobian.
source
LensFactory.Lenses.get_time_delay — Function
get_time_delay(lens::AbstractLens, θx::T, θy::T, 
               adis::Real, 
               z_d::Real, 
               D_d::Real, 
               β::NTuple{2, Real}) where T <: Real --> Real
source
get_time_delay(lens::AbstractLens, θx::T, θy::T, 
               adis::Real, 
               z_d::Real, 
               D_d::Real, 
               β::NTuple{2, Real}) where T <: ROA --> ROA

Calculate time delay for a given lens model and source position. The corresponding expression is given as,

\[t_d(\pmb{θ}; \pmb{β}) = \frac{1+z_d}{\rm c} \frac{D_d D_s}{D_{ds}} \theta_0^2 \left[ \frac{(\pmb{θ} - \pmb{β})^2}{2} - \frac{D_{ds}}{D_s} \psi(\pmb{θ}) \right],\]

where $\theta_0$ is normalizing angular unit. Since all the angular coordinates are in arcseconds, for our case, $\mathbf{\theta_0 = 1~\rm \mathbf{arcsecond}}$.

Arguments

  • lens: Lens model.
  • θx : x-coordinate(s) (in $\rm \mathbf{arcseconds}$).
  • θy : y-coordinate(s) (in $\rm \mathbf{arcseconds}$).
  • adis: Distance ratio (i.e., $D_{ds}/D_s$).
  • z_d : Lens redshift.
  • D_d : Angular diameter distance to the lens (in $\rm \mathbf{meters}$).
  • β : Source angular position (in $\rm \mathbf{arcseconds}$).

Returns

  • t_d: Time delay at the given angular coordinate(s) (in $\rm \mathbf{seconds}$).
source
LensFactory.Lenses.get_kappa_gamma — Function
get_kappa_gamma(lens::AbstractLens, θx::T, θy::T, 
                adis::Real) where T <: Real --> Real
source
get_kappa_gamma(lens::AbstractLens, θx::T, θy::T, 
                adis::Real) where T <: ROA --> ROA

Calculate convergence ($\kappa$) and shear components ($\gamma_1$, $\gamma_2$) at the given angular coordinate(s) for a given lens model. The corresponding formulae are,

\[\begin{equation} \begin{split} κ &= (ψ_{xx} + ψ_{yy})/2, \\ γ_1 &= (ψ_{xx} - ψ_{yy})/2, \\ γ_2 &= ψ_{xy}. \end{split} \end{equation}\]

Arguments

  • lens: Lens model.
  • θx : x-coordinate(s) (in $\rm \mathbf{arcseconds}$).
  • θy : y-coordinate(s) (in $\rm \mathbf{arcseconds}$).
  • adis: Distance ratio (i.e., $D_{ds}/D_s$).

Returns

  • κ : Convergence at the given angular coordinate(s).
  • γ1 : First component of shear at the given angular coordinate(s).
  • γ2 : Second component of shear at the given angular coordinate(s).
source
LensFactory.Lenses.get_magnification_image — Function
get_magnification_image(lens::AbstractLens, θx::T, θy::T, 
                        adis::Real) where T <: Real --> Real
source
get_magnification_image(lens::AbstractLens, θx::T, θy::T, 
                        adis::Real) where T <: ROA --> ROA

Calculate signed magnification at the given angular coordinate(s) for a given lens model,

\[\mu(\pmb{θ}) = \frac{1}{det\left[ \mathbb{I} - a_{\rm dis} \, \mathbb{A} \right]},\]

where $\mathbb{I}$ is the identity matrix.

Arguments

  • lens: Lens model.
  • θx : x-coordinate(s) (in $\rm \mathbf{arcseconds}$).
  • θy : y-coordinate(s) (in $\rm \mathbf{arcseconds}$).
  • adis: Distance ratio (i.e., $D_{ds}/D_s$).

Returns

  • μ : Magnification at the given angular coordinate(s).
source
LensFactory.Lenses.get_magnification_source — Function
get_magnification_source(lens::AbstractLens, θx::T, θy::T, 
                         adis::Real; 
                         rays_per_pixel::Int64 = 1) where T <: Matrix{<:Real} --> Matrix{<:Real}

Calculates the magnification map in source plane using inverse ray shooting (IRS) for a given lens model. The number of average rays per pixel can be specified using the rays_per_pixel keyword argument. This function is not optimized for speed and is only intended to visualize the magnification map.

Arguments

  • lens: Lens model.
  • θx : x-grid (in $\rm \mathbf{arcseconds}$).
  • θy : y-grid (in $\rm \mathbf{arcseconds}$).
  • adis: Distance ratio (i.e., $D_{ds}/D_s$).

Keyword Arguments

  • rays_per_pixel = 1: Average number of rays per pixel.

Returns

  • μ : Magnification map in source plane.
source
LensFactory.Lenses.get_image — Function
get_image(lens::AbstractLens, θx::T, θy::T, 
          adis::Real, 
          β::NTuple{2, Real}) where T <: AbstractMatrix{<:Real} --> Vector{NTuple{2, Real}}

Calculate image positions for a given lens model and point source position. To get the image positions, this implementation finds the intersection points of contours corresponding to,

\[\pmb{β} - \pmb{θ} + a_{\rm dis} \, \pmb{α}(\pmb{θ}) = 0,\]

where $\pmb{β}$ is the source position, $\pmb{θ}$ is the image plane grid, $a_{\rm dis}$ is the distance ratio (i.e., $D_{ds}/D_s$), and $\pmb{α}(\pmb{θ})$ is the deflection angle.

source
get_image(lens::AbstractLens, θx::T, θy::T, 
          adis::Real, 
          β::T) where T <: Matrix{<:Real} --> Matrix{<:Real}

Calculate lensed image map for an extended source given a lens model. This function employs inverse ray shooting (IRS) to construct the image plane map.

Arguments

  • lens: Lens model.
  • θx : x-grid (in $\rm \mathbf{arcseconds}$).
  • θy : y-grid (in $\rm \mathbf{arcseconds}$).
  • adis: Distance ratio (i.e., $D_{ds}/D_s$).
  • β : Either point source position (in $\rm \mathbf{arcseconds}$) or source intensity map.

Returns

  • img : Image positions (in $\rm \mathbf{arcseconds}$).
source
LensFactory.Lenses.get_critical_curve — Function
get_critical_curve(θx::T, θy::T, adis::Float64,
                   ψxx::T, ψyy::T, ψxy::T) where T <: Matrix{<:Real} --> Tuple{Vector{Vector{Vector{Float64}}}, Vector{Vector{Vector{Float64}}}}

Calculate critical curves from a deformation tensor that has already been computed. For this function, no lens is needed.

Arguments

  • θx : x-grid (in $\rm \mathbf{arcseconds}$).
  • θy : y-grid (in $\rm \mathbf{arcseconds}$).
  • adis: Distance ratio (i.e., $D_{ds}/D_s$).
  • ψxx : xx-component of the deformation tensor.
  • ψyy : yy-component of the deformation tensor.
  • ψxy : xy-component of the deformation tensor.

Returns

  • critical_tan: Tangential critical curve(s).
  • critical_rad: Radial critical curve(s).
source
get_critical_curve(lens::AbstractLens, θx::T, θy::T, 
                   adis::Real) where T <: Matrix{<:Real} --> Tuple{Vector{Vector{Vector{Float64}}}, Vector{Vector{Vector{Float64}}}}

Calculate critical curves for a given lens model. This function essentially runs marching squares algorithm to find the zero eigenvalue contours.

Arguments

  • lens: Lens model.
  • θx : x-grid (in $\rm \mathbf{arcseconds}$).
  • θy : y-grid (in $\rm \mathbf{arcseconds}$).
  • adis: Distance ratio (i.e., $D_{ds}/D_s$).

Returns

  • crit_tan: Tangential critical curves (in $\rm \mathbf{arcseconds}$).
  • crit_rad: Radial critical curves (in $\rm \mathbf{arcseconds}$).
source
LensFactory.Lenses.get_caustic — Function
get_caustic(lens::AbstractLens, θx::T, θy::T, adis::Float64, 
            ψxx::T, ψyy::T, ψxy::T) where T <: Matrix{<:Real} --> Tuple{Vector{Vector{Vector{Float64}}}, Vector{Vector{Vector{Float64}}}}

Calculate caustics for a given lens model. The function first gets the critical curves and then maps them to the source plane using the lens equation. The functon runs over all tangential and radial critical curves.

Arguments

  • lens: Lens model.
  • θx : x-grid (in $\rm \mathbf{arcseconds}$).
  • θy : y-grid (in $\rm \mathbf{arcseconds}$).
  • adis: Distance ratio (i.e., $D_{ds}/D_s$).
  • ψxx : xx-component of the deformation tensor.
  • ψyy : yy-component of the deformation tensor.
  • ψxy : xy-component of the deformation tensor.

Returns

  • caustics_tan: Tangential caustics (in $\rm \mathbf{arcseconds}$).
  • caustics_rad: Radial caustics (in $\rm \mathbf{arcseconds}$).
source
get_caustic(lens::AbstractLens, θx::T, θy::T, 
            adis::Real) where T <: Matrix{<:Real} --> Tuple{Vector{Vector{Vector{Float64}}}, Vector{Vector{Vector{Float64}}}}

Calculate caustics for a given lens model. The function first gets the critical curves and then maps them to the source plane using the lens equation. The functon runs over all tangential critical curves.

Arguments

  • lens: Lens model.
  • θx : x-grid (in $\rm \mathbf{arcseconds}$).
  • θy : y-grid (in $\rm \mathbf{arcseconds}$).
  • adis: Distance ratio (i.e., $D_{ds}/D_s$).

Returns

  • caus_tan: Tangential caustic curves (in $\rm \mathbf{arcseconds}$).
  • caus_rad: Radial caustic curves (in $\rm \mathbf{arcseconds}$).
source
LensFactory.Lenses.get_critical_area — Function
get_critical_area(lens::AbstractLens, θx::T, θy::T, 
                  adis::Real) where T <: Matrix{<:Real} --> Real

Calculate the total angular area enclosed by tangential critical curve(s). The function runs shoelace algorithm to calculate the area.

Arguments

  • lens: Lens model.
  • θx : x-grid (in $\rm \mathbf{arcseconds}$).
  • θy : y-grid (in $\rm \mathbf{arcseconds}$).
  • adis: Distance ratio (i.e., $D_{ds}/D_s$).

Returns

  • area: Total angular area enclosed by tangential critical curves (in $\rm \mathbf{arcseconds^2}$).
source
LensFactory.Lenses.get_einstein_angle — Function
get_einstein_angle(lens::AbstractLens, θx::T, θy::T, 
                   adis::Real) where T <: Matrix{<:Real} --> Real

Calculate the Einstein radius (i.e., $θ_E$) for an arbitrary lens model, which is defined as,

\[θ_E = \sqrt{\frac{A_{\rm critical}}{π}},\]

where $A_{\rm critical}$ is the total angular area enclosed by the tangential critical curve(s). Again, it is important to note that we are running over all tangential critical curves.

Arguments

  • lens: Lens model.
  • θx : x-grid (in $\rm \mathbf{arcseconds}$).
  • θy : y-grid (in $\rm \mathbf{arcseconds}$).
  • adis: Distance ratio (i.e., $D_{ds}/D_s$).

Returns

  • θ_E : Einstein angle (in $\rm \mathbf{arcseconds}$).
source
LensFactory.Lenses.get_image_multiplicity — Function
get_image_multiplicity(caustics::Vector{<:Vector{<:Vector{<:Real}}}, βx::Real, βy::Real;
                       n_far::Int    = 1,
                       verbose::Bool = true) --> Int

Calculate the number of images of a point source located at $(β_x, β_y)$ from the caustics alone.

A source lying far outside every caustic has a single image. Moving in towards the lens, the number of images changes by $\pm 2$ at every caustic crossing, so the multiplicity anywhere in the source plane follows from counting the crossings along the way in,

\[N(\pmb{β}) = N_\infty + 2 \sum_i \left| w_i(\pmb{β}) \right|,\]

where $w_i$ is the winding number of the $i$-th caustic about $\pmb{β}$ and $N_\infty = 1$. Using winding numbers rather than a raw crossing count takes care of the sign of each crossing automatically, so the answer does not depend on the direction one comes in from and stays correct for caustics that self-intersect (swallowtails) or that overlap each other (e.g. a naked cusp configuration, where the tangential caustic sticks out of the radial one). Note that the caustics are the only input: the image plane is not needed, and the direction in which the caustics happen to be traced is irrelevant because only $|w_i|$ enters.

Warning

The lens is assumed to be non-singular, so that $N$ is odd everywhere (Burke, 1981). A singular lens (e.g.PointLens, SISLens) destroys the central image and produces cuts (Kovner, 1987) that also change the multiplicity but are not images of critical curves, and hence are invisible here. For such models the count returned is that of the corresponding non-singular lens.

Arguments

  • caustics: Caustic curves in the source plane, e.g. from get_caustic.
  • βx : x-coordinate of the source (in $\rm \mathbf{arcseconds}$).
  • βy : y-coordinate of the source (in $\rm \mathbf{arcseconds}$).

Keyword Arguments

  • n_far = 1: Number of images of a source lying far outside all caustics.
  • verbose = true: Warn when an open (i.e., unclosed) caustic is discarded.

Returns

  • N: Number of images of the point source.
source
get_image_multiplicity(lens::AbstractLens, θx::T, θy::T, adis::Float64;
                       source::Union{Nothing, NTuple{2, Real}} = nothing,
                       n_far::Int    = 1,
                       verbose::Bool = true) where T <: Matrix{<:Real}

Calculate the number of images for a given lens model. The function first gets the tangential and radial caustics with get_caustic and then counts the caustic crossings on the way in from infinity; see the caustic based method above for the details.

The shape of the output follows the source keyword argument,

  • source = (βx, βy) $\Rightarrow$ number of images of that point source,
  • source = nothing $\Rightarrow$ multiplicity map over the whole grid.

In the latter case the grid (θx, θy) is reused as the source plane grid, so that N[i, j] is the number of images of a point source sitting at (θx[i, j], θy[i, j]). This needs no extra input: a grid that contains every critical curve, as it must, also contains every caustic, since the deflection pulls the critical curves inwards. For a multiplicity map on a different (e.g. zoomed in) grid, get the caustics with get_caustic and pass them to the caustic based method above.

The image plane grid must be large enough to contain all critical curves, otherwise the corresponding caustics are open and are dropped from the count.

Arguments

  • lens: Lens model.
  • θx : x-grid (in $\rm \mathbf{arcseconds}$).
  • θy : y-grid (in $\rm \mathbf{arcseconds}$).
  • adis: Distance ratio (i.e., $D_{ds}/D_s$).

Keyword Arguments

  • source = nothing: Source angular position (in $\rm \mathbf{arcseconds}$).
    • If $\mathbf{nothing}$, then the multiplicity is calculated at every pixel of the grid.
  • n_far = 1: Number of images of a source lying far outside all caustics.

Returns

  • N: Number of images, either for the requested source position or over the whole grid.
source
LensFactory.Lenses.get_radial_profile — Function
get_radial_profile(kappa::T, θx::T, θy::T; 
                   origin::Union{Tuple{Float64, Float64}, Nothing} = nothing, 
                   n_bin::Int64     = 50, 
                   bin_type::Symbol = :log) --> Tuple(Vector{Real}, Vector{Real}, Vector{Real})

Calculate the radial convergence profile. To convert it into physicsal units, multiply it by the critical density $Σ_{\rm cr}$.

Arguments

  • kappa: Convergence map.
  • θx : x-grid (in $\rm \mathbf{arcseconds}$).
  • θy : y-grid (in $\rm \mathbf{arcseconds}$).

Keyword Arguments

  • origin = nothing: Center (in $\rm \mathbf{arcseconds}$).
  • n_bin = 50: Number of radial bins.
  • bin_type = :log: Type of radial binning (i.e., $:log$ or $:linear$).

Returns

  • centers: Radial bin centers (in $\rm \mathbf{arcseconds}$).
  • profile: Radial profile (in $\rm \mathbf{arcseconds}$).
  • edges : Radial bin edges (in $\rm \mathbf{arcseconds}$).
source
LensFactory.Lenses.get_mass_profile — Function
get_mass_profile(kappa::T, θx::T, θy::T, 
                 D_d::Real; 
                 origin::Union{Tuple{Float64, Float64}, Nothing} = nothing, 
                 n_bin::Int64     = 50, 
                 bin_type::Symbol = :log) where T <: Matrix{<:Real} --> Tuple{Vector{Float64}, Vector{Float64}}

Calculate the cumulative mass enclosed within a given angular radius $θ$ for a given lens model. While converting the input convergence map into the physical units, it is assumed that source is at infinity (i.e., $a_{\rm dis} = 1$). Hence, if the input convergence is for any finite source redshift, then divide the output mass values by $a_{\rm dis}$.

Arguments

  • kappa: Convergence map.
  • θx : x-grid (in $\rm \mathbf{arcseconds}$).
  • θy : y-grid (in $\rm \mathbf{arcseconds}$).
  • D_d : Angular diameter distance to the lens (in $\rm \mathbf{meters}$).

Keyword Arguments

  • origin = nothing: Center (in $\rm \mathbf{arcseconds}$).
    • If $\rm \mathbf{nothing}$, then the center is set to be the location of the maximum value of the convergence map.
  • n_bin = 50: Number of radial bins.
  • bin_type = :log: Type of radial binning (i.e., :log or :linear).

Returns

  • centers: Radial centers (in $\rm \mathbf{arcseconds}$).
  • mass : Cumulative mass (in $\rm \mathbf{M_\odot}$).
source
LensFactory.Lenses.shear_cartesian2polar — Function
shear_cartesian2polar(γ1::Real, γ2::Real) --> Tuple{Real, Real}

Converts the Cartesian components of the shear (i.e., $γ_1$ and $γ_2$) to polar components (i.e., $γ$ and $φ$) using the relations,

\[\begin{align*} γ &= \sqrt{γ_1^2 + γ_2^2}, \\ φ &= \frac{1}{2} \tan^{-1}\left(\frac{γ_2}{γ_1}\right). \end{align*}\]

Arguments

  • γ1: Cartesian component of the shear (i.e., $γ_1$).
  • γ2: Cartesian component of the shear (i.e., $γ_2$).

Returns

  • γ : Polar component of the shear (i.e., $γ$).
  • φ : Polar component of the shear (i.e., $φ$ in $\rm \mathbf{degrees}$).
source
LensFactory.Lenses.shear_polar2cartesian — Function
shear_polar2cartesian(γ::Real, phi::Real) --> Tuple{Real, Real}

Converts the polar components of the shear (i.e., $γ$ and $φ$) to Cartesian components (i.e., $γ_1$ and $γ_2$) using the relations,

\[\begin{align*} γ_1 &= γ \cos(2φ), \\ γ_2 &= γ \sin(2φ). \end{align*}\]

Arguments

  • γ : Polar component of the shear (i.e., $γ$).
  • φ : Polar component of the shear (i.e., $φ$ in $\rm \mathbf{degrees}$).

Returns

  • γ1: Cartesian component of the shear (i.e., $γ_1$).
  • γ2: Cartesian component of the shear (i.e., $γ_2$).
source
LensFactory.Lenses.ellipticity_cartesian2polar — Function
ellipticity_cartesian2polar(e1::Real, e2::Real) --> Tuple{Real, Real}

Converts the Cartesian components of the ellipticity (i.e., $e_1$ and $e_2$) to polar components (i.e., $e$ and $φ$) using the relations,

\[\begin{align*} e &= \sqrt{e_1^2 + e_2^2}, \\ φ &= \frac{1}{2} \tan^{-1}\left(\frac{e_2}{e_1}\right). \end{align*}\]

Arguments

  • e1: Cartesian component of the ellipticity (i.e., $e_1$).
  • e2: Cartesian component of the ellipticity (i.e., $e_2$).

Returns

  • e : Polar component of the ellipticity (i.e., $e$).
  • φ : Polar component of the ellipticity (i.e., $φ$ in $\rm \mathbf{degrees}$).
source
LensFactory.Lenses.ellipticity_polar2cartesian — Function
ellipticity_polar2cartesian(e::Real, phi::Real) --> Tuple{Real, Real}

Converts the polar components of the ellipticity (i.e., $e$ and $φ$) to Cartesian components (i.e., $e_1$ and $e_2$) using the relations,

\[\begin{align*} e_1 &= e \cos(2φ), \\ e_2 &= e \sin(2φ). \end{align*}\]

Arguments

  • e : Polar component of the ellipticity (i.e., $e$).
  • φ : Polar component of the ellipticity (i.e., $φ$ in $\rm \mathbf{degrees}$).

Returns

  • e1: Cartesian component of the ellipticity (i.e., $e_1$).
  • e2: Cartesian component of the ellipticity (i.e., $e_2$).
source
LensFactory.Lenses.parameter_NFWLens — Function
parameter_NFWLens(; cosmology::Cosmology.AbstractCosmology = nothing, 
                    z_d::Real  = NaN, 
                    mass::Real = NaN, 
                    x_s::Real  = NaN, 
                    c::Real    = NaN) --> NamedTuple

Calculate parameters for NFW lens. The function would either need the concentration c or the scale radius x_s. If both are provided, c will be used to calculate x_s and the input x_s will be overwritten.

Keyword Arguments

  • cosmology = nothing: Cosmology object.
  • z_d = NaN: Redshift of the lens.
  • mass = NaN: Mass of the lens (in $\rm \mathbf{M_\odot}$).
  • x_s = NaN: Scale radius (in $\rm \mathbf{arcseconds}$).
  • c = NaN: Concentration of the lens.

Returns

  • Named tuple of NFW lens parameters.
source
LensFactory.Lenses.parameter_gNFWLens — Function
parameter_gNFWLens(; cosmology::Cosmology.AbstractCosmology = nothing, 
                     z_d::Real  = NaN, 
                     mass::Real = NaN, 
                     x_s::Real  = NaN, 
                     c::Real    = NaN, 
                     n::Real    = 1.0) --> NamedTuple

Calculate parameters for gNFW lens. The function would either need the concentration c or the scale radius x_s. If both are provided, c will be used to calculate x_s and the input x_s will be overwritten.

Keyword Arguments

  • cosmology = nothing: Cosmology object.
  • z_d = NaN: Redshift of the lens.
  • mass = NaN: Mass of the lens (in $\rm \mathbf{M_\odot}$).
  • x_s = NaN: Scale radius (in $\rm \mathbf{arcseconds}$).
  • c = NaN: Concentration of the lens.
  • n = 1.0: Slope parameter of the lens.

Returns

  • Named tuple of gNFW lens parameters.
source
LensFactory.Lenses.parameter_EinastoLens — Function
parameter_EinastoLens(; cosmology::Cosmology.AbstractCosmology=nothing, 
                        z_d::Real  = NaN, 
                        mass::Real = NaN, 
                        x_s::Real  = NaN, 
                        c::Real    = NaN, 
                        n::Real    = 0.2) --> NamedTuple

Calculate parameters of an Einasto lens model. The function would either need the concentration c or the scale radius x_s. If both are provided, c will be used to calculate x_s and the input x_s will be overwritten.

Keyword Arguments

  • cosmology = nothing: Cosmology object.
  • z_d = NaN: Redshift of the lens.
  • mass = NaN: Mass of the lens (in $\rm \mathbf{M_\odot}$).
  • x_s = NaN: Scale radius (in $\rm \mathbf{arcseconds}$).
  • c = NaN: Concentration of the lens.
  • n = 0.2: Slope parameter of the lens.

Returns

  • Named tuple of Einasto lens parameters.
source