From ae6d1564b8981d77ddcdfa163d25b0e8752a5fb1 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Tue, 7 Apr 2026 14:09:15 +0100 Subject: [PATCH] perf: skip savefig in _save_subplot when PYAUTO_FAST_PLOTS=1 The _save_subplot function in PyAutoGalaxy had its own fig.savefig() path that wasn't covered by the PYAUTO_FAST_PLOTS check in autoarray. This caused subplot functions using _save_subplot to still render to disk during smoke tests. Co-Authored-By: Claude Opus 4.6 (1M context) --- autogalaxy/plot/plot_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autogalaxy/plot/plot_utils.py b/autogalaxy/plot/plot_utils.py index 8ff5f8ea..28a66de8 100644 --- a/autogalaxy/plot/plot_utils.py +++ b/autogalaxy/plot/plot_utils.py @@ -74,11 +74,15 @@ def _save_subplot(fig, output_path, output_filename, output_format=None, For FITS output use the dedicated ``fits_*`` functions instead. """ - from autoarray.plot.utils import _output_mode_save, _conf_output_format + from autoarray.plot.utils import _output_mode_save, _conf_output_format, _FAST_PLOTS if _output_mode_save(fig, output_filename): return + if _FAST_PLOTS: + plt.close(fig) + return + fmt = output_format[0] if isinstance(output_format, (list, tuple)) else (output_format or _conf_output_format()) if fmt == "show" or not output_path: plt.show()