v0.2.0.5(2024/07/31)
此版本改动较大,公共部分做了规整,放置到新建文件夹 commons 当中,并所有自定义模块引入 logging 模块,记录重要信息 1. [t_change_ui: clibs.py] - 调整代码组织结构,新增模块,将公共函数以及类合并入此 - 将一些常量放入该模块 - 引入logging/concurrent_log_handler模块,并作初始化操作,供其他模块使用,按50M切割,最多保留10份 - prj_to_xcore函数设置工程名部分重写,修复了多个prj工程可能不能执行的问题 2. [t_change_ui: openapi.py] - 完全重写了 get_from_id 函数,使更精准 - 在 msg_storage 函数中,增加 logger,保留所有响应消息 - 删除 heartbeat 函数中的日志保存功能部分 - 心跳再次修改为 2s... 3. [t_change_ui: aio.py] - 增加了日志初始化部分 - detect_network 函数中修改重新实例化HR间隔为 4s,对应心跳 4. [t_change_ui: do_brake.py] - 使用一直打开曲线的方法规避解决了 OOM 的问题,同时修改数据处理方式,只取最后 12s 5. [t_change_ui: do_current.py] - 保持电流,只取最后 15s 6. [t_change_ui: all the part]: 引入 commons 包,并定制了 logging 输出,后续持续优化
This commit is contained in:
@ -1,31 +1,11 @@
|
||||
import os
|
||||
import random
|
||||
|
||||
from pandas import read_csv
|
||||
from csv import reader
|
||||
from sys import argv
|
||||
from os.path import exists
|
||||
from os import scandir, remove
|
||||
from openpyxl import Workbook
|
||||
from random import randint
|
||||
from logging import getLogger
|
||||
from commons import clibs
|
||||
|
||||
def traversal_files(path, w2t):
|
||||
# 功能:以列表的形式分别返回指定路径下的文件和文件夹,不包含子目录
|
||||
# 参数:路径
|
||||
# 返回值:路径下的文件夹列表 路径下的文件列表
|
||||
if not exists(path):
|
||||
msg = f'数据文件夹{path}不存在,请确认后重试......'
|
||||
w2t(msg, 0, 1, 'red')
|
||||
else:
|
||||
dirs = []
|
||||
files = []
|
||||
for item in scandir(path):
|
||||
if item.is_dir():
|
||||
dirs.append(item.path)
|
||||
elif item.is_file():
|
||||
files.append(item.path)
|
||||
|
||||
return dirs, files
|
||||
logger = getLogger(__file__)
|
||||
|
||||
|
||||
def find_point(bof, step, pos, data_file, flag, df, row, w2t):
|
||||
@ -95,7 +75,7 @@ def get_cycle_info(data_file, df, row, step, w2t):
|
||||
|
||||
|
||||
def initialization(path, w2t):
|
||||
_, data_files = traversal_files(path, w2t)
|
||||
_, data_files = clibs.traversal_files(path, w2t)
|
||||
|
||||
for data_file in data_files:
|
||||
if not data_file.lower().endswith('.csv'):
|
||||
@ -126,7 +106,7 @@ def single_file_proc(ws, data_file, df, low, high, cycle, w2t):
|
||||
_step = 5
|
||||
_data = {}
|
||||
row_max = df.index[-1]-100
|
||||
print(data_file)
|
||||
# print(data_file)
|
||||
while _row < row_max:
|
||||
if count not in _data.keys():
|
||||
_data[count] = []
|
||||
@ -149,7 +129,7 @@ def single_file_proc(ws, data_file, df, low, high, cycle, w2t):
|
||||
ws.cell(row=1, column=i).value = f"第{i-1}次测试"
|
||||
ws.cell(row=i, column=1).value = f"第{i-1}次精度变化"
|
||||
|
||||
print(_data)
|
||||
# print(_data)
|
||||
for i in sorted(_data.keys()):
|
||||
_row = 2
|
||||
_column = i + 1
|
||||
@ -162,9 +142,9 @@ def execution(data_files, w2t):
|
||||
wb = Workbook()
|
||||
for data_file in data_files:
|
||||
ws, df, low, high, cycle = preparation(data_file, wb, w2t)
|
||||
print(f"low = {low}")
|
||||
print(f"high = {high}")
|
||||
print(f"cycle = {cycle}")
|
||||
# print(f"low = {low}")
|
||||
# print(f"high = {high}")
|
||||
# print(f"cycle = {cycle}")
|
||||
single_file_proc(ws, data_file, df, low, high, cycle, w2t)
|
||||
|
||||
wd = data_files[0].split('\\')
|
||||
|
Reference in New Issue
Block a user