lenstronomy.LensModel.LineOfSight package

Subpackages

Submodules

lenstronomy.LensModel.LineOfSight.single_plane_los module

class SinglePlaneLOS(lens_model_list, index_los, numerical_alpha_class=None, lens_redshift_list=None, z_source_convention=None, kwargs_interp=None, kwargs_synthesis=None)[source]

Bases: SinglePlane

This class is based on the ‘SinglePlane’ class, modified to include line-of-sight effects as presented by Fleury et al. in 2104.08883.

Are modified: - init (to include a new attribute, self.los) - fermat potential - alpha - hessian

Are unchanged (inherited from SinglePlane): - ray_shooting, because it calls the modified alpha - mass_2d, mass_3d, density which refer to the main lens without LOS corrections.

__init__(lens_model_list, index_los, numerical_alpha_class=None, lens_redshift_list=None, z_source_convention=None, kwargs_interp=None, kwargs_synthesis=None)[source]

Instance of SinglePlaneLOS() based on the SinglePlane(), except: - argument “index_los” indicating the position of the LOS model in the lens_model_list (for correct association with kwargs) - attribute “los” containing the LOS model. :param kwargs_synthesis: keyword arguments for the ‘SYNTHESIS’ lens model, if applicable

split_lens_los(kwargs)[source]

This function splits the list of key-word arguments given to the lens model into those that correspond to the lens itself (kwargs_main), and those that correspond to the line-of-sight corrections (kwargs_los).

Parameters:

kwargs – the list of key-word arguments passed to lenstronomy

Returns:

a list of kwargs corresponding to the lens and a list of kwargs corresponding to the LOS effects

fermat_potential(x_image, y_image, kwargs_lens, x_source=None, y_source=None, k=None)[source]

Calculates the Fermat Potential with LOS corrections in the tidal regime.

Parameters:
  • x_image – image position

  • y_image – image position

  • x_source – source position

  • y_source – source position

  • kwargs_lens – list of keyword arguments of lens model parameters matching the lens model classes

Returns:

fermat potential in arcsec**2 as a list

alpha(x, y, kwargs, k=None)[source]

Displacement angle including the line-of-sight corrections.

Parameters:
  • x (numpy array) – x-position (preferentially arcsec)

  • y (numpy array) – y-position (preferentially arcsec)

  • kwargs – list of keyword arguments of lens model parameters matching the lens model classes, including line-of-sight corrections

  • k – only evaluate the k-th lens model

Returns:

deflection angles in units of arcsec

hessian(x, y, kwargs, k=None)[source]

Hessian matrix.

Parameters:
  • x (numpy array) – x-position (preferentially arcsec)

  • y (numpy array) – y-position (preferentially arcsec)

  • kwargs – list of keyword arguments of lens model parameters matching the lens model classes

  • k – only evaluate the k-th lens model

Returns:

f_xx, f_xy, f_yx, f_yy components

mass_3d(r, kwargs, bool_list=None)[source]

Computes the mass within a 3d sphere of radius r for the main lens only

Parameters:
  • r – radius (in angular units)

  • kwargs – list of keyword arguments of lens model parameters matching the lens model classes

  • bool_list – list of bools that are part of the output

Returns:

mass (in angular units, modulo epsilon_crit)

mass_2d(r, kwargs, bool_list=None)[source]

Computes the mass enclosed a projected (2d) radius r for the main lens only

The mass definition is such that:

\[\alpha = mass_2d / r / \pi\]

with alpha is the deflection angle

Parameters:
  • r – radius (in angular units)

  • kwargs – list of keyword arguments of lens model parameters matching the lens model classes

  • bool_list – list of bools that are part of the output

Returns:

projected mass (in angular units, modulo epsilon_crit)

density(r, kwargs, bool_list=None)[source]

3d mass density at radius r for the main lens only The integral in the LOS projection of this quantity results in the convergence quantity.

Parameters:
  • r – radius (in angular units)

  • kwargs – list of keyword arguments of lens model parameters matching the lens model classes

  • bool_list – list of bools that are part of the output

Returns:

mass density at radius r (in angular units, modulo epsilon_crit)

potential(x, y, kwargs, k=None)[source]

Lensing potential of the main lens only In the presence of LOS corrections, the system generally does not admit a potential, in the sense that the curl of alpha is generally non-zero.

Parameters:
  • x (numpy array) – x-position (preferentially arcsec)

  • y (numpy array) – y-position (preferentially arcsec)

  • kwargs – list of keyword arguments of lens model parameters matching the lens model classes

  • k – only evaluate the k-th lens model

Returns:

lensing potential in units of arcsec^2

Module contents