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 Dutton+ 2011, 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

  • w_c

  • w_t

  • amp – amplitude of first power-law flux

  • e1 – eccentricity parameter

  • e2 – eccentricity parameter

  • center_x – center

  • center_y – center

Returns

flux of chameleon profile

light_3d(r, amp, w_c, w_t, e1, e2, center_x=0, center_y=0)[source]
Parameters
  • r – 3d radius

  • w_c

  • w_t

  • amp – amplitude of first power-law flux

  • e1 – eccentricity parameter

  • e2 – eccentricity parameter

  • center_x – center

  • center_y – center

Returns

3d flux of chameleon profile at radius r

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 double Chameleon model. See Dutton+2011, Suyu+2014 for the single Chameleon model.

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
  • x

  • y

  • amp

  • ratio

  • w_c1

  • w_t1

  • e11

  • e21

  • w_c2

  • w_t2

  • e12

  • e22

  • center_x

  • center_y

Returns

light_3d(r, amp, ratio, w_c1, w_t1, e11, e21, w_c2, w_t2, e12, e22, center_x=0, center_y=0)[source]
Parameters
  • r – 3d radius

  • amp

  • ratio – ratio of first to second amplitude of Chameleon surface brightness

  • w_c1

  • w_t1

  • e11

  • e21

  • w_c2

  • w_t2

  • e12

  • e22

  • center_x

  • center_y

Returns

3d light density at radius r

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
  • x

  • y

  • amp

  • 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

  • w_c3

  • w_t3

  • e13

  • e23

  • center_x

  • center_y

Returns

light_3d(r, 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
  • r – 3d light radius

  • amp

  • 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

  • w_c3

  • w_t3

  • e13

  • e23

  • 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 – surface brightness within the ellipsoid

  • radius – radius (product average of semi-major and semi-minor axis) of the ellipsoid

  • e1 – eccentricity

  • e2 – eccentricity

  • center_x – center

  • center_y – center

Returns

surface brightness

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
  • 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
  • r

  • amp

  • Rs

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

  • Rs

  • e1

  • e2

  • center_x

  • center_y

Returns

light_3d(r, amp, Rs, e1=0, e2=0)[source]
Parameters
  • r

  • amp

  • Rs

  • e1

  • e2

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/\alpha)^2)^{-\beta}\]

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

light_3d(r, amp, e1, e2, s_scale, center_x=0, center_y=0)[source]

3d light distribution (in spherical regime)

Parameters
  • r – 3d radius

  • 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

light density at 3d radius

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

  • Ra

  • Rs

  • center_x

  • center_y

Returns

light_3d(r, amp, Ra, Rs)[source]
Parameters
  • r

  • amp

  • Rs

  • Ra

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.PJaffeEllipse[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
  • r

  • amp

  • Ra

  • Rs

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 light distribution

function(x, y, amp, gamma, e1, e2, center_x=0, center_y=0)[source]
Parameters
  • x – ra-coordinate

  • y – dec-coordinate

  • amp – amplitude of flux

  • gamma – projected power-law slope

  • e1 – ellipticity

  • e2 – ellipticity

  • center_x – center

  • center_y – center

Returns

projected flux

light_3d(r, amp, gamma, e1=0, e2=0)[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.CoreSersic(smoothing=1e-05, sersic_major_axis=False)[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 – half light radius (either semi-major axis or product average of semi-major and semi-minor axis)

  • 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}
class lenstronomy.LightModel.Profiles.sersic.Sersic(smoothing=1e-05, sersic_major_axis=False)[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.999n-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, sersic_major_axis=False)[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 – half light radius (either semi-major axis or product average of semi-major and semi-minor axis)

  • 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}

lenstronomy.LightModel.Profiles.shapelets module

class lenstronomy.LightModel.Profiles.shapelets.ShapeletSet[source]

Bases: object

class to operate on entire shapelet set limited by a maximal polynomial order n_max, such that n1 + n2 <= n_max

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 – x-coordinates

  • y – y-coordinates

  • amp – array of amplitudes in pre-defined order of shapelet basis functions

  • beta – shapelet scale

  • n_max – maximum polynomial order in Hermite polynomial

  • center_x – shapelet center

  • center_y – shapelet center

Returns

surface brightness of combined shapelet set

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

splits shapelet set in list of individual shapelet basis function responses

Parameters
  • x – x-coordinates

  • y – y-coordinates

  • amp – array of amplitudes in pre-defined order of shapelet basis functions

  • beta – shapelet scale

  • n_max – maximum polynomial order in Hermite polynomial

  • center_x – shapelet center

  • center_y – shapelet center

Returns

list of individual shapelet basis function responses

lower_limit_default = {'beta': 0.01, '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}
class lenstronomy.LightModel.Profiles.shapelets.Shapelets(interpolation=False, precalc=False, stable_cut=True, cut_scale=5)[source]

Bases: object

class for 2d cartesian Shapelets.

Sources: Refregier 2003: Shapelets: I. A Method for Image Analysis https://arxiv.org/abs/astro-ph/0105178 Refregier 2003: Shapelets: II. A Method for Weak Lensing Measurements https://arxiv.org/abs/astro-ph/0105179

For one dimension, the shapelets are defined as

\[\phi_n(x) \equiv \left[2^n \pi^{1/2} n! \right]]^{-1/2}H_n(x) e^{-\frac{x^2}{2}}\]

This basis is orthonormal. The dimensional basis function is

\[B_n(x;\beta) \equiv \beta^{-1/2} \phi_n(\beta^{-1}x)\]

which are orthonormal as well.

The two-dimensional basis function is

\[\phi_{\bf n}({f x}) \equiv \phi_{n1}(x1) \phi_{n2}(x2)\]

where \({\bf n} \equiv (n1, n2)\) and \({\bf x} \equiv (x1, x2)\).

The dimensional two-dimentional basis function is

\[B_{\bf n}({\bf x};\beta) \equiv \beta^{-1/2} \phi_{\bf n}(\beta^{-1}{\bf x}).\]
H_n(n, x)[source]

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

Parameters
  • n – The n’the basis function.

  • x (float or numpy array.) – 1-dim position (dimensionless)

Returns

array– H_n(x).

function(x, y, amp, beta, n1, n2, center_x, center_y)[source]

2d cartesian shapelet

Parameters
  • x – x-coordinate

  • y – y-coordinate

  • amp – amplitude of shapelet

  • beta – scale factor of shapelet

  • n1 – x-order of Hermite polynomial

  • n2 – y-order of Hermite polynomial

  • center_x – center in x

  • center_y – center in y

Returns

flux surface brighness at (x, y)

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

  • tensor – see numpy.polynomial.hermite.hermval

Returns

see numpy.polynomial.hermite.hermval

lower_limit_default = {'amp': 0, 'beta': 0.01, '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 (int.) – The n’the basis function.

  • x (float or numpy array.) – 1-dim position (dimensionless)

Returns

array– phi_n(x).

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 for the full order in the polynomials

Parameters
  • x – x-coordinates (numpy array)

  • y – 7-coordinates (numpy array)

  • beta – shapelet scale

  • n_order – order of shapelets

  • center_x – shapelet center

  • center_y – shapelet center

Returns

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}

lenstronomy.LightModel.Profiles.shapelets_polar module

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

  • n_max

  • 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}
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 – rotational invariance

  • complex_bool – boolean; if True uses complex value of function _chi_n_m()

  • 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}
static 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']
static 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 – rotational invariance

  • complex_bool – boolean; if True uses complex value of function _chi_n_m()

  • 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}
static 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']
static 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}

lenstronomy.LightModel.Profiles.uniform module

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

Bases: object

uniform light profile. This profile can also compensate for an inaccurate background subtraction. name for profile: ‘UNIFORM’

function(x, y, amp)[source]
Parameters
  • x – x-coordinate

  • y – y-coordinate

  • amp – surface brightness

Returns

constant flux

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

Module contents