feat(background.py): 启用背景校正图表生成
algorithmic_baseline() 函数: - 原代码: fig = None # plotting disabled - 修复: 调用 plotting.background_plotting(df, gas) 生成交互式图表, 显示原始浓度、拟合基线、信号点(红色)和背景点(蓝色圆圈) 异常保护:try/except 包裹,绘图失败时回退至 None
This commit is contained in:
@ -52,7 +52,11 @@ def algorithmic_baseline(
|
|||||||
signal = (df[gas] - bkg)[~bkg_points]
|
signal = (df[gas] - bkg)[~bkg_points]
|
||||||
df[f"{gas}_signal"] = np.invert(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 = (
|
output_text = (
|
||||||
f"Baseline algorithm: {algorithm}\n"
|
f"Baseline algorithm: {algorithm}\n"
|
||||||
f"Positive and negative 95% percentile of baseline: {np.percentile(background, 2.5):.2f} ppm, "
|
f"Positive and negative 95% percentile of baseline: {np.percentile(background, 2.5):.2f} ppm, "
|
||||||
|
|||||||
Reference in New Issue
Block a user