feat(background.py): 启用背景校正图表生成

algorithmic_baseline() 函数:
- 原代码: fig = None  # plotting disabled
- 修复: 调用 plotting.background_plotting(df, gas) 生成交互式图表,
  显示原始浓度、拟合基线、信号点(红色)和背景点(蓝色圆圈)

异常保护:try/except 包裹,绘图失败时回退至 None
This commit is contained in:
DXC
2026-07-10 14:49:01 +08:00
parent e3acd46da9
commit 408e1660fc

View File

@ -52,7 +52,11 @@ def algorithmic_baseline(
signal = (df[gas] - bkg)[~bkg_points]
df[f"{gas}_signal"] = np.invert(bkg_points)
fig = None # plotting disabled
try:
from . import plotting
fig = plotting.background_plotting(df, gas)
except Exception:
fig = None
output_text = (
f"Baseline algorithm: {algorithm}\n"
f"Positive and negative 95% percentile of baseline: {np.percentile(background, 2.5):.2f} ppm, "