Constants

Gravity.default_cosmologyConstant

Default cosmological model.

It is currently set with cosmological parameters h = 0.6766, Ωₘ = 0.3111, Ωᵥ = 0.6888086103884988, and Ωᵣ = 9.13896115012328e-5

source
Gravity.TCosmoType

Constant identifying the type to be used for cosmological-related quantities.

Can be a concrete type, or the symbol :same, indicating that the type of the quantities should be computed using the usual promotion rules. Note that, in this case, the use of forward-mode automatic differentiation (AD) can lead to the use of a dual type for the cosmological-related quantities. This might be not what one wants, unless one is also performing inference on the cosmological parameters or on the redshifts of the objects.

Warning

Currently it is not recommended to use :same for this constant, since ForwardDiff has a bug that prevents the differentiation of the QuadGK function, used in many integrals to compute the comoving distance.

source
Gravity.default_lens_inversionConstant

Lens inversion methods and associated parameters

A dictionary in the form OrderedDict(method1 => parameters1, method2 => parameters2...).

The various methods are tried in sequence when inverting the lens equation with lensunmap or lensunmapdistortion, with the specified maximum number of iterations.

Currently, the following methods can be used

  • newton: An advanced Newton-Raphson implementation. Requires the use of derivatives (the Jacobian of the lensing equation), but can deal with singular Jacobian matrices.

  • broyden: Broyden's algorithm, a a quasi-Newton method that does not require derivatives. It is generally less stable and often slower than Newton's method, but is less affected by singular solutions.

  • klement: An algorithm based on Klement (2014). Does not require derivatives but is often slower and less performant than Broyden's one.

The special algorithm success can be used as last key to prevent convergence errors.

The recognized parameters are

  • maxiters: the maximum number of iterations (default: 100);

  • xtol: termination condition applied to position updates; if an update is smaller than xtol, the lens inversion stops (default: eps(Float64)^0.4, approximately 5.477e-7);

  • ftol: termination condition for function updates (default: nothing, indicating that no termination condition on function updates is used);

  • trustregion: a positive number, indicating the maximum ratio between size of the position correction (|δx|) and the error on the source plane (|δy|), squared: $|\delta x|^2 \le \tt{trustregion} \cdot |\delta y|^2$. If set to nothing (the default), the algorithm is unconstrained

source
Gravity.angular_unitConstant

The angular unit, in dimensional arcseconds.

Entered coordinates will be taken to be in units of this quantity. The default value is angular_unit = 1.0u"arcsecond". This value is used to convert between angular and pixel positions, and to compute the time delay between images.

Warning

This value should never be modified directly, since it is connected to many other constants. Please use Gravity.set_angular_unit to change its value.

source
Gravity.set_angular_unitFunction
set_angular_unit(value; force=false)

Change the angular_unit value and all related quantities.

This function should be called to set the size of the angular_unit before any other calculation is carried out. The specified value should be entered either as a quantity with units, using Unitful and UnitfulAngles, or as a float indicating the angular_unit in radians.

If the force keyword is false (the default) the procedure checks if the angular_unit is identical to value and, in case it is, it skip setting the connected variables pixel2angle, angle2pixel, sisfactor, and timedelayfactor.

Example

```julia-repl julia> using Unitfull, UnitfulAngles

julia> setangularunit(0.2u"arcsecond") 0.2 ″

julia> setangularunit(π/180/3600) 1.0 ″

source
Gravity.timedelayfactorConstant

A constant to convert a dimensionless timedelay into days

Defined as

timedelayfactor = (angular_unit^2 * 1.0u"Mpc" / Unitful.c0 |> u"d") / u"d"

Hence, it is assumed that distances are measured in Mpc, angles in units of angular_unit, and that the resulting time delay will be in units of days.

Warning

This value should never be modified directly, since it is connected to many other constants. Please use Gravity.set_angular_unit to change its value.

source
Gravity.sisfactorConstant

A factor entering the equations for a singular isothermal sphere.

Defined as

sisfactor = 4π * angle2pixel / 299792.458^2

It is essentially the Einstein radius in pixels associated to a SIS model with velocity dispersion of 1 km/s.

Warning

This value should never be modified directly, since it is connected to many other constants. Please use Gravity.set_angular_unit to change its value.

source
Gravity.flatsourcepriorsConstant

Flag to force the use of flat priors for the sources.

If set to true, all source parameters will use flat improper priors for all parameters. This only applies to sourceplane or to simplified-imageplane schemes. If set to false, the priors will be Gaussian, with the exception of the source ellipticities, which will use a Wishart prior.

By default this variable is false. This way sourceplane and imageplane analyses should return the compatible results, since the priors will be the same.

source
Gravity.slope_numbercountsConstant

Logarithmic slope of the number counts.

Used for magnitude inference. It is defined as the exponent α of the power law

dN/dm ∝ exp(α m) = 10^(α m / log(10)

where m is the magnitude. The default value is zero.

The standard Hubble power law for number counts requires α = 0.6 log(10).

source
Gravity.use_threadsConstant

Use threads for internal calculations.

An integer used as a bitmask for threads usage. Can be any | (or) combination of the following constants:

  • THREADS_GRID: Use threads for grid calculations
  • THREADS_IMAGEPLANE: Use threads for the calculations of the lens mapping of different sources in an imageplane
  • THREADS_LENSUNMAP: Use threads for the inversion of the lens equation of different sources
  • THREADS_XSOURCES: Use threads for the individual pixels of extended sources
  • THREADS_BLAS: Use threads for BLAS matrix operations
  • THREADS_SAMPLING: Use threads for MCMC sampling
  • THREADS_DEFAULT: Use threads for extended source and MCMC calculations: equivalent to THREADS_SAMPLING
  • THREADS_ALWAYS: equivalent to all options above summed

Additionally, if CUDA is available, the following constants can also be used:

  • THREADS_CUDA_GRID: Use CUDA threads for grid calculations
  • THREADS_CUDA_XSOURCES: Use CUDA threads for extended sources

By default this variable is set to THREADS_DEFAULT = THREADS_SAMPLING.

source