完成了<呼吸可用性及间期标注>的代码重构
修复了<人工纠正>中多次寻峰时会保存多个相同峰值横坐标的问题
This commit is contained in:
@ -9,7 +9,7 @@ from PySide6.QtWidgets import QMessageBox, QMainWindow, QApplication, QTableWidg
|
||||
from matplotlib import gridspec, patches
|
||||
from matplotlib.backends.backend_qt import NavigationToolbar2QT
|
||||
from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg
|
||||
from numpy import append, delete, arange
|
||||
from numpy import append, delete, arange, setdiff1d
|
||||
from overrides import overrides
|
||||
from pandas import read_csv, DataFrame
|
||||
from scipy.signal import find_peaks
|
||||
@ -818,6 +818,7 @@ class MainWindow_label_check(QMainWindow):
|
||||
height=Config["FindPeaks"]["MinHeight"],
|
||||
distance=Config["FindPeaks"]["MinInterval"])
|
||||
peaks_idx = peaks_idx + int(rect_left)
|
||||
peaks_idx = setdiff1d(peaks_idx, self.data.corrected_peak)
|
||||
if len(peaks_idx) != 0:
|
||||
PublicFunc.text_output(self.ui, f"{Constants.LABEL_CHECK_ADD_POINTS_SUCCESSFULLY}{peaks_idx}",
|
||||
Constants.TIPS_TYPE_INFO)
|
||||
|
||||
1552
func/Module_resp_quality_label.py
Normal file
1552
func/Module_resp_quality_label.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -275,6 +275,7 @@ class ConfigParams:
|
||||
}
|
||||
}
|
||||
RESP_QUALITY_LABEL_PREPROCESS_FC: int = 1
|
||||
RESP_QUALITY_LABEL_PARTS_TIME_SEC: int = 30
|
||||
RESP_QUALITY_LABEL_LABEL_TRANSPARENCY: float = 0.2
|
||||
RESP_QUALITY_LABEL_ACTION_LABEL_MULTIPLE_SHORTCUT_KEY: str = "Z"
|
||||
|
||||
@ -341,7 +342,7 @@ class ConfigParams:
|
||||
RESP_QUALITY_LABEL_INPUT_XINXIAO_DEFAULT_FS: int = 1000
|
||||
RESP_QUALITY_LABEL_INPUT_THO_DEFAULT_FS: int = 200
|
||||
|
||||
RESP_QUALITY_LABEL_PARTS_TIME_SEC: int = 30
|
||||
|
||||
|
||||
|
||||
RESP_QUALITY_LABEL_THRESHOLD1_DEFAULT: float = 0.65
|
||||
|
||||
@ -103,7 +103,7 @@ class Constants:
|
||||
"Method_Not_Exist": "(检测方法不存在)",
|
||||
"Data_Length_not_Correct": "(orgBcg和BCG长度不匹配)",
|
||||
"Artifact_Format_Not_Correct": "(体动长度或格式不正确)",
|
||||
"Get_Artifact_Format_Exception": "(获取体动长度或格式异常)",
|
||||
"Data_Length_Not_Correct": "(信号长度不正确)",
|
||||
|
||||
"Open_Data_Exception": "(打开数据异常)",
|
||||
"Process_Exception": "(处理异常)",
|
||||
@ -132,6 +132,7 @@ class Constants:
|
||||
"Get_File_and_Freq_Excepetion": "(检查文件是否存在并获取其数据采样率异常)",
|
||||
"Update_tableWidget_Exception": "(更新表格异常)",
|
||||
"Update_Info_Exception": "(更新信息异常)",
|
||||
"Get_Artifact_Format_Exception": "(获取体动长度或格式异常)",
|
||||
"Label_Format_Exception": "(获取标签格式异常)",
|
||||
"Calculate_Peak_Exception": "(计算峰值异常)",
|
||||
|
||||
@ -389,11 +390,45 @@ class Constants:
|
||||
RESP_QUALITY_LABEL_PLOT_LABEL_ARTIFACT: str = "Artifact"
|
||||
RESP_QUALITY_LABEL_SPECTRUM_BDR_TITLE: str = "Spectrum of BDR_sync by filter OrgBCG_Sync"
|
||||
RESP_QUALITY_LABEL_SPECTRUM_THO_TITLE: str = "Spectrum of THO_sync after preprocess"
|
||||
RESP_QUALITY_LABEL_SPECTRUM_ORGBCG_LABEL: str = "orgBcg"
|
||||
RESP_QUALITY_LABEL_SPECTRUM_ORGBCG_LABEL: str = "OrgBCG"
|
||||
RESP_QUALITY_LABEL_SPECTRUM_BDR_LABEL: str = "BDR"
|
||||
RESP_QUALITY_LABEL_SPECTRUM_THO_LABEL: str = "THO"
|
||||
|
||||
RESP_QUALITY_LABEL_SPECTRUM_THO_LABEL: str = "Tho"
|
||||
RESP_QUALITY_LABEL_VIEWING_THE_FIRST_PART: str = "你正在查看第1段信号"
|
||||
RESP_QUALITY_LABEL_VIEWING_THE_LAST_PART: str = "你正在查看最后1段信号"
|
||||
RESP_QUALITY_LABEL_PREV_PART: str = "上一个片段,index "
|
||||
RESP_QUALITY_LABEL_NEXT_PART: str = "下一个片段,index "
|
||||
RESP_QUALITY_LABEL_JUMP: str = "跳转到片段,index "
|
||||
RESP_QUALITY_LABEL_LABEL_SUCCESSFULLY: str = "片段标注成功"
|
||||
RESP_QUALITY_LABEL_LABEL_TYPE: str = "标注类型为:"
|
||||
RESP_QUALITY_LABEL_ADD_POINTS_SUCCESSFULLY: str = "成功新增点,横坐标:"
|
||||
RESP_QUALITY_LABEL_REMOVE_POINTS_SUCCESSFULLY: str = "成功删除点,横坐标:"
|
||||
RESP_QUALITY_LABEL_NO_POINT_IN_THE_INTERVAL: str = "所选区间内无新增或删除点"
|
||||
RESP_QUALITY_LABEL_CUSTOM_FILTER_ARGS_ERROR: str = "OrgBCG带通滤波频率设置范围应为数字,范围是0~1"
|
||||
RESP_QUALITY_LABEL_AUTOLABEL_ARGS_ERROR: str = "人工标注阈值设置范围应为数字,范围是0~1"
|
||||
RESP_QUALITY_LABEL_CHECK_ARGS_QUESTION_CONTENT: str = "你确定要执行此操作吗,请确保参数输入正确"
|
||||
RESP_QUALITY_LABEL_ACTION_LABEL_MULTIPLE_NAME: str = f"批量更改标签({ConfigParams.RESP_QUALITY_LABEL_ACTION_LABEL_MULTIPLE_SHORTCUT_KEY})"
|
||||
RESP_QUALITY_LABEL_A_QUALITY: int = 1
|
||||
RESP_QUALITY_LABEL_B_QUALITY: int = 0
|
||||
RESP_QUALITY_LABEL_C_QUALITY: int = -1
|
||||
RESP_QUALITY_LABEL_KEY_VALUE = {
|
||||
1: "Good",
|
||||
0: "Bad",
|
||||
-1: "None"
|
||||
}
|
||||
RESP_QUALITY_LABEL_FIGTOOLBAR_SPECTRUM_STYLESHEET: str = """
|
||||
QToolBar {
|
||||
border: 1px;
|
||||
spacing: 2px; /* 设置工具栏按钮之间的间距 */
|
||||
}
|
||||
QToolButton {
|
||||
height: 20px; /* 设置工具栏按钮的高度 */
|
||||
width: 20px; /* 设置工具栏按钮的宽度 */
|
||||
font-size: 8px; /* 设置按钮文字大小 */
|
||||
}
|
||||
QToolButton::menu-button {
|
||||
width: 0px; /* 隐藏下拉菜单按钮 */
|
||||
}
|
||||
"""
|
||||
|
||||
# 睡眠呼吸暂停事件标注
|
||||
SA_LABEL_JUMP: str = "跳转到事件"
|
||||
@ -483,52 +518,6 @@ class Constants:
|
||||
background-color: yellow; /* 鼠标悬停时的背景颜色 */
|
||||
}"""
|
||||
|
||||
|
||||
# 呼吸可用性及间期标注
|
||||
RESP_QUALITY_LABEL_FILES_NOT_FOUND: str = f"无法找到{ConfigParams.RESP_QUALITY_LABEL_INPUT_XINXIAO_FILENAME}{ConfigParams.ENDSWITH_TXT}或{ConfigParams.RESP_QUALITY_LABEL_INPUT_THO_FILENAME}{ConfigParams.ENDSWITH_TXT}或{ConfigParams.RESP_QUALITY_LABEL_INPUT_ARTIFACT_FILENAME}{ConfigParams.ENDSWITH_TXT},无法执行<呼吸可用性及间期标注>"
|
||||
RESP_QUALITY_LABEL_FILES_FOUND: str = f"找到{ConfigParams.RESP_QUALITY_LABEL_INPUT_XINXIAO_FILENAME}{ConfigParams.ENDSWITH_TXT}和{ConfigParams.RESP_QUALITY_LABEL_INPUT_THO_FILENAME}{ConfigParams.ENDSWITH_TXT}和{ConfigParams.RESP_QUALITY_LABEL_INPUT_ARTIFACT_FILENAME}{ConfigParams.ENDSWITH_TXT}"
|
||||
RESP_QUALITY_LABEL_HISTORICAL_SAVE1_FOUND: str = f"找到历史存档文件{ConfigParams.RESP_QUALITY_LABEL_SAVE_RESP_QUALITY_LABNEL_FILENAME}{ConfigParams.ENDSWITH_TXT},已成功读取"
|
||||
RESP_QUALITY_LABEL_HISTORICAL_SAVE2_FOUND: str = f"找到历史存档文件{ConfigParams.RESP_QUALITY_LABEL_SAVE_THO_PEAK_FILENAME}{ConfigParams.ENDSWITH_TXT},已成功读取"
|
||||
RESP_QUALITY_LABEL_INPUT_SIGNAL_FAILURE: str = "导入信号失败,请检查信号长度"
|
||||
RESP_QUALITY_LABEL_INPUT_SUCCESSFULLY: str = "导入数据成功"
|
||||
RESP_QUALITY_LABEL_PREPROCESS_SUCCESSFULLY: str = "导入数据成功"
|
||||
RESP_QUALITY_LABEL_INPUT_ARTIFACT_FAILURE_FORMAT: str = "导入体动失败,请检查体动标签格式"
|
||||
RESP_QUALITY_LABEL_INPUT_ARTIFACT_FAILURE_LENGTH: str = "导入体动失败,请检查体动长度是否为4的倍数"
|
||||
|
||||
RESP_QUALITY_LABEL_VIEWING_THE_FIRST_PART: str = "你正在查看第1段信号"
|
||||
RESP_QUALITY_LABEL_VIEWING_THE_LAST_PART: str = "你正在查看最后1段信号"
|
||||
RESP_QUALITY_LABEL_CUSTOM_NAVIGATIONTOOLBAR_WIDGET_NAME: str = "MainWindow"
|
||||
RESP_QUALITY_LABEL_BUTTON_PRESS_EVENT: str = "button_press_event"
|
||||
RESP_QUALITY_LABEL_BUTTON_RELEASE_EVENT: str = "button_release_event"
|
||||
RESP_QUALITY_LABEL_MOTION_NOTIFY_EVENT: str = "motion_notify_event"
|
||||
RESP_QUALITY_LABEL_ADD_POINTS_SUCCESSFULLY: str = "成功新增点,横坐标:"
|
||||
RESP_QUALITY_LABEL_REMOVE_POINTS_SUCCESSFULLY: str = "成功删除点,横坐标:"
|
||||
RESP_QUALITY_LABEL_NO_POINT_IN_THE_INTERVAL: str = "所选区间内无新增或删除点"
|
||||
RESP_QUALITY_LABEL_SAVE_PEAKS_SUCCESSFULLY: str = "保存峰值成功"
|
||||
RESP_QUALITY_LABEL_DATA_NOT_FOUND: str = "数据未导入"
|
||||
RESP_QUALITY_LABEL_LABEL_SUCCESSFULLY: str = "片段标注并保存成功"
|
||||
RESP_QUALITY_LABEL_RESET_SUCCESSFULLY: str = "片段重置并保存成功"
|
||||
RESP_QUALITY_LABEL_PLOT_LABEL_VLINE: str = "vline"
|
||||
RESP_QUALITY_LABEL_PLOT_LABEL_HLINE: str = "hline"
|
||||
RESP_QUALITY_LABEL_A_QUALITY: int = 1
|
||||
RESP_QUALITY_LABEL_B_QUALITY: int = 0
|
||||
RESP_QUALITY_LABEL_C_QUALITY: int = -1
|
||||
RESP_QUALITY_LABEL_LABELED: str = "已标注"
|
||||
RESP_QUALITY_LABEL_TOBELABELED: str = "未标注"
|
||||
|
||||
RESP_QUALITY_LABEL_CUSTOM_FILTER_ARGS_ERROR: str = "orgBcg带通滤波频率设置范围应为数字,范围是0~1"
|
||||
RESP_QUALITY_LABEL_AUTOLABEL_ARGS_ERROR: str = "人工标注阈值设置范围应为数字,范围是0~1"
|
||||
RESP_QUALITY_LABEL_CHECK_ARGS_QUESTION_CONTENT: str = "你确定要执行此操作吗,请确保参数输入正确"
|
||||
RESP_QUALITY_LABEL_KEY_VALUE = {
|
||||
1: "Good",
|
||||
0: "Bad",
|
||||
-1: "None"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 禁止实例化
|
||||
def __new__(cls):
|
||||
raise TypeError("Constants class cannot be instantiated")
|
||||
|
||||
Reference in New Issue
Block a user