repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
sibirrer/lenstronomy | lenstronomy/Util/util.py | averaging | def averaging(grid, numGrid, numPix):
"""
resize 2d pixel grid with numGrid to numPix and averages over the pixels
:param grid: higher resolution pixel grid
:param numGrid: number of pixels per axis in the high resolution input image
:param numPix: lower number of pixels per axis in the output image... | python | def averaging(grid, numGrid, numPix):
"""
resize 2d pixel grid with numGrid to numPix and averages over the pixels
:param grid: higher resolution pixel grid
:param numGrid: number of pixels per axis in the high resolution input image
:param numPix: lower number of pixels per axis in the output image... | resize 2d pixel grid with numGrid to numPix and averages over the pixels
:param grid: higher resolution pixel grid
:param numGrid: number of pixels per axis in the high resolution input image
:param numPix: lower number of pixels per axis in the output image (numGrid/numPix is integer number)
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/util.py#L244-L256 |
sibirrer/lenstronomy | lenstronomy/Util/util.py | displaceAbs | def displaceAbs(x, y, sourcePos_x, sourcePos_y):
"""
calculates a grid of distances to the observer in angel
:param mapped_cartcoord: mapped cartesian coordinates
:type mapped_cartcoord: numpy array (n,2)
:param sourcePos: source position
:type sourcePos: numpy vector [x0,y0]
:returns: arr... | python | def displaceAbs(x, y, sourcePos_x, sourcePos_y):
"""
calculates a grid of distances to the observer in angel
:param mapped_cartcoord: mapped cartesian coordinates
:type mapped_cartcoord: numpy array (n,2)
:param sourcePos: source position
:type sourcePos: numpy vector [x0,y0]
:returns: arr... | calculates a grid of distances to the observer in angel
:param mapped_cartcoord: mapped cartesian coordinates
:type mapped_cartcoord: numpy array (n,2)
:param sourcePos: source position
:type sourcePos: numpy vector [x0,y0]
:returns: array of displacement
:raises: AttributeError, KeyError | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/util.py#L259-L273 |
sibirrer/lenstronomy | lenstronomy/Util/util.py | min_square_dist | def min_square_dist(x_1, y_1, x_2, y_2):
"""
return minimum of quadratic distance of pairs (x1, y1) to pairs (x2, y2)
:param x_1:
:param y_1:
:param x_2:
:param y_2:
:return:
"""
dist = np.zeros_like(x_1)
for i in range(len(x_1)):
dist[i] = np.min((x_1[i] - x_2)**2 + (y_1... | python | def min_square_dist(x_1, y_1, x_2, y_2):
"""
return minimum of quadratic distance of pairs (x1, y1) to pairs (x2, y2)
:param x_1:
:param y_1:
:param x_2:
:param y_2:
:return:
"""
dist = np.zeros_like(x_1)
for i in range(len(x_1)):
dist[i] = np.min((x_1[i] - x_2)**2 + (y_1... | return minimum of quadratic distance of pairs (x1, y1) to pairs (x2, y2)
:param x_1:
:param y_1:
:param x_2:
:param y_2:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/util.py#L318-L330 |
sibirrer/lenstronomy | lenstronomy/Util/util.py | points_on_circle | def points_on_circle(radius, points):
"""
returns a set of uniform points around a circle
:param radius: radius of the circle
:param points: number of points on the circle
:return:
"""
angle = np.linspace(0, 2*np.pi, points)
x_coord = np.cos(angle)*radius
y_coord = np.sin(angle)*radi... | python | def points_on_circle(radius, points):
"""
returns a set of uniform points around a circle
:param radius: radius of the circle
:param points: number of points on the circle
:return:
"""
angle = np.linspace(0, 2*np.pi, points)
x_coord = np.cos(angle)*radius
y_coord = np.sin(angle)*radi... | returns a set of uniform points around a circle
:param radius: radius of the circle
:param points: number of points on the circle
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/util.py#L356-L366 |
sibirrer/lenstronomy | lenstronomy/Util/util.py | neighborSelect | def neighborSelect(a, x, y):
"""
finds (local) minima in a 2d grid
:param a: 1d array of displacements from the source positions
:type a: numpy array with length numPix**2 in float
:returns: array of indices of local minima, values of those minima
:raises: AttributeError, KeyError
"""
... | python | def neighborSelect(a, x, y):
"""
finds (local) minima in a 2d grid
:param a: 1d array of displacements from the source positions
:type a: numpy array with length numPix**2 in float
:returns: array of indices of local minima, values of those minima
:raises: AttributeError, KeyError
"""
... | finds (local) minima in a 2d grid
:param a: 1d array of displacements from the source positions
:type a: numpy array with length numPix**2 in float
:returns: array of indices of local minima, values of those minima
:raises: AttributeError, KeyError | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/util.py#L369-L410 |
sibirrer/lenstronomy | lenstronomy/Util/util.py | make_subgrid | def make_subgrid(ra_coord, dec_coord, subgrid_res=2):
"""
return a grid with subgrid resolution
:param ra_coord:
:param dec_coord:
:param subgrid_res:
:return:
"""
ra_array = array2image(ra_coord)
dec_array = array2image(dec_coord)
n = len(ra_array)
d_ra_x = ra_array[0][1] - ... | python | def make_subgrid(ra_coord, dec_coord, subgrid_res=2):
"""
return a grid with subgrid resolution
:param ra_coord:
:param dec_coord:
:param subgrid_res:
:return:
"""
ra_array = array2image(ra_coord)
dec_array = array2image(dec_coord)
n = len(ra_array)
d_ra_x = ra_array[0][1] - ... | return a grid with subgrid resolution
:param ra_coord:
:param dec_coord:
:param subgrid_res:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/util.py#L453-L478 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/spep.py | SPEP.function | def function(self, x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0):
"""
:param x: set of x-coordinates
:type x: array of size (n)
:param theta_E: Einstein radius of lense
:type theta_E: float.
:param gamma: power law slope of mass profifle
:type gamma: <2 fl... | python | def function(self, x, y, theta_E, gamma, e1, e2, center_x=0, center_y=0):
"""
:param x: set of x-coordinates
:type x: array of size (n)
:param theta_E: Einstein radius of lense
:type theta_E: float.
:param gamma: power law slope of mass profifle
:type gamma: <2 fl... | :param x: set of x-coordinates
:type x: array of size (n)
:param theta_E: Einstein radius of lense
:type theta_E: float.
:param gamma: power law slope of mass profifle
:type gamma: <2 float
:param q: Axis ratio
:type q: 0<q<1
:param phi_G: position angel o... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/spep.py#L20-L47 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/spep.py | SPEP.mass_3d_lens | def mass_3d_lens(self, r, theta_E, gamma, e1, e2):
"""
computes the spherical power-law mass enclosed (with SPP routiune)
:param r:
:param theta_E:
:param gamma:
:param q:
:param phi_G:
:return:
"""
return self.spp.mass_3d_lens(r, theta_E, ... | python | def mass_3d_lens(self, r, theta_E, gamma, e1, e2):
"""
computes the spherical power-law mass enclosed (with SPP routiune)
:param r:
:param theta_E:
:param gamma:
:param q:
:param phi_G:
:return:
"""
return self.spp.mass_3d_lens(r, theta_E, ... | computes the spherical power-law mass enclosed (with SPP routiune)
:param r:
:param theta_E:
:param gamma:
:param q:
:param phi_G:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/spep.py#L115-L125 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/spep.py | SPEP._param_bounds | def _param_bounds(self, gamma, q):
"""
bounds parameters
:param gamma:
:param q:
:return:
"""
if gamma < 1.4:
gamma = 1.4
if gamma > 2.9:
gamma = 2.9
if q < 0.01:
q = 0.01
return float(gamma), q | python | def _param_bounds(self, gamma, q):
"""
bounds parameters
:param gamma:
:param q:
:return:
"""
if gamma < 1.4:
gamma = 1.4
if gamma > 2.9:
gamma = 2.9
if q < 0.01:
q = 0.01
return float(gamma), q | bounds parameters
:param gamma:
:param q:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/spep.py#L127-L141 |
sibirrer/lenstronomy | lenstronomy/Sampling/Likelihoods/position_likelihood.py | PositionLikelihood.solver_penalty | def solver_penalty(self, kwargs_lens, kwargs_ps, kwargs_cosmo, tolerance):
"""
test whether the image positions map back to the same source position
:param kwargs_lens:
:param kwargs_ps:
:return: add penalty when solver does not find a solution
"""
dist = self._pa... | python | def solver_penalty(self, kwargs_lens, kwargs_ps, kwargs_cosmo, tolerance):
"""
test whether the image positions map back to the same source position
:param kwargs_lens:
:param kwargs_ps:
:return: add penalty when solver does not find a solution
"""
dist = self._pa... | test whether the image positions map back to the same source position
:param kwargs_lens:
:param kwargs_ps:
:return: add penalty when solver does not find a solution | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Sampling/Likelihoods/position_likelihood.py#L51-L61 |
sibirrer/lenstronomy | lenstronomy/Sampling/Likelihoods/position_likelihood.py | PositionLikelihood.check_additional_images | def check_additional_images(self, kwargs_ps, kwargs_lens):
"""
checks whether additional images have been found and placed in kwargs_ps
:param kwargs_ps: point source kwargs
:return: bool, True if more image positions are found than originally been assigned
"""
ra_image_l... | python | def check_additional_images(self, kwargs_ps, kwargs_lens):
"""
checks whether additional images have been found and placed in kwargs_ps
:param kwargs_ps: point source kwargs
:return: bool, True if more image positions are found than originally been assigned
"""
ra_image_l... | checks whether additional images have been found and placed in kwargs_ps
:param kwargs_ps: point source kwargs
:return: bool, True if more image positions are found than originally been assigned | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Sampling/Likelihoods/position_likelihood.py#L63-L73 |
sibirrer/lenstronomy | lenstronomy/LightModel/Profiles/sersic.py | Sersic.function | def function(self, x, y, amp, R_sersic, n_sersic, center_x=0, center_y=0):
"""
returns Sersic profile
"""
#if n_sersic < 0.2:
# n_sersic = 0.2
#if R_sersic < 10.**(-6):
# R_sersic = 10.**(-6)
R_sersic = np.maximum(0, R_sersic)
x_shift = x - c... | python | def function(self, x, y, amp, R_sersic, n_sersic, center_x=0, center_y=0):
"""
returns Sersic profile
"""
#if n_sersic < 0.2:
# n_sersic = 0.2
#if R_sersic < 10.**(-6):
# R_sersic = 10.**(-6)
R_sersic = np.maximum(0, R_sersic)
x_shift = x - c... | returns Sersic profile | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LightModel/Profiles/sersic.py#L18-L48 |
sibirrer/lenstronomy | lenstronomy/LightModel/Profiles/sersic.py | SersicElliptic.function | def function(self, x, y, amp, R_sersic, n_sersic, e1, e2, center_x=0, center_y=0):
"""
returns Sersic profile
"""
#if n_sersic < 0.2:
# n_sersic = 0.2
#if R_sersic < 10.**(-6):
# R_sersic = 10.**(-6)
R_sersic = np.maximum(0, R_sersic)
phi_G, ... | python | def function(self, x, y, amp, R_sersic, n_sersic, e1, e2, center_x=0, center_y=0):
"""
returns Sersic profile
"""
#if n_sersic < 0.2:
# n_sersic = 0.2
#if R_sersic < 10.**(-6):
# R_sersic = 10.**(-6)
R_sersic = np.maximum(0, R_sersic)
phi_G, ... | returns Sersic profile | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LightModel/Profiles/sersic.py#L59-L97 |
sibirrer/lenstronomy | lenstronomy/LightModel/Profiles/sersic.py | CoreSersic.function | def function(self, x, y, amp, R_sersic, Re, n_sersic, gamma, e1, e2, center_x=0, center_y=0, alpha=3.):
"""
returns Core-Sersic function
"""
phi_G, q = param_util.ellipticity2phi_q(e1, e2)
Rb = R_sersic
x_shift = x - center_x
y_shift = y - center_y
cos_ph... | python | def function(self, x, y, amp, R_sersic, Re, n_sersic, gamma, e1, e2, center_x=0, center_y=0, alpha=3.):
"""
returns Core-Sersic function
"""
phi_G, q = param_util.ellipticity2phi_q(e1, e2)
Rb = R_sersic
x_shift = x - center_x
y_shift = y - center_y
cos_ph... | returns Core-Sersic function | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LightModel/Profiles/sersic.py#L110-L141 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/sis_truncate.py | SIS_truncate.derivatives | def derivatives(self, x, y, theta_E, r_trunc, center_x=0, center_y=0):
"""
returns df/dx and df/dy of the function
"""
x_shift = x - center_x
y_shift = y - center_y
dphi_dr = self._dphi_dr(x_shift, y_shift, theta_E, r_trunc)
dr_dx, dr_dy = self._dr_dx(x_shift, y_... | python | def derivatives(self, x, y, theta_E, r_trunc, center_x=0, center_y=0):
"""
returns df/dx and df/dy of the function
"""
x_shift = x - center_x
y_shift = y - center_y
dphi_dr = self._dphi_dr(x_shift, y_shift, theta_E, r_trunc)
dr_dx, dr_dy = self._dr_dx(x_shift, y_... | returns df/dx and df/dy of the function | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/sis_truncate.py#L32-L43 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/sis_truncate.py | SIS_truncate.hessian | def hessian(self, x, y, theta_E, r_trunc, center_x=0, center_y=0):
"""
returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy
"""
x_shift = x - center_x
y_shift = y - center_y
dphi_dr = self._dphi_dr(x_shift, y_shift, theta_E, r_trunc)
d2phi_dr2 = self._... | python | def hessian(self, x, y, theta_E, r_trunc, center_x=0, center_y=0):
"""
returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy
"""
x_shift = x - center_x
y_shift = y - center_y
dphi_dr = self._dphi_dr(x_shift, y_shift, theta_E, r_trunc)
d2phi_dr2 = self._... | returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/sis_truncate.py#L45-L58 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/sis_truncate.py | SIS_truncate._dr_dx | def _dr_dx(self, x, y):
"""
derivative of dr/dx, dr/dy
:param x:
:param y:
:return:
"""
r = np.sqrt(x**2 + y**2)
if isinstance(r, int) or isinstance(r, float):
if r == 0:
r = 1
else:
r[r == 0] = 1
r... | python | def _dr_dx(self, x, y):
"""
derivative of dr/dx, dr/dy
:param x:
:param y:
:return:
"""
r = np.sqrt(x**2 + y**2)
if isinstance(r, int) or isinstance(r, float):
if r == 0:
r = 1
else:
r[r == 0] = 1
r... | derivative of dr/dx, dr/dy
:param x:
:param y:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/sis_truncate.py#L110-L124 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/hernquist_ellipse.py | Hernquist_Ellipse.function | def function(self, x, y, sigma0, Rs, e1, e2, center_x=0, center_y=0):
"""
returns double integral of NFW profile
"""
phi_G, q = param_util.ellipticity2phi_q(e1, e2)
x_shift = x - center_x
y_shift = y - center_y
cos_phi = np.cos(phi_G)
sin_phi = np.sin(phi_... | python | def function(self, x, y, sigma0, Rs, e1, e2, center_x=0, center_y=0):
"""
returns double integral of NFW profile
"""
phi_G, q = param_util.ellipticity2phi_q(e1, e2)
x_shift = x - center_x
y_shift = y - center_y
cos_phi = np.cos(phi_G)
sin_phi = np.sin(phi_... | returns double integral of NFW profile | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/hernquist_ellipse.py#L20-L33 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/hernquist_ellipse.py | Hernquist_Ellipse.derivatives | def derivatives(self, x, y, sigma0, Rs, e1, e2, center_x=0, center_y=0):
"""
returns df/dx and df/dy of the function (integral of NFW)
"""
phi_G, q = param_util.ellipticity2phi_q(e1, e2)
x_shift = x - center_x
y_shift = y - center_y
cos_phi = np.cos(phi_G)
... | python | def derivatives(self, x, y, sigma0, Rs, e1, e2, center_x=0, center_y=0):
"""
returns df/dx and df/dy of the function (integral of NFW)
"""
phi_G, q = param_util.ellipticity2phi_q(e1, e2)
x_shift = x - center_x
y_shift = y - center_y
cos_phi = np.cos(phi_G)
... | returns df/dx and df/dy of the function (integral of NFW) | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/hernquist_ellipse.py#L35-L53 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/cnfw.py | CNFW._nfw_func | def _nfw_func(self, x):
"""
Classic NFW function in terms of arctanh and arctan
:param x: r/Rs
:return:
"""
c = 0.000001
if isinstance(x, np.ndarray):
x[np.where(x<c)] = c
nfwvals = np.ones_like(x)
inds1 = np.where(x < 1)
... | python | def _nfw_func(self, x):
"""
Classic NFW function in terms of arctanh and arctan
:param x: r/Rs
:return:
"""
c = 0.000001
if isinstance(x, np.ndarray):
x[np.where(x<c)] = c
nfwvals = np.ones_like(x)
inds1 = np.where(x < 1)
... | Classic NFW function in terms of arctanh and arctan
:param x: r/Rs
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/cnfw.py#L44-L71 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/cnfw.py | CNFW._F | def _F(self, X, b, c = 0.001):
"""
analytic solution of the projection integral
:param x: a dimensionless quantity, either r/rs or r/rc
:type x: float >0
"""
if b == 1:
b = 1 + c
prefac = (b - 1) ** -2
if isinstance(X, np.ndarray):
... | python | def _F(self, X, b, c = 0.001):
"""
analytic solution of the projection integral
:param x: a dimensionless quantity, either r/rs or r/rc
:type x: float >0
"""
if b == 1:
b = 1 + c
prefac = (b - 1) ** -2
if isinstance(X, np.ndarray):
... | analytic solution of the projection integral
:param x: a dimensionless quantity, either r/rs or r/rc
:type x: float >0 | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/cnfw.py#L73-L114 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/cnfw.py | CNFW.density | def density(self, R, Rs, rho0, r_core):
"""
three dimenstional truncated NFW profile
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization (central core density)
:type rho0: floa... | python | def density(self, R, Rs, rho0, r_core):
"""
three dimenstional truncated NFW profile
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization (central core density)
:type rho0: floa... | three dimenstional truncated NFW profile
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization (central core density)
:type rho0: float
:return: rho(R) density | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/cnfw.py#L191-L205 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/cnfw.py | CNFW.density_2d | def density_2d(self, x, y, Rs, rho0, r_core, center_x=0, center_y=0):
"""
projected two dimenstional NFW profile (kappa*Sigma_crit)
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization ... | python | def density_2d(self, x, y, Rs, rho0, r_core, center_x=0, center_y=0):
"""
projected two dimenstional NFW profile (kappa*Sigma_crit)
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization ... | projected two dimenstional NFW profile (kappa*Sigma_crit)
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization (characteristic density)
:type rho0: float
:param r200: radius of (sub)hal... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/cnfw.py#L207-L228 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/cnfw.py | CNFW.mass_3d | def mass_3d(self, R, Rs, rho0, r_core):
"""
mass enclosed a 3d sphere or radius r
:param r:
:param Ra:
:param Rs:
:return:
"""
b = r_core * Rs ** -1
x = R * Rs ** -1
M_0 = 4 * np.pi * Rs**3 * rho0
return M_0 * (x * (1+x) ** -1 * ... | python | def mass_3d(self, R, Rs, rho0, r_core):
"""
mass enclosed a 3d sphere or radius r
:param r:
:param Ra:
:param Rs:
:return:
"""
b = r_core * Rs ** -1
x = R * Rs ** -1
M_0 = 4 * np.pi * Rs**3 * rho0
return M_0 * (x * (1+x) ** -1 * ... | mass enclosed a 3d sphere or radius r
:param r:
:param Ra:
:param Rs:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/cnfw.py#L230-L245 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/cnfw.py | CNFW.cnfwAlpha | def cnfwAlpha(self, R, Rs, rho0, r_core, ax_x, ax_y):
"""
deflection angel of NFW profile along the projection to coordinate axis
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization (c... | python | def cnfwAlpha(self, R, Rs, rho0, r_core, ax_x, ax_y):
"""
deflection angel of NFW profile along the projection to coordinate axis
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization (c... | deflection angel of NFW profile along the projection to coordinate axis
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization (characteristic density)
:type rho0: float
:param r200: radi... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/cnfw.py#L247-L274 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/nfw_ellipse.py | NFW_ELLIPSE.function | def function(self, x, y, Rs, theta_Rs, e1, e2, center_x=0, center_y=0):
"""
returns double integral of NFW profile
"""
phi_G, q = param_util.ellipticity2phi_q(e1, e2)
x_shift = x - center_x
y_shift = y - center_y
cos_phi = np.cos(phi_G)
sin_phi = np.sin(ph... | python | def function(self, x, y, Rs, theta_Rs, e1, e2, center_x=0, center_y=0):
"""
returns double integral of NFW profile
"""
phi_G, q = param_util.ellipticity2phi_q(e1, e2)
x_shift = x - center_x
y_shift = y - center_y
cos_phi = np.cos(phi_G)
sin_phi = np.sin(ph... | returns double integral of NFW profile | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/nfw_ellipse.py#L25-L42 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/nfw_ellipse.py | NFW_ELLIPSE.derivatives | def derivatives(self, x, y, Rs, theta_Rs, e1, e2, center_x=0, center_y=0):
"""
returns df/dx and df/dy of the function (integral of NFW)
"""
phi_G, q = param_util.ellipticity2phi_q(e1, e2)
x_shift = x - center_x
y_shift = y - center_y
cos_phi = np.cos(phi_G)
... | python | def derivatives(self, x, y, Rs, theta_Rs, e1, e2, center_x=0, center_y=0):
"""
returns df/dx and df/dy of the function (integral of NFW)
"""
phi_G, q = param_util.ellipticity2phi_q(e1, e2)
x_shift = x - center_x
y_shift = y - center_y
cos_phi = np.cos(phi_G)
... | returns df/dx and df/dy of the function (integral of NFW) | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/nfw_ellipse.py#L44-L65 |
sibirrer/lenstronomy | lenstronomy/Workflow/alignment_matching.py | AlignmentFitting.pso | def pso(self, n_particles=10, n_iterations=10, lowerLimit=-0.2, upperLimit=0.2, threadCount=1, mpi=False, print_key='default'):
"""
returns the best fit for the lense model on catalogue basis with particle swarm optimizer
"""
init_pos = self.chain.get_args(self.chain.kwargs_data_init)
... | python | def pso(self, n_particles=10, n_iterations=10, lowerLimit=-0.2, upperLimit=0.2, threadCount=1, mpi=False, print_key='default'):
"""
returns the best fit for the lense model on catalogue basis with particle swarm optimizer
"""
init_pos = self.chain.get_args(self.chain.kwargs_data_init)
... | returns the best fit for the lense model on catalogue basis with particle swarm optimizer | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Workflow/alignment_matching.py#L21-L63 |
sibirrer/lenstronomy | lenstronomy/Workflow/alignment_matching.py | AlignmentLikelihood._likelihood | def _likelihood(self, args):
"""
routine to compute X2 given variable parameters for a MCMC/PSO chainF
"""
#generate image and computes likelihood
kwargs_data = self.update_data(args)
imageModel = class_creator.create_image_model(kwargs_data, self._kwargs_psf, self._kwarg... | python | def _likelihood(self, args):
"""
routine to compute X2 given variable parameters for a MCMC/PSO chainF
"""
#generate image and computes likelihood
kwargs_data = self.update_data(args)
imageModel = class_creator.create_image_model(kwargs_data, self._kwargs_psf, self._kwarg... | routine to compute X2 given variable parameters for a MCMC/PSO chainF | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Workflow/alignment_matching.py#L83-L91 |
sibirrer/lenstronomy | lenstronomy/LensModel/Optimizer/optimizer.py | Optimizer.optimize | def optimize(self, n_particles=50, n_iterations=250, restart=1):
"""
the best result of all optimizations will be returned.
total number of lens models sovled: n_particles*n_iterations
:param n_particles: number of particle swarm particles
:param n_iterations: number of particl... | python | def optimize(self, n_particles=50, n_iterations=250, restart=1):
"""
the best result of all optimizations will be returned.
total number of lens models sovled: n_particles*n_iterations
:param n_particles: number of particle swarm particles
:param n_iterations: number of particl... | the best result of all optimizations will be returned.
total number of lens models sovled: n_particles*n_iterations
:param n_particles: number of particle swarm particles
:param n_iterations: number of particle swarm iternations
:param restart: number of times to execute the optimizatio... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Optimizer/optimizer.py#L145-L195 |
sibirrer/lenstronomy | lenstronomy/LensModel/Optimizer/optimizer.py | Optimizer._pso | def _pso(self, n_particles, n_iterations, optimizer):
"""
:param n_particles: number of PSO particles
:param n_iterations: number of PSO iterations
:param optimizer: instance of SinglePlaneOptimizer or MultiPlaneOptimizer
:return: optimized kwargs_lens
"""
pso =... | python | def _pso(self, n_particles, n_iterations, optimizer):
"""
:param n_particles: number of PSO particles
:param n_iterations: number of PSO iterations
:param optimizer: instance of SinglePlaneOptimizer or MultiPlaneOptimizer
:return: optimized kwargs_lens
"""
pso =... | :param n_particles: number of PSO particles
:param n_iterations: number of PSO iterations
:param optimizer: instance of SinglePlaneOptimizer or MultiPlaneOptimizer
:return: optimized kwargs_lens | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Optimizer/optimizer.py#L228-L244 |
sibirrer/lenstronomy | lenstronomy/Util/multi_gauss_expansion.py | de_projection_3d | def de_projection_3d(amplitudes, sigmas):
"""
de-projects a gaussian (or list of multiple Gaussians from a 2d projected to a 3d profile)
:param amplitudes:
:param sigmas:
:return:
"""
amplitudes_3d = amplitudes / sigmas / np.sqrt(2*np.pi)
return amplitudes_3d, sigmas | python | def de_projection_3d(amplitudes, sigmas):
"""
de-projects a gaussian (or list of multiple Gaussians from a 2d projected to a 3d profile)
:param amplitudes:
:param sigmas:
:return:
"""
amplitudes_3d = amplitudes / sigmas / np.sqrt(2*np.pi)
return amplitudes_3d, sigmas | de-projects a gaussian (or list of multiple Gaussians from a 2d projected to a 3d profile)
:param amplitudes:
:param sigmas:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/multi_gauss_expansion.py#L64-L72 |
sibirrer/lenstronomy | lenstronomy/Data/psf.py | PSF.set_pixel_size | def set_pixel_size(self, deltaPix):
"""
update pixel size
:param deltaPix:
:return:
"""
self._pixel_size = deltaPix
if self.psf_type == 'GAUSSIAN':
try:
del self._kernel_point_source
except:
pass | python | def set_pixel_size(self, deltaPix):
"""
update pixel size
:param deltaPix:
:return:
"""
self._pixel_size = deltaPix
if self.psf_type == 'GAUSSIAN':
try:
del self._kernel_point_source
except:
pass | update pixel size
:param deltaPix:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Data/psf.py#L166-L178 |
sibirrer/lenstronomy | lenstronomy/Data/psf.py | PSF.psf_convolution | def psf_convolution(self, grid, grid_scale, psf_subgrid=False, subgrid_res=1):
"""
convolves a given pixel grid with a PSF
"""
psf_type = self.psf_type
if psf_type == 'NONE':
return grid
elif psf_type == 'GAUSSIAN':
sigma = self._sigma_gaussian/gri... | python | def psf_convolution(self, grid, grid_scale, psf_subgrid=False, subgrid_res=1):
"""
convolves a given pixel grid with a PSF
"""
psf_type = self.psf_type
if psf_type == 'NONE':
return grid
elif psf_type == 'GAUSSIAN':
sigma = self._sigma_gaussian/gri... | convolves a given pixel grid with a PSF | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Data/psf.py#L186-L205 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/dipole.py | Dipole_util.com | def com(self, center1_x, center1_y, center2_x, center2_y, Fm):
"""
:return: center of mass
"""
com_x = (Fm * center1_x + center2_x)/(Fm + 1.)
com_y = (Fm * center1_y + center2_y)/(Fm + 1.)
return com_x, com_y | python | def com(self, center1_x, center1_y, center2_x, center2_y, Fm):
"""
:return: center of mass
"""
com_x = (Fm * center1_x + center2_x)/(Fm + 1.)
com_y = (Fm * center1_y + center2_y)/(Fm + 1.)
return com_x, com_y | :return: center of mass | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/dipole.py#L85-L91 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/dipole.py | Dipole_util.angle | def angle(self, center1_x, center1_y, center2_x, center2_y):
"""
compute the rotation angle of the dipole
:return:
"""
phi_G = np.arctan2(center2_y - center1_y, center2_x - center1_x)
return phi_G | python | def angle(self, center1_x, center1_y, center2_x, center2_y):
"""
compute the rotation angle of the dipole
:return:
"""
phi_G = np.arctan2(center2_y - center1_y, center2_x - center1_x)
return phi_G | compute the rotation angle of the dipole
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/dipole.py#L102-L108 |
sibirrer/lenstronomy | lenstronomy/Sampling/Likelihoods/time_delay_likelihood.py | TimeDelayLikelihood.logL | def logL(self, kwargs_lens, kwargs_ps, kwargs_cosmo):
"""
routine to compute the log likelihood of the time delay distance
:param kwargs_lens: lens model kwargs list
:param kwargs_ps: point source kwargs list
:param kwargs_cosmo: cosmology and other kwargs
:return: log li... | python | def logL(self, kwargs_lens, kwargs_ps, kwargs_cosmo):
"""
routine to compute the log likelihood of the time delay distance
:param kwargs_lens: lens model kwargs list
:param kwargs_ps: point source kwargs list
:param kwargs_cosmo: cosmology and other kwargs
:return: log li... | routine to compute the log likelihood of the time delay distance
:param kwargs_lens: lens model kwargs list
:param kwargs_ps: point source kwargs list
:param kwargs_cosmo: cosmology and other kwargs
:return: log likelihood of the model given the time delay data | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Sampling/Likelihoods/time_delay_likelihood.py#L31-L46 |
sibirrer/lenstronomy | lenstronomy/Sampling/Likelihoods/time_delay_likelihood.py | TimeDelayLikelihood._logL_delays | def _logL_delays(self, delays_model, delays_measured, delays_errors):
"""
log likelihood of modeled delays vs measured time delays under considerations of errors
:param delays_model: n delays of the model (not relative delays)
:param delays_measured: relative delays (1-2,1-3,1-4) relati... | python | def _logL_delays(self, delays_model, delays_measured, delays_errors):
"""
log likelihood of modeled delays vs measured time delays under considerations of errors
:param delays_model: n delays of the model (not relative delays)
:param delays_measured: relative delays (1-2,1-3,1-4) relati... | log likelihood of modeled delays vs measured time delays under considerations of errors
:param delays_model: n delays of the model (not relative delays)
:param delays_measured: relative delays (1-2,1-3,1-4) relative to the first in the list
:param delays_errors: gaussian errors on the measured ... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Sampling/Likelihoods/time_delay_likelihood.py#L48-L59 |
sibirrer/lenstronomy | lenstronomy/Data/coord_transforms.py | Coordinates.shift_coordinate_grid | def shift_coordinate_grid(self, x_shift, y_shift, pixel_unit=False):
"""
shifts the coordinate system
:param x_shif: shift in x (or RA)
:param y_shift: shift in y (or DEC)
:param pixel_unit: bool, if True, units of pixels in input, otherwise RA/DEC
:return: updated data c... | python | def shift_coordinate_grid(self, x_shift, y_shift, pixel_unit=False):
"""
shifts the coordinate system
:param x_shif: shift in x (or RA)
:param y_shift: shift in y (or DEC)
:param pixel_unit: bool, if True, units of pixels in input, otherwise RA/DEC
:return: updated data c... | shifts the coordinate system
:param x_shif: shift in x (or RA)
:param y_shift: shift in y (or DEC)
:param pixel_unit: bool, if True, units of pixels in input, otherwise RA/DEC
:return: updated data class with change in coordinate system | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Data/coord_transforms.py#L85-L100 |
sibirrer/lenstronomy | lenstronomy/LensModel/Solver/solver4point.py | Solver4Point._extract_array | def _extract_array(self, kwargs_list):
"""
inverse of _update_kwargs
:param kwargs_list:
:return:
"""
if self._solver_type == 'PROFILE_SHEAR':
e1 = kwargs_list[1]['e1']
e2 = kwargs_list[1]['e2']
phi_ext, gamma_ext = param_util.elliptici... | python | def _extract_array(self, kwargs_list):
"""
inverse of _update_kwargs
:param kwargs_list:
:return:
"""
if self._solver_type == 'PROFILE_SHEAR':
e1 = kwargs_list[1]['e1']
e2 = kwargs_list[1]['e2']
phi_ext, gamma_ext = param_util.elliptici... | inverse of _update_kwargs
:param kwargs_list:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Solver/solver4point.py#L141-L174 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/interpol.py | Interpol.derivatives | def derivatives(self, x, y, grid_interp_x=None, grid_interp_y=None, f_=None, f_x=None, f_y=None, f_xx=None, f_yy=None, f_xy=None):
"""
returns df/dx and df/dy of the function
"""
#self._check_interp(grid_interp_x, grid_interp_y, f_, f_x, f_y, f_xx, f_yy, f_xy)
n = len(np.atleast_... | python | def derivatives(self, x, y, grid_interp_x=None, grid_interp_y=None, f_=None, f_x=None, f_y=None, f_xx=None, f_yy=None, f_xy=None):
"""
returns df/dx and df/dy of the function
"""
#self._check_interp(grid_interp_x, grid_interp_y, f_, f_x, f_y, f_xx, f_yy, f_xy)
n = len(np.atleast_... | returns df/dx and df/dy of the function | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/interpol.py#L40-L64 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/interpol.py | Interpol.hessian | def hessian(self, x, y, grid_interp_x=None, grid_interp_y=None, f_=None, f_x=None, f_y=None, f_xx=None, f_yy=None, f_xy=None):
"""
returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy
"""
#self._check_interp(grid_interp_x, grid_interp_y, f_, f_x, f_y, f_xx, f_yy, f_xy)
... | python | def hessian(self, x, y, grid_interp_x=None, grid_interp_y=None, f_=None, f_x=None, f_y=None, f_xx=None, f_yy=None, f_xy=None):
"""
returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy
"""
#self._check_interp(grid_interp_x, grid_interp_y, f_, f_x, f_y, f_xx, f_yy, f_xy)
... | returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/interpol.py#L66-L94 |
sibirrer/lenstronomy | lenstronomy/Plots/output_plots.py | lens_model_plot | def lens_model_plot(ax, lensModel, kwargs_lens, numPix=500, deltaPix=0.01, sourcePos_x=0, sourcePos_y=0,
point_source=False, with_caustics=False):
"""
plots a lens model (convergence) and the critical curves and caustics
:param ax:
:param kwargs_lens:
:param numPix:
:param d... | python | def lens_model_plot(ax, lensModel, kwargs_lens, numPix=500, deltaPix=0.01, sourcePos_x=0, sourcePos_y=0,
point_source=False, with_caustics=False):
"""
plots a lens model (convergence) and the critical curves and caustics
:param ax:
:param kwargs_lens:
:param numPix:
:param d... | plots a lens model (convergence) and the critical curves and caustics
:param ax:
:param kwargs_lens:
:param numPix:
:param deltaPix:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Plots/output_plots.py#L71-L122 |
sibirrer/lenstronomy | lenstronomy/Plots/output_plots.py | plot_mcmc_behaviour | def plot_mcmc_behaviour(ax, samples_mcmc, param_mcmc, dist_mcmc, num_average=100):
"""
plots the MCMC behaviour and looks for convergence of the chain
:param samples_mcmc: parameters sampled 2d numpy array
:param param_mcmc: list of parameters
:param dist_mcmc: log likelihood of the chain
:param... | python | def plot_mcmc_behaviour(ax, samples_mcmc, param_mcmc, dist_mcmc, num_average=100):
"""
plots the MCMC behaviour and looks for convergence of the chain
:param samples_mcmc: parameters sampled 2d numpy array
:param param_mcmc: list of parameters
:param dist_mcmc: log likelihood of the chain
:param... | plots the MCMC behaviour and looks for convergence of the chain
:param samples_mcmc: parameters sampled 2d numpy array
:param param_mcmc: list of parameters
:param dist_mcmc: log likelihood of the chain
:param num_average: number of samples to average (should coincide with the number of samples in the e... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Plots/output_plots.py#L724-L747 |
sibirrer/lenstronomy | lenstronomy/Plots/output_plots.py | LensModelPlot.plot_main | def plot_main(self, with_caustics=False, image_names=False):
"""
print the main plots together in a joint frame
:return:
"""
f, axes = plt.subplots(2, 3, figsize=(16, 8))
self.data_plot(ax=axes[0, 0])
self.model_plot(ax=axes[0, 1], image_names=True)
self... | python | def plot_main(self, with_caustics=False, image_names=False):
"""
print the main plots together in a joint frame
:return:
"""
f, axes = plt.subplots(2, 3, figsize=(16, 8))
self.data_plot(ax=axes[0, 0])
self.model_plot(ax=axes[0, 1], image_names=True)
self... | print the main plots together in a joint frame
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Plots/output_plots.py#L639-L655 |
sibirrer/lenstronomy | lenstronomy/Plots/output_plots.py | LensModelPlot.plot_separate | def plot_separate(self):
"""
plot the different model components separately
:return:
"""
f, axes = plt.subplots(2, 3, figsize=(16, 8))
self.decomposition_plot(ax=axes[0, 0], text='Lens light', lens_light_add=True, unconvolved=True)
self.decomposition_plot(ax=axe... | python | def plot_separate(self):
"""
plot the different model components separately
:return:
"""
f, axes = plt.subplots(2, 3, figsize=(16, 8))
self.decomposition_plot(ax=axes[0, 0], text='Lens light', lens_light_add=True, unconvolved=True)
self.decomposition_plot(ax=axe... | plot the different model components separately
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Plots/output_plots.py#L657-L675 |
sibirrer/lenstronomy | lenstronomy/Plots/output_plots.py | LensModelPlot.plot_subtract_from_data_all | def plot_subtract_from_data_all(self):
"""
subtract model components from data
:return:
"""
f, axes = plt.subplots(2, 3, figsize=(16, 8))
self.subtract_from_data_plot(ax=axes[0, 0], text='Data')
self.subtract_from_data_plot(ax=axes[0, 1], text='Data - Point Sour... | python | def plot_subtract_from_data_all(self):
"""
subtract model components from data
:return:
"""
f, axes = plt.subplots(2, 3, figsize=(16, 8))
self.subtract_from_data_plot(ax=axes[0, 0], text='Data')
self.subtract_from_data_plot(ax=axes[0, 1], text='Data - Point Sour... | subtract model components from data
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Plots/output_plots.py#L677-L695 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/shapelet_pot_polar.py | PolarShapelets.derivatives | def derivatives(self, x, y, coeffs, beta, center_x=0, center_y=0):
"""
returns df/dx and df/dy of the function
"""
shapelets = self._createShapelet(coeffs)
r, phi = param_util.cart2polar(x, y, center=np.array([center_x, center_y]))
alpha1_shapelets, alpha2_shapelets = sel... | python | def derivatives(self, x, y, coeffs, beta, center_x=0, center_y=0):
"""
returns df/dx and df/dy of the function
"""
shapelets = self._createShapelet(coeffs)
r, phi = param_util.cart2polar(x, y, center=np.array([center_x, center_y]))
alpha1_shapelets, alpha2_shapelets = sel... | returns df/dx and df/dy of the function | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/shapelet_pot_polar.py#L33-L42 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/shapelet_pot_polar.py | PolarShapelets.hessian | def hessian(self, x, y, coeffs, beta, center_x=0, center_y=0):
"""
returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy
"""
shapelets = self._createShapelet(coeffs)
r, phi = param_util.cart2polar(x, y, center=np.array([center_x, center_y]))
kappa_shapelets=sel... | python | def hessian(self, x, y, coeffs, beta, center_x=0, center_y=0):
"""
returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy
"""
shapelets = self._createShapelet(coeffs)
r, phi = param_util.cart2polar(x, y, center=np.array([center_x, center_y]))
kappa_shapelets=sel... | returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/shapelet_pot_polar.py#L44-L58 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/shapelet_pot_polar.py | PolarShapelets._createShapelet | def _createShapelet(self,coeff):
"""
returns a shapelet array out of the coefficients *a, up to order l
:param num_l: order of shapelets
:type num_l: int.
:param coeff: shapelet coefficients
:type coeff: floats
:returns: complex array
:raises: AttributeE... | python | def _createShapelet(self,coeff):
"""
returns a shapelet array out of the coefficients *a, up to order l
:param num_l: order of shapelets
:type num_l: int.
:param coeff: shapelet coefficients
:type coeff: floats
:returns: complex array
:raises: AttributeE... | returns a shapelet array out of the coefficients *a, up to order l
:param num_l: order of shapelets
:type num_l: int.
:param coeff: shapelet coefficients
:type coeff: floats
:returns: complex array
:raises: AttributeError, KeyError | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/shapelet_pot_polar.py#L60-L94 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/shapelet_pot_polar.py | PolarShapelets._shapeletOutput | def _shapeletOutput(self, r, phi, beta, shapelets):
"""
returns the the numerical values of a set of shapelets at polar coordinates
:param shapelets: set of shapelets [l=,r=,a_lr=]
:type shapelets: array of size (n,3)
:param coordPolar: set of coordinates in polar units
:... | python | def _shapeletOutput(self, r, phi, beta, shapelets):
"""
returns the the numerical values of a set of shapelets at polar coordinates
:param shapelets: set of shapelets [l=,r=,a_lr=]
:type shapelets: array of size (n,3)
:param coordPolar: set of coordinates in polar units
:... | returns the the numerical values of a set of shapelets at polar coordinates
:param shapelets: set of shapelets [l=,r=,a_lr=]
:type shapelets: array of size (n,3)
:param coordPolar: set of coordinates in polar units
:type coordPolar: array of size (n,2)
:returns: array of same si... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/shapelet_pot_polar.py#L96-L114 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/shapelet_pot_polar.py | PolarShapelets._chi_lr | def _chi_lr(self,r, phi, nl,nr,beta):
"""
computes the generalized polar basis function in the convention of Massey&Refregier eqn 8
:param nl: left basis
:type nl: int
:param nr: right basis
:type nr: int
:param beta: beta --the characteristic scale typically cho... | python | def _chi_lr(self,r, phi, nl,nr,beta):
"""
computes the generalized polar basis function in the convention of Massey&Refregier eqn 8
:param nl: left basis
:type nl: int
:param nr: right basis
:type nr: int
:param beta: beta --the characteristic scale typically cho... | computes the generalized polar basis function in the convention of Massey&Refregier eqn 8
:param nl: left basis
:type nl: int
:param nr: right basis
:type nr: int
:param beta: beta --the characteristic scale typically choosen to be close to the size of the object.
:type ... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/shapelet_pot_polar.py#L116-L142 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/shapelet_pot_polar.py | PolarShapelets._kappaShapelets | def _kappaShapelets(self, shapelets, beta):
"""
calculates the convergence kappa given lensing potential shapelet coefficients (laplacian/2)
:param shapelets: set of shapelets [l=,r=,a_lr=]
:type shapelets: array of size (n,3)
:returns: set of kappa shapelets.
:raises: A... | python | def _kappaShapelets(self, shapelets, beta):
"""
calculates the convergence kappa given lensing potential shapelet coefficients (laplacian/2)
:param shapelets: set of shapelets [l=,r=,a_lr=]
:type shapelets: array of size (n,3)
:returns: set of kappa shapelets.
:raises: A... | calculates the convergence kappa given lensing potential shapelet coefficients (laplacian/2)
:param shapelets: set of shapelets [l=,r=,a_lr=]
:type shapelets: array of size (n,3)
:returns: set of kappa shapelets.
:raises: AttributeError, KeyError | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/shapelet_pot_polar.py#L144-L163 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/shapelet_pot_polar.py | PolarShapelets._alphaShapelets | def _alphaShapelets(self,shapelets, beta):
"""
calculates the deflection angles given lensing potential shapelet coefficients (laplacian/2)
:param shapelets: set of shapelets [l=,r=,a_lr=]
:type shapelets: array of size (n,3)
:returns: set of alpha shapelets.
:raises: At... | python | def _alphaShapelets(self,shapelets, beta):
"""
calculates the deflection angles given lensing potential shapelet coefficients (laplacian/2)
:param shapelets: set of shapelets [l=,r=,a_lr=]
:type shapelets: array of size (n,3)
:returns: set of alpha shapelets.
:raises: At... | calculates the deflection angles given lensing potential shapelet coefficients (laplacian/2)
:param shapelets: set of shapelets [l=,r=,a_lr=]
:type shapelets: array of size (n,3)
:returns: set of alpha shapelets.
:raises: AttributeError, KeyError | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/shapelet_pot_polar.py#L166-L189 |
sibirrer/lenstronomy | lenstronomy/GalKin/cosmo.py | Cosmo.epsilon_crit | def epsilon_crit(self):
"""
returns the critical projected mass density in units of M_sun/Mpc^2 (physical units)
"""
const_SI = const.c**2 / (4*np.pi * const.G) #c^2/(4*pi*G) in units of [kg/m]
conversion = const.Mpc / const.M_sun # converts [kg/m] to [M_sun/Mpc]
pre_co... | python | def epsilon_crit(self):
"""
returns the critical projected mass density in units of M_sun/Mpc^2 (physical units)
"""
const_SI = const.c**2 / (4*np.pi * const.G) #c^2/(4*pi*G) in units of [kg/m]
conversion = const.Mpc / const.M_sun # converts [kg/m] to [M_sun/Mpc]
pre_co... | returns the critical projected mass density in units of M_sun/Mpc^2 (physical units) | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/GalKin/cosmo.py#L23-L31 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/tnfw.py | TNFW.L | def L(self, x, tau):
"""
Logarithm that appears frequently
:param x: r/Rs
:param tau: t/Rs
:return:
"""
return np.log(x * (tau + np.sqrt(tau ** 2 + x ** 2)) ** -1) | python | def L(self, x, tau):
"""
Logarithm that appears frequently
:param x: r/Rs
:param tau: t/Rs
:return:
"""
return np.log(x * (tau + np.sqrt(tau ** 2 + x ** 2)) ** -1) | Logarithm that appears frequently
:param x: r/Rs
:param tau: t/Rs
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/tnfw.py#L50-L58 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/tnfw.py | TNFW.F | def F(self, x):
"""
Classic NFW function in terms of arctanh and arctan
:param x: r/Rs
:return:
"""
if isinstance(x, np.ndarray):
nfwvals = np.ones_like(x)
inds1 = np.where(x < 1)
inds2 = np.where(x > 1)
nfwvals[inds1] = (1 ... | python | def F(self, x):
"""
Classic NFW function in terms of arctanh and arctan
:param x: r/Rs
:return:
"""
if isinstance(x, np.ndarray):
nfwvals = np.ones_like(x)
inds1 = np.where(x < 1)
inds2 = np.where(x > 1)
nfwvals[inds1] = (1 ... | Classic NFW function in terms of arctanh and arctan
:param x: r/Rs
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/tnfw.py#L60-L80 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/tnfw.py | TNFW.density_2d | def density_2d(self, x, y, Rs, rho0, r_trunc, center_x=0, center_y=0):
"""
projected two dimenstional NFW profile (kappa*Sigma_crit)
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization... | python | def density_2d(self, x, y, Rs, rho0, r_trunc, center_x=0, center_y=0):
"""
projected two dimenstional NFW profile (kappa*Sigma_crit)
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization... | projected two dimenstional NFW profile (kappa*Sigma_crit)
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization (characteristic density)
:type rho0: float
:param r200: radius of (sub)hal... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/tnfw.py#L128-L148 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/tnfw.py | TNFW.mass_3d | def mass_3d(self, R, Rs, rho0, r_trunc):
"""
mass enclosed a 3d sphere or radius r
:param r:
:param Ra:
:param Rs:
:return:
"""
x = R * Rs ** -1
func = (r_trunc ** 2 * (-2 * x * (1 + r_trunc ** 2) + 4 * (1 + x) * r_trunc * np.arctan(x / r_trunc)... | python | def mass_3d(self, R, Rs, rho0, r_trunc):
"""
mass enclosed a 3d sphere or radius r
:param r:
:param Ra:
:param Rs:
:return:
"""
x = R * Rs ** -1
func = (r_trunc ** 2 * (-2 * x * (1 + r_trunc ** 2) + 4 * (1 + x) * r_trunc * np.arctan(x / r_trunc)... | mass enclosed a 3d sphere or radius r
:param r:
:param Ra:
:param Rs:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/tnfw.py#L150-L168 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/tnfw.py | TNFW.nfwPot | def nfwPot(self, R, Rs, rho0, r_trunc):
"""
lensing potential of NFW profile
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization (characteristic density)
:type rho0: float
... | python | def nfwPot(self, R, Rs, rho0, r_trunc):
"""
lensing potential of NFW profile
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization (characteristic density)
:type rho0: float
... | lensing potential of NFW profile
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization (characteristic density)
:type rho0: float
:return: Epsilon(R) projected density at radius R | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/tnfw.py#L170-L185 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/tnfw.py | TNFW.nfwAlpha | def nfwAlpha(self, R, Rs, rho0, r_trunc, ax_x, ax_y):
"""
deflection angel of NFW profile along the projection to coordinate axis
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization (c... | python | def nfwAlpha(self, R, Rs, rho0, r_trunc, ax_x, ax_y):
"""
deflection angel of NFW profile along the projection to coordinate axis
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization (c... | deflection angel of NFW profile along the projection to coordinate axis
:param R: radius of interest
:type R: float/numpy array
:param Rs: scale radius
:type Rs: float
:param rho0: density normalization (characteristic density)
:type rho0: float
:param r200: radi... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/tnfw.py#L187-L212 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/tnfw.py | TNFW.mass_2d | def mass_2d(self,R,Rs,rho0,r_trunc):
"""
analytic solution of the projection integral
(convergence)
:param x: R/Rs
:type x: float >0
"""
x = R / Rs
tau = r_trunc / Rs
gx = self._g(x,tau)
m_2d = 4 * rho0 * Rs * R ** 2 * gx / x ** 2 * np.p... | python | def mass_2d(self,R,Rs,rho0,r_trunc):
"""
analytic solution of the projection integral
(convergence)
:param x: R/Rs
:type x: float >0
"""
x = R / Rs
tau = r_trunc / Rs
gx = self._g(x,tau)
m_2d = 4 * rho0 * Rs * R ** 2 * gx / x ** 2 * np.p... | analytic solution of the projection integral
(convergence)
:param x: R/Rs
:type x: float >0 | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/tnfw.py#L248-L262 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/tnfw.py | TNFW._F | def _F(self, X, tau):
"""
analytic solution of the projection integral
(convergence)
:param x: R/Rs
:type x: float >0
"""
t2 = tau ** 2
#Fx = self.F(X)
_F = self.F(X)
a = t2*(t2+1)**-2
if isinstance(X, np.ndarray):
#b ... | python | def _F(self, X, tau):
"""
analytic solution of the projection integral
(convergence)
:param x: R/Rs
:type x: float >0
"""
t2 = tau ** 2
#Fx = self.F(X)
_F = self.F(X)
a = t2*(t2+1)**-2
if isinstance(X, np.ndarray):
#b ... | analytic solution of the projection integral
(convergence)
:param x: R/Rs
:type x: float >0 | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/tnfw.py#L264-L296 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/tnfw.py | TNFW._g | def _g(self, x, tau):
"""
analytic solution of integral for NFW profile to compute deflection angel and gamma
:param x: R/Rs
:type x: float >0
"""
return tau ** 2 * (tau ** 2 + 1) ** -2 * (
(tau ** 2 + 1 + 2 * (x ** 2 - 1)) * self.F(x) + tau * np.pi + (ta... | python | def _g(self, x, tau):
"""
analytic solution of integral for NFW profile to compute deflection angel and gamma
:param x: R/Rs
:type x: float >0
"""
return tau ** 2 * (tau ** 2 + 1) ** -2 * (
(tau ** 2 + 1 + 2 * (x ** 2 - 1)) * self.F(x) + tau * np.pi + (ta... | analytic solution of integral for NFW profile to compute deflection angel and gamma
:param x: R/Rs
:type x: float >0 | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/tnfw.py#L298-L307 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/tnfw.py | TNFW._h | def _h(self, X, tau):
"""
a horrible expression for the integral to compute potential
:param x: R/Rs
:param tau: t/Rs
:type x: float >0
"""
def cos_func(y):
if isinstance(y, float) or isinstance(y, int):
if y > 1:
... | python | def _h(self, X, tau):
"""
a horrible expression for the integral to compute potential
:param x: R/Rs
:param tau: t/Rs
:type x: float >0
"""
def cos_func(y):
if isinstance(y, float) or isinstance(y, int):
if y > 1:
... | a horrible expression for the integral to compute potential
:param x: R/Rs
:param tau: t/Rs
:type x: float >0 | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/tnfw.py#L309-L396 |
sibirrer/lenstronomy | lenstronomy/Util/param_util.py | cart2polar | def cart2polar(x, y, center=np.array([0, 0])):
"""
transforms cartesian coords [x,y] into polar coords [r,phi] in the frame of the lense center
:param coord: set of coordinates
:type coord: array of size (n,2)
:param center: rotation point
:type center: array of size (2)
:returns: array of... | python | def cart2polar(x, y, center=np.array([0, 0])):
"""
transforms cartesian coords [x,y] into polar coords [r,phi] in the frame of the lense center
:param coord: set of coordinates
:type coord: array of size (n,2)
:param center: rotation point
:type center: array of size (2)
:returns: array of... | transforms cartesian coords [x,y] into polar coords [r,phi] in the frame of the lense center
:param coord: set of coordinates
:type coord: array of size (n,2)
:param center: rotation point
:type center: array of size (2)
:returns: array of same size with coords [r,phi]
:raises: AttributeError,... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/param_util.py#L4-L19 |
sibirrer/lenstronomy | lenstronomy/Util/param_util.py | polar2cart | def polar2cart(r, phi, center):
"""
transforms polar coords [r,phi] into cartesian coords [x,y] in the frame of the lense center
:param coord: set of coordinates
:type coord: array of size (n,2)
:param center: rotation point
:type center: array of size (2)
:returns: array of same size with... | python | def polar2cart(r, phi, center):
"""
transforms polar coords [r,phi] into cartesian coords [x,y] in the frame of the lense center
:param coord: set of coordinates
:type coord: array of size (n,2)
:param center: rotation point
:type center: array of size (2)
:returns: array of same size with... | transforms polar coords [r,phi] into cartesian coords [x,y] in the frame of the lense center
:param coord: set of coordinates
:type coord: array of size (n,2)
:param center: rotation point
:type center: array of size (2)
:returns: array of same size with coords [x,y]
:raises: AttributeError, K... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/param_util.py#L22-L35 |
sibirrer/lenstronomy | lenstronomy/Util/param_util.py | ellipticity2phi_gamma | def ellipticity2phi_gamma(e1, e2):
"""
:param e1: ellipticity component
:param e2: ellipticity component
:return: angle and abs value of ellipticity
"""
phi = np.arctan2(e2, e1)/2
gamma = np.sqrt(e1**2+e2**2)
return phi, gamma | python | def ellipticity2phi_gamma(e1, e2):
"""
:param e1: ellipticity component
:param e2: ellipticity component
:return: angle and abs value of ellipticity
"""
phi = np.arctan2(e2, e1)/2
gamma = np.sqrt(e1**2+e2**2)
return phi, gamma | :param e1: ellipticity component
:param e2: ellipticity component
:return: angle and abs value of ellipticity | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/param_util.py#L50-L58 |
sibirrer/lenstronomy | lenstronomy/Util/param_util.py | transform_e1e2 | def transform_e1e2(x, y, e1, e2, center_x=0, center_y=0):
"""
maps the coordinates x, y with eccentricities e1 e2 into a new elliptical coordiante system
:param x:
:param y:
:param e1:
:param e2:
:param center_x:
:param center_y:
:return:
"""
x_shift = x - center_x
y_shi... | python | def transform_e1e2(x, y, e1, e2, center_x=0, center_y=0):
"""
maps the coordinates x, y with eccentricities e1 e2 into a new elliptical coordiante system
:param x:
:param y:
:param e1:
:param e2:
:param center_x:
:param center_y:
:return:
"""
x_shift = x - center_x
y_shi... | maps the coordinates x, y with eccentricities e1 e2 into a new elliptical coordiante system
:param x:
:param y:
:param e1:
:param e2:
:param center_x:
:param center_y:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/param_util.py#L73-L90 |
sibirrer/lenstronomy | lenstronomy/Util/param_util.py | ellipticity2phi_q | def ellipticity2phi_q(e1, e2):
"""
:param e1:
:param e2:
:return:
"""
phi = np.arctan2(e2, e1)/2
c = np.sqrt(e1**2+e2**2)
if c > 0.999:
c = 0.999
q = (1-c)/(1+c)
return phi, q | python | def ellipticity2phi_q(e1, e2):
"""
:param e1:
:param e2:
:return:
"""
phi = np.arctan2(e2, e1)/2
c = np.sqrt(e1**2+e2**2)
if c > 0.999:
c = 0.999
q = (1-c)/(1+c)
return phi, q | :param e1:
:param e2:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/param_util.py#L93-L104 |
sibirrer/lenstronomy | lenstronomy/Analysis/lens_properties.py | LensProp.time_delays | def time_delays(self, kwargs_lens, kwargs_ps, kappa_ext=0):
"""
predicts the time delays of the image positions
:param kwargs_lens: lens model parameters
:param kwargs_ps: point source parameters
:param kappa_ext: external convergence (optional)
:return: time delays at i... | python | def time_delays(self, kwargs_lens, kwargs_ps, kappa_ext=0):
"""
predicts the time delays of the image positions
:param kwargs_lens: lens model parameters
:param kwargs_ps: point source parameters
:param kappa_ext: external convergence (optional)
:return: time delays at i... | predicts the time delays of the image positions
:param kwargs_lens: lens model parameters
:param kwargs_ps: point source parameters
:param kappa_ext: external convergence (optional)
:return: time delays at image positions for the fixed cosmology | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Analysis/lens_properties.py#L39-L50 |
sibirrer/lenstronomy | lenstronomy/Analysis/lens_properties.py | LensProp.velocity_dispersion | def velocity_dispersion(self, kwargs_lens, kwargs_lens_light, lens_light_model_bool_list=None, aniso_param=1,
r_eff=None, R_slit=0.81, dR_slit=0.1, psf_fwhm=0.7, num_evaluate=1000):
"""
computes the LOS velocity dispersion of the lens within a slit of size R_slit x dR_slit an... | python | def velocity_dispersion(self, kwargs_lens, kwargs_lens_light, lens_light_model_bool_list=None, aniso_param=1,
r_eff=None, R_slit=0.81, dR_slit=0.1, psf_fwhm=0.7, num_evaluate=1000):
"""
computes the LOS velocity dispersion of the lens within a slit of size R_slit x dR_slit an... | computes the LOS velocity dispersion of the lens within a slit of size R_slit x dR_slit and seeing psf_fwhm.
The assumptions are a Hernquist light profile and the spherical power-law lens model at the first position.
Further information can be found in the AnalyticKinematics() class.
:param kw... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Analysis/lens_properties.py#L52-L80 |
sibirrer/lenstronomy | lenstronomy/Analysis/lens_properties.py | LensProp.velocity_dispersion_numerical | def velocity_dispersion_numerical(self, kwargs_lens, kwargs_lens_light, kwargs_anisotropy, kwargs_aperture, psf_fwhm,
aperture_type, anisotropy_model, r_eff=None, kwargs_numerics={}, MGE_light=False,
MGE_mass=False, lens_model_kinematics_bool=N... | python | def velocity_dispersion_numerical(self, kwargs_lens, kwargs_lens_light, kwargs_anisotropy, kwargs_aperture, psf_fwhm,
aperture_type, anisotropy_model, r_eff=None, kwargs_numerics={}, MGE_light=False,
MGE_mass=False, lens_model_kinematics_bool=N... | Computes the LOS velocity dispersion of the deflector galaxy with arbitrary combinations of light and mass models.
For a detailed description, visit the description of the Galkin() class.
Additionaly to executing the Galkin routine, it has an optional Multi-Gaussian-Expansion decomposition of lens
... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Analysis/lens_properties.py#L82-L172 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/gaussian_kappa.py | GaussianKappa.function | def function(self, x, y, amp, sigma, center_x=0, center_y=0):
"""
returns Gaussian
"""
x_ = x - center_x
y_ = y - center_y
r = np.sqrt(x_**2 + y_**2)
sigma_x, sigma_y = sigma, sigma
c = 1. / (2 * sigma_x * sigma_y)
num_int = self._num_integral(r, c... | python | def function(self, x, y, amp, sigma, center_x=0, center_y=0):
"""
returns Gaussian
"""
x_ = x - center_x
y_ = y - center_y
r = np.sqrt(x_**2 + y_**2)
sigma_x, sigma_y = sigma, sigma
c = 1. / (2 * sigma_x * sigma_y)
num_int = self._num_integral(r, c... | returns Gaussian | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/gaussian_kappa.py#L22-L35 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/gaussian_kappa.py | GaussianKappa._num_integral | def _num_integral(self, r, c):
"""
numerical integral (1-e^{-c*x^2})/x dx [0..r]
:param r: radius
:param c: 1/2sigma^2
:return:
"""
out = integrate.quad(lambda x: (1-np.exp(-c*x**2))/x, 0, r)
return out[0] | python | def _num_integral(self, r, c):
"""
numerical integral (1-e^{-c*x^2})/x dx [0..r]
:param r: radius
:param c: 1/2sigma^2
:return:
"""
out = integrate.quad(lambda x: (1-np.exp(-c*x**2))/x, 0, r)
return out[0] | numerical integral (1-e^{-c*x^2})/x dx [0..r]
:param r: radius
:param c: 1/2sigma^2
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/gaussian_kappa.py#L37-L45 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/gaussian_kappa.py | GaussianKappa.derivatives | def derivatives(self, x, y, amp, sigma, center_x=0, center_y=0):
"""
returns df/dx and df/dy of the function
"""
x_ = x - center_x
y_ = y - center_y
R = np.sqrt(x_**2 + y_**2)
sigma_x, sigma_y = sigma, sigma
if isinstance(R, int) or isinstance(R, float):
... | python | def derivatives(self, x, y, amp, sigma, center_x=0, center_y=0):
"""
returns df/dx and df/dy of the function
"""
x_ = x - center_x
y_ = y - center_y
R = np.sqrt(x_**2 + y_**2)
sigma_x, sigma_y = sigma, sigma
if isinstance(R, int) or isinstance(R, float):
... | returns df/dx and df/dy of the function | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/gaussian_kappa.py#L47-L60 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/gaussian_kappa.py | GaussianKappa.hessian | def hessian(self, x, y, amp, sigma, center_x=0, center_y=0):
"""
returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy
"""
x_ = x - center_x
y_ = y - center_y
r = np.sqrt(x_**2 + y_**2)
sigma_x, sigma_y = sigma, sigma
if isinstance(r, int) or is... | python | def hessian(self, x, y, amp, sigma, center_x=0, center_y=0):
"""
returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy
"""
x_ = x - center_x
y_ = y - center_y
r = np.sqrt(x_**2 + y_**2)
sigma_x, sigma_y = sigma, sigma
if isinstance(r, int) or is... | returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/gaussian_kappa.py#L62-L80 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/gaussian_kappa.py | GaussianKappa.alpha_abs | def alpha_abs(self, R, amp, sigma):
"""
absolute value of the deflection
:param R:
:param amp:
:param sigma_x:
:param sigma_y:
:return:
"""
sigma_x, sigma_y = sigma, sigma
amp_density = self._amp2d_to_3d(amp, sigma_x, sigma_y)
alpha... | python | def alpha_abs(self, R, amp, sigma):
"""
absolute value of the deflection
:param R:
:param amp:
:param sigma_x:
:param sigma_y:
:return:
"""
sigma_x, sigma_y = sigma, sigma
amp_density = self._amp2d_to_3d(amp, sigma_x, sigma_y)
alpha... | absolute value of the deflection
:param R:
:param amp:
:param sigma_x:
:param sigma_y:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/gaussian_kappa.py#L133-L145 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/gaussian_kappa.py | GaussianKappa._amp3d_to_2d | def _amp3d_to_2d(self, amp, sigma_x, sigma_y):
"""
converts 3d density into 2d density parameter
:param amp:
:param sigma_x:
:param sigma_y:
:return:
"""
return amp * np.sqrt(np.pi) * np.sqrt(sigma_x * sigma_y * 2) | python | def _amp3d_to_2d(self, amp, sigma_x, sigma_y):
"""
converts 3d density into 2d density parameter
:param amp:
:param sigma_x:
:param sigma_y:
:return:
"""
return amp * np.sqrt(np.pi) * np.sqrt(sigma_x * sigma_y * 2) | converts 3d density into 2d density parameter
:param amp:
:param sigma_x:
:param sigma_y:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/gaussian_kappa.py#L188-L196 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/gaussian_kappa.py | GaussianKappa._amp2d_to_3d | def _amp2d_to_3d(self, amp, sigma_x, sigma_y):
"""
converts 3d density into 2d density parameter
:param amp:
:param sigma_x:
:param sigma_y:
:return:
"""
return amp / (np.sqrt(np.pi) * np.sqrt(sigma_x * sigma_y * 2)) | python | def _amp2d_to_3d(self, amp, sigma_x, sigma_y):
"""
converts 3d density into 2d density parameter
:param amp:
:param sigma_x:
:param sigma_y:
:return:
"""
return amp / (np.sqrt(np.pi) * np.sqrt(sigma_x * sigma_y * 2)) | converts 3d density into 2d density parameter
:param amp:
:param sigma_x:
:param sigma_y:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/gaussian_kappa.py#L198-L206 |
sibirrer/lenstronomy | lenstronomy/LightModel/Profiles/moffat.py | Moffat.function | def function(self, x, y, amp, alpha, beta, center_x, center_y):
"""
returns Moffat profile
"""
x_shift = x - center_x
y_shift = y - center_y
return amp * (1. + (x_shift**2+y_shift**2)/alpha**2)**(-beta) | python | def function(self, x, y, amp, alpha, beta, center_x, center_y):
"""
returns Moffat profile
"""
x_shift = x - center_x
y_shift = y - center_y
return amp * (1. + (x_shift**2+y_shift**2)/alpha**2)**(-beta) | returns Moffat profile | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LightModel/Profiles/moffat.py#L15-L21 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/spemd_smooth.py | SPEMD_SMOOTH._parameter_constraints | def _parameter_constraints(self, theta_E, gamma, q, phi_G, s_scale):
"""
sets bounds to parameters due to numerical stability
:param theta_E:
:param gamma:
:param q:
:param phi_G:
:param s_scale:
:return:
"""
if theta_E < 0:
the... | python | def _parameter_constraints(self, theta_E, gamma, q, phi_G, s_scale):
"""
sets bounds to parameters due to numerical stability
:param theta_E:
:param gamma:
:param q:
:param phi_G:
:param s_scale:
:return:
"""
if theta_E < 0:
the... | sets bounds to parameters due to numerical stability
:param theta_E:
:param gamma:
:param q:
:param phi_G:
:param s_scale:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/spemd_smooth.py#L26-L52 |
sibirrer/lenstronomy | lenstronomy/Util/prob_density.py | compute_lower_upper_errors | def compute_lower_upper_errors(sample, num_sigma=1):
"""
computes the upper and lower sigma from the median value.
This functions gives good error estimates for skewed pdf's
:param sample: 1-D sample
:return: median, lower_sigma, upper_sigma
"""
if num_sigma > 3:
raise ValueError("Nu... | python | def compute_lower_upper_errors(sample, num_sigma=1):
"""
computes the upper and lower sigma from the median value.
This functions gives good error estimates for skewed pdf's
:param sample: 1-D sample
:return: median, lower_sigma, upper_sigma
"""
if num_sigma > 3:
raise ValueError("Nu... | computes the upper and lower sigma from the median value.
This functions gives good error estimates for skewed pdf's
:param sample: 1-D sample
:return: median, lower_sigma, upper_sigma | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/prob_density.py#L137-L169 |
sibirrer/lenstronomy | lenstronomy/Util/prob_density.py | SkewGaussian.pdf | def pdf(self, x, e=0., w=1., a=0.):
"""
probability density function
see: https://en.wikipedia.org/wiki/Skew_normal_distribution
:param x: input value
:param e:
:param w:
:param a:
:return:
"""
t = (x-e) / w
return 2. / w * stats.no... | python | def pdf(self, x, e=0., w=1., a=0.):
"""
probability density function
see: https://en.wikipedia.org/wiki/Skew_normal_distribution
:param x: input value
:param e:
:param w:
:param a:
:return:
"""
t = (x-e) / w
return 2. / w * stats.no... | probability density function
see: https://en.wikipedia.org/wiki/Skew_normal_distribution
:param x: input value
:param e:
:param w:
:param a:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/prob_density.py#L12-L23 |
sibirrer/lenstronomy | lenstronomy/Util/prob_density.py | SkewGaussian.pdf_new | def pdf_new(self, x, mu, sigma, skw):
"""
function with different parameterisation
:param x:
:param mu: mean
:param sigma: sigma
:param skw: skewness
:return:
"""
if skw > 1 or skw < -1:
print("skewness %s out of range" % skw)
... | python | def pdf_new(self, x, mu, sigma, skw):
"""
function with different parameterisation
:param x:
:param mu: mean
:param sigma: sigma
:param skw: skewness
:return:
"""
if skw > 1 or skw < -1:
print("skewness %s out of range" % skw)
... | function with different parameterisation
:param x:
:param mu: mean
:param sigma: sigma
:param skw: skewness
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/prob_density.py#L25-L39 |
sibirrer/lenstronomy | lenstronomy/Util/prob_density.py | SkewGaussian._w_sigma_delta | def _w_sigma_delta(self, sigma, delta):
"""
invert variance
:param sigma:
:param delta:
:return: w parameter
"""
sigma2=sigma**2
w2 = sigma2/(1-2*delta**2/np.pi)
w = np.sqrt(w2)
return w | python | def _w_sigma_delta(self, sigma, delta):
"""
invert variance
:param sigma:
:param delta:
:return: w parameter
"""
sigma2=sigma**2
w2 = sigma2/(1-2*delta**2/np.pi)
w = np.sqrt(w2)
return w | invert variance
:param sigma:
:param delta:
:return: w parameter | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/prob_density.py#L59-L69 |
sibirrer/lenstronomy | lenstronomy/Util/prob_density.py | SkewGaussian.map_mu_sigma_skw | def map_mu_sigma_skw(self, mu, sigma, skw):
"""
map to parameters e, w, a
:param mu: mean
:param sigma: standard deviation
:param skw: skewness
:return: e, w, a
"""
delta = self._delta_skw(skw)
a = self._alpha_delta(delta)
w = self._w_sigma... | python | def map_mu_sigma_skw(self, mu, sigma, skw):
"""
map to parameters e, w, a
:param mu: mean
:param sigma: standard deviation
:param skw: skewness
:return: e, w, a
"""
delta = self._delta_skw(skw)
a = self._alpha_delta(delta)
w = self._w_sigma... | map to parameters e, w, a
:param mu: mean
:param sigma: standard deviation
:param skw: skewness
:return: e, w, a | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/prob_density.py#L82-L94 |
sibirrer/lenstronomy | lenstronomy/Sampling/sampler.py | Sampler.pso | def pso(self, n_particles, n_iterations, lower_start=None, upper_start=None, threadCount=1, init_pos=None,
mpi=False, print_key='PSO'):
"""
returns the best fit for the lense model on catalogue basis with particle swarm optimizer
"""
if lower_start is None or upper_start is N... | python | def pso(self, n_particles, n_iterations, lower_start=None, upper_start=None, threadCount=1, init_pos=None,
mpi=False, print_key='PSO'):
"""
returns the best fit for the lense model on catalogue basis with particle swarm optimizer
"""
if lower_start is None or upper_start is N... | returns the best fit for the lense model on catalogue basis with particle swarm optimizer | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Sampling/sampler.py#L37-L96 |
sibirrer/lenstronomy | lenstronomy/Sampling/sampler.py | Sampler.mcmc_CH | def mcmc_CH(self, walkerRatio, n_run, n_burn, mean_start, sigma_start, threadCount=1, init_pos=None, mpi=False):
"""
runs mcmc on the parameter space given parameter bounds with CosmoHammerSampler
returns the chain
"""
lowerLimit, upperLimit = self.lower_limit, self.upper_limit
... | python | def mcmc_CH(self, walkerRatio, n_run, n_burn, mean_start, sigma_start, threadCount=1, init_pos=None, mpi=False):
"""
runs mcmc on the parameter space given parameter bounds with CosmoHammerSampler
returns the chain
"""
lowerLimit, upperLimit = self.lower_limit, self.upper_limit
... | runs mcmc on the parameter space given parameter bounds with CosmoHammerSampler
returns the chain | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Sampling/sampler.py#L117-L189 |
sibirrer/lenstronomy | lenstronomy/Util/data_util.py | bkg_noise | def bkg_noise(readout_noise, exposure_time, sky_brightness, pixel_scael, num_exposures=1):
"""
computes the expected Gaussian background noise of a pixel in units of counts/second
:param readout_noise: noise added per readout
:param exposure_time: exposure time per exposure (in seconds)
:param sky_... | python | def bkg_noise(readout_noise, exposure_time, sky_brightness, pixel_scael, num_exposures=1):
"""
computes the expected Gaussian background noise of a pixel in units of counts/second
:param readout_noise: noise added per readout
:param exposure_time: exposure time per exposure (in seconds)
:param sky_... | computes the expected Gaussian background noise of a pixel in units of counts/second
:param readout_noise: noise added per readout
:param exposure_time: exposure time per exposure (in seconds)
:param sky_brightness: counts per second per unit arcsecond square
:param pixel_scael: size of pixel in units ... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/data_util.py#L4-L19 |
sibirrer/lenstronomy | lenstronomy/ImSim/image_model.py | ImageModel.reset_point_source_cache | def reset_point_source_cache(self, bool=True):
"""
deletes all the cache in the point source class and saves it from then on
:return:
"""
if self.PointSource is not None:
self.PointSource.delete_lens_model_cach()
self.PointSource.set_save_cache(bool) | python | def reset_point_source_cache(self, bool=True):
"""
deletes all the cache in the point source class and saves it from then on
:return:
"""
if self.PointSource is not None:
self.PointSource.delete_lens_model_cach()
self.PointSource.set_save_cache(bool) | deletes all the cache in the point source class and saves it from then on
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/ImSim/image_model.py#L55-L63 |
sibirrer/lenstronomy | lenstronomy/ImSim/image_model.py | ImageModel.linear_response_matrix | def linear_response_matrix(self, kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None):
"""
computes the linear response matrix (m x n), with n beeing the data size and m being the coefficients
:param kwargs_lens:
:param kwargs_source:
:param kwargs_lens_... | python | def linear_response_matrix(self, kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None):
"""
computes the linear response matrix (m x n), with n beeing the data size and m being the coefficients
:param kwargs_lens:
:param kwargs_source:
:param kwargs_lens_... | computes the linear response matrix (m x n), with n beeing the data size and m being the coefficients
:param kwargs_lens:
:param kwargs_source:
:param kwargs_lens_light:
:param kwargs_ps:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/ImSim/image_model.py#L163-L175 |
sibirrer/lenstronomy | lenstronomy/ImSim/image_model.py | ImageModel.data_response | def data_response(self):
"""
returns the 1d array of the data element that is fitted for (including masking)
:return: 1d numpy array
"""
d = self.ImageNumerics.image2array(self.Data.data * self.ImageNumerics.mask)
return d | python | def data_response(self):
"""
returns the 1d array of the data element that is fitted for (including masking)
:return: 1d numpy array
"""
d = self.ImageNumerics.image2array(self.Data.data * self.ImageNumerics.mask)
return d | returns the 1d array of the data element that is fitted for (including masking)
:return: 1d numpy array | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/ImSim/image_model.py#L178-L185 |
sibirrer/lenstronomy | lenstronomy/ImSim/image_model.py | ImageModel.error_response | def error_response(self, kwargs_lens, kwargs_ps):
"""
returns the 1d array of the error estimate corresponding to the data response
:return: 1d numpy array of response, 2d array of additonal errors (e.g. point source uncertainties)
"""
model_error = self.error_map(kwargs_lens, k... | python | def error_response(self, kwargs_lens, kwargs_ps):
"""
returns the 1d array of the error estimate corresponding to the data response
:return: 1d numpy array of response, 2d array of additonal errors (e.g. point source uncertainties)
"""
model_error = self.error_map(kwargs_lens, k... | returns the 1d array of the error estimate corresponding to the data response
:return: 1d numpy array of response, 2d array of additonal errors (e.g. point source uncertainties) | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/ImSim/image_model.py#L187-L196 |
sibirrer/lenstronomy | lenstronomy/ImSim/image_model.py | ImageModel.reduced_chi2 | def reduced_chi2(self, model, error_map=0):
"""
returns reduced chi2
:param model:
:param error_map:
:return:
"""
chi2 = self.reduced_residuals(model, error_map)
return np.sum(chi2**2) / self.num_data_evaluate() | python | def reduced_chi2(self, model, error_map=0):
"""
returns reduced chi2
:param model:
:param error_map:
:return:
"""
chi2 = self.reduced_residuals(model, error_map)
return np.sum(chi2**2) / self.num_data_evaluate() | returns reduced chi2
:param model:
:param error_map:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/ImSim/image_model.py#L296-L304 |
sibirrer/lenstronomy | lenstronomy/Sampling/parameters.py | Param.kwargs2args | def kwargs2args(self, kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_cosmo=None):
"""
inverse of getParam function
:param kwargs_lens: keyword arguments depending on model options
:param kwargs_source: keyword arguments depending on model options
... | python | def kwargs2args(self, kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None, kwargs_cosmo=None):
"""
inverse of getParam function
:param kwargs_lens: keyword arguments depending on model options
:param kwargs_source: keyword arguments depending on model options
... | inverse of getParam function
:param kwargs_lens: keyword arguments depending on model options
:param kwargs_source: keyword arguments depending on model options
:return: tuple of parameters | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Sampling/parameters.py#L205-L218 |
sibirrer/lenstronomy | lenstronomy/Sampling/parameters.py | Param.image2source_plane | def image2source_plane(self, kwargs_source, kwargs_lens, image_plane=False):
"""
maps the image plane position definition of the source plane
:param kwargs_source:
:param kwargs_lens:
:return:
"""
kwargs_source_copy = copy.deepcopy(kwargs_source)
for i, k... | python | def image2source_plane(self, kwargs_source, kwargs_lens, image_plane=False):
"""
maps the image plane position definition of the source plane
:param kwargs_source:
:param kwargs_lens:
:return:
"""
kwargs_source_copy = copy.deepcopy(kwargs_source)
for i, k... | maps the image plane position definition of the source plane
:param kwargs_source:
:param kwargs_lens:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Sampling/parameters.py#L268-L284 |
sibirrer/lenstronomy | lenstronomy/Sampling/parameters.py | Param.update_lens_scaling | def update_lens_scaling(self, kwargs_cosmo, kwargs_lens, inverse=False):
"""
multiplies the scaling parameters of the profiles
:param args:
:param kwargs_lens:
:param i:
:param inverse:
:return:
"""
kwargs_lens_updated = copy.deepcopy(kwargs_lens)... | python | def update_lens_scaling(self, kwargs_cosmo, kwargs_lens, inverse=False):
"""
multiplies the scaling parameters of the profiles
:param args:
:param kwargs_lens:
:param i:
:param inverse:
:return:
"""
kwargs_lens_updated = copy.deepcopy(kwargs_lens)... | multiplies the scaling parameters of the profiles
:param args:
:param kwargs_lens:
:param i:
:param inverse:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Sampling/parameters.py#L354-L381 |
sibirrer/lenstronomy | lenstronomy/Sampling/parameters.py | Param.check_solver | def check_solver(self, kwargs_lens, kwargs_ps, kwargs_cosmo={}):
"""
test whether the image positions map back to the same source position
:param kwargs_lens:
:param kwargs_ps:
:return: Euclidean distance between the rayshooting of the image positions
"""
if self.... | python | def check_solver(self, kwargs_lens, kwargs_ps, kwargs_cosmo={}):
"""
test whether the image positions map back to the same source position
:param kwargs_lens:
:param kwargs_ps:
:return: Euclidean distance between the rayshooting of the image positions
"""
if self.... | test whether the image positions map back to the same source position
:param kwargs_lens:
:param kwargs_ps:
:return: Euclidean distance between the rayshooting of the image positions | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Sampling/parameters.py#L391-L404 |
sibirrer/lenstronomy | lenstronomy/Sampling/parameters.py | Param.print_setting | def print_setting(self):
"""
prints the setting of the parameter class
:return:
"""
num, param_list = self.num_param()
num_linear = self.num_param_linear()
print("The following model options are chosen:")
print("Lens models:", self._lens_model_list)
... | python | def print_setting(self):
"""
prints the setting of the parameter class
:return:
"""
num, param_list = self.num_param()
num_linear = self.num_param_linear()
print("The following model options are chosen:")
print("Lens models:", self._lens_model_list)
... | prints the setting of the parameter class
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Sampling/parameters.py#L428-L458 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.