lenstronomy.LensModel.LineOfSight.LOSModels package

Submodules

lenstronomy.LensModel.LineOfSight.LOSModels.los module

class LOS(*args, **kwargs)[source]

Bases: object

Class 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}
__init__(*args, **kwargs)[source]
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

set_dynamic()[source]
Returns:

no return, deletes pre-computed variables for certain lens models

lenstronomy.LensModel.LineOfSight.LOSModels.los_minimal module

class LOSMinimal(*args, **kwargs)[source]

Bases: LOS

Class 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}

Module contents