lenstronomy.LensModel.Profiles package¶
Submodules¶
lenstronomy.LensModel.Profiles.arc_perturbations module¶
-
class
lenstronomy.LensModel.Profiles.arc_perturbations.
ArcPerturbations
[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ deflection angles
Parameters: - x – x-coordinate
- y – y-coordinate
- kwargs – keywords of the profile
Returns: raise as definition is not defined
-
function
(*args, **kwargs)[source]¶ lensing potential
Parameters: - x – x-coordinate
- y – y-coordinate
- kwargs – keywords of the profile
Returns: raise as definition is not defined
-
hessian
(*args, **kwargs)[source]¶ 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)[source]¶ 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_static
(**kwargs)[source]¶ pre-computes certain computations that do only relate to the lens model parameters and not to the specific position where to evaluate the lens model
Parameters: kwargs – lens model parameters Returns: no return, for certain lens model some private self variables are initiated
-
lenstronomy.LensModel.Profiles.chameleon module¶
-
class
lenstronomy.LensModel.Profiles.chameleon.
Chameleon
(static=False)[source]¶ Bases:
lenstronomy.LensModel.Profiles.base_profile.LensProfileBase
class of the Chameleon model (See Suyu+2014) an elliptical truncated double isothermal profile
-
density_lens
(r, alpha_1, w_c, w_t, e1=0, e2=0, center_x=0, center_y=0)[source]¶ spherical average density as a function of 3d radius
Parameters: - r – 3d radius
- 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: matter density at 3d radius r
-
derivatives
(x, y, alpha_1, w_c, w_t, e1, e2, center_x=0, center_y=0)[source]¶ 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)[source]¶ 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)[source]¶ 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}¶
-
mass_3d_lens
(r, alpha_1, w_c, w_t, e1=0, e2=0, center_x=0, center_y=0)[source]¶ mass enclosed 3d radius
Parameters: - r – 3d radius
- 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: mass enclosed 3d radius r
-
param_convert
(alpha_1, w_c, w_t, e1, e2)[source]¶ 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_static
(alpha_1, w_c, w_t, e1, e2, center_x=0, center_y=0)[source]¶ Parameters: - alpha_1 –
- w_c –
- w_t –
- e1 –
- e2 –
- 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
[source]¶ Bases:
lenstronomy.LensModel.Profiles.base_profile.LensProfileBase
class of the Chameleon model (See Suyu+2014) an elliptical truncated double isothermal profile
-
density_lens
(r, alpha_1, ratio, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, center_x=0, center_y=0)[source]¶ Parameters: - r – 3d radius
- 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: 3d density at radius r
-
derivatives
(x, y, alpha_1, ratio, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, center_x=0, center_y=0)[source]¶ 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)[source]¶ 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)[source]¶ 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}¶
-
mass_3d_lens
(r, alpha_1, ratio, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, center_x=0, center_y=0)[source]¶ Parameters: - r – 3d radius
- 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: mass enclosed 3d radius
-
param_names
= ['alpha_1', 'ratio', 'w_c1', 'w_t1', 'e11', 'e21', 'w_c2', 'w_t2', 'e12', 'e22', 'center_x', 'center_y']¶
-
set_static
(alpha_1, ratio, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, center_x=0, center_y=0)[source]¶ pre-computes certain computations that do only relate to the lens model parameters and not to the specific position where to evaluate the lens model
Parameters: kwargs – lens model parameters Returns: no return, for certain lens model some private self variables are initiated
-
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
[source]¶ Bases:
lenstronomy.LensModel.Profiles.base_profile.LensProfileBase
class of the Chameleon model (See Suyu+2014) an elliptical truncated double isothermal profile
-
density_lens
(r, 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)[source]¶ Parameters: - r – 3d radius
- 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: density at radius r (spherical average)
-
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)[source]¶ 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)[source]¶ 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)[source]¶ 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}¶
-
mass_3d_lens
(r, 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)[source]¶ Parameters: - r – 3d radius
- 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: mass enclosed 3d radius
-
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_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)[source]¶ pre-computes certain computations that do only relate to the lens model parameters and not to the specific position where to evaluate the lens model
Parameters: kwargs – lens model parameters Returns: no return, for certain lens model some private self variables are initiated
-
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
[source]¶ 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)[source]¶ 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)[source]¶ #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)[source]¶ 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
[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ analytic solution of the projection integral (convergence)
Parameters: x (float >0) – R/Rs
-
mass_3d
(R, Rs, rho0, r_core)[source]¶ mass enclosed a 3d sphere or radius r
Parameters: - r –
- Ra –
- Rs –
Returns:
-
mass_3d_lens
(R, Rs, alpha_Rs, r_core)[source]¶ 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
[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ returns double integral of NFW profile
-
hessian
(x, y, Rs, alpha_Rs, r_core, e1, e2, center_x=0, center_y=0)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ Bases:
lenstronomy.LensModel.Profiles.base_profile.LensProfileBase
Lens model with a constant shift of the deflection field
-
derivatives
(x, y, alpha_x, alpha_y)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ Bases:
lenstronomy.LensModel.Profiles.base_profile.LensProfileBase
a single mass sheet (external convergence)
-
derivatives
(x, y, kappa, ra_0=0, dec_0=0)[source]¶ deflection angle
Parameters: - x – x-coordinate
- y – y-coordinate
- kappa – (external) convergence
Returns: deflection angles (first order derivatives)
-
function
(x, y, kappa, ra_0=0, dec_0=0)[source]¶ lensing potential
Parameters: - x – x-coordinate
- y – y-coordinate
- kappa – (external) convergence
Returns: lensing potential
-
hessian
(x, y, kappa, ra_0=0, dec_0=0)[source]¶ Hessian matrix
Parameters: - x – x-coordinate
- y – y-coordinate
- kappa – external convergence
- ra_0 – zero point of polynomial expansion (no deflection added)
- dec_0 – zero point of polynomial expansion (no deflection added)
Returns: second order derivatives f_xx, f_xy, f_yx, f_yy
-
lower_limit_default
= {'dec_0': -100, 'kappa': -10, 'ra_0': -100}¶
-
model_name
= 'CONVERGENCE'¶
-
param_names
= ['kappa', 'ra_0', 'dec_0']¶
-
upper_limit_default
= {'dec_0': 100, 'kappa': 10, 'ra_0': 100}¶
-
lenstronomy.LensModel.Profiles.coreBurkert module¶
-
class
lenstronomy.LensModel.Profiles.coreBurkert.
CoreBurkert
(*args, **kwargs)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ deflection angle
Parameters: - R –
- Rs –
- rho0 –
- r_core –
- ax_x –
- ax_y –
Returns:
-
density
(R, Rs, rho0, r_core)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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}¶
-
static
lenstronomy.LensModel.Profiles.cored_density_2 module¶
-
class
lenstronomy.LensModel.Profiles.cored_density_2.
CoredDensity2
(*args, **kwargs)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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}¶
-
static
lenstronomy.LensModel.Profiles.cored_density_exp module¶
-
class
lenstronomy.LensModel.Profiles.cored_density_exp.
CoredDensityExp
(*args, **kwargs)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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')[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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
[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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
[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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
[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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
[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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
[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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}¶
-
lenstronomy.LensModel.Profiles.elliptical_density_slice module¶
-
class
lenstronomy.LensModel.Profiles.elliptical_density_slice.
ElliSLICE
(*args, **kwargs)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ lensing potential for (x,y) inside the elliptical slice
Parameters: kwargs_slice – dict, dictionary with the slice definition (a,b,psi,sigma_0)
-
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
[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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_static
(theta_E, gamma, e1, e2, center_x=0, center_y=0)[source]¶ 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
[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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
[source]¶ 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
[source]¶ 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
[source]¶ 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
[source]¶ 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)[source]¶ Bases:
lenstronomy.LensModel.Profiles.base_profile.LensProfileBase
class for flexion
-
derivatives
(x, y, g1, g2, g3, g4, ra_0=0, dec_0=0)[source]¶ 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)[source]¶ 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)[source]¶ 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
[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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
ornumpy.array
) – x coordinate - y (
float
ornumpy.array
) – y coordinate - amp (
numpy.array
withdtype=float
) – Amplitude of Gaussian, convention: \(A/(2 \pi\sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\) - sigma (
numpy.array
withdtype=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
, ornumpy.array
with shape equal tox.shape
- x (
-
derivatives
(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)[source]¶ 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
ornumpy.array
) – x coordinate - y (
float
ornumpy.array
) – y coordinate - amp (
numpy.array
withdtype=float
) – Amplitude of Gaussian, convention: \(A/(2 \pi\sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\) - sigma (
numpy.array
withdtype=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 eachnumpy
array’s shape equal tox.shape
- x (
-
function
(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)[source]¶ Compute the potential function for a set of concentric elliptical Gaussian convergence profiles.
Parameters: - x (
float
ornumpy.array
) – x coordinate - y (
float
ornumpy.array
) – y coordinate - amp (
numpy.array
withdtype=float
) – Amplitude of Gaussian, convention: \(A/(2 \pi\sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\) - sigma (
numpy.array
withdtype=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
, ornumpy.array
withshape = x.shape
- x (
-
hessian
(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)[source]¶ 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
ornumpy.array
) – x coordinate - y (
float
ornumpy.array
) – y coordinate - amp (
numpy.array
withdtype=float
) – Amplitude of Gaussian, convention: \(A/(2 \pi\sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\) - sigma (
numpy.array
withdtype=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 eachnumpy
array’s shape equal tox.shape
- x (
-
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)[source]¶ 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)[source]¶ Compute the convergence profile for Gauss-decomposed elliptic Sersic profile.
Parameters: - x (
float
ornumpy.array
) – x coordinate - y (
float
ornumpy.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)
- x (
-
derivatives
(x, y, e1=0.0, e2=0.0, center_x=0.0, center_y=0.0, **kwargs)[source]¶ Compute the derivatives of the deflection potential \(\partial f/\partial x\), \(\partial f/\partial y\) for a Gauss-decomposed elliptic convergence.
Parameters: - x (
float
ornumpy.array
) – x coordinate - y (
float
ornumpy.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))
- x (
-
function
(x, y, e1=0.0, e2=0.0, center_x=0.0, center_y=0.0, **kwargs)[source]¶ 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
- x (
-
gauss_decompose
(**kwargs)[source]¶ 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)
- func (
-
get_kappa_1d
(y, **kwargs)[source]¶ Abstract method to compute the spherical Sersic profile at y. The concrete method has to defined by the child class.
Parameters: - y (
float
ornumpy.array
) – y coordinate - **kwargs – Keyword arguments that are defined by the child class that are particular for the convergence profile
- y (
-
get_scale
(**kwargs)[source]¶ 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)[source]¶ 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
ornumpy.array
) – x coordinate - y (
float
ornumpy.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))
- 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)[source]¶ 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)[source]¶ 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)
- y (
-
get_scale
(**kwargs)[source]¶ 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
- n_sersic (
-
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)[source]¶ 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)[source]¶ Compute the spherical projected NFW profile at y.
Parameters: - y (
float
) – y coordinate - **kwargs – Keyword arguments
Keyword Arguments: - alpha_Rs (
float
) – Deflection angle atRs
- R_s (
float
) – NFW scale radius
Returns: projected NFW profile at y
Return type: type(y)
- y (
-
get_scale
(**kwargs)[source]¶ Identify the scale size from the keyword arguments.
Parameters: **kwargs – Keyword arguments
Keyword Arguments: - alpha_Rs (
float
) – Deflection angle atRs
- R_s (
float
) – NFW scale radius
Returns: NFW scale radius
Return type: float
- alpha_Rs (
-
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)[source]¶ 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)[source]¶ 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)
- func (
-
-
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)[source]¶ 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)[source]¶ 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)
- y (
-
get_scale
(**kwargs)[source]¶ 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
- r_s (
-
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)[source]¶ 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)[source]¶ Compute the density of elliptical Gaussian \(A/(2 \pi \sigma^2) \exp(-(x^2+y^2/q^2)/2\sigma^2)\).
Parameters: - x (
float
ornumpy.array
) – x coordinate. - y (
float
ornumpy.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
, ornumpy.array
with shape =x.shape
.- x (
-
derivatives
(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)[source]¶ Compute the derivatives of function angles \(\partial f/\partial x\), \(\partial f/\partial y\) at \(x,\ y\).
Parameters: - x (
float
ornumpy.array
) – x coordinate - y (
float
ornumpy.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 eachnumpy.array
’s shape equal tox.shape
.- x (
-
function
(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)[source]¶ Compute the potential function for elliptical Gaussian convergence.
Parameters: - x (
float
ornumpy.array
) – x coordinate - y (
float
ornumpy.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
, ornumpy.array
with shape equal tox.shape
- x (
-
hessian
(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)[source]¶ 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
ornumpy.array
) – x coordinate - y (
float
ornumpy.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 eachnumpy.array
’s shape equal tox.shape
.- x (
-
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)[source]¶ 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)[source]¶ Compute the function \(\varsigma (z; q)\) from equation (4.12) of Shajib (2019).
Parameters: - x (
float
ornumpy.array
) – Real part of complex variable, \(x = \mathrm{Re}(z)\) - y (
float
ornumpy.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))
- x (
-
upper_limit_default
= {'amp': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'sigma': 100}¶
-
lenstronomy.LensModel.Profiles.gaussian_ellipse_potential module¶
-
class
lenstronomy.LensModel.Profiles.gaussian_ellipse_potential.
GaussianEllipsePotential
[source]¶ 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_2d
(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)[source]¶ Parameters: - R –
- am –
- sigma_x –
- sigma_y –
Returns:
-
derivatives
(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)[source]¶ returns df/dx and df/dy of the function
-
hessian
(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)[source]¶ 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}¶
-
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
[source]¶ 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)[source]¶ absolute value of the deflection :param R: :param amp: :param sigma_x: :param sigma_y: :return:
-
density_2d
(x, y, amp, sigma, center_x=0, center_y=0)[source]¶ Parameters: - R –
- am –
- sigma_x –
- sigma_y –
Returns:
-
derivatives
(x, y, amp, sigma, center_x=0, center_y=0)[source]¶ returns df/dx and df/dy of the function
-
hessian
(x, y, amp, sigma, center_x=0, center_y=0)[source]¶ 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', '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)[source]¶ 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)[source]¶ returns df/dx and df/dy of the function
-
hessian
(x, y, amp, sigma_x, sigma_y, center_x=0, center_y=0)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ #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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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
[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ returns double integral of NFW profile
-
hessian
(x, y, sigma0, Rs, e1, e2, center_x=0, center_y=0)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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, e1=0, e2=0)[source]¶ mass enclosed a 3d sphere or radius r in lensing parameterization
Parameters: - r – 3-d radius within the mass is integrated (same distance units as density definition)
- sigma0 – rho0 * Rs (units of projected density)
- 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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, kwargs_spline=None)[source]¶ 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)[source]¶ 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)
-
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)[source]¶ 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)[source]¶ 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, kwargs_spline=None)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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
[source]¶ Bases:
lenstronomy.LensModel.Profiles.base_profile.LensProfileBase
-
density_2d
(x, y, amp, sigma, center_x=0, center_y=0, scale_factor=1)[source]¶ Parameters: - R –
- am –
- sigma_x –
- sigma_y –
Returns:
-
derivatives
(x, y, amp, sigma, center_x=0, center_y=0, scale_factor=1)[source]¶ Parameters: - x –
- y –
- amp –
- sigma –
- center_x –
- center_y –
Returns:
-
function
(x, y, amp, sigma, center_x=0, center_y=0, scale_factor=1)[source]¶ Parameters: - x –
- y –
- amp –
- sigma –
- center_x –
- center_y –
Returns:
-
hessian
(x, y, amp, sigma, center_x=0, center_y=0, scale_factor=1)[source]¶ Parameters: - x –
- y –
- amp –
- sigma –
- center_x –
- center_y –
Returns:
-
lower_limit_default
= {'amp': 0, 'center_x': -100, 'center_y': -100, 'sigma': 0}¶
-
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
[source]¶ Bases:
lenstronomy.LensModel.Profiles.base_profile.LensProfileBase
-
density_2d
(x, y, amp, sigma, e1, e2, center_x=0, center_y=0, scale_factor=1)[source]¶ Parameters: - R –
- am –
- sigma_x –
- sigma_y –
Returns:
-
derivatives
(x, y, amp, sigma, e1, e2, center_x=0, center_y=0, scale_factor=1)[source]¶ 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)[source]¶ 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)[source]¶ 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}¶
-
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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)
-
static
alpha2rho0
(alpha_Rs, Rs)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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
-
hessian
(x, y, Rs, alpha_Rs, center_x=0, center_y=0)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ 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)[source]¶ convert rho0 to angle at Rs