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/LensModel/Profiles/numerical_deflections.py | NumericalAlpha.hessian | def hessian(self, x, y, center_x = 0, center_y = 0, **kwargs):
"""
returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy
(un-normalized!!!) interpolated from the numerical deflection table
"""
diff = 1e-6
alpha_ra, alpha_dec = self.derivatives(x, y, center_x =... | python | def hessian(self, x, y, center_x = 0, center_y = 0, **kwargs):
"""
returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy
(un-normalized!!!) interpolated from the numerical deflection table
"""
diff = 1e-6
alpha_ra, alpha_dec = self.derivatives(x, y, center_x =... | returns Hessian matrix of function d^2f/dx^2, d^f/dy^2, d^2/dxdy
(un-normalized!!!) interpolated from the numerical deflection table | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/numerical_deflections.py#L85-L108 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/sersic_ellipse.py | SersicEllipse.function | def function(self, x, y, n_sersic, R_sersic, k_eff, e1, e2, center_x=0, center_y=0):
"""
returns Gaussian
"""
phi_G, q = param_util.ellipticity2phi_q(e1, e2)
x_, y_ = self._coord_transf(x, y, q, phi_G, center_x, center_y)
f_ = self.sersic.function(x_, y_, n_sersic, R_sers... | python | def function(self, x, y, n_sersic, R_sersic, k_eff, e1, e2, center_x=0, center_y=0):
"""
returns Gaussian
"""
phi_G, q = param_util.ellipticity2phi_q(e1, e2)
x_, y_ = self._coord_transf(x, y, q, phi_G, center_x, center_y)
f_ = self.sersic.function(x_, y_, n_sersic, R_sers... | returns Gaussian | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/sersic_ellipse.py#L21-L28 |
sibirrer/lenstronomy | lenstronomy/LensModel/Profiles/sersic_ellipse.py | SersicEllipse.derivatives | def derivatives(self, x, y, n_sersic, R_sersic, k_eff, e1, e2, center_x=0, center_y=0):
"""
returns df/dx and df/dy of the function
"""
phi_G, q = param_util.ellipticity2phi_q(e1, e2)
e = abs(1. - q)
cos_phi = np.cos(phi_G)
sin_phi = np.sin(phi_G)
x_, y_ =... | python | def derivatives(self, x, y, n_sersic, R_sersic, k_eff, e1, e2, center_x=0, center_y=0):
"""
returns df/dx and df/dy of the function
"""
phi_G, q = param_util.ellipticity2phi_q(e1, e2)
e = abs(1. - q)
cos_phi = np.cos(phi_G)
sin_phi = np.sin(phi_G)
x_, y_ =... | returns df/dx and df/dy of the function | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/sersic_ellipse.py#L30-L44 |
sibirrer/lenstronomy | lenstronomy/Util/image_util.py | add_layer2image | def add_layer2image(grid2d, x_pos, y_pos, kernel, order=1):
"""
adds a kernel on the grid2d image at position x_pos, y_pos with an interpolated subgrid pixel shift of order=order
:param grid2d: 2d pixel grid (i.e. image)
:param x_pos: x-position center (pixel coordinate) of the layer to be added
:pa... | python | def add_layer2image(grid2d, x_pos, y_pos, kernel, order=1):
"""
adds a kernel on the grid2d image at position x_pos, y_pos with an interpolated subgrid pixel shift of order=order
:param grid2d: 2d pixel grid (i.e. image)
:param x_pos: x-position center (pixel coordinate) of the layer to be added
:pa... | adds a kernel on the grid2d image at position x_pos, y_pos with an interpolated subgrid pixel shift of order=order
:param grid2d: 2d pixel grid (i.e. image)
:param x_pos: x-position center (pixel coordinate) of the layer to be added
:param y_pos: y-position center (pixel coordinate) of the layer to be added... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/image_util.py#L10-L26 |
sibirrer/lenstronomy | lenstronomy/Util/image_util.py | add_layer2image_int | def add_layer2image_int(grid2d, x_pos, y_pos, kernel):
"""
adds a kernel on the grid2d image at position x_pos, y_pos at integer positions of pixel
:param grid2d: 2d pixel grid (i.e. image)
:param x_pos: x-position center (pixel coordinate) of the layer to be added
:param y_pos: y-position center (p... | python | def add_layer2image_int(grid2d, x_pos, y_pos, kernel):
"""
adds a kernel on the grid2d image at position x_pos, y_pos at integer positions of pixel
:param grid2d: 2d pixel grid (i.e. image)
:param x_pos: x-position center (pixel coordinate) of the layer to be added
:param y_pos: y-position center (p... | adds a kernel on the grid2d image at position x_pos, y_pos at integer positions of pixel
:param grid2d: 2d pixel grid (i.e. image)
:param x_pos: x-position center (pixel coordinate) of the layer to be added
:param y_pos: y-position center (pixel coordinate) of the layer to be added
:param kernel: the la... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/image_util.py#L29-L64 |
sibirrer/lenstronomy | lenstronomy/Util/image_util.py | add_background | def add_background(image, sigma_bkd):
"""
adds background noise to image
:param image: pixel values of image
:param sigma_bkd: background noise (sigma)
:return: a realisation of Gaussian noise of the same size as image
"""
if sigma_bkd < 0:
raise ValueError("Sigma background is small... | python | def add_background(image, sigma_bkd):
"""
adds background noise to image
:param image: pixel values of image
:param sigma_bkd: background noise (sigma)
:return: a realisation of Gaussian noise of the same size as image
"""
if sigma_bkd < 0:
raise ValueError("Sigma background is small... | adds background noise to image
:param image: pixel values of image
:param sigma_bkd: background noise (sigma)
:return: a realisation of Gaussian noise of the same size as image | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/image_util.py#L67-L78 |
sibirrer/lenstronomy | lenstronomy/Util/image_util.py | add_poisson | def add_poisson(image, exp_time):
"""
adds a poison (or Gaussian) distributed noise with mean given by surface brightness
:param image: pixel values (photon counts per unit exposure time)
:param exp_time: exposure time
:return: Poisson noise realization of input image
"""
"""
adds a pois... | python | def add_poisson(image, exp_time):
"""
adds a poison (or Gaussian) distributed noise with mean given by surface brightness
:param image: pixel values (photon counts per unit exposure time)
:param exp_time: exposure time
:return: Poisson noise realization of input image
"""
"""
adds a pois... | adds a poison (or Gaussian) distributed noise with mean given by surface brightness
:param image: pixel values (photon counts per unit exposure time)
:param exp_time: exposure time
:return: Poisson noise realization of input image | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/image_util.py#L81-L100 |
sibirrer/lenstronomy | lenstronomy/Util/image_util.py | re_size_array | def re_size_array(x_in, y_in, input_values, x_out, y_out):
"""
resizes 2d array (i.e. image) to new coordinates. So far only works with square output aligned with coordinate axis.
:param x_in:
:param y_in:
:param input_values:
:param x_out:
:param y_out:
:return:
"""
interp_2d = ... | python | def re_size_array(x_in, y_in, input_values, x_out, y_out):
"""
resizes 2d array (i.e. image) to new coordinates. So far only works with square output aligned with coordinate axis.
:param x_in:
:param y_in:
:param input_values:
:param x_out:
:param y_out:
:return:
"""
interp_2d = ... | resizes 2d array (i.e. image) to new coordinates. So far only works with square output aligned with coordinate axis.
:param x_in:
:param y_in:
:param input_values:
:param x_out:
:param y_out:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/image_util.py#L115-L128 |
sibirrer/lenstronomy | lenstronomy/Util/image_util.py | symmetry_average | def symmetry_average(image, symmetry):
"""
symmetry averaged image
:param image:
:param symmetry:
:return:
"""
img_sym = np.zeros_like(image)
angle = 360./symmetry
for i in range(symmetry):
img_sym += rotateImage(image, angle*i)
img_sym /= symmetry
return img_sym | python | def symmetry_average(image, symmetry):
"""
symmetry averaged image
:param image:
:param symmetry:
:return:
"""
img_sym = np.zeros_like(image)
angle = 360./symmetry
for i in range(symmetry):
img_sym += rotateImage(image, angle*i)
img_sym /= symmetry
return img_sym | symmetry averaged image
:param image:
:param symmetry:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/image_util.py#L131-L143 |
sibirrer/lenstronomy | lenstronomy/Util/image_util.py | findOverlap | def findOverlap(x_mins, y_mins, min_distance):
"""
finds overlapping solutions, deletes multiples and deletes non-solutions and if it is not a solution, deleted as well
"""
n = len(x_mins)
idex = []
for i in range(n):
if i == 0:
pass
else:
for j in range(0... | python | def findOverlap(x_mins, y_mins, min_distance):
"""
finds overlapping solutions, deletes multiples and deletes non-solutions and if it is not a solution, deleted as well
"""
n = len(x_mins)
idex = []
for i in range(n):
if i == 0:
pass
else:
for j in range(0... | finds overlapping solutions, deletes multiples and deletes non-solutions and if it is not a solution, deleted as well | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/image_util.py#L146-L162 |
sibirrer/lenstronomy | lenstronomy/Util/image_util.py | coordInImage | def coordInImage(x_coord, y_coord, numPix, deltapix):
"""
checks whether image positions are within the pixel image in units of arcsec
if not: remove it
:param imcoord: image coordinate (in units of angels) [[x,y,delta,magnification][...]]
:type imcoord: (n,4) numpy array
:returns: image posit... | python | def coordInImage(x_coord, y_coord, numPix, deltapix):
"""
checks whether image positions are within the pixel image in units of arcsec
if not: remove it
:param imcoord: image coordinate (in units of angels) [[x,y,delta,magnification][...]]
:type imcoord: (n,4) numpy array
:returns: image posit... | checks whether image positions are within the pixel image in units of arcsec
if not: remove it
:param imcoord: image coordinate (in units of angels) [[x,y,delta,magnification][...]]
:type imcoord: (n,4) numpy array
:returns: image positions within the pixel image | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/image_util.py#L165-L182 |
sibirrer/lenstronomy | lenstronomy/Util/image_util.py | re_size | def re_size(image, factor=1):
"""
resizes image with nx x ny to nx/factor x ny/factor
:param image: 2d image with shape (nx,ny)
:param factor: integer >=1
:return:
"""
if factor < 1:
raise ValueError('scaling factor in re-sizing %s < 1' %factor)
f = int(factor)
nx, ny = np.sh... | python | def re_size(image, factor=1):
"""
resizes image with nx x ny to nx/factor x ny/factor
:param image: 2d image with shape (nx,ny)
:param factor: integer >=1
:return:
"""
if factor < 1:
raise ValueError('scaling factor in re-sizing %s < 1' %factor)
f = int(factor)
nx, ny = np.sh... | resizes image with nx x ny to nx/factor x ny/factor
:param image: 2d image with shape (nx,ny)
:param factor: integer >=1
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/image_util.py#L185-L200 |
sibirrer/lenstronomy | lenstronomy/Util/image_util.py | rebin_image | def rebin_image(bin_size, image, wht_map, sigma_bkg, ra_coords, dec_coords, idex_mask):
"""
rebins pixels, updates cutout image, wht_map, sigma_bkg, coordinates, PSF
:param bin_size: number of pixels (per axis) to merge
:return:
"""
numPix = int(len(image)/bin_size)
numPix_precut = numPix * ... | python | def rebin_image(bin_size, image, wht_map, sigma_bkg, ra_coords, dec_coords, idex_mask):
"""
rebins pixels, updates cutout image, wht_map, sigma_bkg, coordinates, PSF
:param bin_size: number of pixels (per axis) to merge
:return:
"""
numPix = int(len(image)/bin_size)
numPix_precut = numPix * ... | rebins pixels, updates cutout image, wht_map, sigma_bkg, coordinates, PSF
:param bin_size: number of pixels (per axis) to merge
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/image_util.py#L203-L224 |
sibirrer/lenstronomy | lenstronomy/Util/image_util.py | rebin_coord_transform | def rebin_coord_transform(factor, x_at_radec_0, y_at_radec_0, Mpix2coord, Mcoord2pix):
"""
adopt coordinate system and transformation between angular and pixel coordinates of a re-binned image
:param bin_size:
:param ra_0:
:param dec_0:
:param x_0:
:param y_0:
:param Matrix:
:param M... | python | def rebin_coord_transform(factor, x_at_radec_0, y_at_radec_0, Mpix2coord, Mcoord2pix):
"""
adopt coordinate system and transformation between angular and pixel coordinates of a re-binned image
:param bin_size:
:param ra_0:
:param dec_0:
:param x_0:
:param y_0:
:param Matrix:
:param M... | adopt coordinate system and transformation between angular and pixel coordinates of a re-binned image
:param bin_size:
:param ra_0:
:param dec_0:
:param x_0:
:param y_0:
:param Matrix:
:param Matrix_inv:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/image_util.py#L227-L245 |
sibirrer/lenstronomy | lenstronomy/Util/image_util.py | stack_images | def stack_images(image_list, wht_list, sigma_list):
"""
stacks images and saves new image as a fits file
:param image_name_list: list of image_names to be stacked
:return:
"""
image_stacked = np.zeros_like(image_list[0])
wht_stacked = np.zeros_like(image_stacked)
sigma_stacked = 0.
f... | python | def stack_images(image_list, wht_list, sigma_list):
"""
stacks images and saves new image as a fits file
:param image_name_list: list of image_names to be stacked
:return:
"""
image_stacked = np.zeros_like(image_list[0])
wht_stacked = np.zeros_like(image_stacked)
sigma_stacked = 0.
f... | stacks images and saves new image as a fits file
:param image_name_list: list of image_names to be stacked
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/image_util.py#L248-L264 |
sibirrer/lenstronomy | lenstronomy/Util/image_util.py | cut_edges | def cut_edges(image, numPix):
"""
cuts out the edges of a 2d image and returns re-sized image to numPix
center is well defined for odd pixel sizes.
:param image: 2d numpy array
:param numPix: square size of cut out image
:return: cutout image with size numPix
"""
nx, ny = image.shape
... | python | def cut_edges(image, numPix):
"""
cuts out the edges of a 2d image and returns re-sized image to numPix
center is well defined for odd pixel sizes.
:param image: 2d numpy array
:param numPix: square size of cut out image
:return: cutout image with size numPix
"""
nx, ny = image.shape
... | cuts out the edges of a 2d image and returns re-sized image to numPix
center is well defined for odd pixel sizes.
:param image: 2d numpy array
:param numPix: square size of cut out image
:return: cutout image with size numPix | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/image_util.py#L267-L291 |
sibirrer/lenstronomy | lenstronomy/Cosmo/cosmo_solver.py | InvertCosmo._make_interpolation | def _make_interpolation(self):
"""
creates an interpolation grid in H_0, omega_m and computes quantities in Dd and Ds_Dds
:return:
"""
H0_range = np.linspace(10, 100, 90)
omega_m_range = np.linspace(0.05, 1, 95)
grid2d = np.dstack(np.meshgrid(H0_range, omega_m_ran... | python | def _make_interpolation(self):
"""
creates an interpolation grid in H_0, omega_m and computes quantities in Dd and Ds_Dds
:return:
"""
H0_range = np.linspace(10, 100, 90)
omega_m_range = np.linspace(0.05, 1, 95)
grid2d = np.dstack(np.meshgrid(H0_range, omega_m_ran... | creates an interpolation grid in H_0, omega_m and computes quantities in Dd and Ds_Dds
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Cosmo/cosmo_solver.py#L66-L85 |
sibirrer/lenstronomy | lenstronomy/Cosmo/cosmo_solver.py | InvertCosmo.get_cosmo | def get_cosmo(self, Dd, Ds_Dds):
"""
return the values of H0 and omega_m computed with an interpolation
:param Dd: flat
:param Ds_Dds: float
:return:
"""
if not hasattr(self, '_f_H0') or not hasattr(self, '_f_omega_m'):
self._make_interpolation()
... | python | def get_cosmo(self, Dd, Ds_Dds):
"""
return the values of H0 and omega_m computed with an interpolation
:param Dd: flat
:param Ds_Dds: float
:return:
"""
if not hasattr(self, '_f_H0') or not hasattr(self, '_f_omega_m'):
self._make_interpolation()
... | return the values of H0 and omega_m computed with an interpolation
:param Dd: flat
:param Ds_Dds: float
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Cosmo/cosmo_solver.py#L87-L103 |
sibirrer/lenstronomy | lenstronomy/LensModel/numerical_profile_integrals.py | ProfileIntegrals.mass_enclosed_3d | def mass_enclosed_3d(self, r, kwargs_profile):
"""
computes the mass enclosed within a sphere of radius r
:param r: radius (arcsec)
:param kwargs_profile: keyword argument list with lens model parameters
:return: 3d mass enclosed of r
"""
kwargs = copy.deepcopy(kw... | python | def mass_enclosed_3d(self, r, kwargs_profile):
"""
computes the mass enclosed within a sphere of radius r
:param r: radius (arcsec)
:param kwargs_profile: keyword argument list with lens model parameters
:return: 3d mass enclosed of r
"""
kwargs = copy.deepcopy(kw... | computes the mass enclosed within a sphere of radius r
:param r: radius (arcsec)
:param kwargs_profile: keyword argument list with lens model parameters
:return: 3d mass enclosed of r | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/numerical_profile_integrals.py#L22-L37 |
sibirrer/lenstronomy | lenstronomy/LensModel/numerical_profile_integrals.py | ProfileIntegrals.density_2d | def density_2d(self, r, kwargs_profile):
"""
computes the projected density along the line-of-sight
:param r: radius (arcsec)
:param kwargs_profile: keyword argument list with lens model parameters
:return: 2d projected density at projected radius r
"""
kwargs = c... | python | def density_2d(self, r, kwargs_profile):
"""
computes the projected density along the line-of-sight
:param r: radius (arcsec)
:param kwargs_profile: keyword argument list with lens model parameters
:return: 2d projected density at projected radius r
"""
kwargs = c... | computes the projected density along the line-of-sight
:param r: radius (arcsec)
:param kwargs_profile: keyword argument list with lens model parameters
:return: 2d projected density at projected radius r | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/numerical_profile_integrals.py#L39-L54 |
sibirrer/lenstronomy | lenstronomy/LensModel/numerical_profile_integrals.py | ProfileIntegrals.mass_enclosed_2d | def mass_enclosed_2d(self, r, kwargs_profile):
"""
computes the mass enclosed the projected line-of-sight
:param r: radius (arcsec)
:param kwargs_profile: keyword argument list with lens model parameters
:return: projected mass enclosed radius r
"""
kwargs = copy.... | python | def mass_enclosed_2d(self, r, kwargs_profile):
"""
computes the mass enclosed the projected line-of-sight
:param r: radius (arcsec)
:param kwargs_profile: keyword argument list with lens model parameters
:return: projected mass enclosed radius r
"""
kwargs = copy.... | computes the mass enclosed the projected line-of-sight
:param r: radius (arcsec)
:param kwargs_profile: keyword argument list with lens model parameters
:return: projected mass enclosed radius r | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/numerical_profile_integrals.py#L56-L71 |
sibirrer/lenstronomy | lenstronomy/Data/imaging_data.py | Data.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/imaging_data.py#L93-L102 |
sibirrer/lenstronomy | lenstronomy/Data/imaging_data.py | Data.C_D | def C_D(self):
"""
Covariance matrix of all pixel values in 2d numpy array (only diagonal component)
The covariance matrix is estimated from the data.
WARNING: For low count statistics, the noise in the data may lead to biased estimates of the covariance matrix.
:return: covaria... | python | def C_D(self):
"""
Covariance matrix of all pixel values in 2d numpy array (only diagonal component)
The covariance matrix is estimated from the data.
WARNING: For low count statistics, the noise in the data may lead to biased estimates of the covariance matrix.
:return: covaria... | Covariance matrix of all pixel values in 2d numpy array (only diagonal component)
The covariance matrix is estimated from the data.
WARNING: For low count statistics, the noise in the data may lead to biased estimates of the covariance matrix.
:return: covariance matrix of all pixel values in 2... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Data/imaging_data.py#L171-L184 |
sibirrer/lenstronomy | lenstronomy/Data/imaging_data.py | Data.covariance_matrix | def covariance_matrix(self, data, background_rms=1, exposure_map=1, noise_map=None, verbose=False):
"""
returns a diagonal matrix for the covariance estimation which describes the error
Notes:
- the exposure map must be positive definite. Values that deviate too much from the mean expo... | python | def covariance_matrix(self, data, background_rms=1, exposure_map=1, noise_map=None, verbose=False):
"""
returns a diagonal matrix for the covariance estimation which describes the error
Notes:
- the exposure map must be positive definite. Values that deviate too much from the mean expo... | returns a diagonal matrix for the covariance estimation which describes the error
Notes:
- the exposure map must be positive definite. Values that deviate too much from the mean exposure time will be
given a lower limit to not under-predict the Poisson component of the noise.
- th... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Data/imaging_data.py#L223-L257 |
sibirrer/lenstronomy | lenstronomy/LensModel/Solver/lens_equation_solver.py | LensEquationSolver.image_position_stochastic | def image_position_stochastic(self, source_x, source_y, kwargs_lens, search_window=10,
precision_limit=10**(-10), arrival_time_sort=True, x_center=0,
y_center=0, num_random=1000, verbose=False):
"""
Solves the lens equation stochastical... | python | def image_position_stochastic(self, source_x, source_y, kwargs_lens, search_window=10,
precision_limit=10**(-10), arrival_time_sort=True, x_center=0,
y_center=0, num_random=1000, verbose=False):
"""
Solves the lens equation stochastical... | Solves the lens equation stochastically with the scipy minimization routine on the quadratic distance between
the backwards ray-shooted proposed image position and the source position.
Credits to Giulia Pagano
:param source_x: source position
:param source_y: source position
:pa... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Solver/lens_equation_solver.py#L22-L55 |
sibirrer/lenstronomy | lenstronomy/LensModel/Solver/lens_equation_solver.py | LensEquationSolver.image_position_from_source | def image_position_from_source(self, sourcePos_x, sourcePos_y, kwargs_lens, min_distance=0.1, search_window=10,
precision_limit=10**(-10), num_iter_max=100, arrival_time_sort=True,
initial_guess_cut=True, verbose=False, x_center=0, y_center=0, num_ra... | python | def image_position_from_source(self, sourcePos_x, sourcePos_y, kwargs_lens, min_distance=0.1, search_window=10,
precision_limit=10**(-10), num_iter_max=100, arrival_time_sort=True,
initial_guess_cut=True, verbose=False, x_center=0, y_center=0, num_ra... | finds image position source position and lense model
:param sourcePos_x: source position in units of angle
:param sourcePos_y: source position in units of angle
:param kwargs_lens: lens model parameters as keyword arguments
:param min_distance: minimum separation to consider for two ima... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Solver/lens_equation_solver.py#L70-L130 |
sibirrer/lenstronomy | lenstronomy/LensModel/Solver/lens_equation_solver.py | LensEquationSolver.sort_arrival_times | def sort_arrival_times(self, x_mins, y_mins, kwargs_lens):
"""
sort arrival times (fermat potential) of image positions in increasing order of light travel time
:param x_mins: ra position of images
:param y_mins: dec position of images
:param kwargs_lens: keyword arguments of len... | python | def sort_arrival_times(self, x_mins, y_mins, kwargs_lens):
"""
sort arrival times (fermat potential) of image positions in increasing order of light travel time
:param x_mins: ra position of images
:param y_mins: dec position of images
:param kwargs_lens: keyword arguments of len... | sort arrival times (fermat potential) of image positions in increasing order of light travel time
:param x_mins: ra position of images
:param y_mins: dec position of images
:param kwargs_lens: keyword arguments of lens model
:return: sorted lists of x_mins and y_mins | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Solver/lens_equation_solver.py#L218-L244 |
sibirrer/lenstronomy | lenstronomy/PointSource/point_source_param.py | PointSourceParam.check_positive_flux | def check_positive_flux(cls, kwargs_ps):
"""
check whether inferred linear parameters are positive
:param kwargs_ps:
:return: bool
"""
pos_bool = True
for kwargs in kwargs_ps:
point_amp = kwargs['point_amp']
for amp in point_amp:
... | python | def check_positive_flux(cls, kwargs_ps):
"""
check whether inferred linear parameters are positive
:param kwargs_ps:
:return: bool
"""
pos_bool = True
for kwargs in kwargs_ps:
point_amp = kwargs['point_amp']
for amp in point_amp:
... | check whether inferred linear parameters are positive
:param kwargs_ps:
:return: bool | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/PointSource/point_source_param.py#L194-L208 |
sibirrer/lenstronomy | lenstronomy/Workflow/fitting_sequence.py | FittingSequence.best_fit_likelihood | def best_fit_likelihood(self):
"""
returns the log likelihood of the best fit model of the current state of this class
:return: log likelihood, float
"""
kwargs_lens, kwargs_source, kwargs_lens_light, kwargs_ps, kwargs_cosmo = self.best_fit(bijective=False)
param_class =... | python | def best_fit_likelihood(self):
"""
returns the log likelihood of the best fit model of the current state of this class
:return: log likelihood, float
"""
kwargs_lens, kwargs_source, kwargs_lens_light, kwargs_ps, kwargs_cosmo = self.best_fit(bijective=False)
param_class =... | returns the log likelihood of the best fit model of the current state of this class
:return: log likelihood, float | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Workflow/fitting_sequence.py#L96-L107 |
sibirrer/lenstronomy | lenstronomy/Workflow/fitting_sequence.py | FittingSequence.mcmc | def mcmc(self, n_burn, n_run, walkerRatio, sigma_scale=1, threadCount=1, init_samples=None, re_use_samples=True):
"""
MCMC routine
:param n_burn: number of burn in iterations (will not be saved)
:param n_run: number of MCMC iterations that are saved
:param walkerRatio: ratio of ... | python | def mcmc(self, n_burn, n_run, walkerRatio, sigma_scale=1, threadCount=1, init_samples=None, re_use_samples=True):
"""
MCMC routine
:param n_burn: number of burn in iterations (will not be saved)
:param n_run: number of MCMC iterations that are saved
:param walkerRatio: ratio of ... | MCMC routine
:param n_burn: number of burn in iterations (will not be saved)
:param n_run: number of MCMC iterations that are saved
:param walkerRatio: ratio of walkers/number of free parameters
:param sigma_scale: scaling of the initial parameter spread relative to the width in the ini... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Workflow/fitting_sequence.py#L129-L167 |
sibirrer/lenstronomy | lenstronomy/Workflow/fitting_sequence.py | FittingSequence.pso | def pso(self, n_particles, n_iterations, sigma_scale=1, print_key='PSO', threadCount=1):
"""
Particle Swarm Optimization
:param n_particles: number of particles in the Particle Swarm Optimization
:param n_iterations: number of iterations in the optimization process
:param sigma_... | python | def pso(self, n_particles, n_iterations, sigma_scale=1, print_key='PSO', threadCount=1):
"""
Particle Swarm Optimization
:param n_particles: number of particles in the Particle Swarm Optimization
:param n_iterations: number of iterations in the optimization process
:param sigma_... | Particle Swarm Optimization
:param n_particles: number of particles in the Particle Swarm Optimization
:param n_iterations: number of iterations in the optimization process
:param sigma_scale: scaling of the initial parameter spread relative to the width in the initial settings
:param p... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Workflow/fitting_sequence.py#L169-L196 |
sibirrer/lenstronomy | lenstronomy/Workflow/fitting_sequence.py | FittingSequence.psf_iteration | def psf_iteration(self, num_iter=10, no_break=True, stacking_method='median', block_center_neighbour=0, keep_psf_error_map=True,
psf_symmetry=1, psf_iter_factor=1, verbose=True, compute_bands=None):
"""
iterative PSF reconstruction
:param num_iter: number of iterations in the p... | python | def psf_iteration(self, num_iter=10, no_break=True, stacking_method='median', block_center_neighbour=0, keep_psf_error_map=True,
psf_symmetry=1, psf_iter_factor=1, verbose=True, compute_bands=None):
"""
iterative PSF reconstruction
:param num_iter: number of iterations in the p... | iterative PSF reconstruction
:param num_iter: number of iterations in the process
:param no_break: bool, if False will break the process as soon as one step lead to a wors reconstruction then the previous step
:param stacking_method: string, 'median' and 'mean' supported
:param block_ce... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Workflow/fitting_sequence.py#L198-L239 |
sibirrer/lenstronomy | lenstronomy/Workflow/fitting_sequence.py | FittingSequence.align_images | def align_images(self, n_particles=10, n_iterations=10, lowerLimit=-0.2, upperLimit=0.2, threadCount=1,
compute_bands=None):
"""
aligns the coordinate systems of different exposures within a fixed model parameterisation by executing a PSO
with relative coordinate shifts as f... | python | def align_images(self, n_particles=10, n_iterations=10, lowerLimit=-0.2, upperLimit=0.2, threadCount=1,
compute_bands=None):
"""
aligns the coordinate systems of different exposures within a fixed model parameterisation by executing a PSO
with relative coordinate shifts as f... | aligns the coordinate systems of different exposures within a fixed model parameterisation by executing a PSO
with relative coordinate shifts as free parameters
:param n_particles: number of particles in the Particle Swarm Optimization
:param n_iterations: number of iterations in the optimizati... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Workflow/fitting_sequence.py#L241-L277 |
sibirrer/lenstronomy | lenstronomy/Workflow/fitting_sequence.py | FittingSequence.update_settings | def update_settings(self, kwargs_model={}, kwargs_constraints={}, kwargs_likelihood={}, lens_add_fixed=[],
source_add_fixed=[], lens_light_add_fixed=[], ps_add_fixed=[], cosmo_add_fixed=[], lens_remove_fixed=[],
source_remove_fixed=[], lens_light_remove_fixed=[], ps_remove_fixe... | python | def update_settings(self, kwargs_model={}, kwargs_constraints={}, kwargs_likelihood={}, lens_add_fixed=[],
source_add_fixed=[], lens_light_add_fixed=[], ps_add_fixed=[], cosmo_add_fixed=[], lens_remove_fixed=[],
source_remove_fixed=[], lens_light_remove_fixed=[], ps_remove_fixe... | updates lenstronomy settings "on the fly"
:param kwargs_model: kwargs, specified keyword arguments overwrite the existing ones
:param kwargs_constraints: kwargs, specified keyword arguments overwrite the existing ones
:param kwargs_likelihood: kwargs, specified keyword arguments overwrite the e... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Workflow/fitting_sequence.py#L279-L307 |
sibirrer/lenstronomy | lenstronomy/ImSim/de_lens.py | get_param_WLS | def get_param_WLS(A, C_D_inv, d, inv_bool=True):
"""
returns the parameter values given
:param A: response matrix Nd x Ns (Nd = # data points, Ns = # parameters)
:param C_D_inv: inverse covariance matrix of the data, Nd x Nd, diagonal form
:param d: data array, 1-d Nd
:param inv_bool: boolean, w... | python | def get_param_WLS(A, C_D_inv, d, inv_bool=True):
"""
returns the parameter values given
:param A: response matrix Nd x Ns (Nd = # data points, Ns = # parameters)
:param C_D_inv: inverse covariance matrix of the data, Nd x Nd, diagonal form
:param d: data array, 1-d Nd
:param inv_bool: boolean, w... | returns the parameter values given
:param A: response matrix Nd x Ns (Nd = # data points, Ns = # parameters)
:param C_D_inv: inverse covariance matrix of the data, Nd x Nd, diagonal form
:param d: data array, 1-d Nd
:param inv_bool: boolean, wheter returning also the inverse matrix or just solve the lin... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/ImSim/de_lens.py#L7-L38 |
sibirrer/lenstronomy | lenstronomy/GalKin/anisotropy.py | MamonLokasAnisotropy.K | def K(self, r, R, kwargs):
"""
equation A16 im Mamon & Lokas
:param r: 3d radius
:param R: projected 2d radius
:return:
"""
u = r / R
if np.min(u) < 1:
raise ValueError("3d radius is smaller than projected radius! Does not make sense.")
... | python | def K(self, r, R, kwargs):
"""
equation A16 im Mamon & Lokas
:param r: 3d radius
:param R: projected 2d radius
:return:
"""
u = r / R
if np.min(u) < 1:
raise ValueError("3d radius is smaller than projected radius! Does not make sense.")
... | equation A16 im Mamon & Lokas
:param r: 3d radius
:param R: projected 2d radius
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/GalKin/anisotropy.py#L23-L61 |
sibirrer/lenstronomy | lenstronomy/GalKin/anisotropy.py | MamonLokasAnisotropy.beta_r | def beta_r(self, r, kwargs):
"""
returns the anisotorpy parameter at a given radius
:param r:
:return:
"""
if self._type == 'const':
return self.const_beta(kwargs)
elif self._type == 'OsipkovMerritt':
return self.ospikov_meritt(r, kwargs)
... | python | def beta_r(self, r, kwargs):
"""
returns the anisotorpy parameter at a given radius
:param r:
:return:
"""
if self._type == 'const':
return self.const_beta(kwargs)
elif self._type == 'OsipkovMerritt':
return self.ospikov_meritt(r, kwargs)
... | returns the anisotorpy parameter at a given radius
:param r:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/GalKin/anisotropy.py#L63-L80 |
sibirrer/lenstronomy | lenstronomy/GalKin/anisotropy.py | MamonLokasAnisotropy._B | def _B(self, x, a, b):
"""
incomplete Beta function as described in Mamon&Lokas A13
:param x:
:param a:
:param b:
:return:
"""
return special.betainc(a, b, x) * special.beta(a, b) | python | def _B(self, x, a, b):
"""
incomplete Beta function as described in Mamon&Lokas A13
:param x:
:param a:
:param b:
:return:
"""
return special.betainc(a, b, x) * special.beta(a, b) | incomplete Beta function as described in Mamon&Lokas A13
:param x:
:param a:
:param b:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/GalKin/anisotropy.py#L82-L91 |
sibirrer/lenstronomy | lenstronomy/GalKin/anisotropy.py | Anisotropy.beta_r | def beta_r(self, r, kwargs):
"""
returns the anisotorpy parameter at a given radius
:param r:
:return:
"""
if self._type == 'const':
return self.const_beta(kwargs)
elif self._type == 'r_ani':
return self.beta_r_ani(r, kwargs)
else:
... | python | def beta_r(self, r, kwargs):
"""
returns the anisotorpy parameter at a given radius
:param r:
:return:
"""
if self._type == 'const':
return self.const_beta(kwargs)
elif self._type == 'r_ani':
return self.beta_r_ani(r, kwargs)
else:
... | returns the anisotorpy parameter at a given radius
:param r:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/GalKin/anisotropy.py#L130-L141 |
sibirrer/lenstronomy | lenstronomy/SimulationAPI/data_api.py | DataAPI.data_class | def data_class(self):
"""
creates a Data() instance of lenstronomy based on knowledge of the observation
:return: instance of Data() class
"""
x_grid, y_grid, ra_at_xy_0, dec_at_xy_0, x_at_radec_0, y_at_radec_0, Mpix2coord, Mcoord2pix = util.make_grid_with_coordtransform(
... | python | def data_class(self):
"""
creates a Data() instance of lenstronomy based on knowledge of the observation
:return: instance of Data() class
"""
x_grid, y_grid, ra_at_xy_0, dec_at_xy_0, x_at_radec_0, y_at_radec_0, Mpix2coord, Mcoord2pix = util.make_grid_with_coordtransform(
... | creates a Data() instance of lenstronomy based on knowledge of the observation
:return: instance of Data() class | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/SimulationAPI/data_api.py#L25-L38 |
sibirrer/lenstronomy | lenstronomy/SimulationAPI/data_api.py | DataAPI.psf_class | def psf_class(self):
"""
creates instance of PSF() class based on knowledge of the observations
For the full possibility of how to create such an instance, see the PSF() class documentation
:return: instance of PSF() class
"""
if self._psf_type == 'GAUSSIAN':
... | python | def psf_class(self):
"""
creates instance of PSF() class based on knowledge of the observations
For the full possibility of how to create such an instance, see the PSF() class documentation
:return: instance of PSF() class
"""
if self._psf_type == 'GAUSSIAN':
... | creates instance of PSF() class based on knowledge of the observations
For the full possibility of how to create such an instance, see the PSF() class documentation
:return: instance of PSF() class | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/SimulationAPI/data_api.py#L41-L60 |
sibirrer/lenstronomy | lenstronomy/Workflow/update_manager.py | UpdateManager.update_options | def update_options(self, kwargs_model, kwargs_constraints, kwargs_likelihood):
"""
updates the options by overwriting the kwargs with the new ones being added/changed
WARNING: some updates may not be valid depending on the model options. Use carefully!
:param kwargs_model:
:para... | python | def update_options(self, kwargs_model, kwargs_constraints, kwargs_likelihood):
"""
updates the options by overwriting the kwargs with the new ones being added/changed
WARNING: some updates may not be valid depending on the model options. Use carefully!
:param kwargs_model:
:para... | updates the options by overwriting the kwargs with the new ones being added/changed
WARNING: some updates may not be valid depending on the model options. Use carefully!
:param kwargs_model:
:param kwargs_constraints:
:param kwargs_likelihood:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Workflow/update_manager.py#L93-L106 |
sibirrer/lenstronomy | lenstronomy/Workflow/update_manager.py | UpdateManager.update_limits | def update_limits(self, change_source_lower_limit=None, change_source_upper_limit=None):
"""
updates the limits (lower and upper) of the update manager instance
:param change_source_lower_limit: [[i_model, ['param_name', ...], [value1, value2, ...]]]
:return: updates internal state of l... | python | def update_limits(self, change_source_lower_limit=None, change_source_upper_limit=None):
"""
updates the limits (lower and upper) of the update manager instance
:param change_source_lower_limit: [[i_model, ['param_name', ...], [value1, value2, ...]]]
:return: updates internal state of l... | updates the limits (lower and upper) of the update manager instance
:param change_source_lower_limit: [[i_model, ['param_name', ...], [value1, value2, ...]]]
:return: updates internal state of lower and upper limits accessible from outside | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Workflow/update_manager.py#L108-L118 |
sibirrer/lenstronomy | lenstronomy/Workflow/update_manager.py | UpdateManager.update_fixed | def update_fixed(self, kwargs_lens, kwargs_source, kwargs_lens_light, kwargs_ps, kwargs_cosmo, lens_add_fixed=[],
source_add_fixed=[], lens_light_add_fixed=[], ps_add_fixed=[], cosmo_add_fixed=[], lens_remove_fixed=[],
source_remove_fixed=[], lens_light_remove_fixed=[], ps_remo... | python | def update_fixed(self, kwargs_lens, kwargs_source, kwargs_lens_light, kwargs_ps, kwargs_cosmo, lens_add_fixed=[],
source_add_fixed=[], lens_light_add_fixed=[], ps_add_fixed=[], cosmo_add_fixed=[], lens_remove_fixed=[],
source_remove_fixed=[], lens_light_remove_fixed=[], ps_remo... | adds the values of the keyword arguments that are stated in the _add_fixed to the existing fixed arguments.
:param kwargs_lens:
:param kwargs_source:
:param kwargs_lens_light:
:param kwargs_ps:
:param kwargs_cosmo:
:param lens_add_fixed:
:param source_add_fixed:
... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Workflow/update_manager.py#L136-L171 |
sibirrer/lenstronomy | lenstronomy/GalKin/analytic_kinematics.py | AnalyticKinematics.vel_disp | def vel_disp(self, gamma, theta_E, r_eff, r_ani, R_slit, dR_slit, FWHM, rendering_number=1000):
"""
computes the averaged LOS velocity dispersion in the slit (convolved)
:param gamma: power-law slope of the mass profile (isothermal = 2)
:param theta_E: Einstein radius of the lens (in ar... | python | def vel_disp(self, gamma, theta_E, r_eff, r_ani, R_slit, dR_slit, FWHM, rendering_number=1000):
"""
computes the averaged LOS velocity dispersion in the slit (convolved)
:param gamma: power-law slope of the mass profile (isothermal = 2)
:param theta_E: Einstein radius of the lens (in ar... | computes the averaged LOS velocity dispersion in the slit (convolved)
:param gamma: power-law slope of the mass profile (isothermal = 2)
:param theta_E: Einstein radius of the lens (in arcseconds)
:param r_eff: half light radius of the Hernquist profile (or as an approximation of any other prof... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/GalKin/analytic_kinematics.py#L38-L60 |
sibirrer/lenstronomy | lenstronomy/GalKin/analytic_kinematics.py | AnalyticKinematics.vel_disp_one | def vel_disp_one(self, gamma, rho0_r0_gamma, r_eff, r_ani, R_slit, dR_slit, FWHM):
"""
computes one realisation of the velocity dispersion realized in the slit
:param gamma: power-law slope of the mass profile (isothermal = 2)
:param rho0_r0_gamma: combination of Einstein radius and pow... | python | def vel_disp_one(self, gamma, rho0_r0_gamma, r_eff, r_ani, R_slit, dR_slit, FWHM):
"""
computes one realisation of the velocity dispersion realized in the slit
:param gamma: power-law slope of the mass profile (isothermal = 2)
:param rho0_r0_gamma: combination of Einstein radius and pow... | computes one realisation of the velocity dispersion realized in the slit
:param gamma: power-law slope of the mass profile (isothermal = 2)
:param rho0_r0_gamma: combination of Einstein radius and power-law slope as equation (14) in Suyu+ 2010
:param r_eff: half light radius of the Hernquist pr... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/GalKin/analytic_kinematics.py#L67-L89 |
sibirrer/lenstronomy | lenstronomy/GalKin/analytic_kinematics.py | AnalyticKinematics.R_r | def R_r(self, r):
"""
draws a random projection from radius r in 2d and 1d
:param r: 3d radius
:return: R, x, y
"""
phi = np.random.uniform(0, 2*np.pi)
theta = np.random.uniform(0, np.pi)
x = r * np.sin(theta) * np.cos(phi)
y = r * np.sin(theta) * ... | python | def R_r(self, r):
"""
draws a random projection from radius r in 2d and 1d
:param r: 3d radius
:return: R, x, y
"""
phi = np.random.uniform(0, 2*np.pi)
theta = np.random.uniform(0, np.pi)
x = r * np.sin(theta) * np.cos(phi)
y = r * np.sin(theta) * ... | draws a random projection from radius r in 2d and 1d
:param r: 3d radius
:return: R, x, y | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/GalKin/analytic_kinematics.py#L101-L112 |
sibirrer/lenstronomy | lenstronomy/GalKin/analytic_kinematics.py | AnalyticKinematics.sigma_s2 | def sigma_s2(self, r, R, r_ani, a, gamma, rho0_r0_gamma):
"""
projected velocity dispersion
:param r:
:param R:
:param r_ani:
:param a:
:param gamma:
:param phi_E:
:return:
"""
beta = self._beta_ani(r, r_ani)
return (1 - bet... | python | def sigma_s2(self, r, R, r_ani, a, gamma, rho0_r0_gamma):
"""
projected velocity dispersion
:param r:
:param R:
:param r_ani:
:param a:
:param gamma:
:param phi_E:
:return:
"""
beta = self._beta_ani(r, r_ani)
return (1 - bet... | projected velocity dispersion
:param r:
:param R:
:param r_ani:
:param a:
:param gamma:
:param phi_E:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/GalKin/analytic_kinematics.py#L144-L156 |
sibirrer/lenstronomy | lenstronomy/GalKin/analytic_kinematics.py | AnalyticKinematics.sigma_r2 | def sigma_r2(self, r, a, gamma, rho0_r0_gamma, r_ani):
"""
equation (19) in Suyu+ 2010
"""
# first term
prefac1 = 4*np.pi * const.G * a**(-gamma) * rho0_r0_gamma / (3-gamma)
prefac2 = r * (r + a)**3/(r**2 + r_ani**2)
hyp1 = vel_util.hyp_2F1(a=2+gamma, b=gamma, c=3... | python | def sigma_r2(self, r, a, gamma, rho0_r0_gamma, r_ani):
"""
equation (19) in Suyu+ 2010
"""
# first term
prefac1 = 4*np.pi * const.G * a**(-gamma) * rho0_r0_gamma / (3-gamma)
prefac2 = r * (r + a)**3/(r**2 + r_ani**2)
hyp1 = vel_util.hyp_2F1(a=2+gamma, b=gamma, c=3... | equation (19) in Suyu+ 2010 | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/GalKin/analytic_kinematics.py#L158-L168 |
sibirrer/lenstronomy | lenstronomy/Analysis/lens_analysis.py | LensAnalysis.ellipticity_lens_light | def ellipticity_lens_light(self, kwargs_lens_light, center_x=0, center_y=0, model_bool_list=None, deltaPix=None,
numPix=None):
"""
make sure that the window covers all the light, otherwise the moments may give to low answers.
:param kwargs_lens_light:
:par... | python | def ellipticity_lens_light(self, kwargs_lens_light, center_x=0, center_y=0, model_bool_list=None, deltaPix=None,
numPix=None):
"""
make sure that the window covers all the light, otherwise the moments may give to low answers.
:param kwargs_lens_light:
:par... | make sure that the window covers all the light, otherwise the moments may give to low answers.
:param kwargs_lens_light:
:param center_x:
:param center_y:
:param model_bool_list:
:param deltaPix:
:param numPix:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Analysis/lens_analysis.py#L42-L66 |
sibirrer/lenstronomy | lenstronomy/Analysis/lens_analysis.py | LensAnalysis.half_light_radius_lens | def half_light_radius_lens(self, kwargs_lens_light, center_x=0, center_y=0, model_bool_list=None, deltaPix=None, numPix=None):
"""
computes numerically the half-light-radius of the deflector light and the total photon flux
:param kwargs_lens_light:
:return:
"""
if model_... | python | def half_light_radius_lens(self, kwargs_lens_light, center_x=0, center_y=0, model_bool_list=None, deltaPix=None, numPix=None):
"""
computes numerically the half-light-radius of the deflector light and the total photon flux
:param kwargs_lens_light:
:return:
"""
if model_... | computes numerically the half-light-radius of the deflector light and the total photon flux
:param kwargs_lens_light:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Analysis/lens_analysis.py#L68-L86 |
sibirrer/lenstronomy | lenstronomy/Analysis/lens_analysis.py | LensAnalysis.half_light_radius_source | def half_light_radius_source(self, kwargs_source, center_x=0, center_y=0, deltaPix=None, numPix=None):
"""
computes numerically the half-light-radius of the deflector light and the total photon flux
:param kwargs_source:
:return:
"""
if numPix is None:
numPix... | python | def half_light_radius_source(self, kwargs_source, center_x=0, center_y=0, deltaPix=None, numPix=None):
"""
computes numerically the half-light-radius of the deflector light and the total photon flux
:param kwargs_source:
:return:
"""
if numPix is None:
numPix... | computes numerically the half-light-radius of the deflector light and the total photon flux
:param kwargs_source:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Analysis/lens_analysis.py#L88-L104 |
sibirrer/lenstronomy | lenstronomy/Analysis/lens_analysis.py | LensAnalysis._lens_light_internal | def _lens_light_internal(self, x_grid, y_grid, kwargs_lens_light, model_bool_list=None):
"""
evaluates only part of the light profiles
:param x_grid:
:param y_grid:
:param kwargs_lens_light:
:return:
"""
if model_bool_list is None:
model_bool_... | python | def _lens_light_internal(self, x_grid, y_grid, kwargs_lens_light, model_bool_list=None):
"""
evaluates only part of the light profiles
:param x_grid:
:param y_grid:
:param kwargs_lens_light:
:return:
"""
if model_bool_list is None:
model_bool_... | evaluates only part of the light profiles
:param x_grid:
:param y_grid:
:param kwargs_lens_light:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Analysis/lens_analysis.py#L106-L122 |
sibirrer/lenstronomy | lenstronomy/Analysis/lens_analysis.py | LensAnalysis.multi_gaussian_lens_light | def multi_gaussian_lens_light(self, kwargs_lens_light, model_bool_list=None, e1=0, e2=0, n_comp=20, deltaPix=None, numPix=None):
"""
multi-gaussian decomposition of the lens light profile (in 1-dimension)
:param kwargs_lens_light:
:param n_comp:
:return:
"""
if '... | python | def multi_gaussian_lens_light(self, kwargs_lens_light, model_bool_list=None, e1=0, e2=0, n_comp=20, deltaPix=None, numPix=None):
"""
multi-gaussian decomposition of the lens light profile (in 1-dimension)
:param kwargs_lens_light:
:param n_comp:
:return:
"""
if '... | multi-gaussian decomposition of the lens light profile (in 1-dimension)
:param kwargs_lens_light:
:param n_comp:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Analysis/lens_analysis.py#L124-L147 |
sibirrer/lenstronomy | lenstronomy/Analysis/lens_analysis.py | LensAnalysis.multi_gaussian_lens | def multi_gaussian_lens(self, kwargs_lens, model_bool_list=None, e1=0, e2=0, n_comp=20):
"""
multi-gaussian lens model in convergence space
:param kwargs_lens:
:param n_comp:
:return:
"""
if 'center_x' in kwargs_lens[0]:
center_x = kwargs_lens[0]['cen... | python | def multi_gaussian_lens(self, kwargs_lens, model_bool_list=None, e1=0, e2=0, n_comp=20):
"""
multi-gaussian lens model in convergence space
:param kwargs_lens:
:param n_comp:
:return:
"""
if 'center_x' in kwargs_lens[0]:
center_x = kwargs_lens[0]['cen... | multi-gaussian lens model in convergence space
:param kwargs_lens:
:param n_comp:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Analysis/lens_analysis.py#L149-L175 |
sibirrer/lenstronomy | lenstronomy/Analysis/lens_analysis.py | LensAnalysis.flux_components | def flux_components(self, kwargs_light, n_grid=400, delta_grid=0.01, deltaPix=0.05, type="lens"):
"""
computes the total flux in each component of the model
:param kwargs_light:
:param n_grid:
:param delta_grid:
:return:
"""
flux_list = []
R_h_lis... | python | def flux_components(self, kwargs_light, n_grid=400, delta_grid=0.01, deltaPix=0.05, type="lens"):
"""
computes the total flux in each component of the model
:param kwargs_light:
:param n_grid:
:param delta_grid:
:return:
"""
flux_list = []
R_h_lis... | computes the total flux in each component of the model
:param kwargs_light:
:param n_grid:
:param delta_grid:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Analysis/lens_analysis.py#L177-L204 |
sibirrer/lenstronomy | lenstronomy/Analysis/lens_analysis.py | LensAnalysis.error_map_source | def error_map_source(self, kwargs_source, x_grid, y_grid, cov_param):
"""
variance of the linear source reconstruction in the source plane coordinates,
computed by the diagonal elements of the covariance matrix of the source reconstruction as a sum of the errors
of the basis set.
... | python | def error_map_source(self, kwargs_source, x_grid, y_grid, cov_param):
"""
variance of the linear source reconstruction in the source plane coordinates,
computed by the diagonal elements of the covariance matrix of the source reconstruction as a sum of the errors
of the basis set.
... | variance of the linear source reconstruction in the source plane coordinates,
computed by the diagonal elements of the covariance matrix of the source reconstruction as a sum of the errors
of the basis set.
:param kwargs_source: keyword arguments of source model
:param x_grid: x-axis of... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Analysis/lens_analysis.py#L206-L226 |
sibirrer/lenstronomy | lenstronomy/Analysis/lens_analysis.py | LensAnalysis.light2mass_interpol | def light2mass_interpol(lens_light_model_list, kwargs_lens_light, numPix=100, deltaPix=0.05, subgrid_res=5, center_x=0, center_y=0):
"""
takes a lens light model and turns it numerically in a lens model
(with all lensmodel quantities computed on a grid). Then provides an interpolated grid for th... | python | def light2mass_interpol(lens_light_model_list, kwargs_lens_light, numPix=100, deltaPix=0.05, subgrid_res=5, center_x=0, center_y=0):
"""
takes a lens light model and turns it numerically in a lens model
(with all lensmodel quantities computed on a grid). Then provides an interpolated grid for th... | takes a lens light model and turns it numerically in a lens model
(with all lensmodel quantities computed on a grid). Then provides an interpolated grid for the quantities.
:param kwargs_lens_light: lens light keyword argument list
:param numPix: number of pixels per axis for the return interpo... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Analysis/lens_analysis.py#L253-L303 |
sibirrer/lenstronomy | lenstronomy/Analysis/lens_analysis.py | LensAnalysis.mass_fraction_within_radius | def mass_fraction_within_radius(self, kwargs_lens, center_x, center_y, theta_E, numPix=100):
"""
computes the mean convergence of all the different lens model components within a spherical aperture
:param kwargs_lens: lens model keyword argument list
:param center_x: center of the apert... | python | def mass_fraction_within_radius(self, kwargs_lens, center_x, center_y, theta_E, numPix=100):
"""
computes the mean convergence of all the different lens model components within a spherical aperture
:param kwargs_lens: lens model keyword argument list
:param center_x: center of the apert... | computes the mean convergence of all the different lens model components within a spherical aperture
:param kwargs_lens: lens model keyword argument list
:param center_x: center of the aperture
:param center_y: center of the aperture
:param theta_E: radius of aperture
:return: l... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Analysis/lens_analysis.py#L305-L324 |
sibirrer/lenstronomy | lenstronomy/PointSource/point_source.py | PointSource.update_search_window | def update_search_window(self, search_window, x_center, y_center):
"""
update the search area for the lens equation solver
:param search_window: search_window: window size of the image position search with the lens equation solver.
:param x_center: center of search window
:param... | python | def update_search_window(self, search_window, x_center, y_center):
"""
update the search area for the lens equation solver
:param search_window: search_window: window size of the image position search with the lens equation solver.
:param x_center: center of search window
:param... | update the search area for the lens equation solver
:param search_window: search_window: window size of the image position search with the lens equation solver.
:param x_center: center of search window
:param y_center: center of search window
:return: updated self instances | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/PointSource/point_source.py#L60-L69 |
sibirrer/lenstronomy | lenstronomy/PointSource/point_source.py | PointSource.point_source_list | def point_source_list(self, kwargs_ps, kwargs_lens, k=None):
"""
returns the coordinates and amplitudes of all point sources in a single array
:param kwargs_ps:
:param kwargs_lens:
:return:
"""
ra_list, dec_list = self.image_position(kwargs_ps, kwargs_lens, k=k)
... | python | def point_source_list(self, kwargs_ps, kwargs_lens, k=None):
"""
returns the coordinates and amplitudes of all point sources in a single array
:param kwargs_ps:
:param kwargs_lens:
:return:
"""
ra_list, dec_list = self.image_position(kwargs_ps, kwargs_lens, k=k)
... | returns the coordinates and amplitudes of all point sources in a single array
:param kwargs_ps:
:param kwargs_lens:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/PointSource/point_source.py#L140-L156 |
sibirrer/lenstronomy | lenstronomy/PointSource/point_source.py | PointSource.image_amplitude | def image_amplitude(self, kwargs_ps, kwargs_lens, k=None):
"""
returns the image amplitudes
:param kwargs_ps:
:param kwargs_lens:
:return:
"""
amp_list = []
for i, model in enumerate(self._point_source_list):
if k is None or k == i:
... | python | def image_amplitude(self, kwargs_ps, kwargs_lens, k=None):
"""
returns the image amplitudes
:param kwargs_ps:
:param kwargs_lens:
:return:
"""
amp_list = []
for i, model in enumerate(self._point_source_list):
if k is None or k == i:
... | returns the image amplitudes
:param kwargs_ps:
:param kwargs_lens:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/PointSource/point_source.py#L168-L184 |
sibirrer/lenstronomy | lenstronomy/PointSource/point_source.py | PointSource.source_amplitude | def source_amplitude(self, kwargs_ps, kwargs_lens):
"""
returns the source amplitudes
:param kwargs_ps:
:param kwargs_lens:
:return:
"""
amp_list = []
for i, model in enumerate(self._point_source_list):
amp_list.append(model.source_amplitude(k... | python | def source_amplitude(self, kwargs_ps, kwargs_lens):
"""
returns the source amplitudes
:param kwargs_ps:
:param kwargs_lens:
:return:
"""
amp_list = []
for i, model in enumerate(self._point_source_list):
amp_list.append(model.source_amplitude(k... | returns the source amplitudes
:param kwargs_ps:
:param kwargs_lens:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/PointSource/point_source.py#L186-L197 |
sibirrer/lenstronomy | lenstronomy/PointSource/point_source.py | PointSource.check_image_positions | def check_image_positions(self, kwargs_ps, kwargs_lens, tolerance=0.001):
"""
checks whether the point sources in kwargs_ps satisfy the lens equation with a tolerance
(computed by ray-tracing in the source plane)
:param kwargs_ps:
:param kwargs_lens:
:param tolerance:
... | python | def check_image_positions(self, kwargs_ps, kwargs_lens, tolerance=0.001):
"""
checks whether the point sources in kwargs_ps satisfy the lens equation with a tolerance
(computed by ray-tracing in the source plane)
:param kwargs_ps:
:param kwargs_lens:
:param tolerance:
... | checks whether the point sources in kwargs_ps satisfy the lens equation with a tolerance
(computed by ray-tracing in the source plane)
:param kwargs_ps:
:param kwargs_lens:
:param tolerance:
:return: bool: True, if requirement on tolerance is fulfilled, False if not. | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/PointSource/point_source.py#L258-L277 |
sibirrer/lenstronomy | lenstronomy/PointSource/point_source.py | PointSource.re_normalize_flux | def re_normalize_flux(self, kwargs_ps, norm_factor):
"""
renormalizes the point source amplitude keywords by a factor
:param kwargs_ps_updated:
:param norm_factor:
:return:
"""
for i, model in enumerate(self.point_source_type_list):
if model == 'UNLEN... | python | def re_normalize_flux(self, kwargs_ps, norm_factor):
"""
renormalizes the point source amplitude keywords by a factor
:param kwargs_ps_updated:
:param norm_factor:
:return:
"""
for i, model in enumerate(self.point_source_type_list):
if model == 'UNLEN... | renormalizes the point source amplitude keywords by a factor
:param kwargs_ps_updated:
:param norm_factor:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/PointSource/point_source.py#L279-L295 |
sibirrer/lenstronomy | lenstronomy/LensModel/lens_model_extensions.py | LensModelExtensions.magnification_finite | def magnification_finite(self, x_pos, y_pos, kwargs_lens, source_sigma=0.003, window_size=0.1, grid_number=100,
shape="GAUSSIAN", polar_grid=False, aspect_ratio=0.5):
"""
returns the magnification of an extended source with Gaussian light profile
:param x_pos: x-axis... | python | def magnification_finite(self, x_pos, y_pos, kwargs_lens, source_sigma=0.003, window_size=0.1, grid_number=100,
shape="GAUSSIAN", polar_grid=False, aspect_ratio=0.5):
"""
returns the magnification of an extended source with Gaussian light profile
:param x_pos: x-axis... | returns the magnification of an extended source with Gaussian light profile
:param x_pos: x-axis positons of point sources
:param y_pos: y-axis position of point sources
:param kwargs_lens: lens model kwargs
:param source_sigma: Gaussian sigma in arc sec in source
:param window_s... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/lens_model_extensions.py#L25-L71 |
sibirrer/lenstronomy | lenstronomy/LensModel/lens_model_extensions.py | LensModelExtensions._tiling_crit | def _tiling_crit(self, edge1, edge2, edge_90, max_order, kwargs_lens):
"""
tiles a rectangular triangle and compares the signs of the magnification
:param edge1: [ra_coord, dec_coord, magnification]
:param edge2: [ra_coord, dec_coord, magnification]
:param edge_90: [ra_coord, de... | python | def _tiling_crit(self, edge1, edge2, edge_90, max_order, kwargs_lens):
"""
tiles a rectangular triangle and compares the signs of the magnification
:param edge1: [ra_coord, dec_coord, magnification]
:param edge2: [ra_coord, dec_coord, magnification]
:param edge_90: [ra_coord, de... | tiles a rectangular triangle and compares the signs of the magnification
:param edge1: [ra_coord, dec_coord, magnification]
:param edge2: [ra_coord, dec_coord, magnification]
:param edge_90: [ra_coord, dec_coord, magnification]
:param max_order: maximal order to fold triangle
:r... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/lens_model_extensions.py#L106-L142 |
sibirrer/lenstronomy | lenstronomy/LensModel/lens_model_extensions.py | LensModelExtensions.effective_einstein_radius | def effective_einstein_radius(self, kwargs_lens_list, k=None, spacing=1000):
"""
computes the radius with mean convergence=1
:param kwargs_lens:
:param spacing: number of annular bins to compute the convergence (resolution of the Einstein radius estimate)
:return:
"""
... | python | def effective_einstein_radius(self, kwargs_lens_list, k=None, spacing=1000):
"""
computes the radius with mean convergence=1
:param kwargs_lens:
:param spacing: number of annular bins to compute the convergence (resolution of the Einstein radius estimate)
:return:
"""
... | computes the radius with mean convergence=1
:param kwargs_lens:
:param spacing: number of annular bins to compute the convergence (resolution of the Einstein radius estimate)
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/lens_model_extensions.py#L178-L212 |
sibirrer/lenstronomy | lenstronomy/LensModel/lens_model_extensions.py | LensModelExtensions.external_lensing_effect | def external_lensing_effect(self, kwargs_lens, lens_model_internal_bool=None):
"""
computes deflection, shear and convergence at (0,0) for those part of the lens model not included in the main deflector
:param kwargs_lens:
:return:
"""
alpha0_x, alpha0_y = 0, 0
k... | python | def external_lensing_effect(self, kwargs_lens, lens_model_internal_bool=None):
"""
computes deflection, shear and convergence at (0,0) for those part of the lens model not included in the main deflector
:param kwargs_lens:
:return:
"""
alpha0_x, alpha0_y = 0, 0
k... | computes deflection, shear and convergence at (0,0) for those part of the lens model not included in the main deflector
:param kwargs_lens:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/lens_model_extensions.py#L214-L235 |
sibirrer/lenstronomy | lenstronomy/LensModel/lens_model_extensions.py | LensModelExtensions.lens_center | def lens_center(self, kwargs_lens, k=None, bool_list=None, numPix=200, deltaPix=0.01, center_x_init=0, center_y_init=0):
"""
computes the convergence weighted center of a lens model
:param kwargs_lens: lens model keyword argument list
:param bool_list: bool list (optional) to include ce... | python | def lens_center(self, kwargs_lens, k=None, bool_list=None, numPix=200, deltaPix=0.01, center_x_init=0, center_y_init=0):
"""
computes the convergence weighted center of a lens model
:param kwargs_lens: lens model keyword argument list
:param bool_list: bool list (optional) to include ce... | computes the convergence weighted center of a lens model
:param kwargs_lens: lens model keyword argument list
:param bool_list: bool list (optional) to include certain models or not
:return: center_x, center_y | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/lens_model_extensions.py#L255-L276 |
sibirrer/lenstronomy | lenstronomy/LensModel/lens_model_extensions.py | LensModelExtensions.profile_slope | def profile_slope(self, kwargs_lens_list, lens_model_internal_bool=None, num_points=10):
"""
computes the logarithmic power-law slope of a profile
:param kwargs_lens_list: lens model keyword argument list
:param lens_model_internal_bool: bool list, indicate which part of the model to co... | python | def profile_slope(self, kwargs_lens_list, lens_model_internal_bool=None, num_points=10):
"""
computes the logarithmic power-law slope of a profile
:param kwargs_lens_list: lens model keyword argument list
:param lens_model_internal_bool: bool list, indicate which part of the model to co... | computes the logarithmic power-law slope of a profile
:param kwargs_lens_list: lens model keyword argument list
:param lens_model_internal_bool: bool list, indicate which part of the model to consider
:param num_points: number of estimates around the Einstein radius
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/lens_model_extensions.py#L278-L303 |
sibirrer/lenstronomy | lenstronomy/LensModel/numeric_lens_differentials.py | NumericLens.kappa | def kappa(self, x, y, kwargs, diff=diff):
"""
computes the convergence
:return: kappa
"""
f_xx, f_xy, f_yx, f_yy = self.hessian(x, y, kwargs, diff=diff)
kappa = 1./2 * (f_xx + f_yy)
return kappa | python | def kappa(self, x, y, kwargs, diff=diff):
"""
computes the convergence
:return: kappa
"""
f_xx, f_xy, f_yx, f_yy = self.hessian(x, y, kwargs, diff=diff)
kappa = 1./2 * (f_xx + f_yy)
return kappa | computes the convergence
:return: kappa | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/numeric_lens_differentials.py#L13-L20 |
sibirrer/lenstronomy | lenstronomy/LensModel/numeric_lens_differentials.py | NumericLens.gamma | def gamma(self, x, y, kwargs, diff=diff):
"""
computes the shear
:return: gamma1, gamma2
"""
f_xx, f_xy, f_yx, f_yy = self.hessian(x, y, kwargs, diff=diff)
gamma1 = 1./2 * (f_xx - f_yy)
gamma2 = f_xy
return gamma1, gamma2 | python | def gamma(self, x, y, kwargs, diff=diff):
"""
computes the shear
:return: gamma1, gamma2
"""
f_xx, f_xy, f_yx, f_yy = self.hessian(x, y, kwargs, diff=diff)
gamma1 = 1./2 * (f_xx - f_yy)
gamma2 = f_xy
return gamma1, gamma2 | computes the shear
:return: gamma1, gamma2 | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/numeric_lens_differentials.py#L22-L30 |
sibirrer/lenstronomy | lenstronomy/LensModel/numeric_lens_differentials.py | NumericLens.magnification | def magnification(self, x, y, kwargs, diff=diff):
"""
computes the magnification
:return: potential
"""
f_xx, f_xy, f_yx, f_yy = self.hessian(x, y, kwargs, diff=diff)
det_A = (1 - f_xx) * (1 - f_yy) - f_xy*f_yx
return 1/det_A | python | def magnification(self, x, y, kwargs, diff=diff):
"""
computes the magnification
:return: potential
"""
f_xx, f_xy, f_yx, f_yy = self.hessian(x, y, kwargs, diff=diff)
det_A = (1 - f_xx) * (1 - f_yy) - f_xy*f_yx
return 1/det_A | computes the magnification
:return: potential | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/numeric_lens_differentials.py#L32-L39 |
sibirrer/lenstronomy | lenstronomy/LensModel/numeric_lens_differentials.py | NumericLens.hessian | def hessian(self, x, y, kwargs, diff=diff):
"""
computes the differentials f_xx, f_yy, f_xy from f_x and f_y
:return: f_xx, f_xy, f_yx, f_yy
"""
alpha_ra, alpha_dec = self.alpha(x, y, kwargs)
alpha_ra_dx, alpha_dec_dx = self.alpha(x + diff, y, kwargs)
alpha_ra_dy... | python | def hessian(self, x, y, kwargs, diff=diff):
"""
computes the differentials f_xx, f_yy, f_xy from f_x and f_y
:return: f_xx, f_xy, f_yx, f_yy
"""
alpha_ra, alpha_dec = self.alpha(x, y, kwargs)
alpha_ra_dx, alpha_dec_dx = self.alpha(x + diff, y, kwargs)
alpha_ra_dy... | computes the differentials f_xx, f_yy, f_xy from f_x and f_y
:return: f_xx, f_xy, f_yx, f_yy | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/numeric_lens_differentials.py#L41-L60 |
sibirrer/lenstronomy | lenstronomy/Cosmo/background.py | Background.D_dt | def D_dt(self, z_lens, z_source):
"""
time-delay distance
:param z_lens: redshift of lens
:param z_source: redshift of source
:return: time-delay distance in units of Mpc
"""
return self.D_xy(0, z_lens) * self.D_xy(0, z_source) / self.D_xy(z_lens, z_source) * (1 ... | python | def D_dt(self, z_lens, z_source):
"""
time-delay distance
:param z_lens: redshift of lens
:param z_source: redshift of source
:return: time-delay distance in units of Mpc
"""
return self.D_xy(0, z_lens) * self.D_xy(0, z_source) / self.D_xy(z_lens, z_source) * (1 ... | time-delay distance
:param z_lens: redshift of lens
:param z_source: redshift of source
:return: time-delay distance in units of Mpc | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Cosmo/background.py#L43-L51 |
sibirrer/lenstronomy | lenstronomy/Cosmo/background.py | Background.rho_crit | def rho_crit(self):
"""
critical density
:return: value in M_sol/Mpc^3
"""
h = self.cosmo.H(0).value / 100.
return 3 * h ** 2 / (8 * np.pi * const.G) * 10 ** 10 * const.Mpc / const.M_sun | python | def rho_crit(self):
"""
critical density
:return: value in M_sol/Mpc^3
"""
h = self.cosmo.H(0).value / 100.
return 3 * h ** 2 / (8 * np.pi * const.G) * 10 ** 10 * const.Mpc / const.M_sun | critical density
:return: value in M_sol/Mpc^3 | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Cosmo/background.py#L64-L70 |
sibirrer/lenstronomy | lenstronomy/LightModel/Profiles/shapelets.py | Shapelets.hermval | def hermval(self, x, n_array, tensor=True):
"""
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
:param x: array of values
... | python | def hermval(self, x, n_array, tensor=True):
"""
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
:param x: array of values
... | 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
:param x: array of values
:param n_array: list of coeffs in H_n
:param cut_scale... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LightModel/Profiles/shapelets.py#L37-L61 |
sibirrer/lenstronomy | lenstronomy/LightModel/Profiles/shapelets.py | Shapelets.H_n | def H_n(self, n, x):
"""
constructs the Hermite polynomial of order n at position x (dimensionless)
:param n: The n'the basis function.
:type name: int.
:param x: 1-dim position (dimensionless)
:type state: float or numpy array.
:returns: array-- H_n(x).
... | python | def H_n(self, n, x):
"""
constructs the Hermite polynomial of order n at position x (dimensionless)
:param n: The n'the basis function.
:type name: int.
:param x: 1-dim position (dimensionless)
:type state: float or numpy array.
:returns: array-- H_n(x).
... | constructs the Hermite polynomial of order n at position x (dimensionless)
:param n: The n'the basis function.
:type name: int.
:param x: 1-dim position (dimensionless)
:type state: float or numpy array.
:returns: array-- H_n(x).
:raises: AttributeError, KeyError | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LightModel/Profiles/shapelets.py#L81-L97 |
sibirrer/lenstronomy | lenstronomy/LightModel/Profiles/shapelets.py | Shapelets.pre_calc | def pre_calc(self, x, y, beta, n_order, center_x, center_y):
"""
calculates the H_n(x) and H_n(y) for a given x-array and y-array
:param x:
:param y:
:param amp:
:param beta:
:param n_order:
:param center_x:
:param center_y:
:return: list o... | python | def pre_calc(self, x, y, beta, n_order, center_x, center_y):
"""
calculates the H_n(x) and H_n(y) for a given x-array and y-array
:param x:
:param y:
:param amp:
:param beta:
:param n_order:
:param center_x:
:param center_y:
:return: list o... | calculates the H_n(x) and H_n(y) for a given x-array and y-array
:param x:
:param y:
:param amp:
:param beta:
:param n_order:
:param center_x:
:param center_y:
:return: list of H_n(x) and H_n(y) | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LightModel/Profiles/shapelets.py#L113-L139 |
sibirrer/lenstronomy | lenstronomy/LightModel/Profiles/shapelets.py | ShapeletSet.decomposition | def decomposition(self, image, x, y, n_max, beta, deltaPix, center_x=0, center_y=0):
"""
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:... | python | def decomposition(self, image, x, y, n_max, beta, deltaPix, center_x=0, center_y=0):
"""
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:... | 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: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LightModel/Profiles/shapelets.py#L229-L258 |
sibirrer/lenstronomy | lenstronomy/LensModel/Optimizer/particle_swarm.py | ParticleSwarmOptimizer._sample | def _sample(self, maxIter=1000, c1=1.193, c2=1.193, lookback = 0.25, standard_dev = None):
"""
Launches the PSO. Yields the complete swarm per iteration
:param maxIter: maximum iterations
:param c1: cognitive weight
:param c2: social weight
:param lookback: percentange o... | python | def _sample(self, maxIter=1000, c1=1.193, c2=1.193, lookback = 0.25, standard_dev = None):
"""
Launches the PSO. Yields the complete swarm per iteration
:param maxIter: maximum iterations
:param c1: cognitive weight
:param c2: social weight
:param lookback: percentange o... | Launches the PSO. Yields the complete swarm per iteration
:param maxIter: maximum iterations
:param c1: cognitive weight
:param c2: social weight
:param lookback: percentange of particles to use when determining convergence
:param standard_dev: standard deviation of the last loo... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Optimizer/particle_swarm.py#L40-L92 |
sibirrer/lenstronomy | lenstronomy/LensModel/Optimizer/particle_swarm.py | ParticleSwarmOptimizer._optimize | def _optimize(self, maxIter=1000, c1=1.193, c2=1.193, lookback=0.25, standard_dev=None):
"""
:param maxIter: maximum number of swarm iterations
:param c1: social weight
:param c2: personal weight
:param lookback: how many particles to assess when considering convergence
... | python | def _optimize(self, maxIter=1000, c1=1.193, c2=1.193, lookback=0.25, standard_dev=None):
"""
:param maxIter: maximum number of swarm iterations
:param c1: social weight
:param c2: personal weight
:param lookback: how many particles to assess when considering convergence
... | :param maxIter: maximum number of swarm iterations
:param c1: social weight
:param c2: personal weight
:param lookback: how many particles to assess when considering convergence
:param standard_dev: the standard deviation of the last lookback # of particles used to determine convergence
... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Optimizer/particle_swarm.py#L94-L112 |
sibirrer/lenstronomy | lenstronomy/LensModel/Optimizer/particle_swarm.py | Particle.create | def create(cls, paramCount):
"""
Creates a new particle without position, velocity and -inf as fitness
"""
return Particle(numpy.array([[]]*paramCount),
numpy.array([[]]*paramCount),
-numpy.Inf) | python | def create(cls, paramCount):
"""
Creates a new particle without position, velocity and -inf as fitness
"""
return Particle(numpy.array([[]]*paramCount),
numpy.array([[]]*paramCount),
-numpy.Inf) | Creates a new particle without position, velocity and -inf as fitness | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Optimizer/particle_swarm.py#L167-L174 |
sibirrer/lenstronomy | lenstronomy/LensModel/Optimizer/particle_swarm.py | Particle.copy | def copy(self):
"""
Creates a copy of itself
"""
return Particle(copy(self.position),
copy(self.velocity),
self.fitness) | python | def copy(self):
"""
Creates a copy of itself
"""
return Particle(copy(self.position),
copy(self.velocity),
self.fitness) | Creates a copy of itself | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Optimizer/particle_swarm.py#L182-L188 |
sibirrer/lenstronomy | lenstronomy/ImSim/MultiBand/multi_data_base.py | MultiDataBase.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:
"""
for imageModel in self._imageModel_list:
imageModel.reset_point_source_cache(bool=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:
"""
for imageModel in self._imageModel_list:
imageModel.reset_point_source_cache(bool=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/MultiBand/multi_data_base.py#L38-L45 |
sibirrer/lenstronomy | lenstronomy/Util/analysis_util.py | moments | def moments(I_xy_input, x, y):
"""
compute quadrupole moments from a light distribution
:param I_xy: light distribution
:param x: x-coordinates of I_xy
:param y: y-coordinates of I_xy
:return: Q_xx, Q_xy, Q_yy
"""
I_xy = copy.deepcopy(I_xy_input)
background = np.minimum(0, np.min(I_... | python | def moments(I_xy_input, x, y):
"""
compute quadrupole moments from a light distribution
:param I_xy: light distribution
:param x: x-coordinates of I_xy
:param y: y-coordinates of I_xy
:return: Q_xx, Q_xy, Q_yy
"""
I_xy = copy.deepcopy(I_xy_input)
background = np.minimum(0, np.min(I_... | compute quadrupole moments from a light distribution
:param I_xy: light distribution
:param x: x-coordinates of I_xy
:param y: y-coordinates of I_xy
:return: Q_xx, Q_xy, Q_yy | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/analysis_util.py#L93-L112 |
sibirrer/lenstronomy | lenstronomy/Util/analysis_util.py | ellipticities | def ellipticities(I_xy, x, y):
"""
compute ellipticities of a light distribution
:param I_xy:
:param x:
:param y:
:return:
"""
Q_xx, Q_xy, Q_yy, bkg = moments(I_xy, x, y)
norm = Q_xx + Q_yy + 2 * np.sqrt(Q_xx*Q_yy - Q_xy**2)
e1 = (Q_xx - Q_yy) / norm
e2 = 2 * Q_xy / norm
... | python | def ellipticities(I_xy, x, y):
"""
compute ellipticities of a light distribution
:param I_xy:
:param x:
:param y:
:return:
"""
Q_xx, Q_xy, Q_yy, bkg = moments(I_xy, x, y)
norm = Q_xx + Q_yy + 2 * np.sqrt(Q_xx*Q_yy - Q_xy**2)
e1 = (Q_xx - Q_yy) / norm
e2 = 2 * Q_xy / norm
... | compute ellipticities of a light distribution
:param I_xy:
:param x:
:param y:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/Util/analysis_util.py#L115-L128 |
sibirrer/lenstronomy | lenstronomy/LensModel/multi_plane.py | MultiPlane.ray_shooting | def ray_shooting(self, theta_x, theta_y, kwargs_lens, k=None):
"""
ray-tracing (backwards light cone)
:param theta_x: angle in x-direction on the image
:param theta_y: angle in y-direction on the image
:param kwargs_lens:
:return: angles in the source plane
"""
... | python | def ray_shooting(self, theta_x, theta_y, kwargs_lens, k=None):
"""
ray-tracing (backwards light cone)
:param theta_x: angle in x-direction on the image
:param theta_y: angle in y-direction on the image
:param kwargs_lens:
:return: angles in the source plane
"""
... | ray-tracing (backwards light cone)
:param theta_x: angle in x-direction on the image
:param theta_y: angle in y-direction on the image
:param kwargs_lens:
:return: angles in the source plane | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/multi_plane.py#L52-L73 |
sibirrer/lenstronomy | lenstronomy/LensModel/multi_plane.py | MultiPlane.ray_shooting_partial | def ray_shooting_partial(self, x, y, alpha_x, alpha_y, z_start, z_stop, kwargs_lens, keep_range=False,
include_z_start=False):
"""
ray-tracing through parts of the coin, starting with (x,y) and angles (alpha_x, alpha_y) at redshift z_start
and then backwards to redsh... | python | def ray_shooting_partial(self, x, y, alpha_x, alpha_y, z_start, z_stop, kwargs_lens, keep_range=False,
include_z_start=False):
"""
ray-tracing through parts of the coin, starting with (x,y) and angles (alpha_x, alpha_y) at redshift z_start
and then backwards to redsh... | ray-tracing through parts of the coin, starting with (x,y) and angles (alpha_x, alpha_y) at redshift z_start
and then backwards to redshfit z_stop
:param x: co-moving position [Mpc]
:param y: co-moving position [Mpc]
:param alpha_x: ray angle at z_start [arcsec]
:param alpha_y: ... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/multi_plane.py#L75-L117 |
sibirrer/lenstronomy | lenstronomy/LensModel/multi_plane.py | MultiPlane.ray_shooting_partial_steps | def ray_shooting_partial_steps(self, x, y, alpha_x, alpha_y, z_start, z_stop, kwargs_lens,
include_z_start=False):
"""
ray-tracing through parts of the coin, starting with (x,y) and angles (alpha_x, alpha_y) at redshift z_start
and then backwards to redshfit z_stop.
... | python | def ray_shooting_partial_steps(self, x, y, alpha_x, alpha_y, z_start, z_stop, kwargs_lens,
include_z_start=False):
"""
ray-tracing through parts of the coin, starting with (x,y) and angles (alpha_x, alpha_y) at redshift z_start
and then backwards to redshfit z_stop.
... | ray-tracing through parts of the coin, starting with (x,y) and angles (alpha_x, alpha_y) at redshift z_start
and then backwards to redshfit z_stop.
This function differs from 'ray_shooting_partial' in that it returns the angular position of the ray
at each lens plane.
:param x: co-movi... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/multi_plane.py#L119-L188 |
sibirrer/lenstronomy | lenstronomy/LensModel/multi_plane.py | MultiPlane.arrival_time | def arrival_time(self, theta_x, theta_y, kwargs_lens, k=None):
"""
light travel time relative to a straight path through the coordinate (0,0)
Negative sign means earlier arrival time
:param theta_x: angle in x-direction on the image
:param theta_y: angle in y-direction on the im... | python | def arrival_time(self, theta_x, theta_y, kwargs_lens, k=None):
"""
light travel time relative to a straight path through the coordinate (0,0)
Negative sign means earlier arrival time
:param theta_x: angle in x-direction on the image
:param theta_y: angle in y-direction on the im... | light travel time relative to a straight path through the coordinate (0,0)
Negative sign means earlier arrival time
:param theta_x: angle in x-direction on the image
:param theta_y: angle in y-direction on the image
:param kwargs_lens:
:return: travel time in unit of days | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/multi_plane.py#L190-L221 |
sibirrer/lenstronomy | lenstronomy/LensModel/multi_plane.py | MultiPlane.alpha | def alpha(self, theta_x, theta_y, kwargs_lens, k=None):
"""
reduced deflection angle
:param theta_x: angle in x-direction
:param theta_y: angle in y-direction
:param kwargs_lens: lens model kwargs
:return:
"""
beta_x, beta_y = self.ray_shooting(theta_x, t... | python | def alpha(self, theta_x, theta_y, kwargs_lens, k=None):
"""
reduced deflection angle
:param theta_x: angle in x-direction
:param theta_y: angle in y-direction
:param kwargs_lens: lens model kwargs
:return:
"""
beta_x, beta_y = self.ray_shooting(theta_x, t... | reduced deflection angle
:param theta_x: angle in x-direction
:param theta_y: angle in y-direction
:param kwargs_lens: lens model kwargs
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/multi_plane.py#L223-L235 |
sibirrer/lenstronomy | lenstronomy/LensModel/multi_plane.py | MultiPlane.hessian | def hessian(self, theta_x, theta_y, kwargs_lens, k=None, diff=0.00000001):
"""
computes the hessian components f_xx, f_yy, f_xy from f_x and f_y with numerical differentiation
:param theta_x: x-position (preferentially arcsec)
:type theta_x: numpy array
:param theta_y: y-positio... | python | def hessian(self, theta_x, theta_y, kwargs_lens, k=None, diff=0.00000001):
"""
computes the hessian components f_xx, f_yy, f_xy from f_x and f_y with numerical differentiation
:param theta_x: x-position (preferentially arcsec)
:type theta_x: numpy array
:param theta_y: y-positio... | computes the hessian components f_xx, f_yy, f_xy from f_x and f_y with numerical differentiation
:param theta_x: x-position (preferentially arcsec)
:type theta_x: numpy array
:param theta_y: y-position (preferentially arcsec)
:type theta_y: numpy array
:param kwargs_lens: list o... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/multi_plane.py#L237-L264 |
sibirrer/lenstronomy | lenstronomy/LensModel/multi_plane.py | MultiPlane._reduced2physical_deflection | def _reduced2physical_deflection(self, alpha_reduced, idex_lens):
"""
alpha_reduced = D_ds/Ds alpha_physical
:param alpha_reduced: reduced deflection angle
:param z_lens: lens redshift
:param z_source: source redshift
:return: physical deflection angle
"""
... | python | def _reduced2physical_deflection(self, alpha_reduced, idex_lens):
"""
alpha_reduced = D_ds/Ds alpha_physical
:param alpha_reduced: reduced deflection angle
:param z_lens: lens redshift
:param z_source: source redshift
:return: physical deflection angle
"""
... | alpha_reduced = D_ds/Ds alpha_physical
:param alpha_reduced: reduced deflection angle
:param z_lens: lens redshift
:param z_source: source redshift
:return: physical deflection angle | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/multi_plane.py#L278-L289 |
sibirrer/lenstronomy | lenstronomy/LensModel/multi_plane.py | MultiPlane._geometrical_delay | def _geometrical_delay(self, alpha_x, alpha_y, delta_T):
"""
geometrical delay (evaluated at z=0) of a light ray with an angle relative to the shortest path
:param alpha_x: angle relative to a straight path
:param alpha_y: angle relative to a straight path
:param delta_T: transv... | python | def _geometrical_delay(self, alpha_x, alpha_y, delta_T):
"""
geometrical delay (evaluated at z=0) of a light ray with an angle relative to the shortest path
:param alpha_x: angle relative to a straight path
:param alpha_y: angle relative to a straight path
:param delta_T: transv... | geometrical delay (evaluated at z=0) of a light ray with an angle relative to the shortest path
:param alpha_x: angle relative to a straight path
:param alpha_y: angle relative to a straight path
:param delta_T: transversal diameter distance between the start and end of the ray
:return:... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/multi_plane.py#L306-L316 |
sibirrer/lenstronomy | lenstronomy/LensModel/multi_plane.py | MultiPlane._lensing_potential2time_delay | def _lensing_potential2time_delay(self, potential, z_lens, z_source):
"""
transforms the lensing potential (in units arcsec^2) to a gravitational time-delay as measured at z=0
:param potential: lensing potential
:param z_lens: redshift of the deflector
:param z_source: redshift ... | python | def _lensing_potential2time_delay(self, potential, z_lens, z_source):
"""
transforms the lensing potential (in units arcsec^2) to a gravitational time-delay as measured at z=0
:param potential: lensing potential
:param z_lens: redshift of the deflector
:param z_source: redshift ... | transforms the lensing potential (in units arcsec^2) to a gravitational time-delay as measured at z=0
:param potential: lensing potential
:param z_lens: redshift of the deflector
:param z_source: redshift of source for the definition of the lensing quantities
:return: gravitational time... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/multi_plane.py#L318-L329 |
sibirrer/lenstronomy | lenstronomy/LensModel/multi_plane.py | MultiPlane._co_moving2angle | def _co_moving2angle(self, x, y, idex):
"""
transforms co-moving distances Mpc into angles on the sky (radian)
:param x: co-moving distance
:param y: co-moving distance
:param z_lens: redshift of plane
:return: angles on the sky
"""
T_z = self._T_z_list[i... | python | def _co_moving2angle(self, x, y, idex):
"""
transforms co-moving distances Mpc into angles on the sky (radian)
:param x: co-moving distance
:param y: co-moving distance
:param z_lens: redshift of plane
:return: angles on the sky
"""
T_z = self._T_z_list[i... | transforms co-moving distances Mpc into angles on the sky (radian)
:param x: co-moving distance
:param y: co-moving distance
:param z_lens: redshift of plane
:return: angles on the sky | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/multi_plane.py#L331-L344 |
sibirrer/lenstronomy | lenstronomy/LensModel/multi_plane.py | MultiPlane._co_moving2angle_source | def _co_moving2angle_source(self, x, y):
"""
special case of the co_moving2angle definition at the source redshift
:param x:
:param y:
:return:
"""
T_z = self._T_z_source
theta_x = x / T_z
theta_y = y / T_z
return theta_x, theta_y | python | def _co_moving2angle_source(self, x, y):
"""
special case of the co_moving2angle definition at the source redshift
:param x:
:param y:
:return:
"""
T_z = self._T_z_source
theta_x = x / T_z
theta_y = y / T_z
return theta_x, theta_y | special case of the co_moving2angle definition at the source redshift
:param x:
:param y:
:return: | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/multi_plane.py#L346-L357 |
sibirrer/lenstronomy | lenstronomy/LensModel/multi_plane.py | MultiPlane._ray_step | def _ray_step(self, x, y, alpha_x, alpha_y, delta_T):
"""
ray propagation with small angle approximation
:param x: co-moving x-position
:param y: co-moving y-position
:param alpha_x: deflection angle in x-direction at (x, y)
:param alpha_y: deflection angle in y-directio... | python | def _ray_step(self, x, y, alpha_x, alpha_y, delta_T):
"""
ray propagation with small angle approximation
:param x: co-moving x-position
:param y: co-moving y-position
:param alpha_x: deflection angle in x-direction at (x, y)
:param alpha_y: deflection angle in y-directio... | ray propagation with small angle approximation
:param x: co-moving x-position
:param y: co-moving y-position
:param alpha_x: deflection angle in x-direction at (x, y)
:param alpha_y: deflection angle in y-direction at (x, y)
:param delta_T: transversal angular diameter distance ... | https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/multi_plane.py#L359-L372 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.