lenstronomy.LensModel package — lenstronomy 1.9.1 documentation

# lenstronomy.LensModel package

## Subpackages

- lenstronomy.LensModel.LightConeSim package
  - Submodules
  - lenstronomy.LensModel.LightConeSim.light_cone module
  - Module contents
- lenstronomy.LensModel.MultiPlane package
  - Submodules
  - lenstronomy.LensModel.MultiPlane.multi_plane module
  - lenstronomy.LensModel.MultiPlane.multi_plane_base module
  - Module contents
- lenstronomy.LensModel.Profiles package
  - Submodules
  - lenstronomy.LensModel.Profiles.arc_perturbations module
  - lenstronomy.LensModel.Profiles.base_profile module
  - lenstronomy.LensModel.Profiles.chameleon module
  - lenstronomy.LensModel.Profiles.cnfw module
  - lenstronomy.LensModel.Profiles.cnfw_ellipse module
  - lenstronomy.LensModel.Profiles.const_mag module
  - lenstronomy.LensModel.Profiles.constant_shift module
  - lenstronomy.LensModel.Profiles.convergence module
  - lenstronomy.LensModel.Profiles.coreBurkert module
  - lenstronomy.LensModel.Profiles.cored_density module
  - lenstronomy.LensModel.Profiles.cored_density_2 module
  - lenstronomy.LensModel.Profiles.cored_density_exp module
  - lenstronomy.LensModel.Profiles.cored_density_mst module
  - lenstronomy.LensModel.Profiles.curved_arc_const module
  - lenstronomy.LensModel.Profiles.curved_arc_sis_mst module
  - lenstronomy.LensModel.Profiles.curved_arc_spp module
  - lenstronomy.LensModel.Profiles.curved_arc_spt module
  - lenstronomy.LensModel.Profiles.curved_arc_tan_diff module
  - lenstronomy.LensModel.Profiles.dipole module
  - lenstronomy.LensModel.Profiles.elliptical_density_slice module
  - lenstronomy.LensModel.Profiles.epl module
  - lenstronomy.LensModel.Profiles.epl_numba module
  - lenstronomy.LensModel.Profiles.flexion module
  - lenstronomy.LensModel.Profiles.flexionfg module
  - lenstronomy.LensModel.Profiles.gauss_decomposition module
  - lenstronomy.LensModel.Profiles.gaussian_ellipse_kappa module
  - lenstronomy.LensModel.Profiles.gaussian_ellipse_potential module
  - lenstronomy.LensModel.Profiles.gaussian_kappa module
  - lenstronomy.LensModel.Profiles.gaussian_potential module
  - lenstronomy.LensModel.Profiles.hernquist module
  - lenstronomy.LensModel.Profiles.hernquist_ellipse module
  - lenstronomy.LensModel.Profiles.hessian module
  - lenstronomy.LensModel.Profiles.interpol module
  - lenstronomy.LensModel.Profiles.multi_gaussian_kappa module
  - lenstronomy.LensModel.Profiles.multipole module
  - lenstronomy.LensModel.Profiles.nfw module
  - lenstronomy.LensModel.Profiles.nfw_ellipse module
  - lenstronomy.LensModel.Profiles.nfw_mass_concentration module
  - lenstronomy.LensModel.Profiles.nfw_vir_trunc module
  - lenstronomy.LensModel.Profiles.nie module
  - lenstronomy.LensModel.Profiles.nie_potential module
  - lenstronomy.LensModel.Profiles.numerical_deflections module
  - lenstronomy.LensModel.Profiles.p_jaffe module
  - lenstronomy.LensModel.Profiles.p_jaffe_ellipse module
  - lenstronomy.LensModel.Profiles.pemd module
  - lenstronomy.LensModel.Profiles.point_mass module
  - lenstronomy.LensModel.Profiles.sersic module
  - lenstronomy.LensModel.Profiles.sersic_ellipse_kappa module
  - lenstronomy.LensModel.Profiles.sersic_ellipse_potential module
  - lenstronomy.LensModel.Profiles.sersic_utils module
  - lenstronomy.LensModel.Profiles.shapelet_pot_cartesian module
  - lenstronomy.LensModel.Profiles.shapelet_pot_polar module
  - lenstronomy.LensModel.Profiles.shear module
  - lenstronomy.LensModel.Profiles.sie module
  - lenstronomy.LensModel.Profiles.sis module
  - lenstronomy.LensModel.Profiles.sis_truncate module
  - lenstronomy.LensModel.Profiles.spemd module
  - lenstronomy.LensModel.Profiles.spep module
  - lenstronomy.LensModel.Profiles.splcore module
  - lenstronomy.LensModel.Profiles.spp module
  - lenstronomy.LensModel.Profiles.tnfw module
  - lenstronomy.LensModel.Profiles.uldm module
  - Module contents
- lenstronomy.LensModel.QuadOptimizer package
  - Submodules
  - lenstronomy.LensModel.QuadOptimizer.multi_plane_fast module
  - lenstronomy.LensModel.QuadOptimizer.optimizer module
  - lenstronomy.LensModel.QuadOptimizer.param_manager module
  - Module contents
- lenstronomy.LensModel.Solver package
  - Submodules
  - lenstronomy.LensModel.Solver.lens_equation_solver module
  - lenstronomy.LensModel.Solver.solver module
  - lenstronomy.LensModel.Solver.solver2point module
  - lenstronomy.LensModel.Solver.solver4point module
  - Module contents

## Submodules

## lenstronomy.LensModel.convergence_integrals module

`lenstronomy.LensModel.convergence_integrals.` `potential_from_kappa_grid`(kappa, grid_spacing)

  lensing potential on the convergence grid the computation is performed as a convolution of the Green’s function with the convergence map using FFT

  Parameters: | kappa – 2d grid of convergence values grid_spacing – pixel size of grid
  Returns: | lensing potential in a 2d grid at positions x_grid, y_grid

`lenstronomy.LensModel.convergence_integrals.` `potential_from_kappa_grid_adaptive`(kappa_high_res, grid_spacing, low_res_factor, high_res_kernel_size)

  lensing potential on the convergence grid the computation is performed as a convolution of the Green’s function with the convergence map using FFT

  Parameters: | kappa_high_res – 2d grid of convergence values grid_spacing – pixel size of grid low_res_factor – lower resolution factor of larger scale kernel. high_res_kernel_size – int, size of high resolution kernel in units of degraded pixels
  Returns: | lensing potential in a 2d grid at positions x_grid, y_grid

`lenstronomy.LensModel.convergence_integrals.` `deflection_from_kappa_grid`(kappa, grid_spacing)

  deflection angles on the convergence grid the computation is performed as a convolution of the Green’s function with the convergence map using FFT

  Parameters: | kappa – convergence values for each pixel (2-d array) grid_spacing – pixel size of grid
  Returns: | numerical deflection angles in x- and y- direction

`lenstronomy.LensModel.convergence_integrals.` `deflection_from_kappa_grid_adaptive`(kappa_high_res, grid_spacing, low_res_factor, high_res_kernel_size)

  deflection angles on the convergence grid with adaptive FFT the computation is performed as a convolution of the Green’s function with the convergence map using FFT The grid is returned in the lower resolution grid

  Parameters: | kappa_high_res – convergence values for each pixel (2-d array) grid_spacing – pixel size of high resolution grid low_res_factor – lower resolution factor of larger scale kernel. high_res_kernel_size – int, size of high resolution kernel in units of degraded pixels
  Returns: | numerical deflection angles in x- and y- direction

`lenstronomy.LensModel.convergence_integrals.` `potential_kernel`(num_pix, delta_pix)

  numerical gridded integration kernel for convergence to lensing kernel with given pixel size

  Parameters: | num_pix – integer; number of pixels of kernel per axis delta_pix – pixel size (per dimension in units of angle)
  Returns: | kernel for lensing potential

`lenstronomy.LensModel.convergence_integrals.` `deflection_kernel`(num_pix, delta_pix)

  numerical gridded integration kernel for convergence to deflection angle with given pixel size

  Parameters: | num_pix – integer; number of pixels of kernel per axis, should be odd number to have a defined center delta_pix – pixel size (per dimension in units of angle)
  Returns: | kernel for x-direction and kernel of y-direction deflection angles

## lenstronomy.LensModel.lens_model module

class `lenstronomy.LensModel.lens_model.` `LensModel`(lens_model_list, z_lens=None, z_source=None, lens_redshift_list=None, cosmo=None, multi_plane=False, numerical_alpha_class=None, observed_convention_index=None, z_source_convention=None, cosmo_interp=False, z_interp_stop=None, num_z_interp=100, kwargs_interp=None)

  Bases: `object`

  class to handle an arbitrary list of lens models. This is the main lenstronomy LensModel API for all other modules.

  `alpha`(x, y, kwargs, k=None, diff=None)

    deflection angles

    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 diff – None or float. If set, computes the deflection as a finite numerical differential of the lensing potential. This differential is only applicable in the single lensing plane where the form of the lensing potential is analytically known
    Returns: | deflection angles in units of arcsec

  `arrival_time`(x_image, y_image, kwargs_lens, kappa_ext=0)

    Parameters: | x_image – image position y_image – image position kwargs_lens – lens model parameter keyword argument list kappa_ext – external convergence contribution not accounted in the lens model that leads to the same observables in position and relative fluxes but rescales the time delays
    Returns: | arrival time of image positions in units of days

  `curl`(x, y, kwargs, k=None, diff=None, diff_method='square')

    curl computation F_xy - F_yx

    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 diff – float, scale over which the finite numerical differential is computed. If None, then using the exact (if available) differentials. diff_method – string, ‘square’ or ‘cross’, indicating whether finite differentials are computed from a cross or a square of points around (x, y)
    Returns: | curl at position (x, y)

  `fermat_potential`(x_image, y_image, kwargs_lens, x_source=None, y_source=None)

    fermat potential (negative sign means earlier arrival time) for Multi-plane lensing, it computes the effective Fermat potential (derived from the arrival time and subtracted off the time-delay distance for the given cosmology). The units are given in arcsecond square.

    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 without geometry term (second part of Eqn 1 in Suyu et al. 2013) as a list

  `flexion`(x, y, kwargs, k=None, diff=1e-06, hessian_diff=True)

    third derivatives (flexion)

    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 – int or None, if set, only evaluates the differential from one model component diff – numerical differential length of Flexion hessian_diff – boolean, if true also computes the numerical differential length of Hessian (optional)
    Returns: | f_xxx, f_xxy, f_xyy, f_yyy

  `gamma`(x, y, kwargs, k=None, diff=None, diff_method='square')

    shear computation g1 = 1/2(d^2phi/dx^2 - d^2phi/dy^2) g2 = d^2phi/dxdy

    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 diff – float, scale over which the finite numerical differential is computed. If None, then using the exact (if available) differentials. diff_method – string, ‘square’ or ‘cross’, indicating whether finite differentials are computed from a cross or a square of points around (x, y)
    Returns: | gamma1, gamma2

  `hessian`(x, y, kwargs, k=None, diff=None, diff_method='square')

    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 diff – float, scale over which the finite numerical differential is computed. If None, then using the exact (if available) differentials. diff_method – string, ‘square’ or ‘cross’, indicating whether finite differentials are computed from a cross or a square of points around (x, y)
    Returns: | f_xx, f_xy, f_yx, f_yy components

  `kappa`(x, y, kwargs, k=None, diff=None, diff_method='square')

    lensing convergence k = 1/2 laplacian(phi)

    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 diff – float, scale over which the finite numerical differential is computed. If None, then using the exact (if available) differentials. diff_method – string, ‘square’ or ‘cross’, indicating whether finite differentials are computed from a cross or a square of points around (x, y)
    Returns: | lensing convergence

  `magnification`(x, y, kwargs, k=None, diff=None, diff_method='square')

    mag = 1/det(A) A = 1 - d^2phi/d_ij

    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 diff – float, scale over which the finite numerical differential is computed. If None, then using the exact (if available) differentials. diff_method – string, ‘square’ or ‘cross’, indicating whether finite differentials are computed from a cross or a square of points around (x, y)
    Returns: | magnification

  `potential`(x, y, kwargs, k=None)

    lensing potential

    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

  `ray_shooting`(x, y, kwargs, k=None)

    maps image to source position (inverse deflection)

    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: | source plane positions corresponding to (x, y) in the image plane

  `set_dynamic`()

    deletes cache for static setting and makes sure the observed convention in the position of lensing profiles in the multi-plane setting is enabled. Dynamic is the default setting of this class enabling an accurate computation of lensing quantities with different parameters in the lensing profiles.

    Returns: | None

  `set_static`(kwargs)

    set this instance to a static lens model. This can improve the speed in evaluating lensing quantities at different positions but must not be used with different lens model parameters!

    Parameters: | kwargs – lens model keyword argument list
    Returns: | kwargs_updated (in case of image position convention in multiplane lensing this is changed)

## lenstronomy.LensModel.lens_model_extensions module

class `lenstronomy.LensModel.lens_model_extensions.` `LensModelExtensions`(lensModel)

  Bases: `object`

  class with extension routines not part of the LensModel core routines

  `critical_curve_caustics`(kwargs_lens, compute_window=5, grid_scale=0.01, center_x=0, center_y=0)

    Parameters: | kwargs_lens – lens model kwargs compute_window – window size in arcsec where the critical curve is computed grid_scale – numerical grid spacing of the computation of the critical curves center_x – float, center of the window to compute critical curves and caustics center_y – float, center of the window to compute critical curves and caustics
    Returns: | lists of ra and dec arrays corresponding to different disconnected critical curves and their caustic counterparts

  `critical_curve_tiling`(kwargs_lens, compute_window=5, start_scale=0.5, max_order=10, center_x=0, center_y=0)

    Parameters: | kwargs_lens – lens model keyword argument list compute_window – total window in the image plane where to search for critical curves start_scale – float, angular scale on which to start the tiling from (if there are two distinct curves in a region, it might only find one. max_order – int, maximum order in the tiling to compute critical curve triangles center_x – float, center of the window to compute critical curves and caustics center_y – float, center of the window to compute critical curves and caustics
    Returns: | list of positions representing coordinates of the critical curve (in RA and DEC)

  `curved_arc_estimate`(x, y, kwargs_lens, smoothing=None, smoothing_3rd=0.001, tan_diff=False)

    performs the estimation of the curved arc description at a particular position of an arbitrary lens profile

    Parameters: | x – float, x-position where the estimate is provided y – float, y-position where the estimate is provided kwargs_lens – lens model keyword arguments smoothing – (optional) finite differential of second derivative (radial and tangential stretches) smoothing_3rd – differential scale for third derivative to estimate the tangential curvature tan_diff – boolean, if True, also returns the relative tangential stretch differential in tangential direction
    Returns: | keyword argument list corresponding to a CURVED_ARC profile at (x, y) given the initial lens model

  `curved_arc_finite_area`(x, y, kwargs_lens, dr)

    computes an estimated curved arc over a finite extent mimicking the appearance of a finite source with radius dr

    Parameters: | x – x-position (float) y – y-position (float) kwargs_lens – lens model keyword argument list dr – radius of finite source
    Returns: | keyword arguments of curved arc

  `hessian_eigenvectors`(x, y, kwargs_lens, diff=None)

    computes magnification eigenvectors at position (x, y)

    Parameters: | x – x-position y – y-position kwargs_lens – lens model keyword arguments
    Returns: | radial stretch, tangential stretch

  `magnification_finite`(x_pos, y_pos, kwargs_lens, source_sigma=0.003, window_size=0.1, grid_number=100, polar_grid=False, aspect_ratio=0.5)

    returns the magnification of an extended source with Gaussian light profile :param x_pos: x-axis positons of point sources :param y_pos: y-axis position of point sources :param kwargs_lens: lens model kwargs :param source_sigma: Gaussian sigma in arc sec in source :param window_size: size of window to compute the finite flux :param grid_number: number of grid cells per axis in the window to numerically compute the flux :return: numerically computed brightness of the sources

  `magnification_finite_adaptive`(x_image, y_image, source_x, source_y, kwargs_lens, source_fwhm_parsec, z_source, cosmo=None, grid_resolution=None, grid_radius_arcsec=None, axis_ratio=0.5, tol=0.001, step_size=0.05, use_largest_eigenvalue=True, source_light_model='SINGLE_GAUSSIAN', dx=None, dy=None, size_scale=None, amp_scale=None, fixed_aperture_size=False)

    This method computes image magnifications with a finite-size background source assuming a Gaussian or a double Gaussian source light profile. It can be much faster that magnification_finite for lens models with many deflectors and a compact source. This is because most pixels in a rectangular window around a lensed image of a compact source do not map onto the source, and therefore don’t contribute to the integrated flux in the image plane.

    Rather than ray tracing through a rectangular grid, this routine accelerates the computation of image magnifications with finite-size sources by ray tracing through an elliptical region oriented such that tracks the surface brightness of the lensed image. The aperture size is initially quite small, and increases in size until the flux inside of it (and hence the magnification) converges. The orientation of the elliptical aperture is computed from the magnification tensor evaluated at the image coordinate.

    If for whatever reason you prefer a circular aperture to the elliptical approximation using the hessian eigenvectors, you can just set axis_ratio = 1.

    To use the eigenvalues of the hessian matrix to estimate the optimum axis ratio, set axis_ratio = 0.

    The default settings for the grid resolution and ray tracing window size work well for sources with fwhm between 0.5 - 100 pc.

    Parameters: | x_image – a list or array of x coordinates [units arcsec] y_image – a list or array of y coordinates [units arcsec] kwargs_lens – keyword arguments for the lens model source_fwhm_parsec – the size of the background source [units parsec] z_source – the source redshift cosmo – (optional) an instance of astropy.cosmology; if not specified, a default cosmology will be used grid_resolution – the grid resolution in units arcsec/pixel; if not specified, an appropriate value will be estimated from the source size grid_radius_arcsec – (optional) the size of the ray tracing region in arcsec; if not specified, an appropriate value will be estimated from the source size axis_ratio – the axis ratio of the ellipse used for ray tracing; if axis_ratio = 0, then the eigenvalues the hessian matrix will be used to estimate an appropriate axis ratio. Be warned: if the image is highly magnified it will tend to curve out of the resulting ellipse tol – tolerance for convergence in the magnification step_size – sets the increment for the successively larger ray tracing windows use_largest_eigenvalue – bool; if True, then the major axis of the ray tracing ellipse region will be aligned with the eigenvector corresponding to the largest eigenvalue of the hessian matrix source_light_model – the model for backgourn source light; currently implemented are ‘SINGLE_GAUSSIAN’ and ‘DOUBLE_GAUSSIAN’. dx – used with source model ‘DOUBLE_GAUSSIAN’, the offset of the second source light profile from the first [arcsec] dy – used with source model ‘DOUBLE_GAUSSIAN’, the offset of the second source light profile from the first [arcsec] size_scale – used with source model ‘DOUBLE_GAUSSIAN’, the size of the second source light profile relative to the first amp_scale – used with source model ‘DOUBLE_GAUSSIAN’, the peak brightness of the second source light profile relative to the first fixed_aperture_size – bool, if True the flux is computed inside a fixed aperture size with radius grid_radius_arcsec
    Returns: | an array of image magnifications

  `radial_tangential_differentials`(x, y, kwargs_lens, center_x=0, center_y=0, smoothing_3rd=0.001, smoothing_2nd=None)

    computes the differentials in stretches and directions

    Parameters: | x – x-position y – y-position kwargs_lens – lens model keyword arguments center_x – x-coord of center towards which the rotation direction is defined center_y – x-coord of center towards which the rotation direction is defined smoothing_3rd – finite differential length of third order in units of angle smoothing_2nd – float or None, finite average differential scale of Hessian
    Returns: |

  `radial_tangential_stretch`(x, y, kwargs_lens, diff=None, ra_0=0, dec_0=0, coordinate_frame_definitions=False)

    computes the radial and tangential stretches at a given position

    Parameters: | x – x-position y – y-position kwargs_lens – lens model keyword arguments diff – float or None, finite average differential scale
    Returns: | radial stretch, tangential stretch

  `tangential_average`(x, y, kwargs_lens, dr, smoothing=None, num_average=9)

    computes average tangential stretch around position (x, y) within dr in radial direction

    Parameters: | x – x-position (float) y – y-position (float) kwargs_lens – lens model keyword argument list dr – averaging scale in radial direction smoothing – smoothing scale of derivative num_average – integer, number of points averaged over within dr in the radial direction
    Returns: |

  `zoom_source`(x_pos, y_pos, kwargs_lens, source_sigma=0.003, window_size=0.1, grid_number=100, shape='GAUSSIAN')

    computes the surface brightness on an image with a zoomed window

    Parameters: | x_pos – angular coordinate of center of image y_pos – angular coordinate of center of image kwargs_lens – lens model parameter list source_sigma – source size (in angular units) window_size – window size in angular units grid_number – number of grid points per axis shape – string, shape of source, supports ‘GAUSSIAN’ and ‘TORUS
    Returns: | 2d numpy array

## lenstronomy.LensModel.lens_param module

class `lenstronomy.LensModel.lens_param.` `LensParam`(lens_model_list, kwargs_fixed, kwargs_lower=None, kwargs_upper=None, kwargs_logsampling=None, num_images=0, solver_type='NONE', num_shapelet_lens=0)

  Bases: `object`

  class to handle the lens model parameter

  `get_params`(args, i)

    Parameters: | args – tuple of individual floats of sampling argument i – integer, index at the beginning of the tuple for read out to keyword argument convention
    Returns: | kwargs_list, index at the end of read out of this model component

  `num_param`()

    Returns: | integer, number of free parameters being sampled from the lens model components

  `set_params`(kwargs_list)

    Parameters: | kwargs_list – keyword argument list of lens model components
    Returns: | tuple of arguments (floats) that are being sampled

## lenstronomy.LensModel.profile_integrals module

class `lenstronomy.LensModel.profile_integrals.` `ProfileIntegrals`(profile_class)

  Bases: `object`

  class to perform integrals of spherical profiles to compute: - projected densities - enclosed densities - projected enclosed densities

  `density_2d`(r, kwargs_profile, lens_param=False)

    computes the projected density along the line-of-sight :param r: radius (arcsec) :param kwargs_profile: keyword argument list with lens model parameters :param lens_param: boolean, if True uses the lens model parameterization in computing the 3d density convention and the return is the convergence :return: 2d projected density at projected radius r

  `mass_enclosed_2d`(r, kwargs_profile)

    computes the mass enclosed the projected line-of-sight :param r: radius (arcsec) :param kwargs_profile: keyword argument list with lens model parameters :return: projected mass enclosed radius r

  `mass_enclosed_3d`(r, kwargs_profile, lens_param=False)

    computes the mass enclosed within a sphere of radius r

    Parameters: | r – radius (arcsec) kwargs_profile – keyword argument list with lens model parameters lens_param – boolean, if True uses the lens model parameterization in computing the 3d density convention and the return is the convergence
    Returns: | 3d mass enclosed of r

## lenstronomy.LensModel.profile_list_base module

class `lenstronomy.LensModel.profile_list_base.` `ProfileListBase`(lens_model_list, numerical_alpha_class=None, lens_redshift_list=None, z_source_convention=None, kwargs_interp=None)

  Bases: `object`

  class that manages the list of lens model class instances. This class is applicable for single plane and multi plane lensing

  `set_dynamic`()

    frees cache set by static model (if exists) and re-computes all lensing quantities each time a definition is called assuming different parameters are executed. This is the default mode if not specified as set_static()

    Returns: | None

  `set_static`(kwargs_list)

    Parameters: | kwargs_list – list of keyword arguments for each profile
    Returns: | kwargs_list

## lenstronomy.LensModel.single_plane module

class `lenstronomy.LensModel.single_plane.` `SinglePlane`(lens_model_list, numerical_alpha_class=None, lens_redshift_list=None, z_source_convention=None, kwargs_interp=None)

  Bases: `lenstronomy.LensModel.profile_list_base.ProfileListBase`

  class to handle an arbitrary list of lens models in a single lensing plane

  `alpha`(x, y, kwargs, k=None)

    deflection angles :param x: x-position (preferentially arcsec) :type x: numpy array :param y: y-position (preferentially arcsec) :type y: numpy array :param kwargs: list of keyword arguments of lens model parameters matching the lens model classes :param k: only evaluate the k-th lens model :return: deflection angles in units of arcsec

  `density`(r, kwargs, bool_list=None)

    3d mass density at radius r 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)

  `fermat_potential`(x_image, y_image, kwargs_lens, x_source=None, y_source=None, k=None)

    fermat potential (negative sign means earlier arrival time)

    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 without geometry term (second part of Eqn 1 in Suyu et al. 2013) as a list

  `hessian`(x, y, kwargs, k=None)

    hessian matrix :param x: x-position (preferentially arcsec) :type x: numpy array :param y: y-position (preferentially arcsec) :type y: numpy array :param kwargs: list of keyword arguments of lens model parameters matching the lens model classes :param k: only evaluate the k-th lens model :return: f_xx, f_xy, f_yx, f_yy components

  `mass_2d`(r, kwargs, bool_list=None)

    computes the mass enclosed a projected (2d) radius r

    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)

  `mass_3d`(r, kwargs, bool_list=None)

    computes the mass within a 3d sphere of radius r

    if you want to have physical units of kg, you need to multiply by this factor: const.arcsec ** 2 * self._cosmo.dd * self._cosmo.ds / self._cosmo.dds * const.Mpc * const.c ** 2 / (4 * np.pi * const.G) grav_pot = -const.G * mass_dim / (r * const.arcsec * self._cosmo.dd * const.Mpc)

    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)

  `potential`(x, y, kwargs, k=None)

    lensing potential :param x: x-position (preferentially arcsec) :type x: numpy array :param y: y-position (preferentially arcsec) :type y: numpy array :param kwargs: list of keyword arguments of lens model parameters matching the lens model classes :param k: only evaluate the k-th lens model :return: lensing potential in units of arcsec^2

  `ray_shooting`(x, y, kwargs, k=None)

    maps image to source position (inverse deflection) :param x: x-position (preferentially arcsec) :type x: numpy array :param y: y-position (preferentially arcsec) :type y: numpy array :param kwargs: list of keyword arguments of lens model parameters matching the lens model classes :param k: only evaluate the k-th lens model :return: source plane positions corresponding to (x, y) in the image plane

## Module contents