lenstronomy.LightModel.Profiles package

Submodules

lenstronomy.LightModel.Profiles.chameleon module

class lenstronomy.LightModel.Profiles.chameleon.Chameleon[source]

Bases: object

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

function(x, y, amp, w_c, w_t, e1, e2, center_x=0, center_y=0)[source]
Parameters:
  • x – ra-coordinate
  • y – dec-coordinate
  • amp – amplitude of first power-law flux
  • flux_ratio – ratio of amplitudes of first to second power-law profile
  • gamma1 – power-law slope
  • gamma2 – power-law slope
  • e1 – ellipticity parameter
  • e2 – ellipticity parameter
  • center_x – center
  • center_y – center
Returns:

flux of chameleon profile

lower_limit_default = {'amp': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'w_c': 0, 'w_t': 0}
param_names = ['amp', 'w_c', 'w_t', 'e1', 'e2', 'center_x', 'center_y']
upper_limit_default = {'amp': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'w_c': 100, 'w_t': 100}
class lenstronomy.LightModel.Profiles.chameleon.DoubleChameleon[source]

Bases: object

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

function(x, y, amp, ratio, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, center_x=0, center_y=0)[source]
Parameters:
  • amp
  • ratio
  • w_c1
  • w_t1
  • e11
  • e21
  • w_c2
  • w_t2
  • e12
  • e22
  • center_x
  • center_y
Returns:

lower_limit_default = {'amp': 0, 'center_x': -100, 'center_y': -100, 'e11': -0.8, 'e12': -0.8, 'e21': -0.8, 'e22': -0.8, 'ratio': 0, 'w_c1': 0, 'w_c2': 0, 'w_t1': 0, 'w_t2': 0}
param_names = ['amp', 'ratio', 'w_c1', 'w_t1', 'e11', 'e21', 'w_c2', 'w_t2', 'e12', 'e22', 'center_x', 'center_y']
upper_limit_default = {'amp': 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.LightModel.Profiles.chameleon.TripleChameleon[source]

Bases: object

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

function(x, y, amp, 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:
  • amp
  • 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 = {'amp': 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.0, 'w_c1': 0, 'w_c2': 0, 'w_c3': 0, 'w_t1': 0, 'w_t2': 0, 'w_t3': 0}
param_names = ['amp', 'ratio12', 'ratio13', 'w_c1', 'w_t1', 'e11', 'e21', 'w_c2', 'w_t2', 'e12', 'e22', 'w_c3', 'w_t3', 'e13', 'e23', 'center_x', 'center_y']
upper_limit_default = {'amp': 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}

lenstronomy.LightModel.Profiles.ellipsoid module

class lenstronomy.LightModel.Profiles.ellipsoid.Ellipsoid[source]

Bases: object

class for an universal surface brightness within an ellipsoid

function(x, y, amp, radius, e1, e2, center_x, center_y)[source]
Parameters:
  • x
  • y
  • amp
  • radius
  • e1
  • e2
  • center_x
  • center_y
Returns:

lenstronomy.LightModel.Profiles.gaussian module

class lenstronomy.LightModel.Profiles.gaussian.Gaussian[source]

Bases: object

class for Gaussian light profile The two-dimensional Gaussian profile amplitude is defined such that the 2D integral leads to the ‘amp’ value.

profile name in LightModel module: ‘GAUSSIAN’

function(x, y, amp, sigma, center_x=0, center_y=0)[source]

surface brightness per angular unit

Parameters:
  • x – coordinate on the sky
  • y – coordinate on the sky
  • amp – amplitude, such that 2D integral leads to this value
  • sigma – sigma of Gaussian in each direction
  • center_x – center of profile
  • center_y – center of profile
Returns:

surface brightness at (x, y)

light_3d(r, amp, sigma)[source]

3D brightness per angular volume element

Parameters:
  • r – 3d distance from center of profile
  • amp – amplitude, such that 2D integral leads to this value
  • sigma – sigma of Gaussian in each direction
Returns:

3D brightness per angular volume element

total_flux(amp, sigma, center_x=0, center_y=0)[source]

integrated flux of the profile

Parameters:
  • amp – amplitude, such that 2D integral leads to this value
  • sigma – sigma of Gaussian in each direction
  • center_x – center of profile
  • center_y – center of profile
Returns:

total flux

class lenstronomy.LightModel.Profiles.gaussian.GaussianEllipse[source]

Bases: object

class for Gaussian light profile with ellipticity

profile name in LightModel module: ‘GAUSSIAN_ELLIPSE’

function(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)[source]
Parameters:
  • x – coordinate on the sky
  • y – coordinate on the sky
  • amp – amplitude, such that 2D integral leads to this value
  • sigma – sigma of Gaussian in each direction
  • e1 – eccentricity modulus
  • e2 – eccentricity modulus
  • center_x – center of profile
  • center_y – center of profile
Returns:

surface brightness at (x, y)

light_3d(r, amp, sigma, e1=0, e2=0)[source]

3D brightness per angular volume element

Parameters:
  • r – 3d distance from center of profile
  • amp – amplitude, such that 2D integral leads to this value
  • sigma – sigma of Gaussian in each direction
  • e1 – eccentricity modulus
  • e2 – eccentricity modulus
Returns:

3D brightness per angular volume element

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']
total_flux(amp, sigma=None, e1=None, e2=None, center_x=None, center_y=None)[source]

total integrated flux of profile

Parameters:
  • x – coordinate on the sky
  • y – coordinate on the sky
  • amp – amplitude, such that 2D integral leads to this value
  • sigma – sigma of Gaussian in each direction
  • e1 – eccentricity modulus
  • e2 – eccentricity modulus
  • center_x – center of profile
  • center_y – center of profile
Returns:

total flux

upper_limit_default = {'amp': 1000, 'center_x': 100, 'center_y': 100, 'e1': -0.5, 'e2': -0.5, 'sigma': 100}
class lenstronomy.LightModel.Profiles.gaussian.MultiGaussian[source]

Bases: object

class for elliptical pseudo Jaffe lens light (2d projected light/mass distribution

profile name in LightModel module: ‘MULTI_GAUSSIAN’

function(x, y, amp, sigma, center_x=0, center_y=0)[source]

surface brightness per angular unit

Parameters:
  • x – coordinate on the sky
  • y – coordinate on the sky
  • amp – list of amplitudes of individual Gaussian profiles
  • sigma – list of widths of individual Gaussian profiles
  • center_x – center of profile
  • center_y – center of profile
Returns:

surface brightness at (x, y)

function_split(x, y, amp, sigma, center_x=0, center_y=0)[source]

split surface brightness in individual components

Parameters:
  • x – coordinate on the sky
  • y – coordinate on the sky
  • amp – list of amplitudes of individual Gaussian profiles
  • sigma – list of widths of individual Gaussian profiles
  • center_x – center of profile
  • center_y – center of profile
Returns:

list of arrays of surface brightness

light_3d(r, amp, sigma)[source]

3D brightness per angular volume element

Parameters:
  • r – 3d distance from center of profile
  • amp – list of amplitudes of individual Gaussian profiles
  • sigma – list of widths of individual Gaussian profiles
Returns:

3D brightness per angular volume element

lower_limit_default = {'amp': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'sigma': 0}
param_names = ['amp', 'sigma', 'center_x', 'center_y']
total_flux(amp, sigma, center_x=0, center_y=0)[source]

total integrated flux of profile

Parameters:
  • amp – list of amplitudes of individual Gaussian profiles
  • sigma – list of widths of individual Gaussian profiles
  • center_x – center of profile
  • center_y – center of profile
Returns:

total flux

upper_limit_default = {'amp': 1000, 'center_x': 100, 'center_y': 100, 'e1': -0.5, 'e2': -0.5, 'sigma': 100}
class lenstronomy.LightModel.Profiles.gaussian.MultiGaussianEllipse[source]

Bases: object

class for elliptical multi Gaussian profile

profile name in LightModel module: ‘MULTI_GAUSSIAN_ELLIPSE’

function(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)[source]

surface brightness per angular unit

Parameters:
  • x – coordinate on the sky
  • y – coordinate on the sky
  • amp – list of amplitudes of individual Gaussian profiles
  • sigma – list of widths of individual Gaussian profiles
  • e1 – eccentricity modulus
  • e2 – eccentricity modulus
  • center_x – center of profile
  • center_y – center of profile
Returns:

surface brightness at (x, y)

function_split(x, y, amp, sigma, e1, e2, center_x=0, center_y=0)[source]

split surface brightness in individual components

Parameters:
  • x – coordinate on the sky
  • y – coordinate on the sky
  • amp – list of amplitudes of individual Gaussian profiles
  • sigma – list of widths of individual Gaussian profiles
  • e1 – eccentricity modulus
  • e2 – eccentricity modulus
  • center_x – center of profile
  • center_y – center of profile
Returns:

list of arrays of surface brightness

light_3d(r, amp, sigma, e1=0, e2=0)[source]

3D brightness per angular volume element

Parameters:
  • r – 3d distance from center of profile
  • amp – list of amplitudes of individual Gaussian profiles
  • sigma – list of widths of individual Gaussian profiles
  • e1 – eccentricity modulus
  • e2 – eccentricity modulus
Returns:

3D brightness per angular volume element

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']
total_flux(amp, sigma, e1, e2, center_x=0, center_y=0)[source]

total integrated flux of profile

Parameters:
  • amp – list of amplitudes of individual Gaussian profiles
  • sigma – list of widths of individual Gaussian profiles
  • e1 – eccentricity modulus
  • e2 – eccentricity modulus
  • center_x – center of profile
  • center_y – center of profile
Returns:

total flux

upper_limit_default = {'amp': 1000, 'center_x': 100, 'center_y': 100, 'e1': -0.5, 'e2': -0.5, 'sigma': 100}

lenstronomy.LightModel.Profiles.hernquist module

class lenstronomy.LightModel.Profiles.hernquist.Hernquist[source]

Bases: object

class for pseudo Jaffe lens light (2d projected light/mass distribution

function(x, y, amp, Rs, center_x=0, center_y=0)[source]
Parameters:
  • x
  • y
  • amp
  • Rs – scale radius: half-light radius = Rs / 0.551
  • center_x
  • center_y
Returns:

light_3d(r, amp, Rs)[source]
Parameters:
  • y
  • amp
  • Rs
  • center_x
  • center_y
Returns:

class lenstronomy.LightModel.Profiles.hernquist.HernquistEllipse[source]

Bases: object

class for elliptical pseudo Jaffe lens light (2d projected light/mass distribution

function(x, y, amp, Rs, e1, e2, center_x=0, center_y=0)[source]
Parameters:
  • x
  • y
  • amp
  • a
  • s
  • center_x
  • center_y
Returns:

light_3d(r, amp, Rs, e1=0, e2=0)[source]
Parameters:
  • y
  • amp
  • Rs
  • center_x
  • center_y
Returns:

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

lenstronomy.LightModel.Profiles.interpolation module

class lenstronomy.LightModel.Profiles.interpolation.Interpol[source]

Bases: object

class which uses an interpolation of an image to compute the surface brightness

parameters are ‘image’: 2d numpy array of surface brightness (not integrated flux per pixel!) ‘center_x’: coordinate of center of image in angular units (i.e. arc seconds) ‘center_y’: coordinate of center of image in angular units (i.e. arc seconds) ‘phi_G’: rotation of image relative to the rectangular ra-to-dec orientation ‘scale’: arcseconds per pixel of the image to be interpolated

static coord2image_pixel(ra, dec, center_x, center_y, phi_G, scale)[source]
Parameters:
  • ra – angular coordinate
  • dec – angular coordinate
  • center_x – center of image in angular coordinates
  • center_y – center of image in angular coordinates
  • phi_G – rotation angle
  • scale – pixel scale of image
Returns:

pixel coordinates

delete_cache()[source]

delete the cached interpolated image

function(x, y, image=None, amp=1, center_x=0, center_y=0, phi_G=0, scale=1)[source]
Parameters:
  • x – x-coordinate to evaluate surface brightness
  • y – y-coordinate to evaluate surface brightness
  • image – 2d numpy array (image) to be used to interpolate
  • amp – amplitude of surface brightness scaling in respect of original image
  • center_x – center of interpolated image
  • center_y – center of interpolated image
  • phi_G – rotation angle of simulated image in respect to input gird
  • scale – pixel scale (in angular units) of the simulated image
Returns:

surface brightness from the model at coordinates (x, y)

image_interp(x, y, image)[source]
lower_limit_default = {'amp': 0, 'center_x': -1000, 'center_y': -1000, 'phi_G': -3.141592653589793, 'scale': 1e-09}
param_names = ['image', 'amp', 'center_x', 'center_y', 'phi_G', 'scale']
total_flux(image, scale, amp=1, center_x=0, center_y=0, phi_G=0)[source]

sums up all the image surface brightness (image pixels defined in surface brightness at the coordinate of the pixel) times pixel area

Parameters:
  • image – pixelized surface brightness
  • scale – scale of the pixel in units of angle
  • amp – linear scaling parameter of the surface brightness multiplicative with the initial image
  • center_x – center of image in angular coordinates
  • center_y – center of image in angular coordinates
  • phi_G – rotation angle
Returns:

total flux of the image

upper_limit_default = {'amp': 1000000, 'center_x': 1000, 'center_y': 1000, 'phi_G': 3.141592653589793, 'scale': 10000000000}

lenstronomy.LightModel.Profiles.moffat module

class lenstronomy.LightModel.Profiles.moffat.Moffat[source]

Bases: object

this class contains functions to evaluate a Moffat surface brightness profile

\[I(r) = I_0 * (1 + (r/lpha)^2)^{-eta}\]

with \(I_0 = amp\).

function(x, y, amp, alpha, beta, center_x=0, center_y=0)[source]

2D Moffat profile

Parameters:
  • x – x-position (angle)
  • y – y-position (angle)
  • amp – normalization
  • alpha – scale
  • beta – exponent
  • center_x – x-center
  • center_y – y-center
Returns:

surface brightness

lenstronomy.LightModel.Profiles.nie module

class lenstronomy.LightModel.Profiles.nie.NIE[source]

Bases: lenstronomy.LightModel.Profiles.profile_base.LightProfileBase

non-divergent isothermal ellipse (projected) This is effectively the convergence profile of the NIE lens model with an amplitude ‘amp’ rather than an Einstein radius ‘theta_E’

function(x, y, amp, e1, e2, s_scale, center_x=0, center_y=0)[source]
Parameters:
  • x – x-coordinate
  • y – y-coordinate
  • amp – surface brightness normalization
  • e1 – eccentricity component
  • e2 – eccentricity component
  • s_scale – smoothing scale (square averaged of minor and major axis)
  • center_x – center of profile
  • center_y – center of profile
Returns:

surface brightness of NIE profile

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

lenstronomy.LightModel.Profiles.p_jaffe module

class lenstronomy.LightModel.Profiles.p_jaffe.PJaffe[source]

Bases: object

class for pseudo Jaffe lens light (2d projected light/mass distribution)

function(x, y, amp, Ra, Rs, center_x=0, center_y=0)[source]
Parameters:
  • x
  • y
  • amp
  • a
  • s
  • center_x
  • center_y
Returns:

light_3d(r, amp, Ra, Rs)[source]
Parameters:
  • y
  • amp
  • Rs
  • center_x
  • center_y
Returns:

lower_limit_default = {'Ra': 0, 'Rs': 0, 'amp': 0, 'center_x': -100, 'center_y': -100}
param_names = ['amp', 'Ra', 'Rs', 'center_x', 'center_y']
upper_limit_default = {'Ra': 100, 'Rs': 100, 'amp': 100, 'center_x': 100, 'center_y': 100}
class lenstronomy.LightModel.Profiles.p_jaffe.PJaffe_Ellipse[source]

Bases: object

calss for elliptical pseudo Jaffe lens light

function(x, y, amp, Ra, Rs, e1, e2, center_x=0, center_y=0)[source]
Parameters:
  • x
  • y
  • amp
  • Ra
  • Rs
  • center_x
  • center_y
Returns:

light_3d(r, amp, Ra, Rs, e1=0, e2=0)[source]
Parameters:
  • y
  • amp
  • Rs
  • center_x
  • center_y
Returns:

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

lenstronomy.LightModel.Profiles.power_law module

class lenstronomy.LightModel.Profiles.power_law.PowerLaw[source]

Bases: object

class for power-law elliptical mass distribution

function(x, y, amp, gamma, e1, e2, center_x=0, center_y=0)[source]
Parameters:
  • x – ra-coordinate
  • y – dec-coordinate
  • gamma – projected power-law slope
  • e1 – ellipticity
  • e2 – ellipticity
  • center_x – center
  • center_y – center
Returns:

projected flux

light_3d(r, amp, gamma, e1, e2)[source]
Parameters:
  • r
  • amp
  • gamma
  • e1
  • e2
Returns:

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

lenstronomy.LightModel.Profiles.sersic module

class lenstronomy.LightModel.Profiles.sersic.Sersic(smoothing=1e-05)[source]

Bases: lenstronomy.LensModel.Profiles.sersic_utils.SersicUtil

this class contains functions to evaluate an spherical Sersic function

\[I(R) = I_0 \exp \left[ -b_n (R/R_{\rm Sersic})^{\frac{1}{n}}\right]\]

with \(I_0 = amp\) and with \(b_{n}\approx 1.999\,n-0.327\)

function(x, y, amp, R_sersic, n_sersic, center_x=0, center_y=0, max_R_frac=100.0)[source]
Parameters:
  • x
  • y
  • amp – surface brightness/amplitude value at the half light radius
  • R_sersic – semi-major axis half light radius
  • n_sersic – Sersic index
  • center_x – center in x-coordinate
  • center_y – center in y-coordinate
  • max_R_frac – maximum window outside of which the mass is zeroed, in units of R_sersic (float)
Returns:

Sersic profile value at (x, y)

lower_limit_default = {'R_sersic': 0, 'amp': 0, 'center_x': -100, 'center_y': -100, 'n_sersic': 0.5}
param_names = ['amp', 'R_sersic', 'n_sersic', 'center_x', 'center_y']
upper_limit_default = {'R_sersic': 100, 'amp': 100, 'center_x': 100, 'center_y': 100, 'n_sersic': 8}
class lenstronomy.LightModel.Profiles.sersic.SersicElliptic(smoothing=1e-05)[source]

Bases: lenstronomy.LensModel.Profiles.sersic_utils.SersicUtil

this class contains functions to evaluate an elliptical Sersic function

function(x, y, amp, R_sersic, n_sersic, e1, e2, center_x=0, center_y=0, max_R_frac=100.0)[source]
Parameters:
  • x
  • y
  • amp – surface brightness/amplitude value at the half light radius
  • R_sersic – semi-major axis half light radius
  • n_sersic – Sersic index
  • e1 – eccentricity parameter
  • e2 – eccentricity parameter
  • center_x – center in x-coordinate
  • center_y – center in y-coordinate
  • max_R_frac – maximum window outside of which the mass is zeroed, in units of R_sersic (float)
Returns:

Sersic profile value at (x, y)

lower_limit_default = {'R_sersic': 0, 'amp': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'n_sersic': 0.5}
param_names = ['amp', 'R_sersic', 'n_sersic', 'e1', 'e2', 'center_x', 'center_y']
upper_limit_default = {'R_sersic': 100, 'amp': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'n_sersic': 8}
class lenstronomy.LightModel.Profiles.sersic.CoreSersic(smoothing=1e-05)[source]

Bases: lenstronomy.LensModel.Profiles.sersic_utils.SersicUtil

this class contains the Core-Sersic function introduced by e.g Trujillo et al. 2004

\[I(R) = I' \left[1 + (R_b/R)^{\alpha} \right]^{\gamma / \alpha} \exp \left{ -b_n \left[(R^{\alpha} + R_b^{lpha})/R_e^{\alpha} \right]^{1 / (n\alpha)} \right}\]

with

\[I' = I_b 2^{-\gamma/ \alpha} \exp \left[b_n 2^{1 / (n\alpha)} (R_b/R_e)^{1/n} \right]\]

where \(I_b\) is the intensity at the break radius.

function(x, y, amp, R_sersic, Rb, n_sersic, gamma, e1, e2, center_x=0, center_y=0, alpha=3.0, max_R_frac=100.0)[source]
Parameters:
  • x
  • y
  • amp – surface brightness/amplitude value at the half light radius
  • R_sersic – semi-major axis half light radius
  • Rb – “break” core radius
  • n_sersic – Sersic index
  • gamma – inner power-law exponent
  • e1 – eccentricity parameter
  • e2 – eccentricity parameter
  • center_x – center in x-coordinate
  • center_y – center in y-coordinate
  • alpha – sharpness of the transition between the cusp and the outer Sersic profile (float)
  • max_R_frac – maximum window outside of which the mass is zeroed, in units of R_sersic (float)
Returns:

Cored Sersic profile value at (x, y)

lower_limit_default = {'Rb': 0, 'amp': 0, 'center_x': -100, 'center_y': -100, 'e1': -0.5, 'e2': -0.5, 'gamma': 0, 'n_sersic': 0.5}
param_names = ['amp', 'R_sersic', 'Rb', 'n_sersic', 'gamma', 'e1', 'e2', 'center_x', 'center_y']
upper_limit_default = {'Rb': 100, 'amp': 100, 'center_x': 100, 'center_y': 100, 'e1': 0.5, 'e2': 0.5, 'gamma': 10, 'n_sersic': 8}

lenstronomy.LightModel.Profiles.shapelets module

class lenstronomy.LightModel.Profiles.shapelets.Shapelets(interpolation=False, precalc=False, stable_cut=True, cut_scale=5)[source]

Bases: object

H_n(n, x)[source]

constructs the Hermite polynomial of order n at position x (dimensionless)

Parameters:
  • n – The n’the basis function.
  • x – 1-dim position (dimensionless)
Returns:

array– H_n(x).

Raises:

AttributeError, KeyError

function(x, y, amp, beta, n1, n2, center_x, center_y)[source]
Parameters:
  • amp – amplitude of shapelet
  • beta – scale factor of shapelet
  • n1 – x-order
  • n2 – y-order
  • center_x – center in x
  • center_y – center in y
Returns:

hermval(x, n_array, tensor=True)[source]

computes the Hermit polynomial as numpy.polynomial.hermite.hermval difference: for values more than sqrt(n_max + 1) * cut_scale, the value is set to zero this should be faster and numerically stable

Parameters:
  • x – array of values
  • n_array – list of coeffs in H_n
  • cut_scale – scale where the polynomial will be set to zero
Returns:

see numpy.polynomial.hermite.hermval

lower_limit_default = {'amp': 0, 'beta': 0, 'center_x': -100, 'center_y': -100, 'n1': 0, 'n2': 0}
param_names = ['amp', 'beta', 'n1', 'n2', 'center_x', 'center_y']
phi_n(n, x)[source]

constructs the 1-dim basis function (formula (1) in Refregier et al. 2001)

Parameters:
  • n – The n’the basis function.
  • x – 1-dim position (dimensionless)
Returns:

array– phi_n(x).

Raises:

AttributeError, KeyError

pre_calc(x, y, beta, n_order, center_x, center_y)[source]

calculates the H_n(x) and H_n(y) for a given x-array and y-array :param x: :param y: :param amp: :param beta: :param n_order: :param center_x: :param center_y: :return: list of H_n(x) and H_n(y)

upper_limit_default = {'amp': 100, 'beta': 100, 'center_x': 100, 'center_y': 100, 'n1': 150, 'n2': 150}
class lenstronomy.LightModel.Profiles.shapelets.ShapeletSet[source]

Bases: object

class to operate on entire shapelet set

decomposition(image, x, y, n_max, beta, deltaPix, center_x=0, center_y=0)[source]

decomposes an image into the shapelet coefficients in same order as for the function call :param image: :param x: :param y: :param n_max: :param beta: :param center_x: :param center_y: :return:

function(x, y, amp, n_max, beta, center_x=0, center_y=0)[source]
Parameters:
  • x
  • y
  • amp
  • beta
  • center_x
  • center_y
Returns:

function_split(x, y, amp, n_max, beta, center_x=0, center_y=0)[source]
lower_limit_default = {'beta': 0, 'center_x': -100, 'center_y': -100}
param_names = ['amp', 'n_max', 'beta', 'center_x', 'center_y']
shapelet_basis_2d(num_order, beta, numPix, deltaPix=1, center_x=0, center_y=0)[source]
Parameters:
  • num_order – max shapelet order
  • beta – shapelet scale
  • numPix – number of pixel of the grid
Returns:

list of shapelets drawn on pixel grid, centered.

upper_limit_default = {'beta': 100, 'center_x': 100, 'center_y': 100}

lenstronomy.LightModel.Profiles.shapelets_polar module

class lenstronomy.LightModel.Profiles.shapelets_polar.ShapeletsPolar[source]

Bases: object

2D polar Shapelets, see Massey & Refregier 2005

function(x, y, amp, beta, n, m, complex_bool, center_x, center_y)[source]
Parameters:
  • x – x-coordinate, numpy array
  • y – y-ccordinate, numpy array
  • amp – amplitude normalization
  • beta – shaplet scale
  • n – order of polynomial
  • m – roational invariance
  • center_x – center of shapelet
  • center_y – center of shapelet
Returns:

amplitude of shapelet at possition (x, y)

index2poly(index)[source]

manages the convention from an iterative index to the specific polynomial n, m, (real/imaginary part)

Parameters:index – int, index of list
Returns:n, m bool
lower_limit_default = {'amp': 0, 'beta': 0, 'center_x': -100, 'center_y': -100, 'm': 0, 'n': 0}
num_param(n_max)[source]
Parameters:n_max – maximal polynomial order
Returns:number of basis components
param_names = ['amp', 'beta', 'n', 'm', 'center_x', 'center_y']
poly2index(n, m, complex_bool)[source]
Parameters:
  • n – non-negative integer
  • m – integer, running from -n to n in steps of two
  • complex_bool – bool, if True, assigns complex part
Returns:

upper_limit_default = {'amp': 100, 'beta': 100, 'center_x': 100, 'center_y': 100, 'm': 150, 'n': 150}
class lenstronomy.LightModel.Profiles.shapelets_polar.ShapeletsPolarExp[source]

Bases: object

2D exponential shapelets, Berge et al. 2019

function(x, y, amp, beta, n, m, complex_bool, center_x, center_y)[source]
Parameters:
  • x – x-coordinate, numpy array
  • y – y-ccordinate, numpy array
  • amp – amplitude normalization
  • beta – shaplet scale
  • n – order of polynomial
  • m – roational invariance
  • center_x – center of shapelet
  • center_y – center of shapelet
Returns:

amplitude of shapelet at possition (x, y)

index2poly(index)[source]
Parameters:index
Returns:
lower_limit_default = {'amp': 0, 'beta': 0, 'center_x': -100, 'center_y': -100, 'm': 0, 'n': 0}
num_param(n_max)[source]
Parameters:n_max – maximal polynomial order
Returns:number of basis components
param_names = ['amp', 'beta', 'n', 'm', 'center_x', 'center_y']
poly2index(n, m, complex_bool)[source]
Parameters:
  • n
  • m
  • complex_bool
Returns:

index convention, integer

upper_limit_default = {'amp': 100, 'beta': 100, 'center_x': 100, 'center_y': 100, 'm': 150, 'n': 150}
class lenstronomy.LightModel.Profiles.shapelets_polar.ShapeletSetPolar(exponential=False)[source]

Bases: object

class to operate on entire shapelet set

decomposition(image, x, y, n_max, beta, deltaPix, center_x=0, center_y=0)[source]

decomposes an image into the shapelet coefficients in same order as for the function call :param image: :param x: :param y: :param n_max: :param beta: :param center_x: :param center_y: :return:

function(x, y, amp, n_max, beta, center_x=0, center_y=0)[source]
Parameters:
  • x
  • y
  • amp
  • beta
  • center_x
  • center_y
Returns:

function_split(x, y, amp, n_max, beta, center_x=0, center_y=0)[source]
index2poly(index)[source]
Parameters:index – index of coefficient in the convention here
Returns:n, m, complex_bool
lower_limit_default = {'beta': 0, 'center_x': -100, 'center_y': -100}
param_names = ['amp', 'n_max', 'beta', 'center_x', 'center_y']
upper_limit_default = {'beta': 100, 'center_x': 100, 'center_y': 100}

lenstronomy.LightModel.Profiles.uniform module

class lenstronomy.LightModel.Profiles.uniform.Uniform[source]

Bases: object

class for Gaussian light profile

function(x, y, amp)[source]
Parameters:
  • x
  • y
  • sigma0
  • a
  • s
  • center_x
  • center_y
Returns:

lower_limit_default = {'amp': -100}
param_names = ['amp']
upper_limit_default = {'amp': 100}

Module contents