From 4504f2ef840943eea51c113bb9a0b8df15acb27c Mon Sep 17 00:00:00 2001 From: Champagne <1369741103@qq.com> Date: Fri, 20 Jun 2025 14:54:51 +0800 Subject: [PATCH] 1 --- py/measure_lib.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/py/measure_lib.py b/py/measure_lib.py index f054a4a..518204f 100644 --- a/py/measure_lib.py +++ b/py/measure_lib.py @@ -177,11 +177,15 @@ def vs_measurement(txt_name,position): if not os.path.exists(txt_name): return None,None,None,None # 获取数据 - x_bot, y_bot, x_top, y_top = get_data.get_data(txt_name) - x_bot = np.array(x_bot) - y_bot = np.array(y_bot) - x_top = np.array(x_top) - y_top = np.array(y_top) + try: + x_bot, y_bot, x_top, y_top = get_data.get_data(txt_name) + x_bot = np.array(x_bot) + y_bot = np.array(y_bot) + x_top = np.array(x_top) + y_top = np.array(y_top) + except Exception as e: + print(f"处理过程中发生错误: {e}") + return 1,1,1,1 # 拟合路沿上下直线方程 slope_bot, intercept_bot, r2_bot = calc_slope_line.linear_regression(x_bot, y_bot)