diff --git a/aio/README.md b/aio/README.md index 8afb13f..d3f6ac9 100644 --- a/aio/README.md +++ b/aio/README.md @@ -304,3 +304,6 @@ v0.1.7.0(2024/06/26)-初步可用 6. [aio.py] 修改了在tabview_click函数中对于实例化openapi的动作,使每次切换标签都会重新实例化,也就是每次都会重新连接,修复显示不正确的问题 7. [openapi.py] 新增了socket关闭的函数,并增加msg_id为None的处理逻辑 8. [btn_functions.py] 完善了状态获取的功能,新增告警获取以及功能切换的逻辑 +9. [aio.py] 修改了版本 +10. [current.py] max/avg功能结束之前会将结果数据追加写入源文件,avg算法更改为average+3×std +11. [wavelogger.py] 算法更改为 average+3×std diff --git a/aio/code/aio.py b/aio/code/aio.py index 8640383..3795c23 100644 --- a/aio/code/aio.py +++ b/aio/code/aio.py @@ -99,7 +99,7 @@ class App(customtkinter.CTk): btns_func['log']['btn'].configure(command=lambda: self.thread_it(self.func_log_callback)) btns_func['end']['btn'].configure(command=lambda: self.thread_it(self.func_end_callback)) # create version info - self.label_version = customtkinter.CTkLabel(self.frame_func, justify='left', text="Vers: 0.1.6.3\nDate: 06/18/2024", font=self.my_font, text_color="#4F4F4F") + self.label_version = customtkinter.CTkLabel(self.frame_func, justify='left', text="Vers: 0.1.7.0\nDate: 06/26/2024", font=self.my_font, text_color="#4F4F4F") self.frame_func.rowconfigure(6, weight=1) self.label_version.grid(row=6, column=0, padx=20, pady=20, sticky='s') # ===================================================================== diff --git a/aio/code/automatic_test/btn_functions.py b/aio/code/automatic_test/btn_functions.py index 1a0398f..e6a6d51 100644 --- a/aio/code/automatic_test/btn_functions.py +++ b/aio/code/automatic_test/btn_functions.py @@ -1,10 +1,6 @@ import json -import socket -from os.path import dirname from sys import argv -current_path = dirname(__file__) - def validate_resp(_id, response, w2t): match _id: diff --git a/aio/code/data_process/current.py b/aio/code/data_process/current.py index 86343fd..7c2b820 100644 --- a/aio/code/data_process/current.py +++ b/aio/code/data_process/current.py @@ -6,7 +6,7 @@ from pandas import read_csv, concat, set_option from re import match from threading import Thread from time import sleep -from csv import reader +from csv import reader, writer class GetThreadResult(Thread): @@ -99,6 +99,11 @@ def current_max(data_files, rcs, trqh, w2t): current[axis].append(_) w2t(f"{data_file}: {_:.4f}") + with open(data_file, 'a+') as f_data: + csv_writer = writer(f_data) + csv_writer.writerow([''] * 4) + csv_writer.writerow([_]) + for axis, cur in current.items(): if not cur: continue @@ -127,10 +132,15 @@ def current_avg(data_files, rcs, trqh, w2t): c_avg = df[col].mean() scale = 1 if data_file.endswith('.csv') else 1000 - _ = (abs(c_avg)+c_std)/scale*rca + _ = (abs(c_avg)+c_std*3)/scale*rca current[axis].append(_) w2t(f"{data_file}: {_:.4f}") + with open(data_file, 'a+') as f_data: + csv_writer = writer(f_data) + csv_writer.writerow([''] * 4) + csv_writer.writerow([_]) + for axis, cur in current.items(): if not cur: continue diff --git a/aio/code/data_process/wavelogger.py b/aio/code/data_process/wavelogger.py index 4297e85..730d276 100644 --- a/aio/code/data_process/wavelogger.py +++ b/aio/code/data_process/wavelogger.py @@ -136,7 +136,7 @@ def single_file_proc(ws, data_file, df, low, high, cycle, w2t): _row_lt = find_point('forward', _step, 'c'+str(_row), data_file, 'lt', df, _row, w2t) _start = int(_row_gt + (_row_lt - _row_gt - 50) / 2) _end = _start + 50 - value = df.iloc[_start:_end, 2].mean() + df.iloc[_start:_end, 2].std() + value = df.iloc[_start:_end, 2].mean() + 3 * df.iloc[_start:_end, 2].std() _data[count].append(value) else: _row_gt = find_point('forward', _step, 'c'+str(_row), data_file, 'gt', df, _row, w2t)