1、完善命名规范

2、完成<冗余数据切割和标签映射>的全部代码
This commit is contained in:
2025-05-09 17:21:55 +08:00
parent 9dd7689756
commit aad3dfba49
15 changed files with 567 additions and 272 deletions

View File

@ -33,7 +33,7 @@ class ConfigParams:
# 预处理
PREPROCESS_CONFIG_FILE_PATH: str = "./config/Config_preprocess.yaml"
PREPROCESS_CONFIG_NEW_CONTENT = {
PREPROCESS_CONFIG_NEW_CONTENT: dict = {
"InputConfig": {
"Freq": 1000
},
@ -57,7 +57,7 @@ class ConfigParams:
# BCG的J峰算法定位
DETECT_JPEAK_CONFIG_FILE_PATH: str = "./config/Config_detect_Jpeak.yaml"
DETECT_JPEAK_CONFIG_NEW_CONTENT = {
DETECT_JPEAK_CONFIG_NEW_CONTENT: dict = {
"InputConfig": {
"Freq": 1000
},
@ -79,7 +79,7 @@ class ConfigParams:
# ECG的R峰算法定位
DETECT_RPEAK_CONFIG_FILE_PATH: str = "./config/Config_detect_Rpeak.yaml"
DETECT_RPEAK_CONFIG_NEW_CONTENT = {
DETECT_RPEAK_CONFIG_NEW_CONTENT: dict = {
"InputConfig": {
"Freq": 1000
},
@ -96,7 +96,7 @@ class ConfigParams:
# 人工纠正
LABEL_CHECK_CONFIG_FILE_PATH: str = "./config/Config_label_check.yaml"
LABEL_CHECK_CONFIG_NEW_CONTENT = {
LABEL_CHECK_CONFIG_NEW_CONTENT: dict = {
"InputConfig": {
"Freq": 1000
},
@ -130,7 +130,7 @@ class ConfigParams:
# 数据精同步
PRECISELY_ALIGN_CONFIG_FILE_PATH: str = "./config/Config_precisely_align.yaml"
PRECISELY_ALIGN_CONFIG_NEW_CONTENT = {
PRECISELY_ALIGN_CONFIG_NEW_CONTENT: dict = {
"InputConfig": {
"ECGFreq": 1000
}
@ -152,10 +152,46 @@ class ConfigParams:
PRECISELY_ALIGN_SAVE_PEAK_CHUNK_SIZE: int = 100
# 冗余数据切割和标签映射
CUT_PSG_CONFIG_FILE_PATH: str = "./config/Config_cut_PSG.yaml"
CUT_PSG_CONFIG_NEW_CONTENT: dict = {
"ECGFreq": 1000,
"ChannelInput": {
"Effort Tho": "Effort Tho_Raw_",
"Effort Abd": "Effort Abd_Raw_",
"Flow Patient": "Flow Patient_Raw_",
"Snore": "Snore_Raw_",
"SpO2": "SpO2_Raw_",
"5_class": "5_class_Raw_"
},
"LabelInput": {
"SA Label": "SA Label_Raw"
},
"StartTime": "StartTime_Raw",
"ChannelSave": {
"Effort Tho": "Effort Tho_Sync_",
"Effort Abd": "Effort Abd_Sync_",
"Flow Patient": "Flow Patient_Sync_",
"Snore": "Snore_Sync_",
"SpO2": "SpO2_Sync_",
"5_class": "5_class_Sync_"
},
"LabelSave": {
"SA Label": "SA Label_Sync"
},
"EndWith": {
"Effort Tho": ENDSWITH_TXT,
"Effort Abd": ENDSWITH_TXT,
"Flow Patient": ENDSWITH_TXT,
"Snore": ENDSWITH_TXT,
"SpO2": ENDSWITH_TXT,
"5_class": ENDSWITH_TXT,
"SA Label": ENDSWITH_CSV,
"StartTime": ENDSWITH_TXT
},
}
CUT_PSG_SAVE_ECG_ALIGNINFO_FILENAME: str = "Align_info"
CUT_PSG_SALABEL_EVENT: list = ["Hypopnea", "Central apnea", "Obstructive apnea", "Mixed apnea"]
CUT_PSG_CHANNEL_LIST: list = ["Effort Abd_Raw_", "Effort Tho_Raw_", "Flow Patient_Raw_", "Snore_Raw_", "SpO2_Raw_"]
CUT_PST_LABEL_LIST: list = ["5_class_Raw_", "SA Label_Raw"]
CUT_PST_STARTTIME: list = ["StartTime_Raw"]
# 体动标注

View File

@ -269,6 +269,32 @@ class Constants:
PRECISELY_ALIGN_NO_POINT_IN_THE_INTERVAL: str = "所选区间内无有效点"
PRECISELY_ALIGN_ACTION_GET_RANGE_NAME: str = f"设置范围({ConfigParams.PRECISELY_ALIGN_ACTION_GET_RANGE_SHORTCUT_KEY})"
# 冗余数据切割和标签映射
CUT_PSG_GETTING_FILE_AND_FREQ: str = "正在获取文件及其采样率"
CUT_PSG_GET_FILE_AND_FREQ_FINISHED: str = "获取文件及其采样率完成"
CUT_PSG_GET_FILE_AND_FREQ_FAILURE: str = "获取文件及其采样率失败"
CUT_PSG_CUTTING_DATA: str = "正在切割数据"
CUT_PSG_CUT_DATA_FINISHED: str = "切割数据完成"
CUT_PSG_CUT_DATA_FAILURE: str = "切割数据失败"
CUT_PSG_ALIGNING_LABEL: str = "正在映射标签"
CUT_PSG_ALIGN_LABEL_FINISHED: str = "映射标签完成"
CUT_PSG_ALIGN_LABEL_FAILURE: str = "映射标签失败"
CUT_PSG_FAILURE_REASON: str = {
"Filename_Format_not_Correct": "(文件名格式不正确)",
"File_not_Exist": "(需要处理的文件不存在)",
"Get_File_and_Freq_Excepetion": "(检查文件是否存在并获取其数据采样率异常)",
"Read_Data_Exception": "(读取数据异常)",
"Cut_Data_Length_not_Correct": "(切割数据时长度不正确)",
"Cut_Data_Exception": "(切割数据异常)",
"Align_Label_SALabel_Format_not_Correct": "映射标签时SA Label中的文件格式不正确",
"Align_Label_Exception": "(映射标签异常)",
"Save_Data_not_Exist": "(需要保存的数据不存在)",
"Save_Exception": "(保存异常)"
}
# 体动标注
# TODO弃用

View File

@ -130,7 +130,6 @@ class PublicFunc:
@staticmethod
def add_progressbar(mainWindow):
mainWindow.progressbar = QProgressBar()
mainWindow.progressbar.setRange(0, 100)
mainWindow.progressbar.setValue(0)
@ -139,17 +138,14 @@ class PublicFunc:
@staticmethod
def statusbar_show_msg(mainWindow, msg):
mainWindow.ui.statusbar.showMessage(msg)
@staticmethod
def statusbar_clear_msg(mainWindow):
mainWindow.ui.statusbar.clearMessage()
@staticmethod
def finish_operation(mainWindow, buttonState):
PublicFunc.statusbar_show_msg(mainWindow, PublicFunc.format_status_msg(Constants.OPERATION_FINISHED))
mainWindow.progressbar.setValue(100)
QApplication.processEvents()
@ -158,7 +154,6 @@ class PublicFunc:
@staticmethod
def progressbar_update(mainWindow, current: int, total: int, msg: str, progressbarState: int):
if current > total:
raise ValueError("当前进度值大于总进度值")
if progressbarState < 0 or progressbarState > 100: