@@ -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 ]
0 commit comments