Constants
Gravity.default_cosmology — Constant
Default cosmological model.
It is currently set with cosmological parameters h = 0.6766, Ωₘ = 0.3111, Ωᵥ = 0.6888086103884988, and Ωᵣ = 9.13896115012328e-5
Gravity.TCosmo — Type
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.
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.
Gravity.default_lens_inversion — Constant
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 thanxtol, 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 tonothing(the default), the algorithm is unconstrained
Gravity.angular_unit — Constant
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.
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.
Gravity.pixel2angle — Constant
The conversion factor from a pixel position into an angular one.
Defined as
pixel2angle = angular_unit |> NoUnitsso that, in practice, pixel positions are taken to be in units of angular_unit and angles are taken to be in radians.
See also angular_unit, angle2pixel, and set_angular_unit.
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.
Gravity.angle2pixel — Constant
The conversion factor from an angular position into a pixel one.
Defined as
angle2pixel = 1.0 / pixel2angleSee also angular_unit, pixel2angle, and set_angular_unit.
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.
Gravity.set_angular_unit — Function
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 ″
Gravity.timedelayfactor — Constant
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.
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.
Gravity.sisfactor — Constant
A factor entering the equations for a singular isothermal sphere.
Defined as
sisfactor = 4π * angle2pixel / 299792.458^2It is essentially the Einstein radius in pixels associated to a SIS model with velocity dispersion of 1 km/s.
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.
Gravity.flatsourcepriors — Constant
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.
Gravity.slope_numbercounts — Constant
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).
Gravity.use_threads — Constant
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 calculationsTHREADS_IMAGEPLANE: Use threads for the calculations of the lens mapping of different sources in an imageplaneTHREADS_LENSUNMAP: Use threads for the inversion of the lens equation of different sourcesTHREADS_XSOURCES: Use threads for the individual pixels of extended sourcesTHREADS_BLAS: Use threads for BLAS matrix operationsTHREADS_SAMPLING: Use threads for MCMC samplingTHREADS_DEFAULT: Use threads for extended source and MCMC calculations: equivalent toTHREADS_SAMPLINGTHREADS_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 calculationsTHREADS_CUDA_XSOURCES: Use CUDA threads for extended sources
By default this variable is set to THREADS_DEFAULT = THREADS_SAMPLING.
Gravity.reset_defaults — Function
Reset all configuration variables to their default values.
This function will reset the values of the following variables:
angular_unitand all related quantities