C version - Methods
- class glow.time_domain_c.It_SingleContour_C(Lens, y, p_prec={})
Bases:
ItGeneral_C
Computation for the single contour regime (only one image).
Additional information: theory, default parameters.
(Only new parameters and attributes are documented. See
ItGeneral_C
for the internal information of the parent class)- Parameters:
- p_precdict, optional
Precision parameters. New keys:
parallel
(bool) – Perform the evaluation over \(\tau\)-arrays in parallel.method
(str) – Method for the computation. Options:'standard'
: Parametrize the contours with the angular variable \(\theta\). If it fails, it will automatically switch to'robutst'
.'robust'
: Parametric representation of the contours.
Methods
compute
(tau)Compute \(I(\tau)\).
(subclass defined) Initialize the default parameters.
Find the minimum of the Fermat potential assuming that it is the only critical point.
get_contour
(tau[, n_points])Contour corresponding to a given \(\tau\).
- default_params()
(subclass defined) Initialize the default parameters.
- find_all_images()
Find the minimum of the Fermat potential assuming that it is the only critical point.
An error is raised if more than one critical point is found.
- compute(tau)
Compute \(I(\tau)\).
It includes the step function, \(I(\tau<0)=0\).
- Parameters:
- taufloat
Relative time delay \(\tau\).
- Returns:
- Ifloat
\(I(\tau)\)
- get_contour(tau, n_points=0)
Contour corresponding to a given \(\tau\).
- Parameters:
- taufloat or array
Relative time delay \(\tau\).
- n_pointsint
Number of points in the contour.
- Returns:
- contourarray of dict
The length of the output matches the length of the input
tau
. For each element, the contour is stored as a dictionary with the following entries:'sigma'
: Parameter of the curve.'alpha'
,'R'
: Polar coordinates (centered at the position of the minimum).'x1'
,'x2'
: Cartesian coordinates.
- class glow.time_domain_c.It_SingleIntegral_C(Lens, y, p_prec={})
Bases:
ItGeneral_C
Computation for axisymmetric lenses, solving a single radial integral.
Additional information: theory, default parameters.
(Only new parameters and attributes are documented. See
ItGeneral_C
for the internal information of the parent class)- Parameters:
- p_precdict, optional
Precision parameters. New keys:
parallel
(bool) – Perform the evaluation over \(\tau\)-arrays in parallel.method
(str) – Method for the integral (see the GSL documentation for details). Options:'qng'
: Non-adaptive Gauss-Kronrod integration.'qag15'
: Adaptive 15 point Gauss-Kronrod integration.'qag21'
: Adaptive 21 point Gauss-Kronrod integration.'qag31'
: Adaptive 31 point Gauss-Kronrod integration.'qag41'
: Adaptive 41 point Gauss-Kronrod integration.'qag51'
: Adaptive 51 point Gauss-Kronrod integration.'qag61'
: Adaptive 61 point Gauss-Kronrod integration.'direct'
: Direct integration using theqags
method from GSL, without performing a change of variables to smooth the integrand.
Methods
(subclass defined, optional) Check the input of the implementation.
compute
(tau)Computation of \(I(\tau)\).
(subclass defined) Initialize the default parameters.
Find all the critical points.
get_contour
(tau[, n_points])Compute the contours.
- check_input()
(subclass defined, optional) Check the input of the implementation.
- default_params()
(subclass defined) Initialize the default parameters.
- find_all_images()
Find all the critical points.
- Returns:
- imageslist
Full list of images. The output is stored in
p_crits
, detailed inItGeneral_C
.
- compute(tau)
Computation of \(I(\tau)\).
It includes the step function, \(I(\tau<0)=0\).
- Parameters:
- taufloat or array
Relative time delay \(\tau\).
- Returns:
- Ifloat or array
\(I(\tau)\).
- get_contour(tau, n_points=100)
Compute the contours.
- Parameters:
- taufloat or array
Relative time delay \(\tau\).
- n_pointsint
Number of points in the contours. If it is zero, the contour contains the points used in the integration.
- Returns:
- contourarray of dict
The length of the output matches the length of the input
tau
. For each element, the contours are stored as a dictionary with the following entries:'x1'
,'x2'
: Cartesian coordinates.contour['x1']
is a list of arrays. The length of this list is the number of different contours that contribute to the given \(\tau\).
- class glow.time_domain_c.It_AnalyticSIS_C(y, p_prec={}, psi0=1)
Bases:
ItGeneral_C
Analytic \(I(\tau)\) for the singular isothermal sphere.
Additional information: theory, default parameters.
(Only new parameters and attributes are documented. See
ItGeneral_C
for the internal information of the parent class)- Parameters:
- psi0float
Normalization of the lensing potential \(\psi(x) = \psi_0 x\).
- p_precdict, optional
Precision parameters. New keys:
parallel
(bool) – Perform the evaluation over \(\tau\)-arrays in parallel.
Methods
compute
(tau)Compute \(I(\tau)\).
(subclass defined) Initialize the default parameters.
Compute (analytically) the properties of the images for the SIS.
- default_params()
(subclass defined) Initialize the default parameters.
- find_all_images()
Compute (analytically) the properties of the images for the SIS.
- Returns:
- imageslist
Full list of images. The output is stored in
p_crits
, detailed inItGeneral_C
.
- compute(tau)
Compute \(I(\tau)\).
It includes the step function, \(I(\tau<0)=0\).
- Parameters:
- taufloat or array
Relative time delay \(\tau\).
- Returns:
- Ifloat or array
\(I(\tau)\).
- class glow.time_domain_c.It_AreaIntegral_C(Lens, y, p_prec={})
Bases:
ItGeneral_C
Simple implementation of the binning/grid/area method for the computation of the time-domain integral.
Additional information: theory, default parameters.
(Only new parameters and attributes are documented. See
ItGeneral_C
for the internal information of the parent class)- Parameters:
- p_precdict, optional
Precision parameters. New keys:
tmax
(float) – Maximum \(\tau\) to compute. The upper limit in the radial coordinate \(\rho\) is chosen accordingly.n_rho
(int) – Number of points in the \(\rho\) axis.n_theta
(int) – Number of points in the \(\theta\) axis.
Methods
compute
()Compute \(I(\tau)\).
(subclass defined) Initialize the default parameters.
Warning
This implementation is not heavily optimized, it is only intended for verification. It yields robust, albeit slow and noisy, results for any lens.
- default_params()
(subclass defined) Initialize the default parameters.
- compute()
Compute \(I(\tau)\).
- Returns:
- t0float
Minimum time delay \(t_\text{min}\).
- t_gridarray
Temporal grid \(\tau_i\).
- It_gridarray
Result grid \(I_i=I(\tau_i)\).
- class glow.time_domain_c.It_MultiContour_C(Lens, y, p_prec={})
Bases:
ItGeneral_C
Computation using the contour method for a generic strong lensing scenario.
Additional information: theory, default parameters.
(Only new parameters and attributes are documented. See
ItGeneral_C
for the internal information of the parent class)- Parameters:
- p_precdict, optional
Precision parameters. New keys:
parallel
(bool) – Perform the evaluation over \(\tau\)-arrays in parallel.
- Attributes:
- p_centerslist of dict
Centers of the different families of contours. Keys:
type
(str) – Type of center:'min'
,'max'
: The center of the family of contours is a minimum/maximum of the Fermat potential.'saddle 8 minmin'
,'saddle 8 maxmax'
: The center of the contours is a saddle point, with a critical curve that looks like an 8 and either two minima or two maxima in the lobes.'saddle O min'
,'saddle O max'
: The center of the contours is a saddle point, with a critical curve that looks like a folded 8 (e.g. the standard SIS) and either a minimum or a maximum in the innermost lobe.
x10
,x20
(float) – Location of the center.tau0
,t0
(float) – Time delays \(\tau\) and \(t=\tau + t_\text{min}\) at the center.alpha_out
(float) – Angle with respect to \(x_1\) that is used to search for the right contour (in a straight line out of the center) and start the integration.R_max
(float) – Distance to the last contour contributing in this family, in the direction \(\alpha_\text{out}\).tau_birth
,tau_death
(float) – Minimum and maximum \(\tau\) that the family of contours will contribute to.is_init_birthdeath
(int) – Wheter the contour has been fully initialized (1) or not (0). There must be always one (and only one) center where this variable is 0, since \(R_\text{max}\) and \(\tau_\text{death}\) are not set. This is the outermost family of contours that extends to infinity.
Methods
compute
(tau)Computation of \(I(\tau)\).
(subclass defined) Initialize the default parameters.
Print the information about the centers of the contours in human-readable form.
Find all the critical points.
get_contour
(tau[, n_points])Compute the contours.
get_contour_x1x2
(x10, x20[, sigmaf, n_points])Compute the contour passing by a given point in the lens plane.
Find all the centers of contours.
- default_params()
(subclass defined) Initialize the default parameters.
- display_centers()
Print the information about the centers of the contours in human-readable form.
- find_all_images()
Find all the critical points.
- Returns:
- imageslist
Full list of images. The output is stored in
p_crits
, detailed inItGeneral_C
.
- init_all_centers()
Find all the centers of contours.
- Returns:
- centerslist
Full list of centers. The output is stored in
p_centers
, detailed above.
- compute(tau)
Computation of \(I(\tau)\).
It includes the step function, \(I(\tau<0)=0\).
- Parameters:
- taufloat or array
Relative time delay \(\tau\).
- Returns:
- Ifloat or array
\(I(\tau)\).
- get_contour(tau, n_points=0)
Compute the contours.
- Parameters:
- taufloat or array
Relative time delay \(\tau\).
- n_pointsint
Number of points in the contours. If it is zero, the contour contains the points used in the integration.
- Returns:
- contourarray of dict
The length of the output matches the length of the input
tau
. For each element, the contours are stored as a dictionary with the following entries:'x1'
,'x2'
: Cartesian coordinates.contour['x1']
is a list of arrays. The length of this list is the number of different contours that contribute to the given \(\tau\).'sigma'
: Parameter of the curve.'alpha'
,'R'
: Polar coordinates (with respect to the center of the contour).
- get_contour_x1x2(x10, x20, sigmaf=100, n_points=100)
Compute the contour passing by a given point in the lens plane.
The integration is carried out directly in Cartesian coordinates.
- Parameters:
- x10, x20float or array
Initial position to start the integration.
- sigmaffloat
Maximum parameter of the curve. The contour is computed in the parametric form \(\boldsymbol{x}(\sigma)\) and the integration is carried out from \(\sigma=0\) to \(\sigma=\sigma_f\).
- n_pointsint
Number of points in the contour.
- Returns:
- contourdict
The length of the output matches the length of the input
x10
,x20
. For each element, the contours are stored as a dictionary with the following entries:'sigma'
: Parameter of the curve.'x1'
,'x2'
: Cartesian coordinates.