新增脚本filename_regulation_generator.py,有命名规范需要修改时,只需要修改ConfigParams.py的Filename类里面的变量的值,之后直接运行脚本filename_regulation_generator.py即可获取最新版本的数据结构化输入和输出命名规范.html
This commit is contained in:
@ -15,9 +15,10 @@ from overrides import overrides
|
||||
from pandas import read_csv, DataFrame, Series, concat
|
||||
from yaml import dump, load, FullLoader
|
||||
|
||||
from func.utils.ConfigParams import Filename, Params
|
||||
from func.Filters.Preprocessing import Butterworth_for_ECG_PreProcess
|
||||
from func.utils.PublicFunc import PublicFunc
|
||||
from func.utils.Constants import Constants, ConfigParams
|
||||
from func.utils.Constants import Constants
|
||||
from func.utils.Result import Result
|
||||
|
||||
from ui.MainWindow.MainWindow_SA_label import Ui_MainWindow_SA_label
|
||||
@ -98,36 +99,36 @@ class SettingWindow(QMainWindow):
|
||||
self.ui.pushButton_cancel.clicked.connect(self.close)
|
||||
|
||||
def __read_config__(self):
|
||||
if not Path(ConfigParams.SA_LABEL_CONFIG_FILE_PATH).exists():
|
||||
with open(ConfigParams.SA_LABEL_CONFIG_FILE_PATH, "w") as f:
|
||||
dump(ConfigParams.SA_LABEL_CONFIG_NEW_CONTENT, f)
|
||||
if not Path(Params.SA_LABEL_CONFIG_FILE_PATH).exists():
|
||||
with open(Params.SA_LABEL_CONFIG_FILE_PATH, "w") as f:
|
||||
dump(Params.SA_LABEL_CONFIG_NEW_CONTENT, f)
|
||||
|
||||
with open(ConfigParams.SA_LABEL_CONFIG_FILE_PATH, "r") as f:
|
||||
with open(Params.SA_LABEL_CONFIG_FILE_PATH, "r") as f:
|
||||
file_config = load(f.read(), Loader=FullLoader)
|
||||
Config.update(file_config)
|
||||
self.config = file_config
|
||||
|
||||
Config.update({
|
||||
"Path": {
|
||||
"Input_OrgBCG": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_ORGBCG_ALIGNED /
|
||||
"Input_OrgBCG": str((Path(self.root_path) / Filename.PATH_ORGBCG_ALIGNED /
|
||||
Path(str(self.sampID)))),
|
||||
"Input_Tho": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_PSG_ALIGNED /
|
||||
"Input_Tho": str((Path(self.root_path) / Filename.PATH_PSG_ALIGNED /
|
||||
Path(str(self.sampID)))),
|
||||
"Input_Abd": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_PSG_ALIGNED /
|
||||
Path(str(self.sampID)))),
|
||||
"Input_FlowT": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_PSG_ALIGNED /
|
||||
"Input_Abd": str((Path(self.root_path) / Filename.PATH_PSG_ALIGNED /
|
||||
Path(str(self.sampID)))),
|
||||
"Input_FlowP": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_PSG_ALIGNED /
|
||||
"Input_FlowT": str((Path(self.root_path) / Filename.PATH_PSG_ALIGNED /
|
||||
Path(str(self.sampID)))),
|
||||
"Input_SpO2": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_PSG_ALIGNED /
|
||||
Path(str(self.sampID)))),
|
||||
"Input_Artifact": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_LABEL /
|
||||
Path(str(self.sampID)))),
|
||||
"Input_Label": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_PSG_ALIGNED /
|
||||
"Input_FlowP": str((Path(self.root_path) / Filename.PATH_PSG_ALIGNED /
|
||||
Path(str(self.sampID)))),
|
||||
"Save": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_LABEL /
|
||||
"Input_SpO2": str((Path(self.root_path) / Filename.PATH_PSG_ALIGNED /
|
||||
Path(str(self.sampID)))),
|
||||
"Input_Artifact": str((Path(self.root_path) / Filename.PATH_LABEL /
|
||||
Path(str(self.sampID)))),
|
||||
"Input_Label": str((Path(self.root_path) / Filename.PATH_PSG_ALIGNED /
|
||||
Path(str(self.sampID)))),
|
||||
"Save": str((Path(self.root_path) / Filename.PATH_LABEL /
|
||||
Path(str(self.sampID)))),
|
||||
"Save_2": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_LABEL /
|
||||
"Save_2": str((Path(self.root_path) / Filename.PATH_LABEL /
|
||||
Path(str(self.sampID))))
|
||||
},
|
||||
"PlotEventIndex": 0,
|
||||
@ -182,7 +183,7 @@ class SettingWindow(QMainWindow):
|
||||
self.config["InputConfig"]["FlowPFreq"] = self.ui.spinBox_input_freq_signal_FlowP.value()
|
||||
self.config["InputConfig"]["SpO2Freq"] = self.ui.spinBox_input_freq_signal_SpO2.value()
|
||||
|
||||
with open(ConfigParams.SA_LABEL_CONFIG_FILE_PATH, "w") as f:
|
||||
with open(Params.SA_LABEL_CONFIG_FILE_PATH, "w") as f:
|
||||
dump(self.config, f)
|
||||
|
||||
self.close()
|
||||
@ -193,46 +194,46 @@ class SettingWindow(QMainWindow):
|
||||
def __update_ui__(self):
|
||||
self.ui.plainTextEdit_file_path_input_signal_OrgBCG.setPlainText(
|
||||
str((Path(self.root_path) /
|
||||
ConfigParams.PUBLIC_PATH_ORGBCG_ALIGNED /
|
||||
Filename.PATH_ORGBCG_ALIGNED /
|
||||
Path(str(self.sampID)) /
|
||||
Path(ConfigParams.ORGBCG_SYNC +
|
||||
Path(Filename.ORGBCG_SYNC +
|
||||
str(self.ui.spinBox_input_freq_signal_OrgBCG.value()) +
|
||||
ConfigParams.ENDSWITH_TXT))))
|
||||
Params.ENDSWITH_TXT))))
|
||||
self.ui.plainTextEdit_file_path_input_signal_Tho.setPlainText(
|
||||
str((Path(self.root_path) /
|
||||
ConfigParams.PUBLIC_PATH_PSG_ALIGNED /
|
||||
Filename.PATH_PSG_ALIGNED /
|
||||
Path(str(self.sampID)) /
|
||||
Path(ConfigParams.THO_SYNC +
|
||||
Path(Filename.THO_SYNC +
|
||||
str(self.ui.spinBox_input_freq_signal_Tho.value()) +
|
||||
ConfigParams.ENDSWITH_TXT))))
|
||||
Params.ENDSWITH_TXT))))
|
||||
self.ui.plainTextEdit_file_path_input_signal_Abd.setPlainText(
|
||||
str((Path(self.root_path) /
|
||||
ConfigParams.PUBLIC_PATH_PSG_ALIGNED /
|
||||
Filename.PATH_PSG_ALIGNED /
|
||||
Path(str(self.sampID)) /
|
||||
Path(ConfigParams.ABD_SYNC +
|
||||
Path(Filename.ABD_SYNC +
|
||||
str(self.ui.spinBox_input_freq_signal_Abd.value()) +
|
||||
ConfigParams.ENDSWITH_TXT))))
|
||||
Params.ENDSWITH_TXT))))
|
||||
self.ui.plainTextEdit_file_path_input_signal_FlowT.setPlainText(
|
||||
str((Path(self.root_path) /
|
||||
ConfigParams.PUBLIC_PATH_PSG_ALIGNED /
|
||||
Filename.PATH_PSG_ALIGNED /
|
||||
Path(str(self.sampID)) /
|
||||
Path(ConfigParams.FLOWT_SYNC +
|
||||
Path(Filename.FLOWT_SYNC +
|
||||
str(self.ui.spinBox_input_freq_signal_FlowT.value()) +
|
||||
ConfigParams.ENDSWITH_TXT))))
|
||||
Params.ENDSWITH_TXT))))
|
||||
self.ui.plainTextEdit_file_path_input_signal_FlowP.setPlainText(
|
||||
str((Path(self.root_path) /
|
||||
ConfigParams.PUBLIC_PATH_PSG_ALIGNED /
|
||||
Filename.PATH_PSG_ALIGNED /
|
||||
Path(str(self.sampID)) /
|
||||
Path(ConfigParams.FLOWP_SYNC +
|
||||
Path(Filename.FLOWP_SYNC +
|
||||
str(self.ui.spinBox_input_freq_signal_FlowP.value()) +
|
||||
ConfigParams.ENDSWITH_TXT))))
|
||||
Params.ENDSWITH_TXT))))
|
||||
self.ui.plainTextEdit_file_path_input_signal_SpO2.setPlainText(
|
||||
str((Path(self.root_path) /
|
||||
ConfigParams.PUBLIC_PATH_PSG_ALIGNED /
|
||||
Filename.PATH_PSG_ALIGNED /
|
||||
Path(str(self.sampID)) /
|
||||
Path(ConfigParams.SPO2_SYNC +
|
||||
Path(Filename.SPO2_SYNC +
|
||||
str(self.ui.spinBox_input_freq_signal_SpO2.value()) +
|
||||
ConfigParams.ENDSWITH_TXT))))
|
||||
Params.ENDSWITH_TXT))))
|
||||
|
||||
|
||||
class MainWindow_SA_label(QMainWindow):
|
||||
@ -305,31 +306,31 @@ class MainWindow_SA_label(QMainWindow):
|
||||
self.fig.subplots_adjust(top=0.98, bottom=0.05, right=0.98, left=0.1, hspace=0, wspace=0)
|
||||
self.ax0 = self.fig.add_subplot(self.gs[0])
|
||||
self.ax0.grid(True)
|
||||
self.ax0.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
self.ax0.xaxis.set_major_formatter(Params.FORMATTER)
|
||||
self.ax0.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
|
||||
self.ax1 = self.fig.add_subplot(self.gs[1], sharex=self.ax0)
|
||||
self.ax1.grid(True)
|
||||
self.ax1.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
self.ax1.xaxis.set_major_formatter(Params.FORMATTER)
|
||||
self.ax1.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
|
||||
self.ax2 = self.fig.add_subplot(self.gs[2], sharex=self.ax0)
|
||||
self.ax2.grid(True)
|
||||
self.ax2.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
self.ax2.xaxis.set_major_formatter(Params.FORMATTER)
|
||||
self.ax2.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
|
||||
self.ax3 = self.fig.add_subplot(self.gs[3], sharex=self.ax0)
|
||||
self.ax3.grid(True)
|
||||
self.ax3.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
self.ax3.xaxis.set_major_formatter(Params.FORMATTER)
|
||||
self.ax3.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
|
||||
self.ax4 = self.fig.add_subplot(self.gs[4], sharex=self.ax0)
|
||||
self.ax4.grid(True)
|
||||
self.ax4.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
self.ax4.xaxis.set_major_formatter(Params.FORMATTER)
|
||||
self.ax4.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
|
||||
self.ax5 = self.fig.add_subplot(self.gs[5], sharex=self.ax0)
|
||||
self.ax5.grid(True)
|
||||
self.ax5.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
self.ax5.xaxis.set_major_formatter(Params.FORMATTER)
|
||||
self.ax5.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
|
||||
self.ax6 = self.fig.add_subplot(self.gs[6], sharex=self.ax0)
|
||||
self.ax6.grid(True)
|
||||
self.ax6.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
self.ax6.xaxis.set_major_formatter(Params.FORMATTER)
|
||||
|
||||
PublicFunc.__resetAllButton__(self, ButtonState)
|
||||
|
||||
@ -378,17 +379,17 @@ class MainWindow_SA_label(QMainWindow):
|
||||
self.ui.checkBox_examineBySecond.clicked.connect(self.__slot_checkBox_examineBySecond__)
|
||||
self.ui.checkBox_examineLabeled.clicked.connect(self.__slot_checkBox_examineLabeled__)
|
||||
|
||||
self.ui.pushButton_prev.setShortcut(QCoreApplication.translate("MainWindow", ConfigParams.SA_LABEL_BTN_PREV_SHORTCUT_KEY))
|
||||
self.ui.pushButton_confirmLabel.setShortcut(QCoreApplication.translate("MainWindow", ConfigParams.SA_LABEL_BTN_CONFIRMLABEL_SHORTCUT_KEY))
|
||||
self.ui.pushButton_next.setShortcut(QCoreApplication.translate("MainWindow", ConfigParams.SA_LABEL_BTN_NEXT_SHORTCUT_KEY))
|
||||
self.ui.radioButton_OSA.setShortcut(QCoreApplication.translate("MainWindow", ConfigParams.SA_LABEL_RADIOBUTTON_OSA_SHORTCUT_KEY))
|
||||
self.ui.radioButton_CSA.setShortcut(QCoreApplication.translate("MainWindow", ConfigParams.SA_LABEL_RADIOBUTTON_CSA_SHORTCUT_KEY))
|
||||
self.ui.radioButton_MSA.setShortcut(QCoreApplication.translate("MainWindow", ConfigParams.SA_LABEL_RADIOBUTTON_MSA_SHORTCUT_KEY))
|
||||
self.ui.radioButton_HPY.setShortcut(QCoreApplication.translate("MainWindow", ConfigParams.SA_LABEL_RADIOBUTTON_HPY_SHORTCUT_KEY))
|
||||
self.ui.radioButton_1_class.setShortcut(QCoreApplication.translate("MainWindow", ConfigParams.SA_LABEL_RADIOBUTTON_1_CLASS_SHORTCUT_KEY))
|
||||
self.ui.radioButton_2_class.setShortcut(QCoreApplication.translate("MainWindow", ConfigParams.SA_LABEL_RADIOBUTTON_2_CLASS_SHORTCUT_KEY))
|
||||
self.ui.radioButton_3_class.setShortcut(QCoreApplication.translate("MainWindow", ConfigParams.SA_LABEL_RADIOBUTTON_3_CLASS_SHORTCUT_KEY))
|
||||
self.ui.pushButton_quick_remark_input_waitingForTalk.setShortcut(QCoreApplication.translate("MainWindow", ConfigParams.SA_LABEL_BTN_QUICK_REMARK_WAITINGFORTALK_SHORTCUT_KEY))
|
||||
self.ui.pushButton_prev.setShortcut(QCoreApplication.translate("MainWindow", Params.SA_LABEL_BTN_PREV_SHORTCUT_KEY))
|
||||
self.ui.pushButton_confirmLabel.setShortcut(QCoreApplication.translate("MainWindow", Params.SA_LABEL_BTN_CONFIRMLABEL_SHORTCUT_KEY))
|
||||
self.ui.pushButton_next.setShortcut(QCoreApplication.translate("MainWindow", Params.SA_LABEL_BTN_NEXT_SHORTCUT_KEY))
|
||||
self.ui.radioButton_OSA.setShortcut(QCoreApplication.translate("MainWindow", Params.SA_LABEL_RADIOBUTTON_OSA_SHORTCUT_KEY))
|
||||
self.ui.radioButton_CSA.setShortcut(QCoreApplication.translate("MainWindow", Params.SA_LABEL_RADIOBUTTON_CSA_SHORTCUT_KEY))
|
||||
self.ui.radioButton_MSA.setShortcut(QCoreApplication.translate("MainWindow", Params.SA_LABEL_RADIOBUTTON_MSA_SHORTCUT_KEY))
|
||||
self.ui.radioButton_HPY.setShortcut(QCoreApplication.translate("MainWindow", Params.SA_LABEL_RADIOBUTTON_HPY_SHORTCUT_KEY))
|
||||
self.ui.radioButton_1_class.setShortcut(QCoreApplication.translate("MainWindow", Params.SA_LABEL_RADIOBUTTON_1_CLASS_SHORTCUT_KEY))
|
||||
self.ui.radioButton_2_class.setShortcut(QCoreApplication.translate("MainWindow", Params.SA_LABEL_RADIOBUTTON_2_CLASS_SHORTCUT_KEY))
|
||||
self.ui.radioButton_3_class.setShortcut(QCoreApplication.translate("MainWindow", Params.SA_LABEL_RADIOBUTTON_3_CLASS_SHORTCUT_KEY))
|
||||
self.ui.pushButton_quick_remark_input_waitingForTalk.setShortcut(QCoreApplication.translate("MainWindow", Params.SA_LABEL_BTN_QUICK_REMARK_WAITINGFORTALK_SHORTCUT_KEY))
|
||||
|
||||
@overrides
|
||||
def closeEvent(self, event):
|
||||
@ -1003,37 +1004,37 @@ class MainWindow_SA_label(QMainWindow):
|
||||
if self.ax0 is not None:
|
||||
self.ax0.clear()
|
||||
self.ax0.grid(True)
|
||||
self.ax0.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
self.ax0.xaxis.set_major_formatter(Params.FORMATTER)
|
||||
self.ax0.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
|
||||
if self.ax1 is not None:
|
||||
self.ax1.clear()
|
||||
self.ax1.grid(True)
|
||||
self.ax1.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
self.ax1.xaxis.set_major_formatter(Params.FORMATTER)
|
||||
self.ax1.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
|
||||
if self.ax2 is not None:
|
||||
self.ax2.clear()
|
||||
self.ax2.grid(True)
|
||||
self.ax2.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
self.ax2.xaxis.set_major_formatter(Params.FORMATTER)
|
||||
self.ax2.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
|
||||
if self.ax3 is not None:
|
||||
self.ax3.clear()
|
||||
self.ax3.grid(True)
|
||||
self.ax3.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
self.ax3.xaxis.set_major_formatter(Params.FORMATTER)
|
||||
self.ax3.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
|
||||
if self.ax4 is not None:
|
||||
self.ax4.clear()
|
||||
self.ax4.grid(True)
|
||||
self.ax4.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
self.ax4.xaxis.set_major_formatter(Params.FORMATTER)
|
||||
self.ax4.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
|
||||
if self.ax5 is not None:
|
||||
self.ax5.clear()
|
||||
self.ax5.grid(True)
|
||||
self.ax5.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
self.ax5.xaxis.set_major_formatter(Params.FORMATTER)
|
||||
self.ax5.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
|
||||
if self.ax6 is not None:
|
||||
self.ax6.clear()
|
||||
self.ax6.grid(True)
|
||||
self.ax6.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
self.ax6.xaxis.set_major_formatter(Params.FORMATTER)
|
||||
|
||||
def on_xlim_change(self, event_ax):
|
||||
# 获取当前x轴范围
|
||||
@ -1162,7 +1163,7 @@ class MainWindow_SA_label(QMainWindow):
|
||||
self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "correct_Start"],
|
||||
self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "correct_End"],
|
||||
color='red',
|
||||
alpha=ConfigParams.SA_LABEL_TRANSPARENCY)
|
||||
alpha=Params.SA_LABEL_TRANSPARENCY)
|
||||
elif self.data.df_corrected.at[
|
||||
Config["EventLabelIndexList"][Config["PlotEventIndex"]], "correct_EventsType"] == "Central apnea":
|
||||
for ax in ax_:
|
||||
@ -1170,7 +1171,7 @@ class MainWindow_SA_label(QMainWindow):
|
||||
self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "correct_Start"],
|
||||
self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "correct_End"],
|
||||
color='blue',
|
||||
alpha=ConfigParams.SA_LABEL_TRANSPARENCY)
|
||||
alpha=Params.SA_LABEL_TRANSPARENCY)
|
||||
elif self.data.df_corrected.at[
|
||||
Config["EventLabelIndexList"][Config["PlotEventIndex"]], "correct_EventsType"] == "Mixed apnea":
|
||||
for ax in ax_:
|
||||
@ -1178,7 +1179,7 @@ class MainWindow_SA_label(QMainWindow):
|
||||
self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "correct_Start"],
|
||||
self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "correct_End"],
|
||||
color='gray',
|
||||
alpha=ConfigParams.SA_LABEL_TRANSPARENCY)
|
||||
alpha=Params.SA_LABEL_TRANSPARENCY)
|
||||
elif self.data.df_corrected.at[
|
||||
Config["EventLabelIndexList"][Config["PlotEventIndex"]], "correct_EventsType"] == "Hypopnea":
|
||||
for ax in ax_:
|
||||
@ -1186,7 +1187,7 @@ class MainWindow_SA_label(QMainWindow):
|
||||
self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "correct_Start"],
|
||||
self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "correct_End"],
|
||||
color='pink',
|
||||
alpha=ConfigParams.SA_LABEL_TRANSPARENCY)
|
||||
alpha=Params.SA_LABEL_TRANSPARENCY)
|
||||
else:
|
||||
if self.data.df_corrected.at[
|
||||
Config["EventLabelIndexList"][Config["PlotEventIndex"]], "Event type"] == "Obstructive apnea":
|
||||
@ -1194,28 +1195,28 @@ class MainWindow_SA_label(QMainWindow):
|
||||
ax.axvspan(self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "Start"],
|
||||
self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "End"],
|
||||
color='red',
|
||||
alpha=ConfigParams.SA_LABEL_TRANSPARENCY)
|
||||
alpha=Params.SA_LABEL_TRANSPARENCY)
|
||||
elif self.data.df_corrected.at[
|
||||
Config["EventLabelIndexList"][Config["PlotEventIndex"]], "Event type"] == "Central apnea":
|
||||
for ax in ax_:
|
||||
ax.axvspan(self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "Start"],
|
||||
self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "End"],
|
||||
color='blue',
|
||||
alpha=ConfigParams.SA_LABEL_TRANSPARENCY)
|
||||
alpha=Params.SA_LABEL_TRANSPARENCY)
|
||||
elif self.data.df_corrected.at[
|
||||
Config["EventLabelIndexList"][Config["PlotEventIndex"]], "Event type"] == "Mixed apnea":
|
||||
for ax in ax_:
|
||||
ax.axvspan(self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "Start"],
|
||||
self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "End"],
|
||||
color='gray',
|
||||
alpha=ConfigParams.SA_LABEL_TRANSPARENCY)
|
||||
alpha=Params.SA_LABEL_TRANSPARENCY)
|
||||
elif self.data.df_corrected.at[
|
||||
Config["EventLabelIndexList"][Config["PlotEventIndex"]], "Event type"] == "Hypopnea":
|
||||
for ax in ax_:
|
||||
ax.axvspan(self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "Start"],
|
||||
self.data.df_corrected.at[Config["EventLabelIndexList"][Config["PlotEventIndex"]], "End"],
|
||||
color='pink',
|
||||
alpha=ConfigParams.SA_LABEL_TRANSPARENCY)
|
||||
alpha=Params.SA_LABEL_TRANSPARENCY)
|
||||
|
||||
def pd_add_new_row(self, df, score: int, remark: str, correct_Start: int, correct_End: int, correct_EventsType: str,
|
||||
isLabeled: int):
|
||||
@ -1282,88 +1283,88 @@ class Data:
|
||||
if Path(Config["Path"]["Input_Label"]).is_file():
|
||||
Config["Path"]["Input_Label"] = str(Path(Config["Path"]["Input_Label"]).parent)
|
||||
|
||||
result = PublicFunc.examine_file(Config["Path"]["Input_OrgBCG"], ConfigParams.ORGBCG_SYNC, ConfigParams.ENDSWITH_TXT)
|
||||
result = PublicFunc.examine_file(Config["Path"]["Input_OrgBCG"], Filename.ORGBCG_SYNC, Params.ENDSWITH_TXT)
|
||||
if result.status:
|
||||
Config["Path"]["Input_OrgBCG"] = result.data["path"]
|
||||
Config["InputConfig"]["OrgBCGFreq"] = result.data["freq"]
|
||||
else:
|
||||
return result
|
||||
result = PublicFunc.examine_file(Config["Path"]["Input_Tho"], ConfigParams.THO_SYNC, ConfigParams.ENDSWITH_TXT)
|
||||
result = PublicFunc.examine_file(Config["Path"]["Input_Tho"], Filename.THO_SYNC, Params.ENDSWITH_TXT)
|
||||
if result.status:
|
||||
Config["Path"]["Input_Tho"] = result.data["path"]
|
||||
Config["InputConfig"]["ThoFreq"] = result.data["freq"]
|
||||
else:
|
||||
return result
|
||||
result = PublicFunc.examine_file(Config["Path"]["Input_Abd"], ConfigParams.ABD_SYNC, ConfigParams.ENDSWITH_TXT)
|
||||
result = PublicFunc.examine_file(Config["Path"]["Input_Abd"], Filename.ABD_SYNC, Params.ENDSWITH_TXT)
|
||||
if result.status:
|
||||
Config["Path"]["Input_Abd"] = result.data["path"]
|
||||
Config["InputConfig"]["AbdFreq"] = result.data["freq"]
|
||||
else:
|
||||
return result
|
||||
result = PublicFunc.examine_file(Config["Path"]["Input_FlowT"], ConfigParams.FLOWT_SYNC, ConfigParams.ENDSWITH_TXT)
|
||||
result = PublicFunc.examine_file(Config["Path"]["Input_FlowT"], Filename.FLOWT_SYNC, Params.ENDSWITH_TXT)
|
||||
if result.status:
|
||||
Config["Path"]["Input_FlowT"] = result.data["path"]
|
||||
Config["InputConfig"]["FlowTFreq"] = result.data["freq"]
|
||||
else:
|
||||
return result
|
||||
result = PublicFunc.examine_file(Config["Path"]["Input_FlowP"], ConfigParams.FLOWP_SYNC, ConfigParams.ENDSWITH_TXT)
|
||||
result = PublicFunc.examine_file(Config["Path"]["Input_FlowP"], Filename.FLOWP_SYNC, Params.ENDSWITH_TXT)
|
||||
if result.status:
|
||||
Config["Path"]["Input_FlowP"] = result.data["path"]
|
||||
Config["InputConfig"]["FlowPFreq"] = result.data["freq"]
|
||||
else:
|
||||
return result
|
||||
result = PublicFunc.examine_file(Config["Path"]["Input_SpO2"], ConfigParams.SPO2_SYNC, ConfigParams.ENDSWITH_TXT)
|
||||
result = PublicFunc.examine_file(Config["Path"]["Input_SpO2"], Filename.SPO2_SYNC, Params.ENDSWITH_TXT)
|
||||
if result.status:
|
||||
Config["Path"]["Input_SpO2"] = result.data["path"]
|
||||
Config["InputConfig"]["SpO2Freq"] = result.data["freq"]
|
||||
else:
|
||||
return result
|
||||
result = PublicFunc.examine_file(Config["Path"]["Input_Artifact"], ConfigParams.ARTIFACT_A, ConfigParams.ENDSWITH_TXT)
|
||||
result = PublicFunc.examine_file(Config["Path"]["Input_Artifact"], Filename.ARTIFACT_A, Params.ENDSWITH_TXT)
|
||||
if result.status:
|
||||
Config["Path"]["Input_Artifact"] = result.data["path"]
|
||||
else:
|
||||
return result
|
||||
|
||||
Config["Path"]["Input_Label"] = str(
|
||||
Path(Config["Path"]["Input_Label"]) / Path(ConfigParams.SA_LABEL_SYNC + ConfigParams.ENDSWITH_CSV))
|
||||
Path(Config["Path"]["Input_Label"]) / Path(Filename.SA_LABEL_SYNC + Params.ENDSWITH_CSV))
|
||||
Config["Path"]["Save"] = str(
|
||||
Path(Config["Path"]["Save"]) / Path(ConfigParams.SA_LABEL_CORRECTED + ConfigParams.ENDSWITH_CSV))
|
||||
Path(Config["Path"]["Save"]) / Path(Filename.SA_LABEL_CORRECTED + Params.ENDSWITH_CSV))
|
||||
Config["Path"]["Save_2"] = str(
|
||||
Path(Config["Path"]["Save_2"]) / Path(ConfigParams.SA_LABEL_ADD + ConfigParams.ENDSWITH_CSV))
|
||||
Path(Config["Path"]["Save_2"]) / Path(Filename.SA_LABEL_ADD + Params.ENDSWITH_CSV))
|
||||
|
||||
if not Path(Config["Path"]["Input_Artifact"]).exists():
|
||||
return Result().failure(info=Constants.INPUT_FAILURE + "\n" +
|
||||
ConfigParams.ARTIFACT_A + ":" +
|
||||
Filename.ARTIFACT_A + ":" +
|
||||
Config["Path"]["Input_Artifact"] +
|
||||
Constants.FAILURE_REASON["Path_Not_Exist"])
|
||||
if not Path(Config["Path"]["Input_Label"]).exists():
|
||||
return Result().failure(info=Constants.INPUT_FAILURE + "\n" +
|
||||
ConfigParams.SA_LABEL_SYNC + ":" +
|
||||
Filename.SA_LABEL_SYNC + ":" +
|
||||
Config["Path"]["Input_Label"] +
|
||||
Constants.FAILURE_REASON["Path_Not_Exist"])
|
||||
|
||||
try:
|
||||
self.OrgBCG = read_csv(Config["Path"]["Input_OrgBCG"],
|
||||
encoding=ConfigParams.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
encoding=Params.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
self.Tho = read_csv(Config["Path"]["Input_Tho"],
|
||||
encoding=ConfigParams.UTF8_ENCODING,
|
||||
encoding=Params.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
self.Abd = read_csv(Config["Path"]["Input_Abd"],
|
||||
encoding=ConfigParams.UTF8_ENCODING,
|
||||
encoding=Params.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
self.FlowT = read_csv(Config["Path"]["Input_FlowT"],
|
||||
encoding=ConfigParams.UTF8_ENCODING,
|
||||
encoding=Params.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
self.FlowP = read_csv(Config["Path"]["Input_FlowP"],
|
||||
encoding=ConfigParams.UTF8_ENCODING,
|
||||
encoding=Params.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
self.SpO2 = read_csv(Config["Path"]["Input_SpO2"],
|
||||
encoding=ConfigParams.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
encoding=Params.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
self.Artifact = read_csv(Config["Path"]["Input_Artifact"],
|
||||
encoding=ConfigParams.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
encoding=Params.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
self.event_label = zeros(len(self.OrgBCG) + (int(Config["AddSecond"]["Front"] + int(Config["AddSecond"]["Back"])) * Config["InputConfig"]["PlotFreq"]))
|
||||
except Exception as e:
|
||||
return Result().failure(info=Constants.INPUT_FAILURE +
|
||||
@ -1623,6 +1624,6 @@ class CustomNavigationToolbar(NavigationToolbar2QT):
|
||||
def __init__(self, canvas, parent):
|
||||
super().__init__(canvas, parent)
|
||||
self.action_Reset_Signal_and_Time = QAction('复原视图和时间', self)
|
||||
self.action_Reset_Signal_and_Time.setFont(QFont(ConfigParams.FONT, 14))
|
||||
self.action_Reset_Signal_and_Time.setFont(QFont(Params.FONT, 14))
|
||||
self.action_Reset_Signal_and_Time.setCheckable(True)
|
||||
self.insertAction(self._actions['home'], self.action_Reset_Signal_and_Time)
|
||||
Reference in New Issue
Block a user