master
Paul597 3 months ago
parent 5262c7b30e
commit 15536edc62

@ -23,7 +23,7 @@ def grid_downsample(points, cell_size=15):
参数保存数据的txt文件路径
返回值在目标区域内的下侧数据点坐标x_boty_bot上侧数据点坐标x_top,y_top
"""
def get_data(txt_name):
def get_data(txt_name,jingdu):
# 加载数据
data = np.loadtxt(txt_name)
int_data = data.astype(int)
@ -144,7 +144,7 @@ def get_data(txt_name):
clean_slope_bot, clean_intercept_bot, clean_r2_bot = calc_slope_line.linear_regression(x_bot_clean, y_bot_clean)
clean_slope_top, clean_intercept_top, clean_r2_top = calc_slope_line.linear_regression(x_top_clean, y_top_clean)
print(f"清洗数据后上下沿拟合参数clean_r2_bot = {clean_r2_bot},clean_r2_top = {clean_r2_top}")
if ((1-clean_r2_bot) > (1-0.98)) or ((1-clean_r2_top) > (1-0.98)):
if ((1-clean_r2_bot) > (1-jingdu)) or ((1-clean_r2_top) > (1-jingdu)):
print("无效数据")
return 0, None, None, None, None
return 1, x_bot_clean, y_bot_clean, x_top_clean, y_top_clean

@ -14,9 +14,9 @@ alpha = model.alpha
beta = model.beta
q=model.q
def vs_measurement(txt_name, position = 784):
def vs_measurement(txt_name, position = 784, jingdu =0.98):
# 加载数据
state, x_bot, y_bot, x_top, y_top = get_data.get_data(txt_name)
state, x_bot, y_bot, x_top, y_top = get_data.get_data(txt_name,jingdu)
if state == 0:
return 0, None, None
# 拟合上下沿

Loading…
Cancel
Save