fix: 单步模式下自动发现耀斑掩膜文件

- 单步运行时 PipelineContext 不保留 step2 的 glint_mask_path,
  导致采样时无法剔除耀斑区域
- 新增自动发现:兜底扫描 2_Glint_Detection/severe_glint_area.dat
- 补充缺失的 import os
This commit is contained in:
duxin
2026-07-28 17:25:41 +08:00
parent 241b138bb5
commit 80e46c8476

View File

@ -7,6 +7,7 @@ Step4 处理器:预测采样点生成
剥离为独立的 Step4SamplingHandler。
"""
import os
import time
from typing import Any, Dict
@ -35,6 +36,15 @@ class Step4SamplingHandler(BaseStepHandler):
glint_mask_path = self._resolve_path(
config.get('glint_mask_path'), context.glint_mask_path, 'glint_mask'
)
# ★ 自动发现:单步模式下 context 无缓存,兜底扫描标准目录
if not glint_mask_path:
_glint_dir = context.glint_dir if context.glint_dir else os.path.join(
str(context.work_dir), '2_Glint_Detection')
_candidate = os.path.join(str(_glint_dir), 'severe_glint_area.dat')
if os.path.isfile(_candidate):
glint_mask_path = _candidate
context.notify('step4_sampling', 'info',
f'自动发现耀斑掩膜: {_candidate}')
try:
result = PredictionStep.generate_sampling_points(