@@ -358,6 +358,108 @@ def subplot_fit(
358358 save_figure (fig , path = output_path , filename = f"fit{ plane_index_tag } " , format = output_format )
359359
360360
361+ def subplot_fit_quick (
362+ fit ,
363+ output_path : Optional [str ] = None ,
364+ output_format : str = None ,
365+ colormap : Optional [str ] = None ,
366+ image_plane_lines = None ,
367+ image_plane_line_colors = None ,
368+ source_plane_lines = None ,
369+ source_plane_line_colors = None ,
370+ title_prefix : str = None ,
371+ ):
372+ """
373+ Produce a 6-panel quick-update subplot summarising an imaging fit.
374+
375+ Arranges the following panels in a 2 × 3 grid:
376+
377+ * Data
378+ * Model image
379+ * Normalised residual map (symmetric scale)
380+ * Lens-light-subtracted image
381+ * Source model image
382+ * Source plane image (mid zoom)
383+
384+ This is a lighter alternative to :func:`subplot_fit` (12 panels)
385+ intended for the quick-update visualization path during sampling,
386+ where render speed matters more than completeness.
387+
388+ For single-plane tracers the function delegates to
389+ :func:`subplot_fit_x1_plane`.
390+ """
391+ if len (fit .tracer .planes ) == 1 :
392+ return subplot_fit_x1_plane (
393+ fit , output_path = output_path ,
394+ output_format = output_format , colormap = colormap ,
395+ title_prefix = title_prefix ,
396+ )
397+
398+ final_plane_index = len (fit .tracer .planes ) - 1
399+ source_vmax = _get_source_vmax (fit )
400+
401+ _pf = (lambda t : f"{ title_prefix .rstrip ()} { t } " ) if title_prefix else (lambda t : t )
402+ fig , axes = subplots (2 , 3 , figsize = conf_subplot_figsize (2 , 3 ))
403+ axes_flat = list (axes .flatten ())
404+
405+ # Top row: Data, Model Image, Normalized Residual Map
406+ plot_array (
407+ array = fit .data , ax = axes_flat [0 ], title = _pf ("Data" ), colormap = colormap ,
408+ )
409+
410+ plot_array (
411+ array = fit .model_data , ax = axes_flat [1 ], title = _pf ("Model Image" ),
412+ colormap = colormap , lines = image_plane_lines ,
413+ line_colors = image_plane_line_colors ,
414+ )
415+
416+ norm_resid = fit .normalized_residual_map
417+ _abs_max = _symmetric_vmax (norm_resid )
418+ plot_array (
419+ array = norm_resid , ax = axes_flat [2 ], title = _pf ("Normalized Residual Map" ),
420+ colormap = colormap , vmin = - _abs_max , vmax = _abs_max ,
421+ )
422+
423+ # Bottom row: Lens Light Subtracted, Source Model Image, Source Plane (Mid Zoom)
424+ try :
425+ subtracted_img = fit .subtracted_images_of_planes_list [final_plane_index ]
426+ except (IndexError , AttributeError ):
427+ subtracted_img = None
428+ if subtracted_img is not None :
429+ plot_array (
430+ array = subtracted_img , ax = axes_flat [3 ],
431+ title = _pf ("Lens Light Subtracted" ), colormap = colormap ,
432+ vmin = 0.0 if source_vmax is not None else None , vmax = source_vmax ,
433+ )
434+ else :
435+ axes_flat [3 ].axis ("off" )
436+
437+ try :
438+ source_model_img = fit .model_images_of_planes_list [final_plane_index ]
439+ except (IndexError , AttributeError ):
440+ source_model_img = None
441+ if source_model_img is not None :
442+ plot_array (
443+ array = source_model_img , ax = axes_flat [4 ],
444+ title = _pf ("Source Model Image" ), colormap = colormap ,
445+ vmax = source_vmax , lines = image_plane_lines ,
446+ line_colors = image_plane_line_colors ,
447+ )
448+ else :
449+ axes_flat [4 ].axis ("off" )
450+
451+ _plot_source_plane (
452+ fit , axes_flat [5 ], final_plane_index , zoom_to_brightest = True ,
453+ colormap = colormap , title = _pf ("Source Plane (Mid Zoom)" ),
454+ lines = source_plane_lines , line_colors = source_plane_line_colors ,
455+ vmax = source_vmax , zoom_extent_scale = 2.0 ,
456+ )
457+
458+ hide_unused_axes (axes_flat )
459+ tight_layout ()
460+ save_figure (fig , path = output_path , filename = "fit_quick" , format = output_format , dpi = 200 )
461+
462+
361463def subplot_fit_x1_plane (
362464 fit ,
363465 output_path : Optional [str ] = None ,
0 commit comments