def __init__( self, positions: aa.Grid2DIrregular, noise_map: aa.ValuesIrregular, tracer: Tracer, ): """ Given a positions dataset, which is a list of positions with names that associated them to model source galaxies, use a `Tracer` to determine the traced coordinate positions in the source-plane. Different children of this abstract class are available which use the traced coordinates to define a chi-squared value in different ways. Parameters ----------- positions : Grid2DIrregular The (y,x) arc-second coordinates of named positions which the log_likelihood is computed using. Positions are paired to galaxies in the `Tracer` using their names. tracer : Tracer The object that defines the ray-tracing of the strong lens system of galaxies. noise_value The noise-value assumed when computing the log likelihood. """ self.positions = positions self.noise_map = noise_map self.source_plane_positions = tracer.traced_grid_2d_list_from( grid=positions)[-1]
def via_tracer_from(self, tracer: Tracer, grid: aa.type.Grid2DLike, plane_index: int) -> aplt.Visuals2D: """ From a `Tracer` get the attributes that can be plotted and returns them in a `Visuals2D` object. Only attributes with `True` entries in the `Include` object are extracted. From a tracer the following attributes can be extracted for plotting: - origin: the (y,x) origin of the coordinate system used to plot the light object's quantities in 2D. - border: the border of the mask of the grid used to plot the light object's quantities in 2D. - light profile centres: the (y,x) centre of every `LightProfile` in the object. - mass profile centres: the (y,x) centre of every `MassProfile` in the object. - critical curves: the critical curves of all of the tracer's mass profiles combined. - caustics: the caustics of all of the tracer's mass profiles combined. When plotting a `Tracer` it is common for plots to only display quantities corresponding to one plane at a time (e.g. the convergence in the image plane, the source in the source plane). Therefore, quantities are only extracted from one plane, specified by the input `plane_index`. Parameters ---------- tracer The `Tracer` object which has attributes extracted for plotting. grid The 2D grid of (y,x) coordinates used to plot the tracer's quantities in 2D. plane_index The index of the plane in the tracer which is used to extract quantities, as only one plane is plotted at a time. Returns ------- vis.Visuals2D A collection of attributes that can be plotted by a `Plotter` object. """ origin = self.get("origin", value=aa.Grid2DIrregular(grid=[grid.origin])) border = self.get("border", value=grid.mask.border_grid_sub_1.binned) if border is not None and len(border) > 0 and plane_index > 0: border = tracer.traced_grid_2d_list_from(grid=border)[plane_index] light_profile_centres = self.get( "light_profile_centres", tracer.planes[plane_index].extract_attribute( cls=ag.lp.LightProfile, attr_name="centre"), ) mass_profile_centres = self.get( "mass_profile_centres", tracer.planes[plane_index].extract_attribute(cls=ag.mp.MassProfile, attr_name="centre"), ) if plane_index == 0: critical_curves = self.get( "critical_curves", tracer.critical_curves_from(grid=grid), "critical_curves", ) else: critical_curves = None if plane_index == 1: caustics = self.get("caustics", tracer.caustics_from(grid=grid), "caustics") else: caustics = None return self.visuals + self.visuals.__class__( origin=origin, border=border, light_profile_centres=light_profile_centres, mass_profile_centres=mass_profile_centres, critical_curves=critical_curves, caustics=caustics, )