lenstronomy.LensModel.Profiles package — lenstronomy 1.8.2 documentation

# lenstronomy.LensModel.Profiles package

## Submodules

## lenstronomy.LensModel.Profiles.arc_perturbations module

class `lenstronomy.LensModel.Profiles.arc_perturbations.` `ArcPerturbations`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  uses radial and tangential fourier modes within a specific range in both directions to perturb a lensing potential

  `derivatives`(x, y, coeff, d_r, d_phi, center_x, center_y)

    Parameters: | x – x-coordinate y – y-coordinate coeff – float, amplitude of basis d_r – period of radial sinusoidal in units of angle d_phi – period of tangential sinusoidal in radian center_x – center of rotation for tangential basis center_y – center of rotation for tangential basis
    Returns: | f_x, f_y

  `function`(x, y, coeff, d_r, d_phi, center_x, center_y)

    Parameters: | x – x-coordinate y – y-coordinate coeff – float, amplitude of basis d_r – period of radial sinusoidal in units of angle d_phi – period of tangential sinusoidal in radian center_x – center of rotation for tangential basis center_y – center of rotation for tangential basis
    Returns: |

  `hessian`(x, y, coeff, d_r, d_phi, center_x, center_y)

    Parameters: | x – x-coordinate y – y-coordinate coeff – float, amplitude of basis d_r – period of radial sinusoidal in units of angle d_phi – period of tangential sinusoidal in radian center_x – center of rotation for tangential basis center_y – center of rotation for tangential basis
    Returns: | f_xx, f_yy, f_xy

## lenstronomy.LensModel.Profiles.base_profile module

class `lenstronomy.LensModel.Profiles.base_profile.` `LensProfileBase`(*args, **kwargs)

  Bases: `object`

  this class acts as the base class of all lens model functions and indicates raise statements and default outputs if these functions are not defined in the specific lens model class

  `density_lens`(*args, **kwargs)

    computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

    Parameters: | kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `derivatives`(*args, **kwargs)

    deflection angles

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `function`(*args, **kwargs)

    lensing potential

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `hessian`(*args, **kwargs)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `mass_3d_lens`(*args, **kwargs)

    mass enclosed a 3d sphere or radius r given a lens parameterization with angular units For this profile those are identical.

    Parameters: | kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `set_dynamic`()

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

  `set_static`(**kwargs)

    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.Profiles.chameleon module

class `lenstronomy.LensModel.Profiles.chameleon.` `Chameleon`(static=False)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class of the Chameleon model (See Suyu+2014) an elliptical truncated double isothermal profile

  `derivatives`(x, y, alpha_1, w_c, w_t, e1, e2, center_x=0, center_y=0)

    Parameters: | x – ra-coordinate y – dec-coordinate alpha_1 – deflection angle at 1 (arcseconds) from the center w_c – see Suyu+2014 w_t – see Suyu+2014 e1 – ellipticity parameter e2 – ellipticity parameter center_x – ra center center_y – dec center
    Returns: | deflection angles (RA, DEC)

  `function`(x, y, alpha_1, w_c, w_t, e1, e2, center_x=0, center_y=0)

    Parameters: | x – ra-coordinate y – dec-coordinate alpha_1 – deflection angle at 1 (arcseconds) from the center w_c – see Suyu+2014 w_t – see Suyu+2014 e1 – ellipticity parameter e2 – ellipticity parameter center_x – ra center center_y – dec center
    Returns: | lensing potential

  `hessian`(x, y, alpha_1, w_c, w_t, e1, e2, center_x=0, center_y=0)

    Parameters: | x – ra-coordinate y – dec-coordinate alpha_1 – deflection angle at 1 (arcseconds) from the center w_c – see Suyu+2014 w_t – see Suyu+2014 e1 – ellipticity parameter e2 – ellipticity parameter center_x – ra center center_y – dec center
    Returns: | second derivatives of the lensing potential (Hessian: f_xx, f_xy, f_yx, f_yy)

  `lower_limit_default` = {'alpha_1': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.8, 'e2': -0.8, 'w_c': 0, 'w_t': 0}
  `param_convert`(alpha_1, w_c, w_t, e1, e2)

    convert the parameter alpha_1 (deflection angle one arcsecond from the center) into the “Einstein radius” scale parameter of the two NIE profiles

    Parameters: | alpha_1 – deflection angle at 1 (arcseconds) from the center w_c – see Suyu+2014 w_t – see Suyu+2014 e1 – eccentricity modulus ee – eccentricity modulus
    Returns: |

  `param_names` = ['alpha_1', 'w_c', 'w_t', 'e1', 'e2', 'center_x', 'center_y']
  `set_dynamic`()

    Returns: |

  `set_static`(alpha_1, w_c, w_t, e1, e2, center_x=0, center_y=0)

    Parameters: | logM – concentration – center_x – center_y –
    Returns: |

  `upper_limit_default` = {'alpha_1': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.8, 'e2': 0.8, 'w_c': 100, 'w_t': 100}

class `lenstronomy.LensModel.Profiles.chameleon.` `DoubleChameleon`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class of the Chameleon model (See Suyu+2014) an elliptical truncated double isothermal profile

  `derivatives`(x, y, alpha_1, ratio, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, center_x=0, center_y=0)

    Parameters: | x – ra-coordinate y – dec-coordinate alpha_1 – deflection angle at 1 (arcseconds) from the center ratio – ratio of deflection amplitude at radius = 1 of the first to second Chameleon profile w_c1 – Suyu+2014 for first profile w_t1 – Suyu+2014 for first profile e11 – ellipticity parameter for first profile e21 – ellipticity parameter for first profile w_c2 – Suyu+2014 for second profile w_t2 – Suyu+2014 for second profile e12 – ellipticity parameter for second profile e22 – ellipticity parameter for second profile^V center_x – ra center center_y – dec center
    Returns: | deflection angles (RA, DEC)

  `function`(x, y, alpha_1, ratio, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, center_x=0, center_y=0)

    Parameters: | x – ra-coordinate y – dec-coordinate alpha_1 – deflection angle at 1 (arcseconds) from the center ratio – ratio of deflection amplitude at radius = 1 of the first to second Chameleon profile w_c1 – Suyu+2014 for first profile w_t1 – Suyu+2014 for first profile e11 – ellipticity parameter for first profile e21 – ellipticity parameter for first profile w_c2 – Suyu+2014 for second profile w_t2 – Suyu+2014 for second profile e12 – ellipticity parameter for second profile e22 – ellipticity parameter for second profile center_x – ra center center_y – dec center
    Returns: | lensing potential

  `hessian`(x, y, alpha_1, ratio, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, center_x=0, center_y=0)

    Parameters: | x – ra-coordinate y – dec-coordinate alpha_1 – deflection angle at 1 (arcseconds) from the center ratio – ratio of deflection amplitude at radius = 1 of the first to second Chameleon profile w_c1 – Suyu+2014 for first profile w_t1 – Suyu+2014 for first profile e11 – ellipticity parameter for first profile e21 – ellipticity parameter for first profile w_c2 – Suyu+2014 for second profile w_t2 – Suyu+2014 for second profile e12 – ellipticity parameter for second profile e22 – ellipticity parameter for second profile center_x – ra center center_y – dec center
    Returns: | second derivatives of the lensing potential (Hessian: f_xx, f_yy, f_xy)

  `lower_limit_default` = {'alpha_1': 0, 'center_x': -100, 'center_y': -100, 'e11': -0.8, 'e12': -0.8, 'e21': -0.8, 'e22': -0.8, 'ratio': 0, 'w_c1': 0, 'w_c2': 0, 'w_t1': 0, 'w_t2': 0}
  `param_names` = ['alpha_1', 'ratio', 'w_c1', 'w_t1', 'e11', 'e21', 'w_c2', 'w_t2', 'e12', 'e22', 'center_x', 'center_y']
  `set_dynamic`()

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

  `set_static`(alpha_1, ratio, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, center_x=0, center_y=0)

    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

  `upper_limit_default` = {'alpha_1': 100, 'center_x': 100, 'center_y': 100, 'e11': 0.8, 'e12': 0.8, 'e21': 0.8, 'e22': 0.8, 'ratio': 100, 'w_c1': 100, 'w_c2': 100, 'w_t1': 100, 'w_t2': 100}

class `lenstronomy.LensModel.Profiles.chameleon.` `TripleChameleon`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class of the Chameleon model (See Suyu+2014) an elliptical truncated double isothermal profile

  `derivatives`(x, y, alpha_1, ratio12, ratio13, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, w_c3, w_t3, e13, e23, center_x=0, center_y=0)

    Parameters: | alpha_1 – ratio12 – ratio of first to second amplitude ratio13 – ratio of first to third amplidute w_c1 – w_t1 – e11 – e21 – w_c2 – w_t2 – e12 – e22 – center_x – center_y –
    Returns: |

  `function`(x, y, alpha_1, ratio12, ratio13, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, w_c3, w_t3, e13, e23, center_x=0, center_y=0)

    Parameters: | alpha_1 – ratio12 – ratio of first to second amplitude ratio13 – ratio of first to third amplitude w_c1 – w_t1 – e11 – e21 – w_c2 – w_t2 – e12 – e22 – center_x – center_y –
    Returns: |

  `hessian`(x, y, alpha_1, ratio12, ratio13, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, w_c3, w_t3, e13, e23, center_x=0, center_y=0)

    Parameters: | alpha_1 – ratio12 – ratio of first to second amplitude ratio13 – ratio of first to third amplidute w_c1 – w_t1 – e11 – e21 – w_c2 – w_t2 – e12 – e22 – center_x – center_y –
    Returns: |

  `lower_limit_default` = {'alpha_1': 0, 'center_x': -100, 'center_y': -100, 'e11': -0.8, 'e12': -0.8, 'e13': -0.8, 'e21': -0.8, 'e22': -0.8, 'e23': -0.8, 'ratio12': 0, 'ratio13': 0, 'w_c1': 0, 'w_c2': 0, 'w_c3': 0, 'w_t1': 0, 'w_t2': 0, 'w_t3': 0}
  `param_names` = ['alpha_1', 'ratio12', 'ratio13', 'w_c1', 'w_t1', 'e11', 'e21', 'w_c2', 'w_t2', 'e12', 'e22', 'w_c3', 'w_t3', 'e13', 'e23', 'center_x', 'center_y']
  `set_dynamic`()

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

  `set_static`(alpha_1, ratio12, ratio13, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, w_c3, w_t3, e13, e23, center_x=0, center_y=0)

    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

  `upper_limit_default` = {'alpha_1': 100, 'center_x': 100, 'center_y': 100, 'e11': 0.8, 'e12': 0.8, 'e13': 0.8, 'e21': 0.8, 'e22': 0.8, 'e23': 0.8, 'ratio12': 100, 'ratio13': 100, 'w_c1': 100, 'w_c2': 100, 'w_c3': 100, 'w_t1': 100, 'w_t2': 100, 'w_t3': 100}

class `lenstronomy.LensModel.Profiles.chameleon.` `DoubleChameleonPointMass`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class of the Chameleon model (See Suyu+2014) an elliptical truncated double isothermal profile

  `derivatives`(x, y, alpha_1, ratio_pointmass, ratio_chameleon, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, center_x=0, center_y=0)

    Parameters: | x – y – alpha_1 – ratio_pointmass – ratio of point source Einstein radius to combined Chameleon deflection angle at r=1 ratio_chameleon – ratio in deflection angles at r=1 for the two Chameleon profiles w_c1 – Suyu+2014 for first profile w_t1 – Suyu+2014 for first profile e11 – ellipticity parameter for first profile e21 – ellipticity parameter for first profile w_c2 – Suyu+2014 for second profile w_t2 – Suyu+2014 for second profile e12 – ellipticity parameter for second profile e22 – ellipticity parameter for second profile center_x – ra center center_y – dec center
    Returns: |

  `function`(x, y, alpha_1, ratio_pointmass, ratio_chameleon, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, center_x=0, center_y=0)

    #TODO chose better parameterization for combining point mass and Chameleon profiles :param x: ra-coordinate :param y: dec-coordinate :param alpha_1: deflection angle at 1 (arcseconds) from the center :param ratio_pointmass: ratio of point source Einstein radius to combined Chameleon deflection angle at r=1 :param ratio_chameleon: ratio in deflection angles at r=1 for the two Chameleon profiles :param w_c1: Suyu+2014 for first profile :param w_t1: Suyu+2014 for first profile :param e11: ellipticity parameter for first profile :param e21: ellipticity parameter for first profile :param w_c2: Suyu+2014 for second profile :param w_t2: Suyu+2014 for second profile :param e12: ellipticity parameter for second profile :param e22: ellipticity parameter for second profile :param center_x: ra center :param center_y: dec center :return:

  `hessian`(x, y, alpha_1, ratio_pointmass, ratio_chameleon, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, center_x=0, center_y=0)

    Parameters: | x – y – alpha_1 – ratio_pointmass – ratio of point source Einstein radius to combined Chameleon deflection angle at r=1 ratio_chameleon – ratio in deflection angles at r=1 for the two Chameleon profiles w_c1 – Suyu+2014 for first profile w_t1 – Suyu+2014 for first profile e11 – ellipticity parameter for first profile e21 – ellipticity parameter for first profile w_c2 – Suyu+2014 for second profile w_t2 – Suyu+2014 for second profile e12 – ellipticity parameter for second profile e22 – ellipticity parameter for second profile center_x – ra center center_y – dec center
    Returns: |

  `lower_limit_default` = {'alpha_1': 0, 'center_x': -100, 'center_y': -100, 'e11': -0.8, 'e12': -0.8, 'e21': -0.8, 'e22': -0.8, 'ratio_chameleon': 0, 'ratio_pointmass': 0, 'w_c1': 0, 'w_c2': 0, 'w_t1': 0, 'w_t2': 0}
  `param_names` = ['alpha_1', 'ratio_chameleon', 'ratio_pointmass', 'w_c1', 'w_t1', 'e11', 'e21', 'w_c2', 'w_t2', 'e12', 'e22', 'center_x', 'center_y']
  `upper_limit_default` = {'alpha_1': 100, 'center_x': 100, 'center_y': 100, 'e11': 0.8, 'e12': 0.8, 'e21': 0.8, 'e22': 0.8, 'ratio_chameleon': 100, 'ratio_pointmass': 100, 'w_c1': 100, 'w_c2': 100, 'w_t1': 100, 'w_t2': 100}

## lenstronomy.LensModel.Profiles.cnfw module

class `lenstronomy.LensModel.Profiles.cnfw.` `CNFW`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class computes the lensing quantities of a cored NFW profile: rho = rho0 * (r + r_core)^-1 * (r + rs)^-2 alpha_Rs is the normalization equivalent to the deflection angle at rs in the absence of a core

  `alpha_r`(R, Rs, rho0, r_core)

    deflection angel of NFW profile along the radial direction

    Parameters: | R (float/numpy array) – radius of interest Rs (float) – scale radius
    Returns: | Epsilon(R) projected density at radius R

  `cnfwGamma`(R, Rs, rho0, r_core, ax_x, ax_y)

    shear gamma of NFW profile (times Sigma_crit) along the projection to coordinate ‘axis’

    Parameters: | R (float/numpy array) – radius of interest Rs (float) – scale radius rho0 (float) – density normalization (characteristic density) r200 (float>0) – radius of (sub)halo axis (same as R) – projection to either x- or y-axis
    Returns: | Epsilon(R) projected density at radius R

  `density`(R, Rs, rho0, r_core)

    three dimensional truncated NFW profile

    Parameters: | R (float/numpy array) – radius of interest Rs (float) – scale radius rho0 (float) – density normalization (central core density)
    Returns: | rho(R) density

  `density_2d`(x, y, Rs, rho0, r_core, center_x=0, center_y=0)

    projected two dimenstional NFW profile (kappa*Sigma_crit)

    Parameters: | R (float/numpy array) – radius of interest Rs (float) – scale radius rho0 (float) – density normalization (characteristic density) r200 (float>0) – radius of (sub)halo
    Returns: | Epsilon(R) projected density at radius R

  `density_lens`(R, Rs, alpha_Rs, r_core)

    computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

  `derivatives`(x, y, Rs, alpha_Rs, r_core, center_x=0, center_y=0)

    deflection angles

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `function`(x, y, Rs, alpha_Rs, r_core, center_x=0, center_y=0)

    Parameters: | x – angular position y – angular position Rs – angular turn over point alpha_Rs – deflection at Rs (in the absence of a core r_core – core radius center_x – center of halo center_y – center of halo
    Returns: |

  `hessian`(x, y, Rs, alpha_Rs, r_core, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy

  `lower_limit_default` = {'Rs': 0, 'alpha_Rs': 0, 'center_x': -100, 'center_y': -100, 'r_core': 0}
  `mass_2d`(R, Rs, rho0, r_core)

    analytic solution of the projection integral (convergence)

    Parameters: | x (float >0) – R/Rs

  `mass_3d`(R, Rs, rho0, r_core)

    mass enclosed a 3d sphere or radius r

    Parameters: | r – Ra – Rs –
    Returns: |

  `mass_3d_lens`(R, Rs, alpha_Rs, r_core)

    mass enclosed a 3d sphere or radius r given a lens parameterization with angular units

    Returns: |

  `model_name` = 'CNFW'
  `param_names` = ['Rs', 'alpha_Rs', 'r_core', 'center_x', 'center_y']
  `upper_limit_default` = {'Rs': 100, 'alpha_Rs': 10, 'center_x': 100, 'center_y': 100, 'r_core': 100}

## lenstronomy.LensModel.Profiles.cnfw_ellipse module

class `lenstronomy.LensModel.Profiles.cnfw_ellipse.` `CNFW_ELLIPSE`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains functions concerning the NFW profile

  relation are: R_200 = c * Rs

  `density_lens`(R, Rs, alpha_Rs, r_core, e1=0, e2=0)

    computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

  `derivatives`(x, y, Rs, alpha_Rs, r_core, e1, e2, center_x=0, center_y=0)

    returns df/dx and df/dy of the function (integral of NFW)

  `function`(x, y, Rs, alpha_Rs, r_core, e1, e2, center_x=0, center_y=0)

    returns double integral of NFW profile

  `hessian`(x, y, Rs, alpha_Rs, r_core, e1, e2, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy

  `lower_limit_default` = {'Rs': 0, 'alpha_Rs': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'r_core': 0}
  `mass_3d_lens`(R, Rs, alpha_Rs, r_core, e1=0, e2=0)

    mass enclosed a 3d sphere or radius r given a lens parameterization with angular units

    Returns: |

  `param_names` = ['Rs', 'alpha_Rs', 'r_core', 'e1', 'e2', 'center_x', 'center_y']
  `upper_limit_default` = {'Rs': 100, 'alpha_Rs': 10, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'r_core': 100}

## lenstronomy.LensModel.Profiles.const_mag module

class `lenstronomy.LensModel.Profiles.const_mag.` `ConstMag`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class implements the macromodel potential of Diego et al. Convergence and shear are computed according to Diego2018

  `derivatives`(x, y, mu_r, mu_t, parity, phi_G, center_x=0, center_y=0)

    Parameters: | x – x-coord (in angles) y – y-coord (in angles) mu_r – radial magnification mu_t – tangential magnification parity – parity of the side of the macromodel. Either +1 (positive parity) or -1 (negative parity) phi_G – shear orientation angle (relative to the x-axis)
    Returns: | deflection angle (in angles)

  `function`(x, y, mu_r, mu_t, parity, phi_G, center_x=0, center_y=0)

    Parameters: | x – x-coord (in angles) y – y-coord (in angles) mu_r – radial magnification mu_t – tangential magnification parity – parity side of the macromodel. Either +1 (positive parity) or -1 (negative parity) phi_G – shear orientation angle (relative to the x-axis)
    Returns: | lensing potential

  `hessian`(x, y, mu_r, mu_t, parity, phi_G, center_x=0, center_y=0)

    Parameters: | x – x-coord (in angles) y – y-coord (in angles) mu_r – radial magnification mu_t – tangential magnification parity – parity of the side of the macromodel. Either +1 (positive parity) or -1 (negative parity) phi_G – shear orientation angle (relative to the x-axis)
    Returns: | hessian matrix (in angles)

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'mu_r': 1, 'mu_t': 1000, 'parity': -1, 'phi_G': 0.0}
  `param_names` = ['center_x', 'center_y', 'mu_r', 'mu_t', 'parity', 'phi_G']
  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'mu_r': 1, 'mu_t': 1000, 'parity': 1, 'phi_G': 3.141592653589793}

## lenstronomy.LensModel.Profiles.constant_shift module

class `lenstronomy.LensModel.Profiles.constant_shift.` `Shift`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  Lens model with a constant shift of the deflection field

  `derivatives`(x, y, alpha_x, alpha_y)

    Parameters: | x – coordinate in image plane (angle) y – coordinate in image plane (angle) alpha_x – shift in x-direction (angle) alpha_y – shift in y-direction (angle)
    Returns: | deflection in x- and y-direction

  `function`(x, y, alpha_x, alpha_y)

    Parameters: | x – coordinate in image plane (angle) y – coordinate in image plane (angle) alpha_x – shift in x-direction (angle) alpha_y – shift in y-direction (angle)
    Returns: | lensing potential

  `hessian`(x, y, alpha_x, alpha_y)

    Parameters: | x – coordinate in image plane (angle) y – coordinate in image plane (angle) alpha_x – shift in x-direction (angle) alpha_y – shift in y-direction (angle)
    Returns: | hessian elements f_xx, f_xy, f_yx, f_yy

  `lower_limit_default` = {'alpha_x': -1000, 'alpha_y': -1000}
  `param_names` = ['alpha_x', 'alpha_y']
  `upper_limit_default` = {'alpha_x': 1000, 'alpha_y': 1000}

## lenstronomy.LensModel.Profiles.convergence module

class `lenstronomy.LensModel.Profiles.convergence.` `Convergence`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  a single mass sheet (external convergence)

  `derivatives`(x, y, kappa_ext, ra_0=0, dec_0=0)

    deflection angle

    Parameters: | x – x-coordinate y – y-coordinate kappa_ext – external convergence
    Returns: | deflection angles (first order derivatives)

  `function`(x, y, kappa_ext, ra_0=0, dec_0=0)

    lensing potential

    Parameters: | x – x-coordinate y – y-coordinate kappa_ext – external convergence
    Returns: | lensing potential

  `hessian`(x, y, kappa_ext, ra_0=0, dec_0=0)

    Hessian matrix

    Parameters: | x – x-coordinate y – y-coordinate kappa_ext – external convergence
    Returns: | second order derivatives f_xx, f_xy, f_yx, f_yy

  `lower_limit_default` = {'dec_0': -100, 'kappa_ext': -10, 'ra_0': -100}
  `param_names` = ['kappa_ext', 'ra_0', 'dec_0']
  `upper_limit_default` = {'dec_0': 100, 'kappa_ext': 10, 'ra_0': 100}

## lenstronomy.LensModel.Profiles.coreBurkert module

class `lenstronomy.LensModel.Profiles.coreBurkert.` `CoreBurkert`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  lensing properties of a modified Burkert profile with variable core size normalized by rho0, the central core density

  `cBurkGamma`(R, Rs, rho0, r_core, ax_x, ax_y)

    Parameters: | R – projected distance Rs – scale radius rho0 – central core density r_core – core radius ax_x – x coordinate ax_y – y coordinate
    Returns: |

  `cBurkPot`(R, Rs, rho0, r_core)

    Parameters: | R – projected distance Rs – scale radius rho0 – central core density r_core – core radius

  `coreBurkAlpha`(R, Rs, rho0, r_core, ax_x, ax_y)

    deflection angle

    Parameters: | R – Rs – rho0 – r_core – ax_x – ax_y –
    Returns: |

  `density`(R, Rs, rho0, r_core)

    three dimensional cored Burkert profile

    Parameters: | R (float/numpy array) – radius of interest Rs (float) – scale radius rho0 (float) – characteristic density
    Returns: | rho(R) density

  `density_2d`(x, y, Rs, rho0, r_core, center_x=0, center_y=0)

    projected two dimenstional core Burkert profile (kappa*Sigma_crit)

    Parameters: | x – x coordinate y – y coordinate Rs – scale radius rho0 – central core density r_core – core radius

  `derivatives`(x, y, Rs, alpha_Rs, r_core, center_x=0, center_y=0)

    deflection angles :param x: x coordinate :param y: y coordinate :param Rs: scale radius :param rho0: central core density :param r_core: core radius :param center_x: :param center_y: :return:

  `function`(x, y, Rs, alpha_Rs, r_core, center_x=0, center_y=0)

    Parameters: | x – angular position y – angular position Rs – angular turn over point alpha_Rs – deflection angle at Rs center_x – center of halo center_y – center of halo
    Returns: |

  `hessian`(x, y, Rs, alpha_Rs, r_core, center_x=0, center_y=0)

    Parameters: | x – x coordinate y – y coordinate Rs – scale radius rho0 – central core density r_core – core radius center_x – center_y –
    Returns: |

  `lower_limit_default` = {'Rs': 1, 'alpha_Rs': 0, 'center_x': -100, 'center_y': -100, 'r_core': 0.5}
  `mass_2d`(R, Rs, rho0, r_core)

    analytic solution of the projection integral (convergence)

    Parameters: | R – projected distance Rs – scale radius rho0 – central core density r_core – core radius

  `mass_3d`(R, Rs, rho0, r_core)

    Parameters: | R – projected distance Rs – scale radius rho0 – central core density r_core – core radius

  `param_names` = ['Rs', 'alpha_Rs', 'r_core', 'center_x', 'center_y']
  `upper_limit_default` = {'Rs': 100, 'alpha_Rs': 100, 'center_x': 100, 'center_y': 100, 'r_core': 50}

## lenstronomy.LensModel.Profiles.cored_density module

class `lenstronomy.LensModel.Profiles.cored_density.` `CoredDensity`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class for a uniform cored density dropping steep in the outskirts This profile is e.g. featured in Blum et al. 2020 https://arxiv.org/abs/2001.07182v1 3d rho(r) = 2/pi * Sigma_crit R_c**3 * (R_c**2 + r**2)**(-2)

  static `alpha_r`(r, sigma0, r_core)

    radial deflection angle of the cored density profile

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | deflection angle

  static `d_alpha_dr`(r, sigma0, r_core)

    radial derivatives of the radial deflection angle

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | dalpha/dr

  static `density`(r, sigma0, r_core)

    rho(r) = 2/pi * Sigma_crit R_c**3 * (R_c**2 + r**2)**(-2)

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | density at radius r

  `density_2d`(x, y, sigma0, r_core, center_x=0, center_y=0)

    projected density at projected radius r

    Parameters: | x – x-coordinate in angular units y – y-coordinate in angular units sigma0 – convergence in the core r_core – core radius center_x – center of the profile center_y – center of the profile
    Returns: | projected density

  `density_lens`(r, sigma0, r_core)

    computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | desnity at radius r

  `derivatives`(x, y, sigma0, r_core, center_x=0, center_y=0)

    deflection angle of cored density profile

    Parameters: | x – x-coordinate in angular units y – y-coordinate in angular units sigma0 – convergence in the core r_core – core radius center_x – center of the profile center_y – center of the profile
    Returns: | alpha_x, alpha_y at (x, y)

  `function`(x, y, sigma0, r_core, center_x=0, center_y=0)

    potential of cored density profile

    Parameters: | x – x-coordinate in angular units y – y-coordinate in angular units sigma0 – convergence in the core r_core – core radius center_x – center of the profile center_y – center of the profile
    Returns: | lensing potential at (x, y)

  `hessian`(x, y, sigma0, r_core, center_x=0, center_y=0)

    Parameters: | x – x-coordinate in angular units y – y-coordinate in angular units sigma0 – convergence in the core r_core – core radius center_x – center of the profile center_y – center of the profile
    Returns: | Hessian df/dxdx, df/dxdy, df/dydx, df/dydy at position (x, y)

  static `kappa_r`(r, sigma0, r_core)

    convergence of the cored density profile. This routine is also for testing

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | convergence at r

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'r_core': 0, 'sigma0': -1}
  `mass_2d`(r, sigma0, r_core)

    mass enclosed in cylinder of radius r

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | mass enclosed in cylinder of radius r

  static `mass_3d`(r, sigma0, r_core)

    mass enclosed 3d radius

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | mass enclosed 3d radius

  `mass_3d_lens`(r, sigma0, r_core)

    mass enclosed a 3d sphere or radius r given a lens parameterization with angular units For this profile those are identical.

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | mass enclosed 3d radius

  `param_names` = ['sigma0', 'r_core', 'center_x', 'center_y']
  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'r_core': 100, 'sigma0': 10}

## lenstronomy.LensModel.Profiles.cored_density_2 module

class `lenstronomy.LensModel.Profiles.cored_density_2.` `CoredDensity2`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class for a uniform cored density dropping steep in the outskirts credits for suggesting this profile goes to Kfir Blum

  \[\rho(r) = 2/\pi * \Sigma_{\rm crit} R_c^2 * (R_c^2 + r^2)^{-3/2}\]

  This profile drops like an NFW profile as math:rho(r)^{-3}.

  static `alpha_r`(r, sigma0, r_core)

    radial deflection angle of the cored density profile

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | deflection angle

  static `d_alpha_dr`(r, sigma0, r_core)

    radial derivatives of the radial deflection angle

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | dalpha/dr

  static `density`(r, sigma0, r_core)

    rho(r) = 2/pi * Sigma_crit R_c**3 * (R_c**2 + r**2)**(-3/2)

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | density at radius r

  `density_2d`(x, y, sigma0, r_core, center_x=0, center_y=0)

    projected density at projected radius r

    Parameters: | x – x-coordinate in angular units y – y-coordinate in angular units sigma0 – convergence in the core r_core – core radius center_x – center of the profile center_y – center of the profile
    Returns: | projected density

  `density_lens`(r, sigma0, r_core)

    computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | density at radius r

  `derivatives`(x, y, sigma0, r_core, center_x=0, center_y=0)

    deflection angle of cored density profile

    Parameters: | x – x-coordinate in angular units y – y-coordinate in angular units sigma0 – convergence in the core r_core – core radius center_x – center of the profile center_y – center of the profile
    Returns: | alpha_x, alpha_y at (x, y)

  `function`(x, y, sigma0, r_core, center_x=0, center_y=0)

    potential of cored density profile

    Parameters: | x – x-coordinate in angular units y – y-coordinate in angular units sigma0 – convergence in the core r_core – core radius center_x – center of the profile center_y – center of the profile
    Returns: | lensing potential at (x, y)

  `hessian`(x, y, sigma0, r_core, center_x=0, center_y=0)

    Parameters: | x – x-coordinate in angular units y – y-coordinate in angular units sigma0 – convergence in the core r_core – core radius center_x – center of the profile center_y – center of the profile
    Returns: | Hessian df/dxdx, df/dxdy, df/dydx, df/dydy at position (x, y)

  static `kappa_r`(r, sigma0, r_core)

    convergence of the cored density profile. This routine is also for testing

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | convergence at r

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'r_core': 0, 'sigma0': -1}
  `mass_2d`(r, sigma0, r_core)

    mass enclosed in cylinder of radius r

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | mass enclosed in cylinder of radius r

  static `mass_3d`(r, sigma0, r_core)

    mass enclosed 3d radius

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | mass enclosed 3d radius

  `mass_3d_lens`(r, sigma0, r_core)

    mass enclosed a 3d sphere or radius r given a lens parameterization with angular units For this profile those are identical.

    Parameters: | r – radius (angular scale) sigma0 – convergence in the core r_core – core radius
    Returns: | mass enclosed 3d radius

  `model_name` = 'CORED_DENSITY_2'
  `param_names` = ['sigma0', 'r_core', 'center_x', 'center_y']
  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'r_core': 100, 'sigma0': 10}

## lenstronomy.LensModel.Profiles.cored_density_exp module

class `lenstronomy.LensModel.Profiles.cored_density_exp.` `CoredDensityExp`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains functions concerning an exponential cored density profile, namely

  ..math::
    rho(r) = rho_0 exp(- (theta / theta_c)^2)
  static `alpha_radial`(r, kappa_0, theta_c)

    returns the radial part of the deflection angle :param x: angular position (normally in units of arc seconds) :param y: angular position (normally in units of arc seconds) :param kappa_0: central convergence of profile :param theta_c: core radius (in arcsec) :return: radial deflection angle

  `density`(R, kappa_0, theta_c)

    three dimensional density profile in angular units (rho0_physical = rho0_angular Sigma_crit / D_lens)

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) kappa_0 – central convergence of profile theta_c – core radius (in arcsec)
    Returns: | rho(R) density

  `density_2d`(x, y, kappa_0, theta_c, center_x=0, center_y=0)

    projected two dimensional ULDM profile (convergence * Sigma_crit), but given our units convention for rho0, it is basically the convergence

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) kappa_0 – central convergence of profile theta_c – core radius (in arcsec)
    Returns: | Epsilon(R) projected density at radius R

  `density_lens`(r, kappa_0, theta_c)

    computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) kappa_0 – central convergence of profile theta_c – core radius (in arcsec)
    Returns: | density rho(r)

  `derivatives`(x, y, kappa_0, theta_c, center_x=0, center_y=0)

    returns df/dx and df/dy of the function (lensing potential), which are the deflection angles

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) kappa_0 – central convergence of profile theta_c – core radius (in arcsec) center_x – center of halo (in angular units) center_y – center of halo (in angular units)
    Returns: | deflection angle in x, deflection angle in y

  `function`(x, y, kappa_0, theta_c, center_x=0, center_y=0)

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) kappa_0 – central convergence of profile theta_c – core radius (in arcsec) center_x – center of halo (in angular units) center_y – center of halo (in angular units)
    Returns: | lensing potential (in arcsec^2)

  `hessian`(x, y, kappa_0, theta_c, center_x=0, center_y=0)

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) kappa_0 – central convergence of profile theta_c – core radius (in arcsec) center_x – center of halo (in angular units) center_y – center of halo (in angular units)
    Returns: | Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `kappa_r`(R, kappa_0, theta_c)

    convergence of the cored density profile. This routine is also for testing

    Parameters: | R – radius (angular scale) kappa_0 – convergence in the core theta_c – core radius
    Returns: | convergence at r

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'kappa_0': 0, 'theta_c': 0}
  `mass_2d`(R, kappa_0, theta_c)

    mass enclosed a 2d sphere of radius r returns

    \[M_{2D} = 2 \pi \int_0^r dr' r' \int dz \rho(\sqrt(r'^2 + z^2))\]

    Parameters: | kappa_0 – central convergence of soliton theta_c – core radius (in arcsec)
    Returns: | M_2D (ULDM only)

  static `mass_3d`(R, kappa_0, theta_c)

    mass enclosed a 3d sphere or radius r :param kappa_0: central convergence of profile :param theta_c: core radius (in arcsec) :param R: radius in arcseconds :return: mass of soliton in angular units

  `mass_3d_lens`(r, kappa_0, theta_c)

    mass enclosed a 3d sphere or radius r :param kappa_0: central convergence of profile :param theta_c: core radius (in arcsec) :param center_x: center of halo (in angular units) :param center_y: center of halo (in angular units) :return: mass

  `param_names` = ['kappa_0', 'theta_c', 'center_x', 'center_y']
  `rhotilde`(kappa_0, theta_c)

    Computes the central density in angular units :param kappa_0: central convergence of profile :param theta_c: core radius (in arcsec) :return: central density in 1/arcsec

  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'kappa_0': 10, 'theta_c': 100}

## lenstronomy.LensModel.Profiles.cored_density_mst module

class `lenstronomy.LensModel.Profiles.cored_density_mst.` `CoredDensityMST`(profile_type='CORED_DENSITY')

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  approximate mass-sheet transform of a density core. This routine takes the parameters of the density core and subtracts a mass-sheet that approximates the cored profile in it’s center to counter-act (in approximation) this model. This allows for better sampling of the mass-sheet transformed quantities that do not have strong covariances. The subtraction of the mass-sheet is done such that the sampler returns the real central convergence of the original model (but be careful, the output of quantities like the Einstein angle of the main deflector are still the not-scaled one). Attention!!! The interpretation of the result is that the mass sheet as ‘CONVERGENCE’ that is present needs to be subtracted in post-processing.

  `derivatives`(x, y, lambda_approx, r_core, center_x=0, center_y=0)

    deflection angles of approximate mass-sheet correction

    Parameters: | x – x-coordinate y – y-coordinate lambda_approx – approximate mass sheet transform r_core – core radius of the cored density profile center_x – x-center of the profile center_y – y-center of the profile
    Returns: | alpha_x, alpha_y

  `function`(x, y, lambda_approx, r_core, center_x=0, center_y=0)

    lensing potential of approximate mass-sheet correction

    Parameters: | x – x-coordinate y – y-coordinate lambda_approx – approximate mass sheet transform r_core – core radius of the cored density profile center_x – x-center of the profile center_y – y-center of the profile
    Returns: | lensing potential correction

  `hessian`(x, y, lambda_approx, r_core, center_x=0, center_y=0)

    Hessian terms of approximate mass-sheet correction

    Parameters: | x – x-coordinate y – y-coordinate lambda_approx – approximate mass sheet transform r_core – core radius of the cored density profile center_x – x-center of the profile center_y – y-center of the profile
    Returns: | df/dxx, df/dxy, df/dyx, df/dyy

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'lambda_approx': -1, 'r_core': 0}
  `param_names` = ['lambda_approx', 'r_core', 'center_x', 'center_y']
  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'lambda_approx': 10, 'r_core': 100}

## lenstronomy.LensModel.Profiles.curved_arc_const module

class `lenstronomy.LensModel.Profiles.curved_arc_const.` `CurvedArcConstMST`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  lens model that describes a section of a highly magnified deflector region. The parameterization is chosen to describe local observables efficient.

  Observables are: - curvature radius (basically bending relative to the center of the profile) - radial stretch (plus sign) thickness of arc with parity (more generalized than the power-law slope) - tangential stretch (plus sign). Infinity means at critical curve - direction of curvature - position of arc

  Requirements: - Should work with other perturbative models without breaking its meaning (say when adding additional shear terms) - Must best reflect the observables in lensing - minimal covariances between the parameters, intuitive parameterization.

  `derivatives`(x, y, tangential_stretch, radial_stretch, curvature, direction, center_x, center_y)

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `function`(x, y, tangential_stretch, radial_stretch, curvature, direction, center_x, center_y)

    ATTENTION: there may not be a global lensing potential!

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `hessian`(x, y, tangential_stretch, radial_stretch, curvature, direction, center_x, center_y)

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'curvature': 1e-06, 'direction': -3.141592653589793, 'radial_stretch': -5, 'tangential_stretch': -100}
  `param_names` = ['tangential_stretch', 'radial_stretch', 'curvature', 'direction', 'center_x', 'center_y']
  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'curvature': 100, 'direction': 3.141592653589793, 'radial_stretch': 5, 'tangential_stretch': 100}

## lenstronomy.LensModel.Profiles.curved_arc_sis_mst module

class `lenstronomy.LensModel.Profiles.curved_arc_sis_mst.` `CurvedArcSISMST`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  lens model that describes a section of a highly magnified deflector region. The parameterization is chosen to describe local observables efficient.

  Observables are: - curvature radius (basically bending relative to the center of the profile) - radial stretch (plus sign) thickness of arc with parity (more generalized than the power-law slope) - tangential stretch (plus sign). Infinity means at critical curve - direction of curvature - position of arc

  Requirements: - Should work with other perturbative models without breaking its meaning (say when adding additional shear terms) - Must best reflect the observables in lensing - minimal covariances between the parameters, intuitive parameterization.

  `derivatives`(x, y, tangential_stretch, radial_stretch, curvature, direction, center_x, center_y)

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `function`(x, y, tangential_stretch, radial_stretch, curvature, direction, center_x, center_y)

    ATTENTION: there may not be a global lensing potential!

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `hessian`(x, y, tangential_stretch, radial_stretch, curvature, direction, center_x, center_y)

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'curvature': 1e-06, 'direction': -3.141592653589793, 'radial_stretch': -5, 'tangential_stretch': -100}
  `param_names` = ['tangential_stretch', 'radial_stretch', 'curvature', 'direction', 'center_x', 'center_y']
  static `sis_mst2stretch`(theta_E, kappa_ext, center_x_sis, center_y_sis, center_x, center_y)

    turn Singular power-law lens model into stretch parameterization at position (center_x, center_y) This is the inverse function of stretch2spp()

    Parameters: | theta_E – Einstein radius of SIS profile kappa_ext – external convergence (MST factor 1 - kappa_ext) center_x_sis – center of SPP model center_y_sis – center of SPP model center_x – center of curved model definition center_y – center of curved model definition
    Returns: | tangential_stretch, radial_stretch, curvature, direction
    Returns: |

  static `stretch2sis_mst`(tangential_stretch, radial_stretch, curvature, direction, center_x, center_y)

    Parameters: | tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian center_x – center of source in image plane center_y – center of source in image plane
    Returns: | parameters in terms of a spherical SIS + MST resulting in the same observables

  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'curvature': 100, 'direction': 3.141592653589793, 'radial_stretch': 5, 'tangential_stretch': 100}

## lenstronomy.LensModel.Profiles.curved_arc_spp module

class `lenstronomy.LensModel.Profiles.curved_arc_spp.` `CurvedArcSPP`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  lens model that describes a section of a highly magnified deflector region. The parameterization is chosen to describe local observables efficient.

  Observables are: - curvature radius (basically bending relative to the center of the profile) - radial stretch (plus sign) thickness of arc with parity (more generalized than the power-law slope) - tangential stretch (plus sign). Infinity means at critical curve - direction of curvature - position of arc

  Requirements: - Should work with other perturbative models without breaking its meaning (say when adding additional shear terms) - Must best reflect the observables in lensing - minimal covariances between the parameters, intuitive parameterization.

  `derivatives`(x, y, tangential_stretch, radial_stretch, curvature, direction, center_x, center_y)

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `function`(x, y, tangential_stretch, radial_stretch, curvature, direction, center_x, center_y)

    ATTENTION: there may not be a global lensing potential!

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `hessian`(x, y, tangential_stretch, radial_stretch, curvature, direction, center_x, center_y)

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'curvature': 1e-06, 'direction': -3.141592653589793, 'radial_stretch': -5, 'tangential_stretch': -100}
  `param_names` = ['tangential_stretch', 'radial_stretch', 'curvature', 'direction', 'center_x', 'center_y']
  static `spp2stretch`(theta_E, gamma, center_x_spp, center_y_spp, center_x, center_y)

    turn Singular power-law lens model into stretch parameterization at position (center_x, center_y) This is the inverse function of stretch2spp()

    Parameters: | theta_E – Einstein radius of SPP model gamma – power-law slope center_x_spp – center of SPP model center_y_spp – center of SPP model center_x – center of curved model definition center_y – center of curved model definition
    Returns: | tangential_stretch, radial_stretch, curvature, direction

  static `stretch2spp`(tangential_stretch, radial_stretch, curvature, direction, center_x, center_y)

    Parameters: | tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian center_x – center of source in image plane center_y – center of source in image plane
    Returns: | parameters in terms of a spherical power-law profile resulting in the same observables

  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'curvature': 100, 'direction': 3.141592653589793, 'radial_stretch': 5, 'tangential_stretch': 100}

## lenstronomy.LensModel.Profiles.curved_arc_spt module

class `lenstronomy.LensModel.Profiles.curved_arc_spt.` `CurvedArcSPT`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  Curved arc model based on SIS+MST with an additional non-linear shear distortions applied on the source coordinates around the center. This profile is effectively a Source Position Transform of a curved arc and a shear distortion.

  `derivatives`(x, y, tangential_stretch, radial_stretch, curvature, direction, gamma1, gamma2, center_x, center_y)

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian gamma1 – non-linear reduced shear distortion in the source plane gamma2 – non-linear reduced shear distortion in the source plane center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `function`(x, y, tangential_stretch, radial_stretch, curvature, direction, gamma1, gamma2, center_x, center_y)

    ATTENTION: there may not be a global lensing potential!

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian gamma1 – non-linear reduced shear distortion in the source plane gamma2 – non-linear reduced shear distortion in the source plane center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `hessian`(x, y, tangential_stretch, radial_stretch, curvature, direction, gamma1, gamma2, center_x, center_y)

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian gamma1 – non-linear reduced shear distortion in the source plane gamma2 – non-linear reduced shear distortion in the source plane center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'curvature': 1e-06, 'direction': -3.141592653589793, 'gamma1': -0.5, 'gamma2': -0.5, 'radial_stretch': -5, 'tangential_stretch': -100}
  `param_names` = ['tangential_stretch', 'radial_stretch', 'curvature', 'direction', 'gamma1', 'gamma2', 'center_x', 'center_y']
  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'curvature': 100, 'direction': 3.141592653589793, 'gamma1': 0.5, 'gamma2': 0.5, 'radial_stretch': 5, 'tangential_stretch': 100}

## lenstronomy.LensModel.Profiles.curved_arc_tan_diff module

class `lenstronomy.LensModel.Profiles.curved_arc_tan_diff.` `CurvedArcTanDiff`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  Curved arc model with an additional non-zero tangential stretch differential in tangential direction component

  Observables are: - curvature radius (basically bending relative to the center of the profile) - radial stretch (plus sign) thickness of arc with parity (more generalized than the power-law slope) - tangential stretch (plus sign). Infinity means at critical curve - direction of curvature - position of arc

  Requirements: - Should work with other perturbative models without breaking its meaning (say when adding additional shear terms) - Must best reflect the observables in lensing - minimal covariances between the parameters, intuitive parameterization.

  `derivatives`(x, y, tangential_stretch, radial_stretch, curvature, dtan_dtan, direction, center_x, center_y)

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian dtan_dtan – d(tangential_stretch) / d(tangential direction) / tangential stretch center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `function`(x, y, tangential_stretch, radial_stretch, curvature, dtan_dtan, direction, center_x, center_y)

    ATTENTION: there may not be a global lensing potential!

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian dtan_dtan – d(tangential_stretch) / d(tangential direction) / tangential stretch center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `hessian`(x, y, tangential_stretch, radial_stretch, curvature, dtan_dtan, direction, center_x, center_y)

    Parameters: | x – y – tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius direction – float, angle in radian dtan_dtan – d(tangential_stretch) / d(tangential direction) / tangential stretch center_x – center of source in image plane center_y – center of source in image plane
    Returns: |

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'curvature': 1e-06, 'direction': -3.141592653589793, 'dtan_dtan': -10, 'radial_stretch': -5, 'tangential_stretch': -100}
  `param_names` = ['tangential_stretch', 'radial_stretch', 'curvature', 'dtan_dtan', 'direction', 'center_x', 'center_y']
  static `stretch2sie_mst`(tangential_stretch, radial_stretch, curvature, dtan_dtan, direction, center_x, center_y)

    Parameters: | tangential_stretch – float, stretch of intrinsic source in tangential direction radial_stretch – float, stretch of intrinsic source in radial direction curvature – 1/curvature radius dtan_dtan – d(tangential_stretch) / d(tangential direction) / tangential stretch direction – float, angle in radian center_x – center of source in image plane center_y – center of source in image plane
    Returns: | parameters in terms of a spherical SIS + MST resulting in the same observables

  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'curvature': 100, 'direction': 3.141592653589793, 'dtan_dtab': 10, 'radial_stretch': 5, 'tangential_stretch': 100}

## lenstronomy.LensModel.Profiles.dipole module

class `lenstronomy.LensModel.Profiles.dipole.` `Dipole`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class for dipole response of two massive bodies (experimental)

  `derivatives`(x, y, com_x, com_y, phi_dipole, coupling)

    deflection angles

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `function`(x, y, com_x, com_y, phi_dipole, coupling)

    lensing potential

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `hessian`(x, y, com_x, com_y, phi_dipole, coupling)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `lower_limit_default` = {'com_x': -100, 'com_y': -100, 'coupling': -10, 'phi_dipole': -10}
  `param_names` = ['com_x', 'com_y', 'phi_dipole', 'coupling']
  `upper_limit_default` = {'com_x': 100, 'com_y': 100, 'coupling': 10, 'phi_dipole': 10}

class `lenstronomy.LensModel.Profiles.dipole.` `DipoleUtil`

  Bases: `object`

  pre-calculation of dipole properties

  `angle`(center1_x, center1_y, center2_x, center2_y)

    compute the rotation angle of the dipole :return:

  `com`(center1_x, center1_y, center2_x, center2_y, Fm)

    Returns: | center of mass

  `mass_ratio`(theta_E, theta_E_sub)

    computes mass ration of the two clumps with given Einstein radius and power law slope (clump1/sub-clump) :param theta_E: :param theta_E_sub: :return:

## lenstronomy.LensModel.Profiles.elliptical_density_slice module

class `lenstronomy.LensModel.Profiles.elliptical_density_slice.` `ElliSLICE`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  This class computes the lensing quantities for an elliptical slice of constant density. Based on Schramm 1994 https://ui.adsabs.harvard.edu/abs/1994A%26A…284…44S/abstract

  Computes the lensing quantities of an elliptical slice with semi major axis ‘a’ and semi minor axis ‘b’, centered on ‘center_x’ and ‘center_y’, oriented with an angle ‘psi’ in radian, and with constant surface mass density ‘sigma_0’. In other words, this lens model is characterized by the surface mass density :

  ..math::
    kappa(x,y) = left{
      begin{array}{ll}
        sigma_0 & mbox{if } frac{x_{rot}^2}{a^2} + frac{y_{rot}^2}{b^2} leq 1 0 & mbox{else}

      end{array}

    right}.

  with

  ..math::
    x_{rot} = x_c cos psi + y_c sin psi y_{rot} = - x_c sin psi + y_c cos psi x_c = x - center_x y_c = y - center_y
  `alpha_ext`(x, y, kwargs_slice)

    deflection angle for (x,y) outside the elliptical slice

    Parameters: | kwargs_slice – dict, dictionary with the slice definition (a,b,psi,sigma_0)

  `alpha_in`(x, y, kwargs_slice)

    deflection angle for (x,y) inside the elliptical slice

    Parameters: | kwargs_slice – dict, dictionary with the slice definition (a,b,psi,sigma_0)

  `derivatives`(x, y, a, b, psi, sigma_0, center_x=0.0, center_y=0.0)

    lensing deflection angle

    Parameters: | a – float, semi-major axis, must be positive b – float, semi-minor axis, must be positive psi – float, orientation in radian sigma_0 – float, surface mass density, must be positive center_x – float, center on the x axis center_y – float, center on the y axis

  `function`(x, y, a, b, psi, sigma_0, center_x=0.0, center_y=0.0)

    lensing potential

    Parameters: | a – float, semi-major axis, must be positive b – float, semi-minor axis, must be positive psi – float, orientation in radian sigma_0 – float, surface mass density, must be positive center_x – float, center on the x axis center_y – float, center on the y axis

  `hessian`(x, y, a, b, psi, sigma_0, center_x=0.0, center_y=0.0)

    lensing second derivatives

    Parameters: | a – float, semi-major axis, must be positive b – float, semi-minor axis, must be positive psi – float, orientation in radian sigma_0 – float, surface mass density, must be positive center_x – float, center on the x axis center_y – float, center on the y axis

  `lower_limit_default` = {'a': 0.0, 'b': 0.0, 'center_x': -100.0, 'center_y': -100.0, 'psi': -1.5707963267948966}
  `param_names` = ['a', 'b', 'psi', 'sigma_0', 'center_x', 'center_y']
  `pot_ext`(x, y, kwargs_slice)

    lensing potential for (x,y) outside the elliptical slice

    Parameters: | kwargs_slice – dict, dictionary with the slice definition (a,b,psi,sigma_0)

  `pot_in`(x, y, kwargs_slice)

    lensing potential for (x,y) inside the elliptical slice

    Parameters: | kwargs_slice – dict, dictionary with the slice definition (a,b,psi,sigma_0)

  `sign`(z)

    sign function

    Parameters: | z – complex

  `upper_limit_default` = {'a': 100.0, 'b': 100.0, 'center_x': 100.0, 'center_y': 100.0, 'psi': 1.5707963267948966}

## lenstronomy.LensModel.Profiles.epl module

class `lenstronomy.LensModel.Profiles.epl.` `EPL`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  ” Elliptical Power Law mass profile

  \[\kappa(x, y) = \frac{3-\gamma}{2} \left(\frac{\theta_{E}}{\sqrt{q x^2 + y^2/q}} \right)^{\gamma-1}\]

  with \(\theta_{E}\) is the (circularized) Einstein radius, \(\gamma\) is the negative power-law slope of the 3D mass distributions, \(q\) is the minor/major axis ratio, and \(x\) and \(y\) are defined in a coordinate sys- tem aligned with the major and minor axis of the lens.

  In terms of eccentricities, this profile is defined as

  \[\kappa(r) = \frac{3-\gamma}{2} \left(\frac{\theta'_{E}}{r \sqrt{1 − e*\cos(2*\phi)}} \right)^{\gamma-1}\]

  with \(\epsilon\) is the ellipticity defined as

  \[\epsilon = \frac{1-q^2}{1+q^2}\]

  And an Einstein radius \(\theta'_{\rm E}\) related to the definition used is

  \[\left(\frac{\theta'_{\rm E}}{\theta_{\rm E}}\right)^{2} = \frac{2q}{1+q^2}.\]

  The mathematical form of the calculation is presented by Tessore & Metcalf (2015), https://arxiv.org/abs/1507.01819. The current implementation is using hyperbolic functions. The paper presents an iterative calculation scheme, converging in few iterations to high precision and accuracy.

  A (faster) implementation of the same model using numba is accessible as ‘EPL_NUMBA’ with the iterative calculation scheme.

  `derivatives`(x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0)

    Parameters: | x – x-coordinate in image plane y – y-coordinate in image plane theta_E – Einstein radius gamma – power law slope e1 – eccentricity component e2 – eccentricity component center_x – profile center center_y – profile center
    Returns: | alpha_x, alpha_y

  `function`(x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0)

    Parameters: | x – x-coordinate in image plane y – y-coordinate in image plane theta_E – Einstein radius gamma – power law slope e1 – eccentricity component e2 – eccentricity component center_x – profile center center_y – profile center
    Returns: | lensing potential

  `hessian`(x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0)

    Parameters: | x – x-coordinate in image plane y – y-coordinate in image plane theta_E – Einstein radius gamma – power law slope e1 – eccentricity component e2 – eccentricity component center_x – profile center center_y – profile center
    Returns: | f_xx, f_xy, f_yx, f_yy

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'gamma': 1.5, 'theta_E': 0}
  `param_conv`(theta_E, gamma, e1, e2)

    converts parameters as defined in this class to the parameters used in the EPLMajorAxis() class

    Parameters: | theta_E – Einstein radius as defined in the profile class gamma – negative power-law slope e1 – eccentricity modulus e2 – eccentricity modulus
    Returns: | b, t, q, phi_G

  `param_names` = ['theta_E', 'gamma', 'e1', 'e2', 'center_x', 'center_y']
  `set_dynamic`()

    Returns: |

  `set_static`(theta_E, gamma, e1, e2, center_x=0, center_y=0)

    Parameters: | x – x-coordinate in image plane y – y-coordinate in image plane theta_E – Einstein radius gamma – power law slope e1 – eccentricity component e2 – eccentricity component center_x – profile center center_y – profile center
    Returns: | self variables set

  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'gamma': 2.5, 'theta_E': 100}

class `lenstronomy.LensModel.Profiles.epl.` `EPLMajorAxis`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  This class contains the function and the derivatives of the elliptical power law.

  \[\kappa = (2-t)/2 * \left[\frac{b}{\sqrt{q^2 x^2 + y^2}}\right]^t\]

  where with \(t = \gamma - 1\) (from EPL class) being the projected power-law slope of the convergence profile, critical radius b, axis ratio q.

  Tessore & Metcalf (2015), https://arxiv.org/abs/1507.01819

  `derivatives`(x, y, b, t, q)

    returns the deflection angles

    Parameters: | x – x-coordinate in image plane relative to center (major axis) y – y-coordinate in image plane relative to center (minor axis) b – critical radius t – projected power-law slope q – axis ratio
    Returns: | f_x, f_y

  `function`(x, y, b, t, q)

    returns the lensing potential

    Parameters: | x – x-coordinate in image plane relative to center (major axis) y – y-coordinate in image plane relative to center (minor axis) b – critical radius t – projected power-law slope q – axis ratio
    Returns: | lensing potential

  `hessian`(x, y, b, t, q)

    Hessian matrix of the lensing potential

    Parameters: | x – x-coordinate in image plane relative to center (major axis) y – y-coordinate in image plane relative to center (minor axis) b – critical radius t – projected power-law slope q – axis ratio
    Returns: | f_xx, f_yy, f_xy

  `param_names` = ['b', 't', 'q', 'center_x', 'center_y']

## lenstronomy.LensModel.Profiles.epl_numba module

class `lenstronomy.LensModel.Profiles.epl_numba.` `EPL_numba`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  ” Elliptical Power Law mass profile - computation accelerated with numba

  \[\kappa(x, y) = \frac{3-\gamma}{2} \left(\frac{\theta_{E}}{\sqrt{q x^2 + y^2/q}} \right)^{\gamma-1}\]

  with \(\theta_{E}\) is the (circularized) Einstein radius, \(\gamma\) is the negative power-law slope of the 3D mass distributions, \(q\) is the minor/major axis ratio, and \(x\) and \(y\) are defined in a coordinate system aligned with the major and minor axis of the lens.

  In terms of eccentricities, this profile is defined as

  \[\kappa(r) = \frac{3-\gamma}{2} \left(\frac{\theta'_{E}}{r \sqrt{1 − e*\cos(2*\phi)}} \right)^{\gamma-1}\]

  with \(\epsilon\) is the ellipticity defined as

  \[\epsilon = \frac{1-q^2}{1+q^2}\]

  And an Einstein radius \(\theta'_{\rm E}\) related to the definition used is

  \[\left(\frac{\theta'_{\rm E}}{\theta_{\rm E}}\right)^{2} = \frac{2q}{1+q^2}.\]

  The mathematical form of the calculation is presented by Tessore & Metcalf (2015), https://arxiv.org/abs/1507.01819. The current implementation is using hyperbolic functions. The paper presents an iterative calculation scheme, converging in few iterations to high precision and accuracy.

  A (slower) implementation of the same model using hyperbolic functions without the iterative calculation is accessible as ‘EPL’ not requiring numba.

  `derivatives`

    Parameters: | x – x-coordinate (angle) y – y-coordinate (angle) theta_E – Einstein radius (angle), pay attention to specific definition! gamma – logarithmic slope of the power-law profile. gamma=2 corresponds to isothermal e1 – eccentricity component e2 – eccentricity component center_x – x-position of lens center center_y – y-position of lens center
    Returns: | deflection angles alpha_x, alpha_y

  `function`

    Parameters: | x – x-coordinate (angle) y – y-coordinate (angle) theta_E – Einstein radius (angle), pay attention to specific definition! gamma – logarithmic slope of the power-law profile. gamma=2 corresponds to isothermal e1 – eccentricity component e2 – eccentricity component center_x – x-position of lens center center_y – y-position of lens center
    Returns: | lensing potential

  `hessian`

    Parameters: | x – x-coordinate (angle) y – y-coordinate (angle) theta_E – Einstein radius (angle), pay attention to specific definition! gamma – logarithmic slope of the power-law profile. gamma=2 corresponds to isothermal e1 – eccentricity component e2 – eccentricity component center_x – x-position of lens center center_y – y-position of lens center
    Returns: | Hessian components f_xx, f_yy, f_xy

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'gamma': 1.5, 'theta_E': 0}
  `param_names` = ['theta_E', 'gamma', 'e1', 'e2', 'center_x', 'center_y']
  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'gamma': 2.5, 'theta_E': 100}

## lenstronomy.LensModel.Profiles.flexion module

class `lenstronomy.LensModel.Profiles.flexion.` `Flexion`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class for flexion

  `derivatives`(x, y, g1, g2, g3, g4, ra_0=0, dec_0=0)

    deflection angles

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `function`(x, y, g1, g2, g3, g4, ra_0=0, dec_0=0)

    lensing potential

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `hessian`(x, y, g1, g2, g3, g4, ra_0=0, dec_0=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `lower_limit_default` = {'dec_0': -100, 'g1': -0.1, 'g2': -0.1, 'g3': -0.1, 'g4': -0.1, 'ra_0': -100}
  `param_names` = ['g1', 'g2', 'g3', 'g4', 'ra_0', 'dec_0']
  `upper_limit_default` = {'dec_0': 100, 'g1': 0.1, 'g2': 0.1, 'g3': 0.1, 'g4': 0.1, 'ra_0': 100}

## lenstronomy.LensModel.Profiles.flexionfg module

class `lenstronomy.LensModel.Profiles.flexionfg.` `Flexionfg`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  Flexion consist of basis F flexion and G flexion (F1,F2,G1,G2), see formulas 2.54, 2.55 in Massimo Meneghetti 2017 - “Introduction to Gravitational Lensing”.

  `derivatives`(x, y, F1, F2, G1, G2, ra_0=0, dec_0=0)

    deflection angle :param x: x-coordinate :param y: y-coordinate :param F1: F1 flexion, derivative of kappa in x direction :param F2: F2 flexion, derivative of kappa in y direction :param G1: G1 flexion :param G2: G2 flexion :param ra_0: center x-coordinate :param dec_0: center x-coordinate :return: deflection angle

  `function`(x, y, F1, F2, G1, G2, ra_0=0, dec_0=0)

    lensing potential

    Parameters: | x – x-coordinate y – y-coordinate F1 – F1 flexion, derivative of kappa in x direction F2 – F2 flexion, derivative of kappa in y direction G1 – G1 flexion G2 – G2 flexion ra_0 – center x-coordinate dec_0 – center y-coordinate
    Returns: | lensing potential

  `hessian`(x, y, F1, F2, G1, G2, ra_0=0, dec_0=0)

    Hessian matrix :param x: x-coordinate :param y: y-coordinate :param F1: F1 flexion, derivative of kappa in x direction :param F2: F2 flexion, derivative of kappa in y direction :param G1: G1 flexion :param G2: G2 flexion :param ra_0: center x-coordinate :param dec_0: center y-coordinate :return: second order derivatives f_xx, f_yy, f_xy

  `lower_limit_default` = {'F1': -0.1, 'F2': -0.1, 'G1': -0.1, 'G2': -0.1, 'dec_0': -100, 'ra_0': -100}
  `param_names` = ['F1', 'F2', 'G1', 'G2', 'ra_0', 'dec_0']
  static `transform_fg`(F1, F2, G1, G2)

    basis transform from (F1,F2,G1,G2) to (g1,g2,g3,g4) :param f1: F1 flexion, derivative of kappa in x direction :param f2: F2 flexion, derivative of kappa in y direction :param g1: G1 flexion :param g2: G2 flexion :return: g1,g2,g3,g4 (phi_xxx, phi_xxy, phi_xyy, phi_yyy)

  `upper_limit_default` = {'F1': 0.1, 'F2': 0.1, 'G1': 0.1, 'G2': 0.1, 'dec_0': 100, 'ra_0': 100}

## lenstronomy.LensModel.Profiles.gauss_decomposition module

This module contains the class to compute lensing properties of any elliptical profile using Shajib (2019)’s Gauss decomposition.

class `lenstronomy.LensModel.Profiles.gauss_decomposition.` `GaussianEllipseKappaSet`(use_scipy_wofz=True, min_ellipticity=1e-05)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  This class computes the lensing properties of a set of concentric elliptical Gaussian convergences.

  `density_2d`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)

    Compute the density of a set of concentric elliptical Gaussian convergence profiles \(\sum A/(2\pi \sigma^2) \exp(-( x^2+y^2/q^2)/2\sigma^2)\).

    Parameters: | x (`float` or `numpy.array`) – x coordinate y (`float` or `numpy.array`) – y coordinate amp (`numpy.array` with `dtype=float`) – Amplitude of Gaussian, convention: \(A/(2 \pi\sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\) sigma (`numpy.array` with `dtype=float`) – Standard deviation of Gaussian e1 (`float`) – Ellipticity parameter 1 e2 (`float`) – Ellipticity parameter 2 center_x (`float`) – x coordinate of centroid center_y (`float`) – y coordianate of centroid
    Returns: | Density \(\kappa\) for elliptical Gaussian convergence
    Return type: | `float`, or `numpy.array` with shape equal to `x.shape`

  `derivatives`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)

    Compute the derivatives of function angles \(\partial f/\partial x\), \(\partial f/\partial y\) at \(x,\ y\) for a set of concentric elliptic Gaussian convergence profiles.

    Parameters: | x (`float` or `numpy.array`) – x coordinate y (`float` or `numpy.array`) – y coordinate amp (`numpy.array` with `dtype=float`) – Amplitude of Gaussian, convention: \(A/(2 \pi\sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\) sigma (`numpy.array` with `dtype=float`) – Standard deviation of Gaussian e1 (`float`) – Ellipticity parameter 1 e2 (`float`) – Ellipticity parameter 2 center_x (`float`) – x coordinate of centroid center_y (`float`) – y coordianate of centroid
    Returns: | Deflection angle \(\partial f/\partial x\), \(\partial f/\partial y\) for elliptical Gaussian convergence
    Return type: | tuple `(float, float)` or `(numpy.array, numpy.array)` with each `numpy` array’s shape equal to `x.shape`

  `function`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)

    Compute the potential function for a set of concentric elliptical Gaussian convergence profiles.

    Parameters: | x (`float` or `numpy.array`) – x coordinate y (`float` or `numpy.array`) – y coordinate amp (`numpy.array` with `dtype=float`) – Amplitude of Gaussian, convention: \(A/(2 \pi\sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\) sigma (`numpy.array` with `dtype=float`) – Standard deviation of Gaussian e1 (`float`) – Ellipticity parameter 1 e2 (`float`) – Ellipticity parameter 2 center_x (`float`) – x coordinate of centroid center_y (`float`) – y coordianate of centroid
    Returns: | Potential for elliptical Gaussian convergence
    Return type: | `float`, or `numpy.array` with `shape = x.shape`

  `hessian`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)

    Compute Hessian matrix of function \(\partial^2f/\partial x^2\), \(\partial^2 f/\partial y^2\), \(\partial^2 f/\partial x\partial y\) for a set of concentric elliptic Gaussian convergence profiles.

    Parameters: | x (`float` or `numpy.array`) – x coordinate y (`float` or `numpy.array`) – y coordinate amp (`numpy.array` with `dtype=float`) – Amplitude of Gaussian, convention: \(A/(2 \pi\sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\) sigma (`numpy.array` with `dtype=float`) – Standard deviation of Gaussian e1 (`float`) – Ellipticity parameter 1 e2 (`float`) – Ellipticity parameter 2 center_x (`float`) – x coordinate of centroid center_y (`float`) – y coordianate of centroid
    Returns: | Hessian \(\partial^2f/\partial x^2\), \(\partial^2/\partial x\partial y\), \(\partial^2/\partial y\partial x\), \(\partial^2 f/\partial y^2\) for elliptical Gaussian convergence.
    Return type: | tuple `(float, float, float)` , or `(numpy.array, numpy.array, numpy.array)` with each `numpy` array’s shape equal to `x.shape`

  `lower_limit_default` = {'amp': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'sigma': 0}
  `param_names` = ['amp', 'sigma', 'e1', 'e2', 'center_x', 'center_y']
  `upper_limit_default` = {'amp': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'sigma': 100}

class `lenstronomy.LensModel.Profiles.gauss_decomposition.` `GaussDecompositionAbstract`(n_sigma=15, sigma_start_mult=0.02, sigma_end_mult=15.0, precision=10, use_scipy_wofz=True, min_ellipticity=1e-05)

  Bases: `object`

  This abstract class sets up a template for computing lensing properties of an elliptical convergence through Shajib (2019)’s Gauss decomposition.

  `density_2d`(x, y, e1=0.0, e2=0.0, center_x=0.0, center_y=0.0, **kwargs)

    Compute the convergence profile for Gauss-decomposed elliptic Sersic profile.

    Parameters: | x (`float` or `numpy.array`) – x coordinate y (`float` or `numpy.array`) – y coordinate e1 (`float`) – Ellipticity parameter 1 e2 (`float`) – Ellipticity parameter 2 center_x (`float`) – x coordinate of centroid center_y (`float`) – y coordinate of centroid **kwargs – Keyword arguments that are defined by the child class that are particular for the convergence profile in the child class.
    Returns: | Convergence profile
    Return type: | `type(x)`

  `derivatives`(x, y, e1=0.0, e2=0.0, center_x=0.0, center_y=0.0, **kwargs)

    Compute the derivatives of the deflection potential \(\partial f/\partial x\), \(\partial f/\partial y\) for a Gauss-decomposed elliptic convergence.

    Parameters: | x (`float` or `numpy.array`) – x coordinate y (`float` or `numpy.array`) – y coordinate e1 (`float`) – Ellipticity parameter 1 e2 (`float`) – Ellipticity parameter 2 center_x (`float`) – x coordinate of centroid center_y (`float`) – y coordinate of centroid **kwargs – Keyword arguments that are defined by the child class that are particular for the convergence profile
    Returns: | Derivatives of deflection potential
    Return type: | tuple `(type(x), type(x))`

  `function`(x, y, e1=0.0, e2=0.0, center_x=0.0, center_y=0.0, **kwargs)

    Compute the deflection potential of a Gauss-decomposed elliptic convergence.

    Parameters: | x (`float`) – x coordinate y (`float`) – y coordinate e1 (`float`) – Ellipticity parameter 1 e2 (`float`) – Ellipticity parameter 2 center_x (`float`) – x coordinate of centroid center_y (`float`) – y coordinate of centroid **kwargs – Keyword arguments that are defined by the child class that are particular for the convergence profile
    Returns: | Deflection potential
    Return type: | `float`

  `gauss_decompose`(**kwargs)

    Compute the amplitudes and sigmas of Gaussian components using the integral transform with Gaussian kernel from Shajib (2019). The returned values are in the convention of eq. (2.13).

    Parameters: | func (`function`) – The function to decompose **kwargs – Keyword arguments to send to `func`
    Returns: | Amplitudes and standard deviations of the Gaussian components
    Return type: | tuple `(numpy.array, numpy.array)`

  `get_kappa_1d`(y, **kwargs)

    Abstract method to compute the spherical Sersic profile at y. The concrete method has to defined by the child class.

    Parameters: | y (`float` or `numpy.array`) – y coordinate **kwargs – Keyword arguments that are defined by the child class that are particular for the convergence profile

  `get_scale`(**kwargs)

    Abstract method to identify the keyword argument for the scale size among the profile parameters of the child class’ convergence profile.

    Parameters: | **kwargs – Keyword arguments
    Returns: | Scale size
    Return type: | `float`

  `hessian`(x, y, e1=0.0, e2=0.0, center_x=0.0, center_y=0.0, **kwargs)

    Compute the Hessian of the deflection potential \(\partial^2f/\partial x^2\), \(\partial^2 f/ \partial y^2\), \(\partial^2 f/\partial x\partial y\) of a Gauss-decomposed elliptic Sersic convergence.

    Parameters: | x (`float` or `numpy.array`) – x coordinate y (`float` or `numpy.array`) – y coordinate e1 (`float`) – Ellipticity parameter 1 e2 (`float`) – Ellipticity parameter 2 center_x (`float`) – x coordinate of centroid center_y (`float`) – y coordinate of centroid **kwargs – Keyword arguments that are defined by the child class that are particular for the convergence profile
    Returns: | Hessian of deflection potential
    Return type: | tuple `(type(x), type(x), type(x))`

class `lenstronomy.LensModel.Profiles.gauss_decomposition.` `SersicEllipseGaussDec`(n_sigma=15, sigma_start_mult=0.02, sigma_end_mult=15.0, precision=10, use_scipy_wofz=True, min_ellipticity=1e-05)

  Bases: `lenstronomy.LensModel.Profiles.gauss_decomposition.GaussDecompositionAbstract`

  This class computes the lensing properties of an elliptical Sersic profile using the Shajib (2019)’s Gauss decomposition method.

  `get_kappa_1d`(y, **kwargs)

    Compute the spherical Sersic profile at y.

    Parameters: | y (`float`) – y coordinate **kwargs – Keyword arguments
    Keyword Arguments:
    | n_sersic (`float`) – Sersic index R_sersic (`float`) – Sersic scale radius k_eff (`float`) – Sersic convergence at R_sersic
    Returns: | Sersic function at y
    Return type: | `type(y)`

  `get_scale`(**kwargs)

    Identify the scale size from the keyword arguments.

    Parameters: | **kwargs – Keyword arguments
    Keyword Arguments:
    | n_sersic (`float`) – Sersic index R_sersic (`float`) – Sersic scale radius k_eff (`float`) – Sersic convergence at R_sersic
    Returns: | Sersic radius
    Return type: | `float`

  `lower_limit_default` = {'R_sersic': 0.0, 'center_x': -100.0, 'center_y': -100.0, 'e1': -0.5, 'e2': -0.5, 'k_eff': 0.0, 'n_sersic': 0.5}
  `param_names` = ['k_eff', 'R_sersic', 'n_sersic', 'e1', 'e2', 'center_x', 'center_y']
  `upper_limit_default` = {'R_sersic': 100.0, 'center_x': 100.0, 'center_y': 100.0, 'e1': 0.5, 'e2': 0.5, 'k_eff': 100.0, 'n_sersic': 8.0}

class `lenstronomy.LensModel.Profiles.gauss_decomposition.` `NFWEllipseGaussDec`(n_sigma=15, sigma_start_mult=0.005, sigma_end_mult=50.0, precision=10, use_scipy_wofz=True, min_ellipticity=1e-05)

  Bases: `lenstronomy.LensModel.Profiles.gauss_decomposition.GaussDecompositionAbstract`

  This class computes the lensing properties of an elliptical, projected NFW profile using Shajib (2019)’s Gauss decomposition method.

  `get_kappa_1d`(y, **kwargs)

    Compute the spherical projected NFW profile at y.

    Parameters: | y (`float`) – y coordinate **kwargs – Keyword arguments
    Keyword Arguments:
    | alpha_Rs (`float`) – Deflection angle at `Rs` R_s (`float`) – NFW scale radius
    Returns: | projected NFW profile at y
    Return type: | `type(y)`

  `get_scale`(**kwargs)

    Identify the scale size from the keyword arguments.

    Parameters: | **kwargs – Keyword arguments
    Keyword Arguments:
    | alpha_Rs (`float`) – Deflection angle at `Rs` R_s (`float`) – NFW scale radius
    Returns: | NFW scale radius
    Return type: | `float`

  `lower_limit_default` = {'Rs': 0, 'alpha_Rs': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5}
  `param_names` = ['Rs', 'alpha_Rs', 'e1', 'e2', 'center_x', 'center_y']
  `upper_limit_default` = {'Rs': 100, 'alpha_Rs': 10, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5}

class `lenstronomy.LensModel.Profiles.gauss_decomposition.` `GaussDecompositionAbstract3D`(n_sigma=15, sigma_start_mult=0.02, sigma_end_mult=15.0, precision=10, use_scipy_wofz=True, min_ellipticity=1e-05)

  Bases: `lenstronomy.LensModel.Profiles.gauss_decomposition.GaussDecompositionAbstract`

  This abstract class sets up a template for computing lensing properties of a convergence from 3D spherical profile through Shajib (2019)’s Gauss decomposition.

  `gauss_decompose`(**kwargs)

    Compute the amplitudes and sigmas of Gaussian components using the integral transform with Gaussian kernel from Shajib (2019). The returned values are in the convention of eq. (2.13).

    Parameters: | func (`function`) – The function to decompose **kwargs – Keyword arguments to send to `func`
    Returns: | Amplitudes and standard deviations of the Gaussian components
    Return type: | tuple `(numpy.array, numpy.array)`

class `lenstronomy.LensModel.Profiles.gauss_decomposition.` `CTNFWGaussDec`(n_sigma=15, sigma_start_mult=0.01, sigma_end_mult=20.0, precision=10, use_scipy_wofz=True)

  Bases: `lenstronomy.LensModel.Profiles.gauss_decomposition.GaussDecompositionAbstract3D`

  This class computes the lensing properties of an projection from a spherical cored-truncated NFW profile using Shajib (2019)’s Gauss decomposition method.

  `get_kappa_1d`(y, **kwargs)

    Compute the spherical cored-truncated NFW profile at y.

    Parameters: | y (`float`) – y coordinate **kwargs – Keyword arguments
    Keyword Arguments:
    | r_s (`float`) – Scale radius r_trunc (`float`) – Truncation radius r_core (`float`) – Core radius rho_s (`float`) – Density normalization a (`float`) – Core regularization parameter
    Returns: | projected NFW profile at y
    Return type: | `type(y)`

  `get_scale`(**kwargs)

    Identify the scale size from the keyword arguments.

    Parameters: | **kwargs – Keyword arguments
    Keyword Arguments:
    | r_s (`float`) – Scale radius r_trunc (`float`) – Truncation radius r_core (`float`) – Core radius rho_s (`float`) – Density normalization a (`float`) – Core regularization parameter
    Returns: | NFW scale radius
    Return type: | `float`

  `lower_limit_default` = {'a': 0.0, 'center_x': -100, 'center_y': -100, 'r_core': 0, 'r_s': 0, 'r_trunc': 0, 'rho_s': 0}
  `param_names` = ['r_s', 'r_core', 'r_trunc', 'a', 'rho_s', 'center_xcenter_y']
  `upper_limit_default` = {'a': 10.0, 'center_x': 100, 'center_y': 100, 'r_core': 100, 'r_s': 100, 'r_trunc': 100, 'rho_s': 1000}

## lenstronomy.LensModel.Profiles.gaussian_ellipse_kappa module

This module defines `class GaussianEllipseKappa` to compute the lensing properties of an elliptical Gaussian profile with ellipticity in the convergence using the formulae from Shajib (2019).

class `lenstronomy.LensModel.Profiles.gaussian_ellipse_kappa.` `GaussianEllipseKappa`(use_scipy_wofz=True, min_ellipticity=1e-05)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  This class contains functions to evaluate the derivative and hessian matrix of the deflection potential for an elliptical Gaussian convergence.

  The formulae are from Shajib (2019).

  `density_2d`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)

    Compute the density of elliptical Gaussian \(A/(2 \pi \sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\).

    Parameters: | x (`float` or `numpy.array`) – x coordinate. y (`float` or `numpy.array`) – y coordinate. amp (`float`) – Amplitude of Gaussian, convention: \(A/(2 \pi\sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\) sigma (`float`) – Standard deviation of Gaussian. e1 (`float`) – Ellipticity parameter 1. e2 (`float`) – Ellipticity parameter 2. center_x (`float`) – x coordinate of centroid. center_y (`float`) – y coordianate of centroid.
    Returns: | Density \(\kappa\) for elliptical Gaussian convergence.
    Return type: | `float`, or `numpy.array` with shape = `x.shape`.

  `derivatives`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)

    Compute the derivatives of function angles \(\partial f/\partial x\), \(\partial f/\partial y\) at \(x,\ y\).

    Parameters: | x (`float` or `numpy.array`) – x coordinate y (`float` or `numpy.array`) – y coordinate amp (`float`) – Amplitude of Gaussian, convention: \(A/(2 \pi\sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\) sigma (`float`) – Standard deviation of Gaussian e1 (`float`) – Ellipticity parameter 1 e2 (`float`) – Ellipticity parameter 2 center_x (`float`) – x coordinate of centroid center_y (`float`) – y coordianate of centroid
    Returns: | Deflection angle \(\partial f/\partial x\), \(\partial f/\partial y\) for elliptical Gaussian convergence.
    Return type: | tuple `(float, float)` or `(numpy.array, numpy.array)` with each `numpy.array`’s shape equal to `x.shape`.

  `function`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)

    Compute the potential function for elliptical Gaussian convergence.

    Parameters: | x (`float` or `numpy.array`) – x coordinate y (`float` or `numpy.array`) – y coordinate amp (`float`) – Amplitude of Gaussian, convention: \(A/(2 \pi\sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\) sigma (`float`) – Standard deviation of Gaussian e1 (`float`) – Ellipticity parameter 1 e2 (`float`) – Ellipticity parameter 2 center_x (`float`) – x coordinate of centroid center_y (`float`) – y coordianate of centroid
    Returns: | Potential for elliptical Gaussian convergence
    Return type: | `float`, or `numpy.array` with shape equal to `x.shape`

  `hessian`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)

    Compute Hessian matrix of function \(\partial^2f/\partial x^2\), \(\partial^2 f/\partial y^2\), \(\partial^2/\partial x\partial y\).

    Parameters: | x (`float` or `numpy.array`) – x coordinate y (`float` or `numpy.array`) – y coordinate amp (`float`) – Amplitude of Gaussian, convention: \(A/(2 \pi\sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\) sigma (`float`) – Standard deviation of Gaussian e1 (`float`) – Ellipticity parameter 1 e2 (`float`) – Ellipticity parameter 2 center_x (`float`) – x coordinate of centroid center_y (`float`) – y coordianate of centroid
    Returns: | Hessian \(A/(2 \pi \sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\) for elliptical Gaussian convergence.
    Return type: | tuple `(float, float, float)` , or `(numpy.array, numpy.array, numpy.array)` with each `numpy.array`’s shape equal to `x.shape`.

  `lower_limit_default` = {'amp': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'sigma': 0}
  `param_names` = ['amp', 'sigma', 'e1', 'e2', 'center_x', 'center_y']
  static `sgn`(z)

    Compute the sign function \(\mathrm{sgn}(z)\) factor for deflection as sugggested by Bray (1984). For current implementation, returning 1 is sufficient.

    Parameters: | z (`complex`) – Complex variable \(z = x + \mathrm{i}y\)
    Returns: | \(\mathrm{sgn}(z)\)
    Return type: | `float`

  `sigma_function`(x, y, q)

    Compute the function \(\varsigma (z; q)\) from equation (4.12) of Shajib (2019).

    Parameters: | x (`float` or `numpy.array`) – Real part of complex variable, \(x = \mathrm{Re}(z)\) y (`float` or `numpy.array`) – Imaginary part of complex variable, \(y = \mathrm{Im}(z)\) q (`float`) – Axis ratio
    Returns: | real and imaginary part of \(\varsigma(z; q)\) function
    Return type: | tuple `(type(x), type(x))`

  `upper_limit_default` = {'amp': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'sigma': 100}
  static `w_f_approx`(z)

    Compute the Faddeeva function \(w_{\mathrm F}(z)\) using the approximation given in Zaghloul (2017).

    Parameters: | z (`complex` or `numpy.array(dtype=complex)`) – complex number
    Returns: | \(w_\mathrm{F}(z)\)
    Return type: | `complex`

## lenstronomy.LensModel.Profiles.gaussian_ellipse_potential module

class `lenstronomy.LensModel.Profiles.gaussian_ellipse_potential.` `GaussianEllipsePotential`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains functions to evaluate a Gaussian function and calculates its derivative and hessian matrix with ellipticity in the convergence

  the calculation follows Glenn van de Ven et al. 2009

  `density`(r, amp, sigma, e1, e2)

    Parameters: | r – amp – sigma –
    Returns: |

  `density_2d`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)

    Parameters: | R – am – sigma_x – sigma_y –
    Returns: |

  `derivatives`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)

    returns df/dx and df/dy of the function

  `function`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)

    returns Gaussian

  `hessian`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'amp': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'sigma': 0}
  `mass_2d`(R, amp, sigma, e1, e2)

    Parameters: | R – amp – sigma_x – sigma_y –
    Returns: |

  `mass_2d_lens`(R, amp, sigma, e1, e2)

    Parameters: | R – amp – sigma_x – sigma_y –
    Returns: |

  `mass_3d`(R, amp, sigma, e1, e2)

    Parameters: | R – amp – sigma – e1 – e2 –
    Returns: |

  `mass_3d_lens`(R, amp, sigma, e1, e2)

    Parameters: | R – amp – sigma – e1 – e2 –
    Returns: |

  `param_names` = ['amp', 'sigma', 'e1', 'e2', 'center_x', 'center_y']
  `upper_limit_default` = {'amp': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'sigma': 100}

## lenstronomy.LensModel.Profiles.gaussian_kappa module

class `lenstronomy.LensModel.Profiles.gaussian_kappa.` `GaussianKappa`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains functions to evaluate a Gaussian function and calculates its derivative and hessian matrix

  `alpha_abs`(R, amp, sigma)

    absolute value of the deflection :param R: :param amp: :param sigma_x: :param sigma_y: :return:

  `d_alpha_dr`(R, amp, sigma_x, sigma_y)

    Parameters: | R – amp – sigma_x – sigma_y –
    Returns: |

  `density`(r, amp, sigma)

    Parameters: | r – amp – sigma –
    Returns: |

  `density_2d`(x, y, amp, sigma, center_x=0, center_y=0)

    Parameters: | R – am – sigma_x – sigma_y –
    Returns: |

  `derivatives`(x, y, amp, sigma, center_x=0, center_y=0)

    returns df/dx and df/dy of the function

  `function`(x, y, amp, sigma, center_x=0, center_y=0)

    returns Gaussian

  `hessian`(x, y, amp, sigma, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'amp': 0, 'center_x': -100, 'center_y': -100, 'sigma': 0}
  `mass_2d`(R, amp, sigma)

    Parameters: | R – amp – sigma_x – sigma_y –
    Returns: |

  `mass_2d_lens`(R, amp, sigma)

    Parameters: | R – amp – sigma_x – sigma_y –
    Returns: |

  `mass_3d`(R, amp, sigma)

    Parameters: | R – amp – sigma_x – sigma_y –
    Returns: |

  `mass_3d_lens`(R, amp, sigma)

    Parameters: | R – amp – sigma_x – sigma_y –
    Returns: |

  `param_names` = ['amp', 'sigma', 'center_x', 'center_y']
  `upper_limit_default` = {'amp': 100, 'center_x': 100, 'center_y': 100, 'sigma': 100}

## lenstronomy.LensModel.Profiles.gaussian_potential module

class `lenstronomy.LensModel.Profiles.gaussian_potential.` `Gaussian`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains functions to evaluate a Gaussian function and calculates its derivative and hessian matrix

  `derivatives`(x, y, amp, sigma_x, sigma_y, center_x=0, center_y=0)

    returns df/dx and df/dy of the function

  `function`(x, y, amp, sigma_x, sigma_y, center_x=0, center_y=0)

    returns Gaussian

  `hessian`(x, y, amp, sigma_x, sigma_y, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'amp': 0, 'center_x': -100, 'center_y': -100, 'sigma': 0}
  `param_names` = ['amp', 'sigma_x', 'sigma_y', 'center_x', 'center_y']
  `upper_limit_default` = {'amp': 100, 'center_x': 100, 'center_y': 100, 'sigma': 100}

## lenstronomy.LensModel.Profiles.hernquist module

class `lenstronomy.LensModel.Profiles.hernquist.` `Hernquist`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class to compute the Hernquist 1990 model, which is in 3d: rho(r) = rho0 / (r/Rs * (1 + (r/Rs))**3)

  in lensing terms, the normalization parameter ‘sigma0’ is defined such that the deflection at projected RS leads to alpha = 2./3 * Rs * sigma0

  `density`(r, rho0, Rs)

    computes the 3-d density

    Parameters: | r – 3-d radius rho0 – density normalization Rs – Hernquist radius
    Returns: | density at radius r

  `density_2d`(x, y, rho0, Rs, center_x=0, center_y=0)

    projected density along the line of sight at coordinate (x, y)

    Parameters: | x – x-coordinate y – y-coordinate rho0 – density normalization Rs – Hernquist radius center_x – x-center of the profile center_y – y-center of the profile
    Returns: | projected density

  `density_lens`(r, sigma0, Rs)

    Density as a function of 3d radius in lensing parameters This function converts the lensing definition sigma0 into the 3d density

    Parameters: | r – 3d radius sigma0 – rho0 * Rs (units of projected density) Rs – Hernquist radius
    Returns: | enclosed mass in 3d

  `derivatives`(x, y, sigma0, Rs, center_x=0, center_y=0)

    Parameters: | x – x-coordinate position (units of angle) y – y-coordinate position (units of angle) sigma0 – normalization parameter defined such that the deflection at projected RS leads to alpha = 2./3 * Rs * sigma0 Rs – Hernquist radius in units of angle center_x – x-center of the profile (units of angle) center_y – y-center of the profile (units of angle)
    Returns: | derivative of function (deflection angles in x- and y-direction)

  `function`(x, y, sigma0, Rs, center_x=0, center_y=0)

    lensing potential

    Parameters: | x – x-coordinate position (units of angle) y – y-coordinate position (units of angle) sigma0 – normalization parameter defined such that the deflection at projected RS leads to alpha = 2./3 * Rs * sigma0 Rs – Hernquist radius in units of angle center_x – x-center of the profile (units of angle) center_y – y-center of the profile (units of angle)
    Returns: | lensing potential at (x,y)

  `grav_pot`(x, y, rho0, Rs, center_x=0, center_y=0)

    #TODO decide whether these functions are needed or not

    gravitational potential (modulo 4 pi G and rho0 in appropriate units) :param x: x-coordinate position (units of angle) :param y: y-coordinate position (units of angle) :param rho0: density normalization parameter of Hernquist profile :param Rs: Hernquist radius in units of angle :param center_x: x-center of the profile (units of angle) :param center_y: y-center of the profile (units of angle) :return: gravitational potential at projected radius

  `hessian`(x, y, sigma0, Rs, center_x=0, center_y=0)

    Hessian terms of the function

    Parameters: | x – x-coordinate position (units of angle) y – y-coordinate position (units of angle) sigma0 – normalization parameter defined such that the deflection at projected RS leads to alpha = 2./3 * Rs * sigma0 Rs – Hernquist radius in units of angle center_x – x-center of the profile (units of angle) center_y – y-center of the profile (units of angle)
    Returns: | df/dxdx, df/dxdy, df/dydx, df/dydy

  `lower_limit_default` = {'Rs': 0, 'center_x': -100, 'center_y': -100, 'sigma0': 0}
  `mass_2d`(r, rho0, Rs)

    mass enclosed projected 2d sphere of radius r

    Parameters: | r – projected radius rho0 – density normalization Rs – Hernquist radius
    Returns: | mass enclosed 2d projected radius

  `mass_2d_lens`(r, sigma0, Rs)

    mass enclosed projected 2d sphere of radius r Same as mass_2d but with input normalization in units of projected density :param r: projected radius :param sigma0: rho0 * Rs (units of projected density) :param Rs: Hernquist radius :return: mass enclosed 2d projected radius

  `mass_3d`(r, rho0, Rs)

    mass enclosed a 3d sphere or radius r

    Parameters: | r – 3-d radius within the mass is integrated (same distance units as density definition) rho0 – density normalization Rs – Hernquist radius
    Returns: | enclosed mass

  `mass_3d_lens`(r, sigma0, Rs)

    mass enclosed a 3d sphere or radius r for lens parameterisation This function converts the lensing definition sigma0 into the 3d density

    Parameters: | sigma0 – rho0 * Rs (units of projected density) Rs – Hernquist radius
    Returns: | enclosed mass in 3d

  `mass_tot`(rho0, Rs)

    total mass within the profile :param rho0: density normalization :param Rs: Hernquist radius :return: total mass within profile

  `param_names` = ['sigma0', 'Rs', 'center_x', 'center_y']
  `rho2sigma`(rho0, Rs)

    converts 3d density into 2d projected density parameter :param rho0: 3d density normalization of Hernquist model :param Rs: Hernquist radius :return: sigma0 defined quantity in projected units

  `sigma2rho`(sigma0, Rs)

    converts projected density parameter (in units of deflection) into 3d density parameter :param sigma0: density defined quantity in projected units :param Rs: Hernquist radius :return: rho0 the 3d density normalization of Hernquist model

  `upper_limit_default` = {'Rs': 100, 'center_x': 100, 'center_y': 100, 'sigma0': 100}

## lenstronomy.LensModel.Profiles.hernquist_ellipse module

class `lenstronomy.LensModel.Profiles.hernquist_ellipse.` `Hernquist_Ellipse`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains functions for the elliptical Hernquist profile. Ellipticity is defined in the potential.

  `density`(r, rho0, Rs, e1=0, e2=0)

    computes the 3-d density

    Parameters: | r – 3-d radius rho0 – density normalization Rs – Hernquist radius
    Returns: | density at radius r

  `density_2d`(x, y, rho0, Rs, e1=0, e2=0, center_x=0, center_y=0)

    projected density along the line of sight at coordinate (x, y)

    Parameters: | x – x-coordinate y – y-coordinate rho0 – density normalization Rs – Hernquist radius center_x – x-center of the profile center_y – y-center of the profile
    Returns: | projected density

  `density_lens`(r, sigma0, Rs, e1=0, e2=0)

    Density as a function of 3d radius in lensing parameters This function converts the lensing definition sigma0 into the 3d density

    Parameters: | r – 3d radius sigma0 – rho0 * Rs (units of projected density) Rs – Hernquist radius
    Returns: | enclosed mass in 3d

  `derivatives`(x, y, sigma0, Rs, e1, e2, center_x=0, center_y=0)

    returns df/dx and df/dy of the function (integral of NFW)

  `function`(x, y, sigma0, Rs, e1, e2, center_x=0, center_y=0)

    returns double integral of NFW profile

  `hessian`(x, y, sigma0, Rs, e1, e2, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'Rs': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'sigma0': 0}
  `mass_2d`(r, rho0, Rs, e1=0, e2=0)

    mass enclosed projected 2d sphere of radius r

    Parameters: | r – projected radius rho0 – density normalization Rs – Hernquist radius
    Returns: | mass enclosed 2d projected radius

  `mass_2d_lens`(r, sigma0, Rs, e1=0, e2=0)

    mass enclosed projected 2d sphere of radius r Same as mass_2d but with input normalization in units of projected density :param r: projected radius :param sigma0: rho0 * Rs (units of projected density) :param Rs: Hernquist radius :return: mass enclosed 2d projected radius

  `mass_3d`(r, rho0, Rs, e1=0, e2=0)

    mass enclosed a 3d sphere or radius r

    Parameters: | r – 3-d radius within the mass is integrated (same distance units as density definition) rho0 – density normalization Rs – Hernquist radius
    Returns: | enclosed mass

  `param_names` = ['sigma0', 'Rs', 'e1', 'e2', 'center_x', 'center_y']
  `upper_limit_default` = {'Rs': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'sigma0': 100}

## lenstronomy.LensModel.Profiles.hessian module

class `lenstronomy.LensModel.Profiles.hessian.` `Hessian`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class for constant Hessian distortion (second order) The input is in the same convention as the LensModel.hessian() output.

  `derivatives`(x, y, f_xx, f_yy, f_xy, f_yx, ra_0=0, dec_0=0)

    Parameters: | x – x-coordinate (angle) y – y0-coordinate (angle) f_xx – dalpha_x/dx f_yy – dalpha_y/dy f_xy – dalpha_x/dy f_yx – dalpha_y/dx ra_0 – x/ra position where shear deflection is 0 dec_0 – y/dec position where shear deflection is 0
    Returns: | deflection angles

  `function`(x, y, f_xx, f_yy, f_xy, f_yx, ra_0=0, dec_0=0)

    Parameters: | x – x-coordinate (angle) y – y0-coordinate (angle) f_xx – dalpha_x/dx f_yy – dalpha_y/dy f_xy – dalpha_x/dy f_yx – dalpha_y/dx ra_0 – x/ra position where shear deflection is 0 dec_0 – y/dec position where shear deflection is 0
    Returns: | lensing potential

  `hessian`(x, y, f_xx, f_yy, f_xy, f_yx, ra_0=0, dec_0=0)

    Hessian. Attention: If f_xy != f_yx then this function is not accurate!

    Parameters: | x – x-coordinate (angle) y – y0-coordinate (angle) f_xx – dalpha_x/dx f_yy – dalpha_y/dy f_xy – dalpha_x/dy f_yx – dalpha_y/dx ra_0 – x/ra position where shear deflection is 0 dec_0 – y/dec position where shear deflection is 0
    Returns: | f_xx, f_yy, f_xy

  `lower_limit_default` = {'dec_0': -100, 'f_xx': -100, 'f_xy': -100, 'f_yx': -100, 'f_yy': -100, 'ra_0': -100}
  `param_names` = ['f_xx', 'f_yy', 'f_xy', 'f_yx', 'ra_0', 'dec_0']
  `upper_limit_default` = {'dec_0': 100, 'f_xx': 100, 'f_xy': 100, 'f_yx': 100, 'f_yy': 100, 'ra_0': 100}

## lenstronomy.LensModel.Profiles.interpol module

class `lenstronomy.LensModel.Profiles.interpol.` `Interpol`(grid=False, min_grid_number=100)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class which uses an interpolation of a lens model and its first and second order derivatives

  See also the tests in lenstronomy.test.test_LensModel.test_Profiles.test_interpol.py for example use cases as checks against known analytic models.

  The deflection angle is in the same convention as the one in the LensModel module, meaning that: source position = image position - deflection angle

  `derivatives`(x, y, grid_interp_x=None, grid_interp_y=None, f_=None, f_x=None, f_y=None, f_xx=None, f_yy=None, f_xy=None)

    returns df/dx and df/dy of the function

    Parameters: | x – x-coordinate (angular position), float or numpy array y – y-coordinate (angular position), float or numpy array grid_interp_x – numpy array (ascending) to mark the x-direction of the interpolation grid grid_interp_y – numpy array (ascending) to mark the y-direction of the interpolation grid f – 2d numpy array of lensing potential, matching the grids in grid_interp_x and grid_interp_y f_x – 2d numpy array of deflection in x-direction, matching the grids in grid_interp_x and grid_interp_y f_y – 2d numpy array of deflection in y-direction, matching the grids in grid_interp_x and grid_interp_y f_xx – 2d numpy array of df/dxx, matching the grids in grid_interp_x and grid_interp_y f_yy – 2d numpy array of df/dyy, matching the grids in grid_interp_x and grid_interp_y f_xy – 2d numpy array of df/dxy, matching the grids in grid_interp_x and grid_interp_y
    Returns: | f_x, f_y at interpolated positions (x, y)

  `do_interp`(x_grid, y_grid, f_, f_x, f_y, f_xx=None, f_yy=None, f_xy=None)
  `f_interp`(x, y, x_grid=None, y_grid=None, f_=None, grid=False)
  `f_x_interp`(x, y, x_grid=None, y_grid=None, f_x=None, grid=False)
  `f_xx_interp`(x, y, x_grid=None, y_grid=None, f_xx=None, grid=False)
  `f_xy_interp`(x, y, x_grid=None, y_grid=None, f_xy=None, grid=False)
  `f_y_interp`(x, y, x_grid=None, y_grid=None, f_y=None, grid=False)
  `f_yy_interp`(x, y, x_grid=None, y_grid=None, f_yy=None, grid=False)
  `function`(x, y, grid_interp_x=None, grid_interp_y=None, f_=None, f_x=None, f_y=None, f_xx=None, f_yy=None, f_xy=None)

    Parameters: | x – x-coordinate (angular position), float or numpy array y – y-coordinate (angular position), float or numpy array grid_interp_x – numpy array (ascending) to mark the x-direction of the interpolation grid grid_interp_y – numpy array (ascending) to mark the y-direction of the interpolation grid f – 2d numpy array of lensing potential, matching the grids in grid_interp_x and grid_interp_y f_x – 2d numpy array of deflection in x-direction, matching the grids in grid_interp_x and grid_interp_y f_y – 2d numpy array of deflection in y-direction, matching the grids in grid_interp_x and grid_interp_y f_xx – 2d numpy array of df/dxx, matching the grids in grid_interp_x and grid_interp_y f_yy – 2d numpy array of df/dyy, matching the grids in grid_interp_x and grid_interp_y f_xy – 2d numpy array of df/dxy, matching the grids in grid_interp_x and grid_interp_y
    Returns: | potential at interpolated positions (x, y)

  `hessian`(x, y, grid_interp_x=None, grid_interp_y=None, f_=None, f_x=None, f_y=None, f_xx=None, f_yy=None, f_xy=None)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

    Parameters: | x – x-coordinate (angular position), float or numpy array y – y-coordinate (angular position), float or numpy array grid_interp_x – numpy array (ascending) to mark the x-direction of the interpolation grid grid_interp_y – numpy array (ascending) to mark the y-direction of the interpolation grid f – 2d numpy array of lensing potential, matching the grids in grid_interp_x and grid_interp_y f_x – 2d numpy array of deflection in x-direction, matching the grids in grid_interp_x and grid_interp_y f_y – 2d numpy array of deflection in y-direction, matching the grids in grid_interp_x and grid_interp_y f_xx – 2d numpy array of df/dxx, matching the grids in grid_interp_x and grid_interp_y f_yy – 2d numpy array of df/dyy, matching the grids in grid_interp_x and grid_interp_y f_xy – 2d numpy array of df/dxy, matching the grids in grid_interp_x and grid_interp_y
    Returns: | f_xx, f_xy, f_yx, f_yy at interpolated positions (x, y)

  `lower_limit_default` = {}
  `param_names` = ['grid_interp_x', 'grid_interp_y', 'f_', 'f_x', 'f_y', 'f_xx', 'f_yy', 'f_xy']
  `upper_limit_default` = {}

class `lenstronomy.LensModel.Profiles.interpol.` `InterpolScaled`(grid=True, min_grid_number=100)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class for handling an interpolated lensing map and has the freedom to scale its lensing effect. Applications are e.g. mass to light ratio.

  `derivatives`(x, y, scale_factor=1, grid_interp_x=None, grid_interp_y=None, f_=None, f_x=None, f_y=None, f_xx=None, f_yy=None, f_xy=None)

    Parameters: | x – x-coordinate (angular position), float or numpy array y – y-coordinate (angular position), float or numpy array scale_factor – float, overall scaling of the lens model relative to the input interpolation grid grid_interp_x – numpy array (ascending) to mark the x-direction of the interpolation grid grid_interp_y – numpy array (ascending) to mark the y-direction of the interpolation grid f – 2d numpy array of lensing potential, matching the grids in grid_interp_x and grid_interp_y f_x – 2d numpy array of deflection in x-direction, matching the grids in grid_interp_x and grid_interp_y f_y – 2d numpy array of deflection in y-direction, matching the grids in grid_interp_x and grid_interp_y f_xx – 2d numpy array of df/dxx, matching the grids in grid_interp_x and grid_interp_y f_yy – 2d numpy array of df/dyy, matching the grids in grid_interp_x and grid_interp_y f_xy – 2d numpy array of df/dxy, matching the grids in grid_interp_x and grid_interp_y
    Returns: | deflection angles in x- and y-direction at position (x, y)

  `function`(x, y, scale_factor=1, grid_interp_x=None, grid_interp_y=None, f_=None, f_x=None, f_y=None, f_xx=None, f_yy=None, f_xy=None)

    Parameters: | x – x-coordinate (angular position), float or numpy array y – y-coordinate (angular position), float or numpy array scale_factor – float, overall scaling of the lens model relative to the input interpolation grid grid_interp_x – numpy array (ascending) to mark the x-direction of the interpolation grid grid_interp_y – numpy array (ascending) to mark the y-direction of the interpolation grid f – 2d numpy array of lensing potential, matching the grids in grid_interp_x and grid_interp_y f_x – 2d numpy array of deflection in x-direction, matching the grids in grid_interp_x and grid_interp_y f_y – 2d numpy array of deflection in y-direction, matching the grids in grid_interp_x and grid_interp_y f_xx – 2d numpy array of df/dxx, matching the grids in grid_interp_x and grid_interp_y f_yy – 2d numpy array of df/dyy, matching the grids in grid_interp_x and grid_interp_y f_xy – 2d numpy array of df/dxy, matching the grids in grid_interp_x and grid_interp_y
    Returns: | potential at interpolated positions (x, y)

  `hessian`(x, y, scale_factor=1, grid_interp_x=None, grid_interp_y=None, f_=None, f_x=None, f_y=None, f_xx=None, f_yy=None, f_xy=None)

    Parameters: | x – x-coordinate (angular position), float or numpy array y – y-coordinate (angular position), float or numpy array scale_factor – float, overall scaling of the lens model relative to the input interpolation grid grid_interp_x – numpy array (ascending) to mark the x-direction of the interpolation grid grid_interp_y – numpy array (ascending) to mark the y-direction of the interpolation grid f – 2d numpy array of lensing potential, matching the grids in grid_interp_x and grid_interp_y f_x – 2d numpy array of deflection in x-direction, matching the grids in grid_interp_x and grid_interp_y f_y – 2d numpy array of deflection in y-direction, matching the grids in grid_interp_x and grid_interp_y f_xx – 2d numpy array of df/dxx, matching the grids in grid_interp_x and grid_interp_y f_yy – 2d numpy array of df/dyy, matching the grids in grid_interp_x and grid_interp_y f_xy – 2d numpy array of df/dxy, matching the grids in grid_interp_x and grid_interp_y
    Returns: | second derivatives of the lensing potential f_xx, f_yy, f_xy at position (x, y)

  `lower_limit_default` = {'scale_factor': 0}
  `param_names` = ['scale_factor', 'grid_interp_x', 'grid_interp_y', 'f_', 'f_x', 'f_y', 'f_xx', 'f_yy', 'f_xy']
  `upper_limit_default` = {'scale_factor': 100}

## lenstronomy.LensModel.Profiles.multi_gaussian_kappa module

class `lenstronomy.LensModel.Profiles.multi_gaussian_kappa.` `MultiGaussianKappa`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  `density`(r, amp, sigma, scale_factor=1)

    Parameters: | r – amp – sigma –
    Returns: |

  `density_2d`(x, y, amp, sigma, center_x=0, center_y=0, scale_factor=1)

    Parameters: | R – am – sigma_x – sigma_y –
    Returns: |

  `derivatives`(x, y, amp, sigma, center_x=0, center_y=0, scale_factor=1)

    Parameters: | x – y – amp – sigma – center_x – center_y –
    Returns: |

  `function`(x, y, amp, sigma, center_x=0, center_y=0, scale_factor=1)

    Parameters: | x – y – amp – sigma – center_x – center_y –
    Returns: |

  `hessian`(x, y, amp, sigma, center_x=0, center_y=0, scale_factor=1)

    Parameters: | x – y – amp – sigma – center_x – center_y –
    Returns: |

  `lower_limit_default` = {'amp': 0, 'center_x': -100, 'center_y': -100, 'sigma': 0}
  `mass_3d_lens`(R, amp, sigma, scale_factor=1)

    Parameters: | R – amp – sigma –
    Returns: |

  `param_names` = ['amp', 'sigma', 'center_x', 'center_y']
  `upper_limit_default` = {'amp': 100, 'center_x': 100, 'center_y': 100, 'sigma': 100}

class `lenstronomy.LensModel.Profiles.multi_gaussian_kappa.` `MultiGaussianKappaEllipse`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  `density`(r, amp, sigma, e1, e2, scale_factor=1)

    Parameters: | r – amp – sigma –
    Returns: |

  `density_2d`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0, scale_factor=1)

    Parameters: | R – am – sigma_x – sigma_y –
    Returns: |

  `derivatives`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0, scale_factor=1)

    Parameters: | x – y – amp – sigma – center_x – center_y –
    Returns: |

  `function`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0, scale_factor=1)

    Parameters: | x – y – amp – sigma – center_x – center_y –
    Returns: |

  `hessian`(x, y, amp, sigma, e1, e2, center_x=0, center_y=0, scale_factor=1)

    Parameters: | x – y – amp – sigma – center_x – center_y –
    Returns: |

  `lower_limit_default` = {'amp': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'sigma': 0}
  `mass_3d_lens`(R, amp, sigma, e1, e2, scale_factor=1)

    Parameters: | R – amp – sigma –
    Returns: |

  `param_names` = ['amp', 'sigma', 'e1', 'e2', 'center_x', 'center_y']
  `upper_limit_default` = {'amp': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'sigma': 100}

## lenstronomy.LensModel.Profiles.multipole module

class `lenstronomy.LensModel.Profiles.multipole.` `Multipole`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  This class contains a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf m : int, multipole order, m>=2 a_m : float, multipole strength phi_m : float, multipole orientation in radian

  `derivatives`(x, y, m, a_m, phi_m, center_x=0, center_y=0)

    Deflection of a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf

    Parameters: | m – int, multipole order, m>=2 a_m – float, multipole strength phi_m – float, multipole orientation in radian center_x – x-position center_y – x-position
    Returns: | deflection angles alpha_x, alpha_y

  `function`(x, y, m, a_m, phi_m, center_x=0, center_y=0)

    Lensing potential of multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf

    Parameters: | m – int, multipole order, m>=2 a_m – float, multipole strength phi_m – float, multipole orientation in radian center_x – x-position center_y – x-position
    Returns: | lensing potential

  `hessian`(x, y, m, a_m, phi_m, center_x=0, center_y=0)

    Hessian of a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf

    Parameters: | m – int, multipole order, m>=2 a_m – float, multipole strength phi_m – float, multipole orientation in radian center_x – x-position center_y – x-position
    Returns: | f_xx, f_xy, f_yx, f_yy

  `lower_limit_default` = {'a_m': 0, 'center_x': -100, 'center_y': -100, 'm': 2, 'phi_m': -3.141592653589793}
  `param_names` = ['m', 'a_m', 'phi_m', 'center_x', 'center_y']
  `upper_limit_default` = {'a_m': 100, 'center_x': 100, 'center_y': 100, 'm': 100, 'phi_m': 3.141592653589793}

## lenstronomy.LensModel.Profiles.nfw module

class `lenstronomy.LensModel.Profiles.nfw.` `NFW`(interpol=False, num_interp_X=1000, max_interp_X=10)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains functions concerning the NFW profile

  relation are: R_200 = c * Rs The definition of ‘Rs’ is in angular (arc second) units and the normalization is put in in regards to a deflection angle at ‘Rs’ - ‘alpha_Rs’. To convert a physical mass and concentration definition into those lensing quantities for a specific redshift configuration and cosmological model, you can find routines in lenstronomy.Cosmo.lens_cosmo.py

      >>> from lenstronomy.Cosmo.lens_cosmo import LensCosmo
      >>> from astropy.cosmology import FlatLambdaCDM
      >>> cosmo = FlatLambdaCDM(H0=70, Om0=0.3, Ob0=0.05)
      >>> lens_cosmo = LensCosmo(z_lens=0.5, z_source=1.5, cosmo=cosmo)

  Here we compute the angular scale of Rs on the sky (in arc seconds) and the deflection angle at Rs (in arc seconds):

      >>> Rs_angle, alpha_Rs = lens_cosmo.nfw_physical2angle(M=10**13, c=6)

  And here we perform the inverse calculation given Rs_angle and alpha_Rs to return the physical halo properties.

      >>> rho0, Rs, c, r200, M200 = lens_cosmo.nfw_angle2physical(Rs_angle=Rs_angle, alpha_Rs=alpha_Rs)

  The lens model calculation uses angular units as arguments! So to execute a deflection angle calculation one uses

      >>> from lenstronomy.LensModel.Profiles.nfw import NFW
      >>> nfw = NFW()
      >>> alpha_x, alpha_y = nfw.derivatives(x=1, y=1, Rs=Rs_angle, alpha_Rs=alpha_Rs, center_x=0, center_y=0)

  `F_`(X)

    computes h()

    Parameters: | X –
    Returns: |

  static `alpha2rho0`(alpha_Rs, Rs)

    convert angle at Rs into rho0

    Parameters: | alpha_Rs – deflection angle at RS Rs – scale radius
    Returns: | density normalization (characteristic density)

  `density`(R, Rs, rho0)

    three dimensional NFW profile

    Parameters: | R (float/numpy array) – radius of interest Rs (float) – scale radius rho0 (float) – density normalization (characteristic density)
    Returns: | rho(R) density

  `density_2d`(x, y, Rs, rho0, center_x=0, center_y=0)

    projected two dimensional NFW profile (kappa*Sigma_crit)

    Parameters: | R (float/numpy array) – radius of interest Rs (float) – scale radius rho0 (float) – density normalization (characteristic density) r200 (float>0) – radius of (sub)halo
    Returns: | Epsilon(R) projected density at radius R

  `density_lens`(r, Rs, alpha_Rs)

    computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

    Parameters: | r – 3d radios Rs – turn-over radius of NFW profile alpha_Rs – deflection at Rs
    Returns: | density rho(r)

  `derivatives`(x, y, Rs, alpha_Rs, center_x=0, center_y=0)

    returns df/dx and df/dy of the function (integral of NFW), which are the deflection angles

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) Rs – turn over point in the slope of the NFW profile in angular unit alpha_Rs – deflection (angular units) at projected Rs center_x – center of halo (in angular units) center_y – center of halo (in angular units)
    Returns: | deflection angle in x, deflection angle in y

  `function`(x, y, Rs, alpha_Rs, center_x=0, center_y=0)

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) Rs – turn over point in the slope of the NFW profile in angular unit alpha_Rs – deflection (angular units) at projected Rs center_x – center of halo (in angular units) center_y – center of halo (in angular units)
    Returns: | lensing potential

  `g_`(X)

    computes h()

    Parameters: | X (float >0) – R/Rs
    Returns: |

  `h_`(X)

    computes h()

    Parameters: | X (float >0) – R/Rs
    Returns: | h(X)

  `hessian`(x, y, Rs, alpha_Rs, center_x=0, center_y=0)

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) Rs – turn over point in the slope of the NFW profile in angular unit alpha_Rs – deflection (angular units) at projected Rs center_x – center of halo (in angular units) center_y – center of halo (in angular units)
    Returns: | Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'Rs': 0, 'alpha_Rs': 0, 'center_x': -100, 'center_y': -100}
  `mass_2d`(R, Rs, rho0)

    mass enclosed a 2d cylinder or projected radius R :param R: projected radius :param Rs: scale radius :param rho0: density normalization (characteristic density) :return: mass in cylinder

  `mass_3d`(r, Rs, rho0)

    mass enclosed a 3d sphere or radius r

    Parameters: | r – 3d radius Rs – scale radius rho0 – density normalization (characteristic density)
    Returns: | M(<r)

  `mass_3d_lens`(r, Rs, alpha_Rs)

    mass enclosed a 3d sphere or radius r. This function takes as input the lensing parameterization.

    Parameters: | r – 3d radius Rs – scale radius alpha_Rs – deflection (angular units) at projected Rs
    Returns: | M(<r)

  `nfwAlpha`(R, Rs, rho0, ax_x, ax_y)

    deflection angel of NFW profile (times Sigma_crit D_OL) along the projection to coordinate ‘axis’

    Parameters: | R (float/numpy array) – radius of interest Rs (float) – scale radius rho0 (float) – density normalization (characteristic density) r200 (float>0) – radius of (sub)halo axis (same as R) – projection to either x- or y-axis
    Returns: | Epsilon(R) projected density at radius R

  `nfwGamma`(R, Rs, rho0, ax_x, ax_y)

    shear gamma of NFW profile (times Sigma_crit) along the projection to coordinate ‘axis’

    Parameters: | R (float/numpy array) – radius of interest Rs (float) – scale radius rho0 (float) – density normalization (characteristic density) r200 (float>0) – radius of (sub)halo axis (same as R) – projection to either x- or y-axis
    Returns: | Epsilon(R) projected density at radius R

  `nfwPot`(R, Rs, rho0)

    lensing potential of NFW profile (Sigma_crit D_OL**2)

    Parameters: | R (float/numpy array) – radius of interest Rs (float) – scale radius rho0 (float) – density normalization (characteristic density) r200 (float>0) – radius of (sub)halo
    Returns: | Epsilon(R) projected density at radius R

  `param_names` = ['Rs', 'alpha_Rs', 'center_x', 'center_y']
  `profile_name` = 'NFW'
  static `rho02alpha`(rho0, Rs)

    convert rho0 to angle at Rs

    Parameters: | rho0 – density normalization (characteristic density) Rs – scale radius
    Returns: | deflection angle at RS

  `upper_limit_default` = {'Rs': 100, 'alpha_Rs': 10, 'center_x': 100, 'center_y': 100}

## lenstronomy.LensModel.Profiles.nfw_ellipse module

class `lenstronomy.LensModel.Profiles.nfw_ellipse.` `NFW_ELLIPSE`(interpol=False, num_interp_X=1000, max_interp_X=10)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains functions concerning the NFW profile with an ellipticity defined in the potential parameterization of alpha_Rs and Rs is the same as for the spherical NFW profile

  from Glose & Kneib: https://cds.cern.ch/record/529584/files/0112138.pdf

  relation are: R_200 = c * Rs

  `density_lens`(r, Rs, alpha_Rs, e1=1, e2=0)

    computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

    Parameters: | r – 3d radios Rs – turn-over radius of NFW profile alpha_Rs – deflection at Rs
    Returns: | density rho(r)

  `derivatives`(x, y, Rs, alpha_Rs, e1, e2, center_x=0, center_y=0)

    returns df/dx and df/dy of the function, calculated as an elliptically distorted deflection angle of the spherical NFW profile

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) Rs – turn over point in the slope of the NFW profile in angular unit alpha_Rs – deflection (angular units) at projected Rs e1 – eccentricity component in x-direction e2 – eccentricity component in y-direction center_x – center of halo (in angular units) center_y – center of halo (in angular units)
    Returns: | deflection in x-direction, deflection in y-direction

  `function`(x, y, Rs, alpha_Rs, e1, e2, center_x=0, center_y=0)

    returns elliptically distorted NFW lensing potential

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) Rs – turn over point in the slope of the NFW profile in angular unit alpha_Rs – deflection (angular units) at projected Rs e1 – eccentricity component in x-direction e2 – eccentricity component in y-direction center_x – center of halo (in angular units) center_y – center of halo (in angular units)
    Returns: | lensing potential

  `hessian`(x, y, Rs, alpha_Rs, e1, e2, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy the calculation is performed as a numerical differential from the deflection field. Analytical relations are possible

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) Rs – turn over point in the slope of the NFW profile in angular unit alpha_Rs – deflection (angular units) at projected Rs e1 – eccentricity component in x-direction e2 – eccentricity component in y-direction center_x – center of halo (in angular units) center_y – center of halo (in angular units)
    Returns: | d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'Rs': 0, 'alpha_Rs': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5}
  `mass_3d_lens`(R, Rs, alpha_Rs, e1=1, e2=0)

    Parameters: | R – radius (in angular units) Rs – alpha_Rs – e1 – e2 –
    Returns: |

  `param_names` = ['Rs', 'alpha_Rs', 'e1', 'e2', 'center_x', 'center_y']
  `profile_name` = 'NFW_ELLIPSE'
  `upper_limit_default` = {'Rs': 100, 'alpha_Rs': 10, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5}

## lenstronomy.LensModel.Profiles.nfw_mass_concentration module

class `lenstronomy.LensModel.Profiles.nfw_mass_concentration.` `NFWMC`(z_lens, z_source, cosmo=None, static=False)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains functions parameterises the NFW profile with log10 M200 and the concentration rs/r200 relation are: R_200 = c * Rs

  ATTENTION: the parameterization is cosmology and redshift dependent! The cosmology to connect mass and deflection relations is fixed to default H0=70km/s Omega_m=0.3 flat LCDM. It is recommended to keep a given cosmology definition in the lens modeling as the observable reduced deflection angles are sensitive in this parameterization. If you do not want to impose a mass-concentration relation, it is recommended to use the default NFW lensing profile parameterized in reduced deflection angles.

  `derivatives`(x, y, logM, concentration, center_x=0, center_y=0)

    returns df/dx and df/dy of the function (integral of NFW)

  `function`(x, y, logM, concentration, center_x=0, center_y=0)

    Parameters: | x – angular position y – angular position Rs – angular turn over point alpha_Rs – deflection at Rs center_x – center of halo center_y – center of halo
    Returns: |

  `hessian`(x, y, logM, concentration, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'concentration': 0.01, 'logM': 0}
  `param_names` = ['logM', 'concentration', 'center_x', 'center_y']
  `set_dynamic`()

    Returns: |

  `set_static`(logM, concentration, center_x=0, center_y=0)

    Parameters: | logM – concentration – center_x – center_y –
    Returns: |

  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'concentration': 1000, 'logM': 16}

## lenstronomy.LensModel.Profiles.nfw_vir_trunc module

class `lenstronomy.LensModel.Profiles.nfw_vir_trunc.` `NFWVirTrunc`(z_lens, z_source, cosmo=None)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains functions concerning the NFW profile that is sharply truncated at the virial radius https://arxiv.org/pdf/astro-ph/0304034.pdf

  relation are: R_200 = c * Rs

  `kappa`(theta, logM, c)

    projected surface brightness

    Parameters: | theta – radial angle from the center of the profile logM – log_10 halo mass in physical units of M_sun c – concentration of the halo; r_vir = c * r_s
    Returns: | convergence at theta

## lenstronomy.LensModel.Profiles.nie module

class `lenstronomy.LensModel.Profiles.nie.` `NIE`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  Non-singular isothermal ellipsoid kappa = theta_E/2 [s2IE + r2(1 − e * cos(2*phi)]−1/2

  `derivatives`(x, y, theta_E, e1, e2, s_scale, center_x=0, center_y=0)

    Parameters: | x – x-coordinate in image plane y – y-coordinate in image plane theta_E – Einstein radius e1 – eccentricity component e2 – eccentricity component s_scale – smoothing scale center_x – profile center center_y – profile center
    Returns: | alpha_x, alpha_y

  `function`(x, y, theta_E, e1, e2, s_scale, center_x=0, center_y=0)

    Parameters: | x – x-coordinate in image plane y – y-coordinate in image plane theta_E – Einstein radius e1 – eccentricity component e2 – eccentricity component s_scale – smoothing scale center_x – profile center center_y – profile center
    Returns: | lensing potential

  `hessian`(x, y, theta_E, e1, e2, s_scale, center_x=0, center_y=0)

    Parameters: | x – x-coordinate in image plane y – y-coordinate in image plane theta_E – Einstein radius e1 – eccentricity component e2 – eccentricity component s_scale – smoothing scale center_x – profile center center_y – profile center
    Returns: | f_xx, f_xy, f_yx, f_yy

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 's_scale': 0, 'theta_E': 0}
  `param_conv`(theta_E, e1, e2, s_scale)
  `param_names` = ['theta_E', 'e1', 'e2', 's_scale', 'center_x', 'center_y']
  `set_dynamic`()

    Returns: |

  `set_static`(theta_E, e1, e2, s_scale, center_x=0, center_y=0)

    Parameters: | x – x-coordinate in image plane y – y-coordinate in image plane theta_E – Einstein radius e1 – eccentricity component e2 – eccentricity component s_scale – smoothing scale center_x – profile center center_y – profile center
    Returns: | self variables set

  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 's_scale': 100, 'theta_E': 10}

class `lenstronomy.LensModel.Profiles.nie.` `NIEMajorAxis`(diff=1e-10)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  This class contains the function and the derivatives of the non-singular isothermal ellipse. See Keeton and Kochanek 1998, https://arxiv.org/pdf/astro-ph/9705194.pdf

  \[\kappa = b *(q2(s2 + x2) + y2􏰉)^{−1/2}`\]
  `derivatives`(x, y, b, s, q)

    returns df/dx and df/dy of the function

  `function`(x, y, b, s, q)

    lensing potential

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `hessian`(x, y, b, s, q)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  static `kappa`(x, y, b, s, q)

    convergence

    Parameters: | x – major axis coordinate y – minor axis coordinate b – normalization s – smoothing scale q – axis ratio
    Returns: | convergence

  `param_names` = ['b', 's', 'q', 'center_x', 'center_y']

## lenstronomy.LensModel.Profiles.nie_potential module

class `lenstronomy.LensModel.Profiles.nie_potential.` `NIE_POTENTIAL`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class implements the elliptical potential of Eq. (67) of LECTURES ON GRAVITATIONAL LENSING and Eq. (1) of Blandford & Kochanek 1987, mapped to Eq. (8) of Barnaka1998 to find the ellipticity bounds

  `derivatives`(x, y, theta_E, theta_c, e1, e2, center_x=0, center_y=0)

    Parameters: | x – x-coord (in angles) y – y-coord (in angles) theta_E – Einstein radius (in angles) theta_c – core radius (in angles) e1 – eccentricity component, x direction(dimensionless) e2 – eccentricity component, y direction (dimensionless)
    Returns: | deflection angle (in angles)

  `function`(x, y, theta_E, theta_c, e1, e2, center_x=0, center_y=0)

    Parameters: | x – x-coord (in angles) y – y-coord (in angles) theta_E – Einstein radius (in angles) theta_c – core radius (in angles) e1 – eccentricity component, x direction(dimensionless) e2 – eccentricity component, y direction (dimensionless)
    Returns: | lensing potential

  `hessian`(x, y, theta_E, theta_c, e1, e2, center_x=0, center_y=0)

    Parameters: | x – x-coord (in angles) y – y-coord (in angles) theta_E – Einstein radius (in angles) theta_c – core radius (in angles) e1 – eccentricity component, x direction(dimensionless) e2 – eccentricity component, y direction (dimensionless)
    Returns: | hessian matrix (in angles)

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'e1': 0, 'e2': 0, 'theta_E': 0, 'theta_c': 0}
  `param_conv`(theta_E, theta_c, e1, e2)
  `param_names` = ['center_x', 'center_y', 'theta_E', 'theta_c', 'e1', 'e2']
  `set_dynamic`()

    Returns: |

  `set_static`(theta_E, theta_c, e1, e2, center_x=0, center_y=0)

    Parameters: | x – x-coordinate in image plane y – y-coordinate in image plane theta_E – Einstein radius theta_c – core radius e1 – eccentricity component e2 – eccentricity component center_x – profile center center_y – profile center
    Returns: | self variables set

  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'e1': 0.2, 'e2': 0.2, 'theta_E': 10, 'theta_c': 10}

class `lenstronomy.LensModel.Profiles.nie_potential.` `NIEPotentialMajorAxis`(diff=1e-10)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class implements the elliptical potential of Eq. (67) of LECTURES ON GRAVITATIONAL LENSING and Eq. (1) of Blandford & Kochanek 1987, mapped to Eq. (8) of Barnaka1998 to find the ellipticity bounds

  `derivatives`(x, y, theta_E, theta_c, eps)

    returns df/dx and df/dy of the function

  `function`(x, y, theta_E, theta_c, eps)

    lensing potential

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `hessian`(x, y, theta_E, theta_c, eps)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `param_names` = ['theta_E', 'theta_c', 'eps', 'center_x', 'center_y']

## lenstronomy.LensModel.Profiles.numerical_deflections module

class `lenstronomy.LensModel.Profiles.numerical_deflections.` `NumericalAlpha`(custom_class)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  `derivatives`(x, y, center_x=0, center_y=0, **kwargs)

    returns df/dx and df/dy (un-normalized!!!) interpolated from the numerical deflection table

  `function`(x, y, center_x=0, center_y=0, **kwargs)

    lensing potential

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `hessian`(x, y, center_x=0, center_y=0, **kwargs)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2 (un-normalized!!!) interpolated from the numerical deflection table

## lenstronomy.LensModel.Profiles.p_jaffe module

class `lenstronomy.LensModel.Profiles.p_jaffe.` `PJaffe`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class to compute the DUAL PSEUDO ISOTHERMAL ELLIPTICAL MASS DISTRIBUTION based on Eliasdottir (2007) https://arxiv.org/pdf/0710.5636.pdf Appendix A

  Module name: ‘PJAFFE’;

  An alternative name is dPIED.

  The 3D density distribution is

  \[\rho(r) = \frac{\rho_0}{(1+r^2/Ra^2)(1+r^2/Rs^2)}\]

  with \(Rs > Ra\).

  The projected density is

  \[\Sigma(R) = \Sigma_0 \frac{Ra Rs}{Rs-Ra}\left(\frac{1}{\sqrt{Ra^2+R^2}} - \frac{1}{\sqrt{Rs^2+R^2}} \right)\]

  with

  \[\Sigma_0 = \pi \rho_0 \frac{Ra Rs}{Rs + Ra}\]

  In the lensing parameterization,

  \[\sigma_0 = \frac{\Sigma_0}{\Sigma_{\rm crit}}\]
  `density`(r, rho0, Ra, Rs)

    computes the density

    Parameters: | r – radial distance from the center (in 3D) rho0 – density normalization (see class documentation above) Ra – core radius Rs – transition radius from logarithmic slope -2 to -4
    Returns: | density at r

  `density_2d`(x, y, rho0, Ra, Rs, center_x=0, center_y=0)

    projected density

    Parameters: | x – projected coordinate on the sky y – projected coordinate on the sky rho0 – density normalization (see class documentation above) Ra – core radius Rs – transition radius from logarithmic slope -2 to -4 center_x – center of profile center_y – center of profile
    Returns: | projected density

  `derivatives`(x, y, sigma0, Ra, Rs, center_x=0, center_y=0)

    deflection angles

    Parameters: | x – projected coordinate on the sky y – projected coordinate on the sky sigma0 – sigma0/sigma_crit (see class documentation above) Ra – core radius (see class documentation above) Rs – transition radius from logarithmic slope -2 to -4 (see class documentation above) center_x – center of profile center_y – center of profile
    Returns: | f_x, f_y

  `function`(x, y, sigma0, Ra, Rs, center_x=0, center_y=0)

    lensing potential

    Parameters: | x – projected coordinate on the sky y – projected coordinate on the sky sigma0 – sigma0/sigma_crit (see class documentation above) Ra – core radius (see class documentation above) Rs – transition radius from logarithmic slope -2 to -4 (see class documentation above) center_x – center of profile center_y – center of profile
    Returns: | lensing potential

  `grav_pot`(r, rho0, Ra, Rs)

    gravitational potential (modulo 4 pi G and rho0 in appropriate units)

    Parameters: | r – radial distance from the center (in 3D) rho0 – density normalization (see class documentation above) Ra – core radius Rs – transition radius from logarithmic slope -2 to -4
    Returns: | gravitational potential (modulo 4 pi G and rho0 in appropriate units)

  `hessian`(x, y, sigma0, Ra, Rs, center_x=0, center_y=0)

    Hessian of lensing potential

    Parameters: | x – projected coordinate on the sky y – projected coordinate on the sky sigma0 – sigma0/sigma_crit (see class documentation above) Ra – core radius (see class documentation above) Rs – transition radius from logarithmic slope -2 to -4 (see class documentation above) center_x – center of profile center_y – center of profile
    Returns: | f_xx, f_xy, f_yx, f_yy

  `lower_limit_default` = {'Ra': 0, 'Rs': 0, 'center_x': -100, 'center_y': -100, 'sigma0': 0}
  `mass_2d`(r, rho0, Ra, Rs)

    mass enclosed projected 2d sphere of radius r

    Parameters: | r – radial distance from the center in projection rho0 – density normalization (see class documentation above) Ra – core radius Rs – transition radius from logarithmic slope -2 to -4
    Returns: | Sigma(<r)

  `mass_3d`(r, rho0, Ra, Rs)

    mass enclosed a 3d sphere or radius r

    Parameters: | r – radial distance from the center (in 3D) rho0 – density normalization (see class documentation above) Ra – core radius Rs – transition radius from logarithmic slope -2 to -4
    Returns: | M(<r)

  `mass_3d_lens`(r, sigma0, Ra, Rs)

    mass enclosed a 3d sphere or radius r given a lens parameterization with angular units

    Parameters: | r – radial distance from the center (in 3D) rho0 – density normalization (see class documentation above) Ra – core radius Rs – transition radius from logarithmic slope -2 to -4
    Returns: | M(<r) in angular units (modulo critical mass density)

  `mass_tot`(rho0, Ra, Rs)

    total mass within the profile

    Parameters: | rho0 – density normalization (see class documentation above) Ra – core radius Rs – transition radius from logarithmic slope -2 to -4
    Returns: | total mass

  `param_names` = ['sigma0', 'Ra', 'Rs', 'center_x', 'center_y']
  `rho2sigma`(rho0, Ra, Rs)

    converts 3d density into 2d projected density parameter, Equation A4 in Eliasdottir (2007)

    Parameters: | rho0 – density normalization Ra – core radius (see class documentation above) Rs – transition radius from logarithmic slope -2 to -4 (see class documentation above)
    Returns: | projected density normalization

  `sigma2rho`(sigma0, Ra, Rs)

    inverse of rho2sigma()

    Parameters: | sigma0 – projected density normalization Ra – core radius (see class documentation above) Rs – transition radius from logarithmic slope -2 to -4 (see class documentation above)
    Returns: | 3D density normalization

  `upper_limit_default` = {'Ra': 100, 'Rs': 100, 'center_x': 100, 'center_y': 100, 'sigma0': 10}

## lenstronomy.LensModel.Profiles.p_jaffe_ellipse module

class `lenstronomy.LensModel.Profiles.p_jaffe_ellipse.` `PJaffe_Ellipse`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains functions concerning the NFW profile

  relation are: R_200 = c * Rs

  `derivatives`(x, y, sigma0, Ra, Rs, e1, e2, center_x=0, center_y=0)

    returns df/dx and df/dy of the function (integral of NFW)

  `function`(x, y, sigma0, Ra, Rs, e1, e2, center_x=0, center_y=0)

    returns double integral of NFW profile

  `hessian`(x, y, sigma0, Ra, Rs, e1, e2, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'Ra': 0, 'Rs': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'sigma0': 0}
  `mass_3d_lens`(r, sigma0, Ra, Rs, e1=0, e2=0)

    Parameters: | r – sigma0 – Ra – Rs – q – phi_G –
    Returns: |

  `param_names` = ['sigma0', 'Ra', 'Rs', 'e1', 'e2', 'center_x', 'center_y']
  `upper_limit_default` = {'Ra': 100, 'Rs': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'sigma0': 10}

## lenstronomy.LensModel.Profiles.pemd module

class `lenstronomy.LensModel.Profiles.pemd.` `PEMD`(suppress_fastell=False)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class for power law ellipse mass density profile. This class effectively calls the class SPEMD_SMOOTH with a fixed and very small central smoothing scale to perform the numerical integral using the FASTELL code by Renan Barkana.

  \[\kappa(x, y) = \frac{3-\gamma}{2} \left(\frac{\theta_{E}}{\sqrt{q x^2 + y^2/q}} \right)^{\gamma-1}\]

  with \(\theta_{E}\) is the (circularized) Einstein radius, \(\gamma\) is the negative power-law slope of the 3D mass distributions, \(q\) is the minor/major axis ratio, and \(x\) and \(y\) are defined in a coordinate system aligned with the major and minor axis of the lens.

  In terms of eccentricities, this profile is defined as

  \[\kappa(r) = \frac{3-\gamma}{2} \left(\frac{\theta'_{E}}{r \sqrt{1 − e*\cos(2*\phi)}} \right)^{\gamma-1}\]

  with \(\epsilon\) is the ellipticity defined as

  \[\epsilon = \frac{1-q^2}{1+q^2}\]

  And an Einstein radius \(\theta'_{\rm E}\) related to the definition used is

  \[\left(\frac{\theta'_{\rm E}}{\theta_{\rm E}}\right)^{2} = \frac{2q}{1+q^2}.\]
  `density_lens`(r, theta_E, gamma, e1=None, e2=None)

    computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

    Parameters: | r – radius within the mass is computed theta_E – Einstein radius gamma – power-law slope e1 – eccentricity component (not used) e2 – eccentricity component (not used)
    Returns: | mass enclosed a 3D radius r

  `derivatives`(x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0)

    Parameters: | x – x-coordinate (angle) y – y-coordinate (angle) theta_E – Einstein radius (angle), pay attention to specific definition! gamma – logarithmic slope of the power-law profile. gamma=2 corresponds to isothermal e1 – eccentricity component e2 – eccentricity component center_x – x-position of lens center center_y – y-position of lens center
    Returns: | deflection angles alpha_x, alpha_y

  `function`(x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0)

    Parameters: | x – x-coordinate (angle) y – y-coordinate (angle) theta_E – Einstein radius (angle), pay attention to specific definition! gamma – logarithmic slope of the power-law profile. gamma=2 corresponds to isothermal e1 – eccentricity component e2 – eccentricity component center_x – x-position of lens center center_y – y-position of lens center
    Returns: | lensing potential

  `hessian`(x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0)

    Parameters: | x – x-coordinate (angle) y – y-coordinate (angle) theta_E – Einstein radius (angle), pay attention to specific definition! gamma – logarithmic slope of the power-law profile. gamma=2 corresponds to isothermal e1 – eccentricity component e2 – eccentricity component center_x – x-position of lens center center_y – y-position of lens center
    Returns: | Hessian components f_xx, f_xy, f_yx, f_yy

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'gamma': 1.5, 'theta_E': 0}
  `mass_3d_lens`(r, theta_E, gamma, e1=None, e2=None)

    computes the spherical power-law mass enclosed (with SPP routine) :param r: radius within the mass is computed :param theta_E: Einstein radius :param gamma: power-law slope :param e1: eccentricity component (not used) :param e2: eccentricity component (not used) :return: mass enclosed a 3D radius r

  `param_names` = ['theta_E', 'gamma', 'e1', 'e2', 'center_x', 'center_y']
  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'gamma': 2.5, 'theta_E': 100}

## lenstronomy.LensModel.Profiles.point_mass module

class `lenstronomy.LensModel.Profiles.point_mass.` `PointMass`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class to compute the physical deflection angle of a point mass, given as an Einstein radius

  `derivatives`(x, y, theta_E, center_x=0, center_y=0)

    Parameters: | x – x-coord (in angles) y – y-coord (in angles) theta_E – Einstein radius (in angles)
    Returns: | deflection angle (in angles)

  `function`(x, y, theta_E, center_x=0, center_y=0)

    Parameters: | x – x-coord (in angles) y – y-coord (in angles) theta_E – Einstein radius (in angles)
    Returns: | lensing potential

  `hessian`(x, y, theta_E, center_x=0, center_y=0)

    Parameters: | x – x-coord (in angles) y – y-coord (in angles) theta_E – Einstein radius (in angles)
    Returns: | hessian matrix (in angles)

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'theta_E': 0}
  `param_names` = ['theta_E', 'center_x', 'center_y']
  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'theta_E': 100}

## lenstronomy.LensModel.Profiles.sersic module

class `lenstronomy.LensModel.Profiles.sersic.` `Sersic`(smoothing=1e-05)

  Bases: `lenstronomy.LensModel.Profiles.sersic_utils.SersicUtil`, `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains functions to evaluate a Sersic mass profile: https://arxiv.org/pdf/astro-ph/0311559.pdf

  `derivatives`(x, y, n_sersic, R_sersic, k_eff, center_x=0, center_y=0)

    returns df/dx and df/dy of the function

  `function`(x, y, n_sersic, R_sersic, k_eff, center_x=0, center_y=0)

    Parameters: | x – x-coordinate y – y-coordinate n_sersic – Sersic index R_sersic – half light radius k_eff – convergence at half light radius center_x – x-center center_y – y-center
    Returns: |

  `hessian`(x, y, n_sersic, R_sersic, k_eff, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'R_sersic': 0, 'center_x': -100, 'center_y': -100, 'k_eff': 0, 'n_sersic': 0.5}
  `param_names` = ['k_eff', 'R_sersic', 'n_sersic', 'center_x', 'center_y']
  `upper_limit_default` = {'R_sersic': 100, 'center_x': 100, 'center_y': 100, 'k_eff': 10, 'n_sersic': 8}

## lenstronomy.LensModel.Profiles.sersic_ellipse_kappa module

class `lenstronomy.LensModel.Profiles.sersic_ellipse_kappa.` `SersicEllipseKappa`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains the function and the derivatives of an elliptical sersic profile with the ellipticity introduced in the convergence (not the potential).

  This requires the use of numerical integrals (Keeton 2004)

  `derivatives`(x, y, n_sersic, R_sersic, k_eff, e1, e2, center_x=0, center_y=0)

    deflection angles

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `function`(x, y, n_sersic, R_sersic, k_eff, e1, e2, center_x=0, center_y=0)

    lensing potential

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `hessian`(x, y, n_sersic, R_sersic, k_eff, e1, e2, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'R_sersic': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'k_eff': 0, 'n_sersic': 0.5}
  `param_names` = ['k_eff', 'R_sersic', 'n_sersic', 'e1', 'e2', 'center_x', 'center_y']
  `projected_mass`(x, y, q, n_sersic, R_sersic, k_eff, u=1, power=1)
  `upper_limit_default` = {'R_sersic': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'k_eff': 10, 'n_sersic': 8}

## lenstronomy.LensModel.Profiles.sersic_ellipse_potential module

class `lenstronomy.LensModel.Profiles.sersic_ellipse_potential.` `SersicEllipse`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains functions to evaluate a Sersic mass profile: https://arxiv.org/pdf/astro-ph/0311559.pdf

  `derivatives`(x, y, n_sersic, R_sersic, k_eff, e1, e2, center_x=0, center_y=0)

    returns df/dx and df/dy of the function

  `function`(x, y, n_sersic, R_sersic, k_eff, e1, e2, center_x=0, center_y=0)

    returns Gaussian

  `hessian`(x, y, n_sersic, R_sersic, k_eff, e1, e2, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'R_sersic': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'k_eff': 0, 'n_sersic': 0.5}
  `param_names` = ['k_eff', 'R_sersic', 'n_sersic', 'e1', 'e2', 'center_x', 'center_y']
  `upper_limit_default` = {'R_sersic': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'k_eff': 10, 'n_sersic': 8}

## lenstronomy.LensModel.Profiles.sersic_utils module

class `lenstronomy.LensModel.Profiles.sersic_utils.` `SersicUtil`(smoothing=1e-05)

  Bases: `object`

  `alpha_abs`(x, y, n_sersic, r_eff, k_eff, center_x=0, center_y=0)

    Parameters: | x – y – n_sersic – r_eff – k_eff – center_x – center_y –
    Returns: |

  static `b_n`(n)

    b(n) computation. This is the approximation of the exact solution to the relation, 2*incomplete_gamma_function(2n; b_n) = Gamma_function(2*n). :param n: the sersic index :return:

  `d_alpha_dr`(x, y, n_sersic, r_eff, k_eff, center_x=0, center_y=0)

    Parameters: | x – y – n_sersic – r_eff – k_eff – center_x – center_y –
    Returns: |

  `density`(x, y, n_sersic, r_eff, k_eff, center_x=0, center_y=0)

    de-projection of the Sersic profile based on Prugniel & Simien (1997) :return:

  `get_distance_from_center`(x, y, phi_G, q, center_x, center_y)

    Get the distance from the center of Sersic, accounting for orientation and axis ratio :param x: :param y: :param phi_G: orientation angle in rad :param q: axis ratio :param center_x: center x of sersic :param center_y: center y of sersic

  `k_Re`(n, k)
  `k_bn`(n, Re)

    returns normalisation of the sersic profile such that Re is the half light radius given n_sersic slope

  `total_flux`(amp, R_sersic, n_sersic, e1=0, e2=0, Re=None, gamma=None, center_x=None, center_y=None, alpha=None)

    computes analytical integral to compute total flux of the Sersic profile

    Parameters: | amp – amplitude parameter in Sersic function (surface brightness at R_sersic R_sersic – half-light radius in semi-major axis Re – Cored Sersic function parameter (optional) n_sersic – Sersic index gamma – Cored Sersic function parameter (optional) e1 – eccentricity e2 – eccentricity center_x – profile center (ignored) center_y – profile center (ignored) alpha – Cored Sersic function parameter (optional)
    Returns: | Analytic integral of the total flux of the Sersic profile

## lenstronomy.LensModel.Profiles.shapelet_pot_cartesian module

class `lenstronomy.LensModel.Profiles.shapelet_pot_cartesian.` `CartShapelets`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains the function and the derivatives of the cartesian shapelets

  `H_n`(n, x)

    constructs the Hermite polynomial of order n at position x (dimensionless)

    Parameters: | n – The n’the basis function. x – 1-dim position (dimensionless)
    Returns: | array– H_n(x).
    Raises: | AttributeError, KeyError

  `derivatives`(x, y, coeffs, beta, center_x=0, center_y=0)

    returns df/dx and df/dy of the function

  `function`(x, y, coeffs, beta, center_x=0, center_y=0)

    lensing potential

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `hessian`(x, y, coeffs, beta, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'beta': 0, 'center_x': -100, 'center_y': -100, 'coeffs': [0]}
  `param_names` = ['coeffs', 'beta', 'center_x', 'center_y']
  `phi_n`(n, x)

    constructs the 1-dim basis function (formula (1) in Refregier et al. 2001)

    Parameters: | n – The n’the basis function. x – 1-dim position (dimensionless)
    Returns: | array– phi_n(x).
    Raises: | AttributeError, KeyError

  `pre_calc`(x, y, beta, n_order, center_x, center_y)

    calculates the H_n(x) and H_n(y) for a given x-array and y-array :param x: :param y: :param amp: :param beta: :param n_order: :param center_x: :param center_y: :return: list of H_n(x) and H_n(y)

  `upper_limit_default` = {'beta': 100, 'center_x': 100, 'center_y': 100, 'coeffs': [100]}

## lenstronomy.LensModel.Profiles.shapelet_pot_polar module

class `lenstronomy.LensModel.Profiles.shapelet_pot_polar.` `PolarShapelets`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains the function and the derivatives of the Singular Isothermal Sphere

  `derivatives`(x, y, coeffs, beta, center_x=0, center_y=0)

    returns df/dx and df/dy of the function

  `function`(x, y, coeffs, beta, center_x=0, center_y=0)

    lensing potential

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `hessian`(x, y, coeffs, beta, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'beta': 0, 'center_x': -100, 'center_y': -100, 'coeffs': [0]}
  `param_names` = ['coeffs', 'beta', 'center_x', 'center_y']
  `upper_limit_default` = {'beta': 100, 'center_x': 100, 'center_y': 100, 'coeffs': [100]}

## lenstronomy.LensModel.Profiles.shear module

class `lenstronomy.LensModel.Profiles.shear.` `Shear`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class for external shear gamma1, gamma2 expression

  `derivatives`(x, y, gamma1, gamma2, ra_0=0, dec_0=0)

    Parameters: | x – x-coordinate (angle) y – y0-coordinate (angle) gamma1 – shear component gamma2 – shear component ra_0 – x/ra position where shear deflection is 0 dec_0 – y/dec position where shear deflection is 0
    Returns: | deflection angles

  `function`(x, y, gamma1, gamma2, ra_0=0, dec_0=0)

    Parameters: | x – x-coordinate (angle) y – y0-coordinate (angle) gamma1 – shear component gamma2 – shear component ra_0 – x/ra position where shear deflection is 0 dec_0 – y/dec position where shear deflection is 0
    Returns: | lensing potential

  `hessian`(x, y, gamma1, gamma2, ra_0=0, dec_0=0)

    Parameters: | x – x-coordinate (angle) y – y0-coordinate (angle) gamma1 – shear component gamma2 – shear component ra_0 – x/ra position where shear deflection is 0 dec_0 – y/dec position where shear deflection is 0
    Returns: | f_xx, f_xy, f_yx, f_yy

  `lower_limit_default` = {'dec_0': -100, 'gamma1': -0.5, 'gamma2': -0.5, 'ra_0': -100}
  `param_names` = ['gamma1', 'gamma2', 'ra_0', 'dec_0']
  `upper_limit_default` = {'dec_0': 100, 'gamma1': 0.5, 'gamma2': 0.5, 'ra_0': 100}

class `lenstronomy.LensModel.Profiles.shear.` `ShearGammaPsi`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class to model a shear field with shear strength and direction. The translation ot the cartesian shear distortions is as follow:

  \[\gamma_1 = \gamma_{ext} \cos(2 \phi_{ext} \gamma_2 = \gamma_{ext} \sin(2 \phi_{ext}\]
  `derivatives`(x, y, gamma_ext, psi_ext, ra_0=0, dec_0=0)

    deflection angles

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  static `function`(x, y, gamma_ext, psi_ext, ra_0=0, dec_0=0)

    Parameters: | x – x-coordinate (angle) y – y0-coordinate (angle) gamma_ext – shear strength psi_ext – shear angle (radian) ra_0 – x/ra position where shear deflection is 0 dec_0 – y/dec position where shear deflection is 0
    Returns: |

  `hessian`(x, y, gamma_ext, psi_ext, ra_0=0, dec_0=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `lower_limit_default` = {'dec_0': -100, 'gamma_ext': 0, 'psi_ext': -3.141592653589793, 'ra_0': -100}
  `param_names` = ['gamma_ext', 'psi_ext', 'ra_0', 'dec_0']
  `upper_limit_default` = {'dec_0': 100, 'gamma_ext': 1, 'psi_ext': 3.141592653589793, 'ra_0': 100}

class `lenstronomy.LensModel.Profiles.shear.` `ShearReduced`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  reduced shear distortions \(\gamma' = \gamma / (1-\kappa)\). This distortion keeps the magnification as unity and, thus, does not change the size of apparent objects. To keep the magnification at unity, it requires

  \[(1-\kappa)^2 - \gamma_1^2 - \gamma_2^ = 1\]

  Thus, for given pair of reduced shear \((\gamma'_1, \gamma'_2)\), an additional convergence term is calculated and added to the lensing distortions.

  `derivatives`(x, y, gamma1, gamma2, ra_0=0, dec_0=0)

    Parameters: | x – x-coordinate (angle) y – y0-coordinate (angle) gamma1 – shear component gamma2 – shear component ra_0 – x/ra position where shear deflection is 0 dec_0 – y/dec position where shear deflection is 0
    Returns: | deflection angles

  `function`(x, y, gamma1, gamma2, ra_0=0, dec_0=0)

    Parameters: | x – x-coordinate (angle) y – y0-coordinate (angle) gamma1 – shear component gamma2 – shear component ra_0 – x/ra position where shear deflection is 0 dec_0 – y/dec position where shear deflection is 0
    Returns: | lensing potential

  `hessian`(x, y, gamma1, gamma2, ra_0=0, dec_0=0)

    Parameters: | x – x-coordinate (angle) y – y0-coordinate (angle) gamma1 – shear component gamma2 – shear component ra_0 – x/ra position where shear deflection is 0 dec_0 – y/dec position where shear deflection is 0
    Returns: | f_xx, f_xy, f_yx, f_yy

  `lower_limit_default` = {'dec_0': -100, 'gamma1': -0.5, 'gamma2': -0.5, 'ra_0': -100}
  `param_names` = ['gamma1', 'gamma2', 'ra_0', 'dec_0']
  `upper_limit_default` = {'dec_0': 100, 'gamma1': 0.5, 'gamma2': 0.5, 'ra_0': 100}

## lenstronomy.LensModel.Profiles.sie module

class `lenstronomy.LensModel.Profiles.sie.` `SIE`(NIE=True)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class for singular isothermal ellipsoid (SIS with ellipticity)

  static `density`(r, rho0, e1=0, e2=0)

    computes the density :param r: radius in angles :param rho0: density at angle=1 :return: density at r

  static `density_2d`(x, y, rho0, e1=0, e2=0, center_x=0, center_y=0)

    projected density :param x: :param y: :param rho0: :param center_x: :param center_y: :return:

  `density_lens`(r, theta_E, e1=0, e2=0)

    computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

    Parameters: | r – radius in angles theta_E – Einstein radius e1 – eccentricity component e2 – eccentricity component
    Returns: | density

  `derivatives`(x, y, theta_E, e1, e2, center_x=0, center_y=0)

    Parameters: | x – y – theta_E – q – phi_G – center_x – center_y –
    Returns: |

  `function`(x, y, theta_E, e1, e2, center_x=0, center_y=0)

    Parameters: | x – y – theta_E – q – phi_G – center_x – center_y –
    Returns: |

  `grav_pot`(x, y, rho0, e1=0, e2=0, center_x=0, center_y=0)

    gravitational potential (modulo 4 pi G and rho0 in appropriate units) :param x: :param y: :param rho0: :param a: :param s: :param center_x: :param center_y: :return:

  `hessian`(x, y, theta_E, e1, e2, center_x=0, center_y=0)

    Parameters: | x – y – theta_E – q – phi_G – center_x – center_y –
    Returns: |

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'theta_E': 0}
  `mass_2d`(r, rho0, e1=0, e2=0)

    mass enclosed projected 2d sphere of radius r :param r: :param rho0: :param a: :param s: :return:

  `mass_2d_lens`(r, theta_E, e1=0, e2=0)

    Parameters: | r – theta_E –
    Returns: |

  static `mass_3d`(r, rho0, e1=0, e2=0)

    mass enclosed a 3d sphere or radius r :param r: radius in angular units :param rho0: density at angle=1 :return: mass in angular units

  `mass_3d_lens`(r, theta_E, e1=0, e2=0)

    mass enclosed a 3d sphere or radius r given a lens parameterization with angular units

    Parameters: | r – radius in angular units theta_E – Einstein radius
    Returns: | mass in angular units

  `param_names` = ['theta_E', 'e1', 'e2', 'center_x', 'center_y']
  static `theta2rho`(theta_E)

    converts projected density parameter (in units of deflection) into 3d density parameter :param theta_E: :return:

  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'theta_E': 100}

## lenstronomy.LensModel.Profiles.sis module

class `lenstronomy.LensModel.Profiles.sis.` `SIS`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains the function and the derivatives of the Singular Isothermal Sphere

  static `density`(r, rho0)

    computes the density :param r: radius in angles :param rho0: density at angle=1 :return: density at r

  static `density_2d`(x, y, rho0, center_x=0, center_y=0)

    projected density :param x: :param y: :param rho0: :param center_x: :param center_y: :return:

  `density_lens`(r, theta_E)

    computes the density at 3d radius r given lens model parameterization. The integral in projected in units of angles (i.e. arc seconds) results in the convergence quantity.

    Parameters: | r – 3d radius theta_E – Einstein radius
    Returns: | density(r)

  `derivatives`(x, y, theta_E, center_x=0, center_y=0)

    returns df/dx and df/dy of the function

  `function`(x, y, theta_E, center_x=0, center_y=0)

    lensing potential

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `grav_pot`(x, y, rho0, center_x=0, center_y=0)

    gravitational potential (modulo 4 pi G and rho0 in appropriate units) :param x: :param y: :param rho0: :param a: :param s: :param center_x: :param center_y: :return:

  `hessian`(x, y, theta_E, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'theta_E': 0}
  `mass_2d`(r, rho0)

    mass enclosed projected 2d sphere of radius r :param r: :param rho0: :param a: :param s: :return:

  `mass_2d_lens`(r, theta_E)

    Parameters: | r – radius theta_E – Einstein radius
    Returns: | mass within a radius in projection

  static `mass_3d`(r, rho0)

    mass enclosed a 3d sphere or radius r :param r: radius in angular units :param rho0: density at angle=1 :return: mass in angular units

  `mass_3d_lens`(r, theta_E)

    mass enclosed a 3d sphere or radius r given a lens parameterization with angular units

    Parameters: | r – radius in angular units theta_E – Einstein radius
    Returns: | mass in angular units

  `param_names` = ['theta_E', 'center_x', 'center_y']
  static `rho2theta`(rho0)

    converts 3d density into 2d projected density parameter :param rho0: :param gamma: :return:

  static `theta2rho`(theta_E)

    converts projected density parameter (in units of deflection) into 3d density parameter :param theta_E: :return:

  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'theta_E': 100}

## lenstronomy.LensModel.Profiles.sis_truncate module

class `lenstronomy.LensModel.Profiles.sis_truncate.` `SIS_truncate`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains the function and the derivatives of the Singular Isothermal Sphere

  `derivatives`(x, y, theta_E, r_trunc, center_x=0, center_y=0)

    returns df/dx and df/dy of the function

  `function`(x, y, theta_E, r_trunc, center_x=0, center_y=0)

    lensing potential

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `hessian`(x, y, theta_E, r_trunc, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'r_trunc': 0, 'theta_E': 0}
  `param_names` = ['theta_E', 'r_trunc', 'center_x', 'center_y']
  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'r_trunc': 100, 'theta_E': 100}

## lenstronomy.LensModel.Profiles.spemd module

class `lenstronomy.LensModel.Profiles.spemd.` `SPEMD`(suppress_fastell=False)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class for smooth power law ellipse mass density profile. This class effectively performs the FASTELL calculations by Renan Barkana. The parameters are changed and represent a spherically averaged Einstein radius an a logarithmic 3D mass profile slope.

  The Einstein ring parameter converts to the definition used by GRAVLENS as follow: (theta_E / theta_E_gravlens) = sqrt[ (1+q^2) / (2 q) ]

  FASTELL has the following defintions: The parameters are position (x1,x2), overall factor (q), power (gam), axis ratio (arat) which is <=1, core radius squared (s2), and the output potential (phi). The projected mass density distribution, in units of the critical density, is kappa(x1,x2)=q [u2+s2]^(-gam), where u2=[x1^2+x2^2/(arat^2)].

  static `convert_params`(theta_E, gamma, q, s_scale)

    converts parameter defintions into quantities used by the FASTELL fortran library

    Parameters: | theta_E – Einstein radius gamma – 3D power-law slope of mass profile q – axis ratio minor/major s_scale – float, smoothing scale in the core
    Returns: | pre-factors to SPEMP profile for FASTELL

  `derivatives`(x, y, theta_E, gamma, e1, e2, s_scale, center_x=0, center_y=0)

    Parameters: | x – x-coordinate (angle) y – y-coordinate (angle) theta_E – Einstein radius (angle), pay attention to specific definition! gamma – logarithmic slope of the power-law profile. gamma=2 corresponds to isothermal e1 – eccentricity component e2 – eccentricity component s_scale – smoothing scale in the center of the profile center_x – x-position of lens center center_y – y-position of lens center
    Returns: | deflection angles alpha_x, alpha_y

  `function`(x, y, theta_E, gamma, e1, e2, s_scale, center_x=0, center_y=0)

    Parameters: | x – x-coordinate (angle) y – y-coordinate (angle) theta_E – Einstein radius (angle), pay attention to specific definition! gamma – logarithmic slope of the power-law profile. gamma=2 corresponds to isothermal e1 – eccentricity component e2 – eccentricity component s_scale – smoothing scale in the center of the profile (angle) center_x – x-position of lens center center_y – y-position of lens center
    Returns: | lensing potential

  `hessian`(x, y, theta_E, gamma, e1, e2, s_scale, center_x=0, center_y=0)

    Parameters: | x – x-coordinate (angle) y – y-coordinate (angle) theta_E – Einstein radius (angle), pay attention to specific definition! gamma – logarithmic slope of the power-law profile. gamma=2 corresponds to isothermal e1 – eccentricity component e2 – eccentricity component s_scale – smoothing scale in the center of the profile center_x – x-position of lens center center_y – y-position of lens center
    Returns: | Hessian components f_xx, f_xy, f_yx, f_yy

  static `is_not_empty`(x1, x2)

    Check if float or not an empty array :return: True if x1 and x2 are either floats/ints or an non-empty array, False if e.g. objects are [] :rtype: bool

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'gamma': 0, 's_scale': 0, 'theta_E': 0}
  `param_names` = ['theta_E', 'gamma', 'e1', 'e2', 's_scale', 'center_x', 'center_y']
  `param_transform`(x, y, theta_E, gamma, e1, e2, s_scale, center_x=0, center_y=0)

    transforms parameters in the format of fastell4py

    Parameters: | x – x-coordinate (angle) y – y-coordinate (angle) theta_E – Einstein radius (angle), pay attention to specific definition! gamma – logarithmic slope of the power-law profile. gamma=2 corresponds to isothermal e1 – eccentricity component e2 – eccentricity component s_scale – smoothing scale in the center of the profile center_x – x-position of lens center center_y – y-position of lens center
    Returns: | x-rotated, y-rotated, q_fastell, gam, s2, q, phi_G

  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'gamma': 100, 's_scale': 100, 'theta_E': 100}

## lenstronomy.LensModel.Profiles.spep module

class `lenstronomy.LensModel.Profiles.spep.` `SPEP`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class for Softened power-law elliptical potential (SPEP)

  `density_lens`(r, theta_E, gamma, e1=0, e2=0)

    Parameters: | r – theta_E – gamma – e1 – e2 –
    Returns: |

  `derivatives`(x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0)

    deflection angles

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `function`(x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0)

    Parameters: | x (array of size (n)) – set of x-coordinates theta_E (float.) – Einstein radius of lense gamma (<2 float) – power law slope of mass profifle q (0<phi_G<pi/2) – Axis ratio phi_G – position angel of SES
    Returns: | function
    Raises: | AttributeError, KeyError

  `hessian`(x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'gamma': 0, 'theta_E': 0}
  `mass_3d_lens`(r, theta_E, gamma, e1=0, e2=0)

    computes the spherical power-law mass enclosed (with SPP routiune) :param r: :param theta_E: :param gamma: :param q: :param phi_G: :return:

  `param_names` = ['theta_E', 'gamma', 'e1', 'e2', 'center_x', 'center_y']
  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'gamma': 100, 'theta_E': 100}

## lenstronomy.LensModel.Profiles.splcore module

class `lenstronomy.LensModel.Profiles.splcore.` `SPLCORE`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  > This lens profile corresponds to a spherical power law (SPL) mass distribution with logarithmic slope gamma and a 3D core radius r_core

  > \[\]

  holeft(r, ho_0, r_c, gamma ight) = ho_0 rac{{r_c}^gamma}{left(r^2 + r_c^2 ight)^{ rac{gamma}{2}}}

  > The difference between this and EPL is that this model contains a core radius, is circular, and is also defined for gamma=3.

  > With respect to SPEMD, this model is different in that it is also defined for gamma = 3, is circular, and is defined in terms of a physical density parameter rho0, or the central density at r=0 divided by the critical density for lensing such that rho0 has units 1/arcsec.

  > This class is defined for all gamma > 1

  `alpha`(r, sigma0, r_core, gamma)

    Returns the deflection angle at r :param r: radius [arcsec] :param sigma0: convergence at r=0 :param r_core: core radius [arcsec] :param gamma: logarithmic slope at r -> infinity :return: deflection angle at r

  `density`(r, rho0, r_core, gamma)

    Returns the 3D density at r :param r: radius [arcsec] :param sigma0: convergence at r=0 :param r_core: core radius [arcsec] :param gamma: logarithmic slope at r -> infinity :return: density at r

  `density_2d`(x, y, rho0, r_core, gamma)

    Returns the convergence at radius r :param x: x position [arcsec] :param y: y position [arcsec] :param sigma0: convergence at r=0 :param r_core: core radius [arcsec] :param gamma: logarithmic slope at r -> infinity :return: convergence at r

  `density_lens`(r, sigma0, r_core, gamma)

    Returns the 3D density at r :param r: radius [arcsec] :param sigma0: convergence at r=0 :param r_core: core radius [arcsec] :param gamma: logarithmic slope at r -> infinity :return: density at r

  `derivatives`(x, y, sigma0, r_core, gamma, center_x=0, center_y=0)

    Parameters: | x – projected x position at which to evaluate function [arcsec] y – projected y position at which to evaluate function [arcsec] sigma0 – convergence at r = 0 r_core – core radius [arcsec] gamma – logarithmic slope at r -> infinity center_x – x coordinate center of lens model [arcsec] center_y – y coordinate center of lens model [arcsec]
    Returns: | deflection angle alpha in x and y directions

  `function`(x, y, sigma0, r_core, gamma, center_x=0, center_y=0)

    lensing potential

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `hessian`(x, y, sigma0, r_core, gamma, center_x=0, center_y=0)

    Parameters: | x – projected x position at which to evaluate function [arcsec] y – projected y position at which to evaluate function [arcsec] sigma0 – convergence at r = 0 r_core – core radius [arcsec] gamma – logarithmic slope at r -> infinity center_x – x coordinate center of lens model [arcsec] center_y – y coordinate center of lens model [arcsec]
    Returns: | hessian elements

    alpha_(x/y) = alpha_r * cos/sin(x/y / r)

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'gamma': 1.000001, 'r_core': 1e-06, 'sigma0': 0}
  `mass_2d`(r, rho0, r_core, gamma)

    mass enclosed projected 2d disk of radius r :param r: radius [arcsec] :param rho0: density at r = 0 in units [rho_0_physical / sigma_crit] (which should be equal to [1/arcsec]) where rho_0_physical is a physical density normalization and sigma_crit is the critical density for lensing :param r_core: core radius [arcsec] :param gamma: logarithmic slope at r -> infinity :return: projected mass inside disk of radius r

  `mass_2d_lens`(r, sigma0, r_core, gamma)

    mass enclosed projected 2d disk of radius r :param r: radius [arcsec] :param sigma0: convergence at r = 0 where rho_0_physical is a physical density normalization and sigma_crit is the critical density for lensing :param r_core: core radius [arcsec] :param gamma: logarithmic slope at r -> infinity :return: projected mass inside disk of radius r

  `mass_3d`(r, rho0, r_core, gamma)

    mass enclosed a 3d sphere or radius r :param r: radius [arcsec] :param rho0: density at r = 0 in units [rho_0_physical / sigma_crit] (which should be equal to [arcsec]) where rho_0_physical is a physical density normalization and sigma_crit is the critical density for lensing :param r_core: core radius [arcsec] :param gamma: logarithmic slope at r -> infinity :return: mass inside radius r

  `mass_3d_lens`(r, sigma0, r_core, gamma)

    mass enclosed a 3d sphere or radius r :param r: radius [arcsec] :param sigma0: convergence at r = 0 :param r_core: core radius [arcsec] :param gamma: logarithmic slope at r -> infinity :return: mass inside radius r

  `param_names` = ['sigma0', 'center_x', 'center_y', 'r_core', 'gamma']
  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'gamma': 5.0, 'r_core': 100, 'sigma0': 1000000000000.0}

## lenstronomy.LensModel.Profiles.spp module

class `lenstronomy.LensModel.Profiles.spp.` `SPP`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  class for circular power-law mass distribution

  static `density`(r, rho0, gamma)

    computes the density :param x: :param y: :param rho0: :param a: :param s: :return:

  static `density_2d`(x, y, rho0, gamma, center_x=0, center_y=0)

    projected density :param x: :param y: :param rho0: :param a: :param s: :param center_x: :param center_y: :return:

  `density_lens`(r, theta_E, gamma)

    computes the density at 3d radius r given lens model parameterization. The integral in projected in units of angles (i.e. arc seconds) results in the convergence quantity.

  `derivatives`(x, y, theta_E, gamma, center_x=0.0, center_y=0.0)

    deflection angles

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `function`(x, y, theta_E, gamma, center_x=0, center_y=0)

    Parameters: | x (array of size (n)) – set of x-coordinates theta_E (float.) – Einstein radius of lens gamma (<2 float) – power law slope of mass profile
    Returns: | function
    Raises: | AttributeError, KeyError

  `grav_pot`(x, y, rho0, gamma, center_x=0, center_y=0)

    gravitational potential (modulo 4 pi G and rho0 in appropriate units) :param x: :param y: :param rho0: :param a: :param s: :param center_x: :param center_y: :return:

  `hessian`(x, y, theta_E, gamma, center_x=0.0, center_y=0.0)

    returns Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

    Parameters: | x – x-coordinate y – y-coordinate kwargs – keywords of the profile
    Returns: | raise as definition is not defined

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'gamma': 1.5, 'theta_E': 0}
  `mass_2d`(r, rho0, gamma)

    mass enclosed projected 2d sphere of radius r :param r: :param rho0: :param a: :param s: :return:

  `mass_2d_lens`(r, theta_E, gamma)

    Parameters: | r – projected radius theta_E – Einstein radius gamma – power-law slope
    Returns: | 2d projected radius enclosed

  static `mass_3d`(r, rho0, gamma)

    mass enclosed a 3d sphere or radius r :param r: :param a: :param s: :return:

  `mass_3d_lens`(r, theta_E, gamma)

    Parameters: | r – theta_E – gamma –
    Returns: |

  `param_names` = ['theta_E', 'gamma', 'center_x', 'center_y']
  static `rho2theta`(rho0, gamma)

    converts 3d density into 2d projected density parameter :param rho0: :param gamma: :return:

  static `theta2rho`(theta_E, gamma)

    converts projected density parameter (in units of deflection) into 3d density parameter :param theta_E: :param gamma: :return:

  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'gamma': 2.5, 'theta_E': 100}

## lenstronomy.LensModel.Profiles.tnfw module

class `lenstronomy.LensModel.Profiles.tnfw.` `TNFW`

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  this class contains functions concerning the truncated NFW profile with a truncation function (r_trunc^2)*(r^2+r_trunc^2)

  relation are: R_200 = c * Rs

  `F`(x)

    Classic NFW function in terms of arctanh and arctan :param x: r/Rs :return:

  static `alpha2rho0`(alpha_Rs, Rs)

    convert angle at Rs into rho0; neglects the truncation

    Parameters: | alpha_Rs – deflection angle at RS Rs – scale radius
    Returns: | density normalization (characteristic density)

  static `density`(r, Rs, rho0, r_trunc)

    three dimensional truncated NFW profile

    Parameters: | r (float/numpy array) – radius of interest Rs (float > 0) – scale radius r_trunc (float > 0) – truncation radius (angular units)
    Returns: | rho(r) density

  `density_2d`(x, y, Rs, rho0, r_trunc, center_x=0, center_y=0)

    projected two dimensional NFW profile (kappa*Sigma_crit)

    Parameters: | R (float/numpy array) – projected radius of interest Rs (float) – scale radius rho0 (float) – density normalization (characteristic density) r_trunc (float > 0) – truncation radius (angular units)
    Returns: | Epsilon(R) projected density at radius R

  `derivatives`(x, y, Rs, alpha_Rs, r_trunc, center_x=0, center_y=0)

    returns df/dx and df/dy of the function (integral of TNFW), which are the deflection angles

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) Rs – turn over point in the slope of the NFW profile in angular unit alpha_Rs – deflection (angular units) at projected Rs r_trunc – truncation radius (angular units) center_x – center of halo (in angular units) center_y – center of halo (in angular units)
    Returns: | deflection angle in x, deflection angle in y

  `function`(x, y, Rs, alpha_Rs, r_trunc, center_x=0, center_y=0)

    Parameters: | x – angular position y – angular position Rs – angular turn over point alpha_Rs – deflection at Rs r_trunc – truncation radius center_x – center of halo center_y – center of halo
    Returns: | lensing potential

  `hessian`(x, y, Rs, alpha_Rs, r_trunc, center_x=0, center_y=0)

    returns d^2f/dx^2, d^2f/dxdy, d^2f/dydx, d^2f/dy^2 of the TNFW potential f

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) Rs – turn over point in the slope of the NFW profile in angular unit alpha_Rs – deflection (angular units) at projected Rs r_trunc – truncation radius (angular units) center_x – center of halo (in angular units) center_y – center of halo (in angular units)
    Returns: | Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy

  `lower_limit_default` = {'Rs': 0, 'alpha_Rs': 0, 'center_x': -100, 'center_y': -100, 'r_trunc': 0}
  `mass_2d`(R, Rs, rho0, r_trunc)

    analytic solution of the projection integral (convergence)

    Parameters: | R – projected radius Rs – scale radius rho0 – density normalization (characteristic density) r_trunc – truncation radius (angular units)
    Returns: | mass enclosed 2d projected cylinder

  `mass_3d`(r, Rs, rho0, r_trunc)

    mass enclosed a 3d sphere or radius r

    Parameters: | r – 3d radius Rs – scale radius rho0 – density normalization (characteristic density) r_trunc – truncation radius (angular units)
    Returns: | M(<r)

  `nfwAlpha`(R, Rs, rho0, r_trunc, ax_x, ax_y)

    deflection angel of NFW profile along the projection to coordinate axis

    Parameters: | R (float/numpy array) – radius of interest Rs (float) – scale radius rho0 (float) – density normalization (characteristic density) r_trunc (float > 0) – truncation radius (angular units) axis (same as R) – projection to either x- or y-axis
    Returns: |

  `nfwGamma`(R, Rs, rho0, r_trunc, ax_x, ax_y)

    shear gamma of NFW profile (times Sigma_crit) along the projection to coordinate ‘axis’

    Parameters: | R (float/numpy array) – radius of interest Rs (float) – scale radius rho0 (float) – density normalization (characteristic density) r_trunc (float > 0) – truncation radius (angular units) axis (same as R) – projection to either x- or y-axis
    Returns: |

  `nfwPot`(R, Rs, rho0, r_trunc)

    lensing potential of truncated NFW profile

    Parameters: | R (float/numpy array) – radius of interest Rs (float) – scale radius rho0 (float) – density normalization (characteristic density) r_trunc (float > 0) – truncation radius (angular units)
    Returns: | lensing potential

  `param_names` = ['Rs', 'alpha_Rs', 'r_trunc', 'center_x', 'center_y']
  `profile_name` = 'TNFW'
  static `rho02alpha`(rho0, Rs)

    convert rho0 to angle at Rs; neglects the truncation

    Parameters: | rho0 – density normalization (characteristic density) Rs – scale radius
    Returns: | deflection angle at RS

  `upper_limit_default` = {'Rs': 100, 'alpha_Rs': 10, 'center_x': 100, 'center_y': 100, 'r_trunc': 100}

## lenstronomy.LensModel.Profiles.uldm module

class `lenstronomy.LensModel.Profiles.uldm.` `Uldm`(*args, **kwargs)

  Bases: `lenstronomy.LensModel.Profiles.base_profile.LensProfileBase`

  This class contains functions concerning the ULDM soliton density profile, whose good approximation is (see for example https://arxiv.org/pdf/1406.6586.pdf )

  \[\rho = \rho_0 (1 + a(\theta/\theta_c)^2)^{-\beta}\]

  where \(\theta_c\) is the core radius, corresponding to the radius where the density drops by half its central value, :math: beta is the slope (called just slope in the parameters of this model), :math: rho_0 = kappa_0 Sigma_c/D_lens, and :math: a is a parameter, dependent on :math: beta, chosen such that :math: theta_c indeed corresponds to the radius where the density drops by half (simple math gives :math: a = 0.5^{-1/beta} - 1 ). For an ULDM soliton profile without contributions to background potential, it turns out that :math: beta = 8, a = 0.091. We allow :math: beta to be different from 8 to model solitons which feel the influence of background potential (see 2105.10873) The profile has, as parameters: :param kappa_0: central convergence :param theta_c: core radius (in arcseconds) :param slope: exponent entering the profile, default value is 8

  `alpha_radial`(r, kappa_0, theta_c, slope=8)

    returns the radial part of the deflection angle

    Parameters: | kappa_0 – central convergence of profile theta_c – core radius (in arcsec) slope – exponent entering the profile r – radius where the deflection angle is computed
    Returns: | radial deflection angle

  `density`(R, kappa_0, theta_c, slope=8)

    three dimensional ULDM profile in angular units (rho0_physical = rho0_angular Sigma_crit / D_lens) :param R: radius of interest :param kappa_0: central convergence of profile :param theta_c: core radius (in arcsec) :param slope: exponent entering the profile :return: rho(R) density in angular units

  `density_2d`(x, y, kappa_0, theta_c, center_x=0, center_y=0, slope=8)

    projected two dimensional ULDM profile (convergence * Sigma_crit), but given our units convention for rho0, it is basically the convergence

    Parameters: | R – radius of interest kappa_0 – central convergence of profile theta_c – core radius (in arcsec) slope – exponent entering the profile
    Returns: | Epsilon(R) projected density at radius R

  `density_lens`(r, kappa_0, theta_c, slope=8)

    computes the density at 3d radius r given lens model parameterization. The integral in the LOS projection of this quantity results in the convergence quantity.

    Parameters: | r – 3d radius kappa_0 – central convergence of profile theta_c – core radius (in arcsec) slope – exponent entering the profile
    Returns: | density rho(r)

  `derivatives`(x, y, kappa_0, theta_c, center_x=0, center_y=0, slope=8)

    returns df/dx and df/dy of the function (lensing potential), which are the deflection angles

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) kappa_0 – central convergence of profile theta_c – core radius (in arcsec) slope – exponent entering the profile center_x – center of halo (in angular units) center_y – center of halo (in angular units)
    Returns: | deflection angle in x, deflection angle in y

  `function`(x, y, kappa_0, theta_c, center_x=0, center_y=0, slope=8)

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) kappa_0 – central convergence of profile theta_c – core radius (in arcsec) slope – exponent entering the profile center_x – center of halo (in angular units) center_y – center of halo (in angular units)
    Returns: | lensing potential (in arcsec^2)

  `hessian`(x, y, kappa_0, theta_c, center_x=0, center_y=0, slope=8)

    Parameters: | x – angular position (normally in units of arc seconds) y – angular position (normally in units of arc seconds) kappa_0 – central convergence of profile theta_c – core radius (in arcsec) slope – exponent entering the profile center_x – center of halo (in angular units) center_y – center of halo (in angular units)
    Returns: | Hessian matrix of function d^2f/dx^2, d^2/dxdy, d^2/dydx, d^f/dy^2

  `kappa_r`(R, kappa_0, theta_c, slope=8)

    convergence of the cored density profile. This routine is also for testing

    Parameters: | R – radius (angular scale) kappa_0 – convergence in the core theta_c – core radius slope – exponent entering the profile
    Returns: | convergence at r

  `lower_limit_default` = {'center_x': -100, 'center_y': -100, 'kappa_0': 0, 'slope': 3.5, 'theta_c': 0}
  `mass_2d`(R, kappa_0, theta_c, slope=8)

    mass enclosed a 2d sphere or radius r :param R: radius over which the mass is computed :param kappa_0: central convergence of profile :param theta_c: core radius (in arcsec) :param slope: exponent entering the profile :return: mass enclosed in 2d sphere

  `mass_3d`(R, kappa_0, theta_c, slope=8)

    mass enclosed a 3d sphere or radius r :param R: radius in arcseconds :param kappa_0: central convergence of profile :param theta_c: core radius (in arcsec) :param slope: exponent entering the profile :return: mass of soliton in angular units

  `mass_3d_lens`(r, kappa_0, theta_c, slope=8)

    mass enclosed a 3d sphere or radius r :param r: radius over which the mass is computed :param kappa_0: central convergence of profile :param theta_c: core radius (in arcsec) :param slope: exponent entering the profile :return: mass enclosed in 3D ball

  `param_names` = ['kappa_0', 'theta_c', 'slope', 'center_x', 'center_y']
  `rhotilde`(kappa_0, theta_c, slope=8)

    Computes the central density in angular units :param kappa_0: central convergence of profile :param theta_c: core radius (in arcsec) :param slope: exponent entering the profile :return: central density in 1/arcsec

  `upper_limit_default` = {'center_x': 100, 'center_y': 100, 'kappa_0': 1.0, 'slope': 10, 'theta_c': 100}

## Module contents