lenstronomy.LensModel.Microlensing package

Submodules

lenstronomy.LensModel.Microlensing.adaptive_boundary_mesh module

splitting_centers(x, y, side_length, n_p)[source]

Takes square centered at center = (x, y) with side_length = side length.

(float) and divides it into n_p (integer) squares along each axis - so returns n_p * n_p subsquares from the original square. In particular, the function returns the coordinates of the centers of these subsquares, along with the final side length of the subsquare.

Parameters:
  • x (nparray) – x coordinate of center of square

  • y (nparray) – y coordinate of center of square

  • side_length (float) – side length of square

  • n_p (int) – number of squares along each axis

Returns:

x and y coordinates of centers of subsquares

Return type:

nparray

Returns:

side length of subsquares

Return type:

float

loop_information(eta, beta_0, beta_s)[source]
within_distance(x, y, test_point, threshold, threshold_2)[source]

Check if points in center_points are within a threshold distance of the test_point, component-wise.

Parameters:
  • x (float) – x source coordrate of grid

  • y (float) – y source coordrate of grid

  • test_point (nparray) – Coordinates of the test point (x, y). Source position

  • threshold (float) – delta_beta value.

  • threshold_2 – beta_s value.

Returns:

Boolean array indicating whether each point is within both threshold and threshold_2 distances.

Return type:

nparray

adaptive_boundary_mesh(source_position, L, beta_0, beta_s, n_p, eta, number_of_iterations, final_eta, kwargs_lens)[source]

Original ABM algorithm described in Meena et al. 2022, https://arxiv.org/abs/2203.08131

Returns list of those high resolution image-plane pixels that were mapped to within the radius \(\beta_s\) around the source position (\(\beta_1\), \(\beta_2\)) in the source plane. This is done by first loading all image-plane pixels, ray shooting from the image plane to the source plane, and then checking if they are within the radius \(\beta_s\).

param source_position:

Coordinates of the source position (x, y). Source position

type source_position:

tuple

param L:

Side length of square area in image plane. Same as lenstronomy grid width

type L:

float

param beta_0:

Initial search radius (delta_beta)

type beta_0:

float

param beta_s:

Factor of 1/2 because radius

type beta_s:

float

param n_p:

Number of pixels

type n_p:

int

param eta:

Factor by which the search radius is reduced in each iteration

type eta:

float

param number_of_iterations:

Number of iterations

type number_of_iterations:

int

param final_eta:

Final scale factor

type final_eta:

float

param kwargs_lens:

Keyword arguments for lens model

type kwargs_lens:

dict

return:

side_length: updated side length of square area in image plane

rtype:

side_length: nparray

return:

total_number_of_rays_shot: total number of rays shot

rtype:

total_number_of_rays_shot: int

return:

subset_image_centers_x, subset_image_centers_y: x and y coordinates of high resolution image-plane pixels that were mapped to within the radius β_s around the source position (β1, β2) in the source plane

rtype:

subset_image_centers_x, subset_image_centers_y: nparray

Module contents