完善耐久采集

This commit is contained in:
2025-04-07 10:38:59 +08:00
parent 671db5b1db
commit 6e547ca6a3
16 changed files with 341 additions and 387 deletions

View File

@ -12,7 +12,6 @@ class WaveloggerDataProcess(QThread):
super().__init__()
self.dir_path = dir_path
self.idx = 3
self.logger = clibs.logger
def find_point(self, bof, step, margin, threshold, pos, data_file, flag, df, row):
# bof: backward or forward
@ -31,7 +30,7 @@ class WaveloggerDataProcess(QThread):
break
else:
if bof == "backward":
self.logger("ERROR", "wavelogger", f"find_point-gt: [{pos}] 在 {data_file} 中,无法正确识别数据,需要确认...", "red")
clibs.logger("ERROR", "wavelogger", f"find_point-gt: [{pos}] 在 {data_file} 中,无法正确识别数据,需要确认...", "red")
elif bof == "forward":
row_target = row + margin # to end while loop in function `single_file_proc`
elif flag == "lt":
@ -45,7 +44,7 @@ class WaveloggerDataProcess(QThread):
break
else:
if bof == "backward":
self.logger("ERROR", "wavelogger", f"find_point-lt: [{pos}] 在 {data_file} 中,无法正确识别数据,需要确认...", "red")
clibs.logger("ERROR", "wavelogger", f"find_point-lt: [{pos}] 在 {data_file} 中,无法正确识别数据,需要确认...", "red")
elif bof == "forward":
row_target = row + margin # to end while loop in function `single_file_proc`
return row_target
@ -82,7 +81,7 @@ class WaveloggerDataProcess(QThread):
for data_file in data_files:
if not data_file.lower().endswith(".csv"):
self.logger("ERROR", "wavelogger", f"init: {data_file} 文件后缀错误,只允许 .csv 文件,需要确认!", "red")
clibs.logger("ERROR", "wavelogger", f"init: {data_file} 文件后缀错误,只允许 .csv 文件,需要确认!", "red")
return data_files
@ -108,7 +107,7 @@ class WaveloggerDataProcess(QThread):
value = df.iloc[start:end, 2].astype(float).mean() + 3 * df.iloc[start:end, 2].astype(float).std()
if value > 1:
msg = f"\n"
self.logger("WARNING", "wavelogger", f"{data_file} 文件第 {count} 轮 第 {count_i} 个数据可能有问题,需人工手动确认,确认有问题可删除,无问题则保留")
clibs.logger("WARNING", "wavelogger", f"{data_file} 文件第 {count} 轮 第 {count_i} 个数据可能有问题,需人工手动确认,确认有问题可删除,无问题则保留")
data[count].append(value)
count_i += 1
@ -129,7 +128,7 @@ class WaveloggerDataProcess(QThread):
row += 1
def execution(self, data_files):
self.logger("INFO", "wavelogger", "正在处理中......", "blue")
clibs.logger("INFO", "wavelogger", "正在处理中......", "blue")
wb = openpyxl.Workbook()
step, margin, data_length, threshold = 5, 50, 50, 5
for data_file in data_files:
@ -148,7 +147,7 @@ class WaveloggerDataProcess(QThread):
data_files = self.initialization()
self.execution(data_files)
self.logger("INFO", "wavelogger", "-" * 60 + "<br>全部处理完毕<br>", "purple")
clibs.logger("INFO", "wavelogger", "-" * 60 + "<br>全部处理完毕<br>", "purple")
time_total = time.time() - time_start
msg = f"数据处理时间:{time_total // 3600:02.0f} h {time_total % 3600 // 60:02.0f} m {time_total % 60:02.0f} s"
self.logger("INFO", "wavelogger", msg)
clibs.logger("INFO", "wavelogger", msg)