@@ -22,47 +22,19 @@ def __init__(
2222 self ,
2323 fit : FitImaging ,
2424 mat_plot_2d : aplt .MatPlot2D = None ,
25- visuals_2d : aplt .Visuals2D = None ,
2625 residuals_symmetric_cmap : bool = True ,
27- visuals_2d_of_planes_list : Optional = None
2826 ):
29- """
30- Plots the attributes of `FitImaging` objects using the matplotlib method `imshow()` and many other matplotlib
31- functions which customize the plot's appearance.
32-
33- The `mat_plot_2d` attribute wraps matplotlib function calls to make the figure. By default, the settings
34- passed to every matplotlib function called are those specified in the `config/visualize/mat_wrap/*.ini` files,
35- but a user can manually input values into `MatPlot2d` to customize the figure's appearance.
36-
37- Overlaid on the figure are visuals, contained in the `Visuals2D` object. Attributes may be extracted from
38- the `FitImaging` and plotted via the visuals object.
39-
40- Parameters
41- ----------
42- fit
43- The fit to an imaging dataset the plotter plots.
44- mat_plot_2d
45- Contains objects which wrap the matplotlib function calls that make the plot.
46- visuals_2d
47- Contains visuals that can be overlaid on the plot.
48- residuals_symmetric_cmap
49- If true, the `residual_map` and `normalized_residual_map` are plotted with a symmetric color map such
50- that `abs(vmin) = abs(vmax)`.
51- """
52- super ().__init__ (mat_plot_2d = mat_plot_2d , visuals_2d = visuals_2d )
27+ super ().__init__ (mat_plot_2d = mat_plot_2d )
5328
5429 self .fit = fit
5530
5631 self ._fit_imaging_meta_plotter = FitImagingPlotterMeta (
5732 fit = self .fit ,
5833 mat_plot_2d = self .mat_plot_2d ,
59- visuals_2d = self .visuals_2d ,
6034 residuals_symmetric_cmap = residuals_symmetric_cmap ,
6135 )
6236
6337 self .residuals_symmetric_cmap = residuals_symmetric_cmap
64-
65- self ._visuals_2d_of_planes_list = visuals_2d_of_planes_list
6638 self ._lines_of_planes = None
6739
6840 @property
@@ -80,17 +52,6 @@ def lines_of_planes(self) -> List[List]:
8052 )
8153 return self ._lines_of_planes
8254
83- @property
84- def visuals_2d_of_planes_list (self ):
85- """Legacy property: returns Visuals2D objects per plane for backward-
86- compatible callers (e.g. InversionPlotter)."""
87- if self ._visuals_2d_of_planes_list is None :
88- self ._visuals_2d_of_planes_list = tracer_util .visuals_2d_of_planes_list_from (
89- tracer = self .fit .tracer ,
90- grid = self ._lensing_grid ,
91- )
92- return self ._visuals_2d_of_planes_list
93-
9455 def _lines_for_plane (
9556 self , plane_index : int , remove_critical_caustic : bool = False
9657 ) -> Optional [List ]:
@@ -102,31 +63,6 @@ def _lines_for_plane(
10263 except IndexError :
10364 return None
10465
105- def visuals_2d_from (
106- self , plane_index : Optional [int ] = None , remove_critical_caustic : bool = False
107- ) -> aplt .Visuals2D :
108- """
109- Returns the `Visuals2D` of the plotter with critical curves and caustics added, which are used to plot
110- the critical curves and caustics of the `Tracer` object.
111-
112- If `remove_critical_caustic` is `True`, critical curves and caustics are not included in the visuals.
113-
114- Parameters
115- ----------
116- plane_index
117- The index of the plane in the tracer which is used to extract quantities, as only one plane is plotted
118- at a time.
119- remove_critical_caustic
120- Whether to remove critical curves and caustics from the visuals.
121- """
122- if remove_critical_caustic :
123- return self .visuals_2d
124-
125- return (
126- self .visuals_2d
127- + self .visuals_2d_of_planes_list [plane_index ]
128- )
129-
13066 @property
13167 def tracer (self ):
13268 return self .fit .tracer_linear_light_profiles_to_light_profiles
@@ -135,7 +71,7 @@ def tracer_plotter_of_plane(
13571 self , plane_index : int , remove_critical_caustic : bool = False
13672 ) -> TracerPlotter :
13773 """
138- Returns an `TracerPlotter` corresponding to the `Tracer` in the `FitImaging`.
74+ Returns a `TracerPlotter` corresponding to the `Tracer` in the `FitImaging`.
13975 """
14076
14177 zoom = aa .Zoom2D (mask = self .fit .mask )
@@ -147,9 +83,6 @@ def tracer_plotter_of_plane(
14783 tracer = self .tracer ,
14884 grid = grid ,
14985 mat_plot_2d = self .mat_plot_2d ,
150- visuals_2d = self .visuals_2d_from (
151- plane_index = plane_index , remove_critical_caustic = remove_critical_caustic
152- ),
15386 )
15487
15588 def inversion_plotter_of_plane (
@@ -170,12 +103,11 @@ def inversion_plotter_of_plane(
170103 An object that plots inversions which is used for plotting attributes of the inversion.
171104 """
172105
106+ lines = None if remove_critical_caustic else self ._lines_for_plane (plane_index )
173107 inversion_plotter = aplt .InversionPlotter (
174108 inversion = self .fit .inversion ,
175109 mat_plot_2d = self .mat_plot_2d ,
176- visuals_2d = self .visuals_2d_from (
177- plane_index = plane_index , remove_critical_caustic = remove_critical_caustic
178- ),
110+ lines = lines ,
179111 )
180112 return inversion_plotter
181113
@@ -331,7 +263,6 @@ def figures_2d_of_planes(
331263 plane_image = True ,
332264 plane_index = plane_index ,
333265 zoom_to_brightest = zoom_to_brightest ,
334- retain_visuals = True ,
335266 )
336267
337268 elif self .tracer .planes [plane_index ].has (cls = aa .Pixelization ):
@@ -774,7 +705,6 @@ def subplot_tracer(self):
774705 )
775706
776707 tracer_plotter = self .tracer_plotter_of_plane (plane_index = 0 )
777-
778708 tracer_plotter ._subplot_lens_and_mass ()
779709
780710 self .mat_plot_2d .output .subplot_to_figure (auto_filename = "subplot_tracer" )
@@ -814,18 +744,10 @@ def subplot_mappings_of_plane(
814744 total_pixels = total_pixels , filter_neighbors = True
815745 )
816746
817- indexes = mapper .slim_indexes_for_pix_indexes (pix_indexes = pix_indexes )
818-
819- inversion_plotter .visuals_2d .indexes = indexes
820-
821747 inversion_plotter .figures_2d_of_pixelization (
822748 pixelization_index = pixelization_index , reconstructed_operated_data = True
823749 )
824750
825- self .visuals_2d .source_plane_mesh_indexes = [
826- [index ] for index in pix_indexes [pixelization_index ]
827- ]
828-
829751 self .figures_2d_of_planes (
830752 plane_index = plane_index , plane_image = True , use_source_vmax = True
831753 )
@@ -839,8 +761,6 @@ def subplot_mappings_of_plane(
839761 )
840762 self .set_title (label = None )
841763
842- self .visuals_2d .source_plane_mesh_indexes = None
843-
844764 inversion_plotter .mat_plot_2d .output .subplot_to_figure (
845765 auto_filename = f"{ auto_filename } _{ pixelization_index } "
846766 )
0 commit comments