From 692a88c7bb41d65bfb6ef9f50adbd472b5688e56 Mon Sep 17 00:00:00 2001 From: duxin Date: Thu, 9 Jul 2026 11:22:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20heatmap=5Fpath=20=E6=8F=90=E5=89=8D?= =?UTF-8?q?=E5=A3=B0=E6=98=8E=E9=81=BF=E5=85=8D=E6=B0=B4=E8=89=B2=E6=8C=87?= =?UTF-8?q?=E6=95=B0=E6=A8=A1=E5=BC=8F=E4=B8=8B=20UnboundLocalError?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/postprocessing/report_word.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/postprocessing/report_word.py b/src/postprocessing/report_word.py index 07485d0..0f677cf 100644 --- a/src/postprocessing/report_word.py +++ b/src/postprocessing/report_word.py @@ -1784,10 +1784,10 @@ class WaterQualityReportGenerator: doc.add_paragraph() # 表格和热力图之间的空行 # 2. 添加相关性热力图(放在表格下方)—— 仅 ML 模式 + heatmap_path = vis_dir / "correlation_heatmap.png" if getattr(self, '_pipeline_mode', 'ml') == 'ml': h3 = doc.add_heading("4.2 水质参数相关性分析", level=2) self._style_heading(h3, level=2) - heatmap_path = vis_dir / "correlation_heatmap.png" figure_num = start_figure_num if heatmap_path.exists(): try: @@ -1827,7 +1827,9 @@ class WaterQualityReportGenerator: pass doc.add_page_break() - return start_figure_num + (1 if heatmap_path.exists() else 0) + heatmap_added = 1 if (getattr(self, '_pipeline_mode', 'ml') == 'ml' + and heatmap_path.exists()) else 0 + return start_figure_num + heatmap_added def _add_physical_inversion_section( self,