优化<数据预处理>的代码
优化<BCG的J峰算法定位>的代码
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
from datetime import datetime
|
||||
from logging import error, info
|
||||
from pathlib import Path
|
||||
|
||||
from PySide6.QtWidgets import QMessageBox, QWidget, QPushButton, QProgressBar, QApplication, QRadioButton
|
||||
|
||||
from func.utils.Constants import Constants
|
||||
from func.utils.CustomException import TipsTypeValueNotExistError, MsgBoxTypeValueNotExistError
|
||||
from func.utils.Result import Result
|
||||
|
||||
|
||||
class PublicFunc:
|
||||
@ -172,4 +174,35 @@ class PublicFunc:
|
||||
raise ValueError("进度条值的范围应该在[0, 100]")
|
||||
PublicFunc.statusbar_show_msg(mainWindow, PublicFunc.format_status_msg(f"({str(current)}/{str(total)}){msg}"))
|
||||
mainWindow.progressbar.setValue(progressbarState)
|
||||
QApplication.processEvents()
|
||||
QApplication.processEvents()
|
||||
|
||||
@staticmethod
|
||||
def examine_file(path_str, filename):
|
||||
temp_path = list(
|
||||
Path(path_str).glob(f"{filename}*"))
|
||||
if len(temp_path) == 0:
|
||||
return Result().failure(
|
||||
info=Constants.INPUT_FAILURE + "\n" +
|
||||
filename + ":" +
|
||||
path_str +
|
||||
Constants.FAILURE_REASON["File_Not_Exist"])
|
||||
elif len(temp_path) > 1:
|
||||
return Result().failure(
|
||||
info=Constants.INPUT_FAILURE + "\n" +
|
||||
filename + ":" +
|
||||
path_str +
|
||||
Constants.FAILURE_REASON["File_More_Than_One"])
|
||||
else:
|
||||
path = temp_path[0]
|
||||
freq = path.stem.split("_")[-1]
|
||||
# 验证是否为整数或是否存在
|
||||
if not freq.isdigit():
|
||||
return Result().failure(
|
||||
info=Constants.INPUT_FAILURE + "\n" +
|
||||
filename + ":" +
|
||||
Constants.FAILURE_REASON["Data_Frequency_Not_In_Filename"])
|
||||
data = {
|
||||
"path": str(path),
|
||||
"freq": int(freq)
|
||||
}
|
||||
return Result().success(data=data)
|
||||
Reference in New Issue
Block a user