自动化测试的功能迁移完毕,待测试

This commit is contained in:
2025-01-14 23:52:52 +08:00
parent 0e67a2831c
commit 855448664c
9 changed files with 520 additions and 1198 deletions

View File

@ -177,16 +177,12 @@ def find_point(data_file, df, flag, row_s, row_e, threshold, step, end_point, sk
row_s -= step
continue
else:
# one more time如果连续两次 200 个点的平均值都大于 2,说明已经到了临界点了(其实也不一定,只不过相对遇到一次就判定临界点更安全一点点)
# one more time如果连续两次 200 个点的平均值都大于 threshold,说明已经到了临界点了(其实也不一定,只不过相对遇到一次就判定临界点更安全一点点)
# 从实际数据看,这开逻辑很小概率能触发到
speed_avg = df.iloc[row_s-end_point*skip_scale:row_e-end_point*skip_scale].abs().mean()
if speed_avg < threshold:
insert_logdb("WARNING", "current", f"【lt】{axis} 轴第 {seq} 次查找数据有异常row_s = {row_s}, row_e = {row_e}")
row_e -= end_point*skip_scale
row_s -= end_point*skip_scale
continue
else:
return row_s, row_e
insert_logdb("WARNING", "current", f"【lt】{axis} 轴第 {seq} 次查找数据可能有异常row_s = {row_s}, row_e = {row_e}")
return row_s, row_e
else:
w2t(f"{data_file} 数据有误,需要检查,无法找到第 {seq} 个有效点...", "red", "AnchorNotFound")
elif flag == "gt":
@ -199,16 +195,12 @@ def find_point(data_file, df, flag, row_s, row_e, threshold, step, end_point, sk
row_s -= step
continue
else:
# one more time如果连续两次 200 个点的平均值都小于 2,说明已经到了临界点了(其实也不一定,只不过相对遇到一次就判定临界点更安全一点点)
# one more time如果连续两次 200 个点的平均值都小于 threshold,说明已经到了临界点了(其实也不一定,只不过相对遇到一次就判定临界点更安全一点点)
# 从实际数据看,这开逻辑很小概率能触发到
speed_avg = df.iloc[row_s-end_point*skip_scale:row_e-end_point*skip_scale].abs().mean()
if speed_avg > threshold:
insert_logdb("WARNING", "current", f"【gt】{axis} 轴第 {seq} 次查找数据有异常row_s = {row_s}, row_e = {row_e}")
row_e -= end_point*skip_scale
row_s -= end_point*skip_scale
continue
else:
return row_s, row_e
insert_logdb("WARNING", "current", f"【gt】{axis} 轴第 {seq} 次查找数据可能有异常row_s = {row_s}, row_e = {row_e}")
return row_s, row_e
else:
w2t(f"{data_file} 数据有误,需要检查,无法找到第 {seq} 个有效点...", "red", "AnchorNotFound")
@ -257,7 +249,7 @@ def p_single(wb, single, vel, trq, sensor, rrs, w2t, insert_logdb):
step = 50 # 步进值
end_point = 200 # 有效数值的数目
threshold = 2 # 200个点的平均阈值线
threshold = 5 # 200个点的平均阈值线
skip_scale = 2
row_start, row_middle, row_end = 0, 0, 0
row_e = df.index[-1]
@ -265,15 +257,15 @@ def p_single(wb, single, vel, trq, sensor, rrs, w2t, insert_logdb):
speed_avg = df.iloc[row_s:row_e].abs().mean()
if speed_avg < 2:
# 第一次过滤:消除速度为零的数据,找到速度即将大于零的上升临界点
row_s, row_e = find_point(data_file, df, "lt", row_s, row_e, threshold, step, end_point, skip_scale, axis, 0, w2t, insert_logdb)
row_s, row_e = find_point(data_file, df, "lt", row_s, row_e, threshold, step, end_point, skip_scale, axis, "pre-1", w2t, insert_logdb)
row_e -= end_point*skip_scale
row_s -= end_point*skip_scale
# 第二次过滤:消除速度大于零的数据,找到速度即将趋近于零的下降临界点
row_s, row_e = find_point(data_file, df, "gt", row_s, row_e, threshold, step, end_point, skip_scale, axis, 0, w2t, insert_logdb)
row_s, row_e = find_point(data_file, df, "gt", row_s, row_e, threshold, step, end_point, skip_scale, axis, "pre-2", w2t, insert_logdb)
row_e -= end_point*skip_scale
row_s -= end_point*skip_scale
# 第三次过滤:消除速度为零的数据,找到速度即将大于零的上升临界点
row_s, row_e = find_point(data_file, df, "lt", row_s, row_e, threshold, step, end_point, skip_scale, axis, 0, w2t, insert_logdb)
row_s, row_e = find_point(data_file, df, "lt", row_s, row_e, threshold, step, end_point, skip_scale, axis, "pre-3", w2t, insert_logdb)
row_e -= end_point*skip_scale
row_s -= end_point*skip_scale
# 正式第一次采集:消除速度大于零的数据,找到速度即将趋近于零的下降临界点
@ -291,11 +283,11 @@ def p_single(wb, single, vel, trq, sensor, rrs, w2t, insert_logdb):
row_start = get_row_number(threshold, "start", df, row_s, row_e, axis, insert_logdb)
elif speed_avg > 2:
# 第一次过滤:消除速度大于零的数据,找到速度即将趋近于零的下降临界点
row_s, row_e = find_point(data_file, df, "gt", row_s, row_e, threshold, step, end_point, skip_scale, axis, 0, w2t, insert_logdb)
row_s, row_e = find_point(data_file, df, "gt", row_s, row_e, threshold, step, end_point, skip_scale, axis, "pre-1", w2t, insert_logdb)
row_e -= end_point*skip_scale
row_s -= end_point*skip_scale
# 第二次过滤:消除速度为零的数据,找到速度即将大于零的上升临界点
row_s, row_e = find_point(data_file, df, "lt", row_s, row_e, threshold, step, end_point, skip_scale, axis, 0, w2t, insert_logdb)
row_s, row_e = find_point(data_file, df, "lt", row_s, row_e, threshold, step, end_point, skip_scale, axis, "pre-2", w2t, insert_logdb)
row_e -= end_point*skip_scale
row_s -= end_point*skip_scale
# 第一次正式采集:消除速度大于零的数据,找到速度即将趋近于零的下降临界点