class PointSolver[source]#

Bases: AbstractPointSolver

Given a OperateDeflections (e.g. a _MassProfile, Galaxy, Plane or Tracer) this class uses their deflections_yx_2d_from method to determine the (y,x) coordinates the multiple-images appear given a (y,x) source-centre coordinate in the source-plane.

This is performed as follows:

  1. For an initial input grid, compute all deflection angles, map their values to source-plane and compute the distance of each traced coordinate to the source-plane centre.

  2. Find the ‘peak’ pixels on the image-plane grid. A peak pixel is one that traces closer to the centre of the source in the source-plane than it 8 direct neighboring adjacent pixels.

  3. For every peak pixel, create a higher resolution grid around it and centred on it and using this higher resolution grid find its peak pixel.

This process thus finds a set of ‘peak’ pixels and iteratively refines their values by locating them for higher and higher resolution grids. The following occurances may happen during this process:

  • A peak pixel may ‘split’ into multiple images. This is to be expected, when genuine multiple images were previously merged into one due to the grid being too low resolution.

  • Image pixels which do not correspond to genuine multiple images may be detected as they meet the peak criteria. This can occurance in certain circumstances where a non-multiple image still traces closer than its 8 neighbors. Depending on how the PositionFinder is being used these can be removed.



For an input (y,x) Catersian coordinate create a buffed and upscaled square grid of (y,x) coordinates where:


Find the 'peaks' of a grid of coordinates, where a peak corresponds to a (y,x) coordinate on the grid which traces closer to the input (y,x) source-plane coordinate than any of its 8 adjacent neighbors.


Remove all coordinates from a grid which are within the distance_to_mass_profile_centre attribute of any mass profile of the lensing object.



For an input grid of (y,x) coordinates, remove all coordinates that do not trace within a threshold distance of the source-plane centre.


For an input (y,x) coordinate, determine a set of refined coordinates that are computed by locating peak pixels on a higher resolution grid around that pixel.


refined_coordinates_from(deflections_func, coordinate, pixel_scale, source_plane_coordinate)[source]#

For an input (y,x) coordinate, determine a set of refined coordinates that are computed by locating peak pixels on a higher resolution grid around that pixel.

This may return 1 or multiple refined coordinates. Multiple coordinates occur when the peak ‘splits’ into multiple images.

  • coordinate ((float, float)) – The (y,x) coordinate around which the upscaled grid used to fin the refined coordinates is computed.

  • pixel_scales ((float, float)) – The pixel-scale resolution of the buffed and upscaled grid that is formed around the input coordinate. If upscale > 1, the pixel_scales are reduced to pixel_scale / upscale_factor.

  • lensing_obj – An object which has a deflection_2d_from method for performing lensing calculations, for example a MassProfile, _Galaxy_, Plane or Tracer.

  • source_plane_coordinate ((float, float)) – The (y,x) coordinate in the source-plane pixels that the distance of traced grid coordinates are computed for.