lenstronomy.LensModel.LineOfSight.LOSModels package¶
Submodules¶
lenstronomy.LensModel.LineOfSight.LOSModels.los module¶
- class LOS(*args, **kwargs)[source]¶
Bases:
objectClass allowing one to add tidal line-of-sight effects (convergence and shear) to single-plane lensing. Stricly speaking, this is not a profile, but when present in list of lens models, it is automatically recognised by ModelAPI(), which sets the flag los_effects to True, and thereby leads LensModel to use SinglePlaneLOS() instead of SinglePlane(). It is however incompatible with MultiPlane().
The key-word arguments are the three line-of-sight convergences, the two components of the three line-of-sight shears, and the three line-of-sight rotations, all defined with the convention of https://arxiv.org/abs/2104.08883: kappa_od, kappa_os, kappa_ds, gamma1_od, gamma2_od, gamma1_os, gamma2_os, gamma1_ds, gamma2_ds, omega_od, omega_os, omega_ds
Because LOS is not a profile, it does not contain the usual functions function(), derivatives(), and hessian(), but rather modifies the behaviour of those functions in the SinglePlaneLOS() class.
Instead, it contains the essential building blocks of this modification.
- param_names = ['kappa_od', 'kappa_os', 'kappa_ds', 'gamma1_od', 'gamma2_od', 'gamma1_os', 'gamma2_os', 'gamma1_ds', 'gamma2_ds', 'omega_od', 'omega_os', 'omega_ds']¶
- lower_limit_default = {'gamma1_ds': -0.5, 'gamma1_od': -0.5, 'gamma1_os': -0.5, 'gamma2_ds': -0.5, 'gamma2_od': -0.5, 'gamma2_os': -0.5, 'kappa_ds': -0.5, 'kappa_od': -0.5, 'kappa_os': -0.5, 'omega_ds': -0.5, 'omega_od': -0.5, 'omega_os': -0.5}¶
- upper_limit_default = {'gamma1_ds': 0.5, 'gamma1_od': 0.5, 'gamma1_os': 0.5, 'gamma2_ds': 0.5, 'gamma2_od': 0.5, 'gamma2_os': 0.5, 'kappa_ds': 0.5, 'kappa_od': 0.5, 'kappa_os': 0.5, 'omega_ds': 0.5, 'omega_od': 0.5, 'omega_os': 0.5}¶
- static distort_vector(x, y, kappa=0, gamma1=0, gamma2=0, omega=0)[source]¶
This function applies a distortion matrix to a vector (x, y) and returns (x’, y’) as follows:
\[ \begin{align}\begin{aligned}\begin{pmatrix} x'\\y' \end{pmatrix} = \begin{pmatrix} 1 - \kappa - \gamma_1 & -\gamma_2 + \omega\\-\gamma_2 - \omega & 1 - \kappa + \gamma_1 \end{pmatrix} \begin{pmatrix} x\\y \end{pmatrix}\end{aligned}\end{align} \]- Parameters:
x – x-component of the vector to which the distortion matrix is applied
y – y-component of the vector to which the distortion matrix is applied
kappa – the convergence
gamma1 – the first shear component
gamma2 – the second shear component
omega – the rotation
- Returns:
the distorted vector
- static left_multiply(f_xx, f_xy, f_yx, f_yy, kappa=0, gamma1=0, gamma2=0, omega=0)[source]¶
Left-multiplies the Hessian matrix of a lens with a distortion matrix with convergence kappa, shear gamma1, gamma2, and rotation omega:
\[ \begin{align}\begin{aligned}\mathsf{H}' = \begin{pmatrix} 1 - \kappa - \gamma_1 & -\gamma_2 + \omega\\-\gamma_2 - \omega & 1 - \kappa + \gamma_1 \end{pmatrix} \mathsf{H}\end{aligned}\end{align} \]- Parameters:
f_xx – the i, i element of the Hessian matrix
f_xy – the i, j element of the Hessian matrix
f_yx – the j, i element of the Hessian matrix
f_yy – the j, j element of the Hessian matrix
kappa – the convergence
gamma1 – the first shear component
gamma2 – the second shear component
omega – the rotation
- Returns:
the Hessian left-multiplied by the distortion matrix
- static right_multiply(f_xx, f_xy, f_yx, f_yy, kappa=0, gamma1=0, gamma2=0, omega=0)[source]¶
Right-multiplies the Hessian matrix of a lens with a distortion matrix with convergence kappa and shear gamma1, gamma2:
\[ \begin{align}\begin{aligned}\mathsf{H}' = \mathsf{H} \begin{pmatrix} 1 - \kappa - \gamma_1 & -\gamma_2 + \omega\\-\gamma_2 - \omega & 1 - \kappa + \gamma_1 \end{pmatrix}\end{aligned}\end{align} \]- Parameters:
f_xx – the i, i element of the Hessian matrix
f_xy – the i, j element of the Hessian matrix
f_yx – the j, i element of the Hessian matrix
f_yy – the j, j element of the Hessian matrix
kappa – the convergence
gamma1 – the first shear component
gamma2 – the second shear component
omega – the rotation
- Returns:
the Hessian right-multiplied by the distortion matrix
- set_static(**kwargs)[source]¶
Pre-computes certain computations that do only relate to the lens model parameters and not to the specific position where to evaluate the lens model.
- Parameters:
kwargs – lens model parameters
- Returns:
no return, for certain lens model some private self variables are initiated
lenstronomy.LensModel.LineOfSight.LOSModels.los_flexion module¶
- class LOSFlexion(*args, **kwargs)[source]¶
Bases:
objectClass allowing one to add line-of-sight effects up to flexion (convergence, shear and type-F and G flexion) to single-plane lensing. As the LOS class, this is not a profile, but when present in list of lens models, it is automatically recognised by ModelAPI(), which sets the flag los_flexion_effects to True, and thereby leads LensModel to use SinglePlaneLOSFlexion() instead of SinglePlane(). It is however incompatible with MultiPlane() just like the LOS class.
The key-word arguments are the three line-of-sight convergences, the two components of the three line-of-sight shears, the two components of the four line-of-sight type-F flexion, and the two components of the four line-of-sight type-G flexion, for a total of 25 real numbers. Those are named as in “Weak lensing of strong lensing: beyond the tidal regime” (Duboscq et al. 2024, 2405.12091): kappa_od, kappa_os, kappa_ds, gamma1_od, gamma2_od, gamma1_os, gamma2_os, gamma1_ds, gamma2_ds, F1_od, F2_od, G1_od, G2_od, F1_os, F2_os, G1_os, G2_os, F1_1ds, F2_1ds, G1_1ds, G2_1ds, F1_2ds, F2_2ds, G1_2ds, G2_2ds. On top of this is added the rotation omega_os, which will serve in the minimal model where it transforms into the non zero omega_los.
Because LOSFlexion is not a profile, it does not contain the usual functions function(), derivatives(), and hessian(), but rather modifies the behaviour of those functions in the SinglePlaneLOS() class.
Instead, it contains the essential building blocks of this modification.
- param_names = ['kappa_od', 'kappa_os', 'kappa_ds', 'gamma1_od', 'gamma2_od', 'gamma1_os', 'gamma2_os', 'gamma1_ds', 'gamma2_ds', 'F1_od', 'F2_od', 'G1_od', 'G2_od', 'F1_os', 'F2_os', 'G1_os', 'G2_os', 'F1_1ds', 'F2_1ds', 'G1_1ds', 'G2_1ds', 'F1_2ds', 'F2_2ds', 'G1_2ds', 'G2_2ds', 'omega_os']¶
- lower_limit_default = {'F1_1ds': -0.5, 'F1_2ds': -0.5, 'F1_od': -0.5, 'F1_os': -0.5, 'F2_1ds': -0.5, 'F2_2ds': -0.5, 'F2_od': -0.5, 'F2_os': -0.5, 'G1_1ds': -0.5, 'G1_2ds': -0.5, 'G1_od': -0.5, 'G1_os': -0.5, 'G2_1ds': -0.5, 'G2_2ds': -0.5, 'G2_od': -0.5, 'G2_os': -0.5, 'gamma1_ds': -0.5, 'gamma1_od': -0.5, 'gamma1_os': -0.5, 'gamma2_ds': -0.5, 'gamma2_od': -0.5, 'gamma2_os': -0.5, 'kappa_ds': -0.5, 'kappa_od': -0.5, 'kappa_os': -0.5, 'omega_os': -0.5}¶
- upper_limit_default = {'F1_1ds': 0.5, 'F1_2ds': 0.5, 'F1_od': 0.5, 'F1_os': 0.5, 'F2_1ds': 0.5, 'F2_2ds': 0.5, 'F2_od': 0.5, 'F2_os': 0.5, 'G1_1ds': 0.5, 'G1_2ds': 0.5, 'G1_od': 0.5, 'G1_os': 0.5, 'G2_1ds': 0.5, 'G2_2ds': 0.5, 'G2_od': 0.5, 'G2_os': 0.5, 'gamma1_ds': 0.5, 'gamma1_od': 0.5, 'gamma1_os': 0.5, 'gamma2_ds': 0.5, 'gamma2_od': 0.5, 'gamma2_os': 0.5, 'kappa_ds': 0.5, 'kappa_od': 0.5, 'kappa_os': 0.5, 'omega_os': 0.5}¶
- set_static(**kwargs)[source]¶
Pre-computes certain computations that do only relate to the lens model parameters and not to the specific position where to evaluate the lens model.
- Parameters:
kwargs – lens model parameters
- Returns:
no return, for certain lens model some private self variables are initiated
lenstronomy.LensModel.LineOfSight.LOSModels.los_flexion_minimal module¶
- class LOSFlexionMinimal(*args, **kwargs)[source]¶
Bases:
LOSFlexionClass deriving from LOSFlexion containing the parameters for line-of-sight corrections within the “minimal model” defined in “Weak lensing of strong lensing:
beyond the tidal regime” (Duboscq et al. 2024, 2405.12091). It is equivalent to LOSFlexion but with fewer parameters (19), namely: kappa_od, gamma1_od, gamma2_od, F1_od, F2_od, G1_od, G2_od, kappa_los, gamma1_los, gamma2_los, F1_los, F2_los, G1_los, G2_los, F1_1los, F2_1los, G1_1los, G2_1los, omega_los.
- param_names = ['kappa_od', 'gamma1_od', 'gamma2_od', 'F1_od', 'F2_od', 'G1_od', 'G2_od', 'kappa_los', 'gamma1_los', 'gamma2_los', 'F1_los', 'F2_los', 'G1_los', 'G2_los', 'F1_1los', 'F2_1los', 'G1_1los', 'G2_1los', 'omega_los']¶
- lower_limit_default = {'F1_1los': -0.5, 'F1_los': -0.5, 'F1_od': -0.5, 'F2_1los': -0.5, 'F2_los': -0.5, 'F2_od': -0.5, 'G1_1los': -0.5, 'G1_los': -0.5, 'G1_od': -0.5, 'G2_1los': -0.5, 'G2_los': -0.5, 'G2_od': -0.5, 'gamma1_los': -0.5, 'gamma1_od': -0.5, 'gamma2_los': -0.5, 'gamma2_od': -0.5, 'kappa_los': -0.5, 'kappa_od': -0.5, 'omega_los': -0.5}¶
- upper_limit_default = {'F1_1los': 0.5, 'F1_los': 0.5, 'F1_od': 0.5, 'F2_1los': 0.5, 'F2_los': 0.5, 'F2_od': 0.5, 'G1_1los': 0.5, 'G1_los': 0.5, 'G1_od': 0.5, 'G2_1los': 0.5, 'G2_los': 0.5, 'G2_od': 0.5, 'gamma1_los': 0.5, 'gamma1_od': 0.5, 'gamma2_los': 0.5, 'gamma2_od': 0.5, 'kappa_los': 0.5, 'kappa_od': 0.5, 'omega_los': 0.5}¶
lenstronomy.LensModel.LineOfSight.LOSModels.los_minimal module¶
- class LOSMinimal(*args, **kwargs)[source]¶
Bases:
LOSClass deriving from LOS containing the parameters for line-of-sight corrections within the “minimal model” defined in https://arxiv.org/abs/2104.08883 It is equivalent to LOS but with fewer parameters, namely: kappa_od, gamma1_od, gamma2_od, omega_od, kappa_los, gamma1_los, gamma2_los, omega_los.
- param_names = ['kappa_od', 'gamma1_od', 'gamma2_od', 'omega_od', 'kappa_los', 'gamma1_los', 'gamma2_los', 'omega_los']¶
- lower_limit_default = {'gamma1_los': -0.5, 'gamma1_od': -0.5, 'gamma2_los': -0.5, 'gamma2_od': -0.5, 'kappa_los': -0.5, 'kappa_od': -0.5, 'omega_los': -0.5, 'omega_od': -0.5}¶
- upper_limit_default = {'gamma1_los': 0.5, 'gamma1_od': 0.5, 'gamma2_los': 0.5, 'gamma2_od': 0.5, 'kappa_los': 0.5, 'kappa_od': 0.5, 'omega_los': 0.5, 'omega_od': 0.5}¶