Skip to content

Commit a369cf6

Browse files
Jammy2211Jammy2211
authored andcommitted
visual clean up complete
1 parent 3084bfd commit a369cf6

34 files changed

+539
-958
lines changed

autolens/analysis/plotter_interface.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def should_plot(name):
6363
tracer=tracer,
6464
grid=grid,
6565
mat_plot_2d=mat_plot_2d,
66-
include_2d=self.include_2d,
6766
)
6867

6968
if should_plot("subplot_galaxies_images"):
@@ -169,7 +168,6 @@ def should_plot(name):
169168
image_plotter = aplt.Array2DPlotter(
170169
array=image,
171170
mat_plot_2d=mat_plot_2d,
172-
include_2d=self.include_2d,
173171
visuals_2d=visuals_2d,
174172
)
175173

autolens/imaging/model/plotter_interface.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,29 @@ def fit_imaging(
4040
The maximum log likelihood `FitImaging` of the non-linear search which is used to plot the fit.
4141
"""
4242

43+
import time
44+
4345
if plot_setting(section="tracer", name="subplot_tracer"):
4446

4547
mat_plot_2d = self.mat_plot_2d_from()
4648

4749
fit_plotter = FitImagingPlotter(
48-
fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d
50+
fit=fit, mat_plot_2d=mat_plot_2d
4951
)
5052

53+
start_time = time.time()
54+
5155
fit_plotter.subplot_tracer()
5256

57+
print(f"Tracer subplot took {time.time() - start_time:.2f} seconds to plot.")
58+
5359
def should_plot(name):
5460
return plot_setting(section=["fit", "fit_imaging"], name=name)
5561

5662
mat_plot_2d = self.mat_plot_2d_from()
5763

5864
fit_plotter = FitImagingPlotter(
59-
fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d
65+
fit=fit, mat_plot_2d=mat_plot_2d
6066
)
6167

6268
plane_indexes_to_plot = [i for i in fit.tracer.plane_indexes_with_images if i != 0]
@@ -65,13 +71,20 @@ def should_plot(name):
6571

6672
# This loop means that multiple subplot_fit objects are output for a double source plane lens.
6773

74+
start_time = time.time()
75+
6876
if len(fit.tracer.planes) > 2:
6977
for plane_index in plane_indexes_to_plot:
7078
fit_plotter.subplot_fit(plane_index=plane_index)
7179
else:
7280
fit_plotter.subplot_fit()
7381

82+
print(f"Fit subplot took {time.time() - start_time:.2f} seconds to plot.")
83+
7484
if should_plot("subplot_fit_log10"):
85+
86+
start_time = time.time()
87+
7588
try:
7689
if len(fit.tracer.planes) > 2:
7790
for plane_index in plane_indexes_to_plot:
@@ -81,17 +94,28 @@ def should_plot(name):
8194
except ValueError:
8295
pass
8396

97+
print(f"Fit log10 subplot took {time.time() - start_time:.2f} seconds to plot.")
98+
99+
100+
start_time = time.time()
101+
84102
if should_plot("subplot_of_planes"):
85103
fit_plotter.subplot_of_planes()
86104

105+
print(f"Planes subplot took {time.time() - start_time:.2f} seconds to plot.")
106+
87107
if plot_setting(section="inversion", name="subplot_mappings"):
88108
try:
89109
fit_plotter.subplot_mappings_of_plane(plane_index=len(fit.tracer.planes) - 1)
90110
except IndexError:
91111
pass
92112

113+
start_time = time.time()
114+
93115
fits_to_fits(should_plot=should_plot, image_path=self.image_path, fit=fit)
94116

117+
print(f"Fits to fits took {time.time() - start_time:.2f} seconds to plot.")
118+
95119
def fit_imaging_combined(self, fit_list: List[FitImaging]):
96120
"""
97121
Output visualization of all `FitImaging` objects in a summed combined analysis, typically during or after a
@@ -119,7 +143,7 @@ def should_plot(name):
119143

120144
fit_plotter_list = [
121145
FitImagingPlotter(
122-
fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d
146+
fit=fit, mat_plot_2d=mat_plot_2d
123147
)
124148
for fit in fit_list
125149
]

autolens/imaging/model/visualizer.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ def visualize(
8989
via a non-linear search).
9090
"""
9191

92+
import time
93+
start_time = time.time()
94+
9295
fit = analysis.fit_from(instance=instance)
9396

9497
if analysis.positions_likelihood_list is not None:
@@ -113,11 +116,18 @@ def visualize(
113116
image_path=paths.image_path, title_prefix=analysis.title_prefix
114117
)
115118

119+
import time
120+
start_time = time.time()
121+
116122
try:
117123
plotter_interface.fit_imaging(fit=fit)
118124
except exc.InversionException:
119125
pass
120126

127+
print()
128+
print(f"VisualizerImaging.visualize took {time.time() - start_time} seconds")
129+
fff
130+
121131
tracer = fit.tracer_linear_light_profiles_to_light_profiles
122132

123133
zoom = ag.Zoom2D(mask=fit.mask)

0 commit comments

Comments
 (0)