1、完善命名规范
2、完成<冗余数据切割和标签映射>的全部代码
This commit is contained in:
@ -82,7 +82,6 @@ ButtonState = {
|
||||
class SettingWindow(QMainWindow):
|
||||
|
||||
def __init__(self, root_path, sampID):
|
||||
|
||||
super(SettingWindow, self).__init__()
|
||||
self.ui = Ui_MainWindow_precisely_align_input_setting()
|
||||
self.ui.setupUi(self)
|
||||
@ -99,7 +98,6 @@ class SettingWindow(QMainWindow):
|
||||
self.ui.pushButton_cancel.clicked.connect(self.close)
|
||||
|
||||
def __read_config__(self):
|
||||
|
||||
if not Path(ConfigParams.PRECISELY_ALIGN_CONFIG_FILE_PATH).exists():
|
||||
with open(ConfigParams.PRECISELY_ALIGN_CONFIG_FILE_PATH, "w") as f:
|
||||
dump(ConfigParams.PRECISELY_ALIGN_CONFIG_NEW_CONTENT, f)
|
||||
@ -213,7 +211,6 @@ class SettingWindow(QMainWindow):
|
||||
self.ui.plainTextEdit_file_path_save_Rpeak.setPlainText(Config["Path"]["Save_Rpeak"])
|
||||
|
||||
def __write_config__(self):
|
||||
|
||||
# 从界面写入配置
|
||||
Config["InputConfig"]["ECGFreq"] = self.ui.spinBox_input_freq_ECG.value()
|
||||
Config["Path"]["Input_orgBcg"] = self.ui.plainTextEdit_file_path_input_orgBcg.toPlainText()
|
||||
@ -238,11 +235,9 @@ class SettingWindow(QMainWindow):
|
||||
self.close()
|
||||
|
||||
def __rollback_config__(self):
|
||||
|
||||
self.__read_config__()
|
||||
|
||||
def __update_ui__(self):
|
||||
|
||||
self.ui.plainTextEdit_file_path_input_orgBcg.setPlainText(
|
||||
str((Path(self.root_path) /
|
||||
ConfigParams.PUBLIC_PATH_ORGBCG_TEXT /
|
||||
@ -302,7 +297,6 @@ class SettingWindow(QMainWindow):
|
||||
class MainWindow_precisely_align(QMainWindow):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
super(MainWindow_precisely_align, self).__init__()
|
||||
self.ui = Ui_MainWindow_precisely_align()
|
||||
self.ui.setupUi(self)
|
||||
@ -356,7 +350,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
|
||||
@overrides
|
||||
def show(self, root_path, sampID):
|
||||
|
||||
super().show()
|
||||
self.root_path = root_path
|
||||
self.sampID = sampID
|
||||
@ -408,7 +401,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
|
||||
@overrides
|
||||
def closeEvent(self, event):
|
||||
|
||||
PublicFunc.__disableAllButton__(self, ButtonState)
|
||||
|
||||
PublicFunc.statusbar_show_msg(self, PublicFunc.format_status_msg(Constants.SHUTTING_DOWN))
|
||||
@ -449,11 +441,9 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
|
||||
@staticmethod
|
||||
def __reset__():
|
||||
|
||||
ButtonState["Current"].update(ButtonState["Default"].copy())
|
||||
|
||||
def __plot__(self, plot_element=None):
|
||||
|
||||
# 清空画框
|
||||
if self.figToolbar.ax0_BCG_rectangle_front is not None:
|
||||
self.figToolbar.ax0_BCG_rectangle_front.remove()
|
||||
@ -526,11 +516,11 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_SELECTED_POINT)
|
||||
self.ax0.plot(plot_element["front"]["corre"], 'o', color=Constants.PLOT_COLOR_BLUE,
|
||||
markersize=3, picker=True, pickradius=5)
|
||||
self.ax1.stem(plot_element["front"]["RRIVs"], markerfmt="b.",
|
||||
self.ax1.stem(plot_element["front"]["RRIVs"], markerfmt="b.", linefmt=Constants.PLOT_COLOR_ORANGE,
|
||||
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_RRIV)
|
||||
self.stem_black0 = self.ax1.stem(arange(plot_element["front"]["shift"],
|
||||
plot_element["front"]["shift"] + len(plot_element["front"]["JJIVs"])),
|
||||
plot_element["front"]["JJIVs"], markerfmt="ko",
|
||||
plot_element["front"]["JJIVs"], markerfmt="ko", linefmt=Constants.PLOT_COLOR_GREEN,
|
||||
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JJIV)
|
||||
self.ax2.set_title(
|
||||
"back\ncorre_IIV: {}, corre_II: {}\nsame_sign_rate:{}, total_time_ratio: {}\nshift: {}, alignment offset: {} seconds\noffset_interval: {}, anchor_J: {}, anchor_R: {}".format(
|
||||
@ -547,11 +537,11 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_SELECTED_POINT)
|
||||
self.ax2.plot(plot_element["back"]["corre"], 'o', color=Constants.PLOT_COLOR_BLUE,
|
||||
markersize=3, picker=True, pickradius=5)
|
||||
self.ax3.stem(plot_element["back"]["RRIVs"], markerfmt="b.",
|
||||
self.ax3.stem(plot_element["back"]["RRIVs"], markerfmt="b.", linefmt=Constants.PLOT_COLOR_ORANGE,
|
||||
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_RRIV)
|
||||
self.stem_black1 = self.ax3.stem(arange(plot_element["back"]["shift"],
|
||||
plot_element["back"]["shift"] + len(plot_element["back"]["JJIVs"])),
|
||||
plot_element["back"]["JJIVs"], markerfmt="ko",
|
||||
plot_element["back"]["JJIVs"], markerfmt="ko", linefmt=Constants.PLOT_COLOR_GREEN,
|
||||
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JJIV)
|
||||
|
||||
self.ax0.legend(loc=Constants.PLOT_UPPER_RIGHT)
|
||||
@ -607,7 +597,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
return status, info
|
||||
|
||||
def __update_info__(self):
|
||||
|
||||
self.ui.spinBox_BCG_front_JJIV_1.setValue(Config["IV_Coordinate"]["BCG_front_1"])
|
||||
self.ui.spinBox_BCG_front_JJIV_2.setValue(Config["IV_Coordinate"]["BCG_front_2"])
|
||||
self.ui.spinBox_BCG_back_JJIV_1.setValue(Config["IV_Coordinate"]["BCG_back_1"])
|
||||
@ -626,7 +615,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
self.ui.spinBox_ECG_back_Signal_2.setValue(Config["Coordinate"]["ECG_back_2"])
|
||||
|
||||
def __slot_btn_input__(self):
|
||||
|
||||
PublicFunc.__disableAllButton__(self, ButtonState)
|
||||
|
||||
# 清空画框
|
||||
@ -679,7 +667,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
|
||||
def __slot_btn_calculate_correlation__(self, test1=None, shift_front=None, shift_back=None):
|
||||
# TODO:这里有个未知的问BUG,虽然不影响功能,但会影响代码整洁性,第一个形参赋值为None时,之后使用变量时将会变成False,不知道为什么
|
||||
|
||||
PublicFunc.__disableAllButton__(self, ButtonState)
|
||||
|
||||
sender = self.sender()
|
||||
@ -740,7 +727,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
PublicFunc.finish_operation(self, ButtonState)
|
||||
|
||||
def __slot_btn_correlation_align__(self):
|
||||
|
||||
PublicFunc.__disableAllButton__(self, ButtonState)
|
||||
|
||||
sender = self.sender()
|
||||
@ -783,7 +769,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
PublicFunc.finish_operation(self, ButtonState)
|
||||
|
||||
def __slot_btn_view_align__(self):
|
||||
|
||||
PublicFunc.__disableAllButton__(self, ButtonState)
|
||||
|
||||
# 数据后处理
|
||||
@ -812,7 +797,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
PublicFunc.finish_operation(self, ButtonState)
|
||||
|
||||
def __slot_btn_save__(self):
|
||||
|
||||
reply = QMessageBox.question(self, Constants.QUESTION_TITLE, Constants.QUESTION_CONTENT,
|
||||
QMessageBox.Yes | QMessageBox.No,
|
||||
QMessageBox.Yes)
|
||||
@ -944,7 +928,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
PublicFunc.finish_operation(self, ButtonState)
|
||||
|
||||
def __update_coordinate__(self):
|
||||
|
||||
try:
|
||||
if self.data is not None:
|
||||
if self.data.Jpeak is None or self.data.Rpeak is None:
|
||||
@ -1005,7 +988,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
pass
|
||||
|
||||
def reset_axes(self):
|
||||
|
||||
for ax in self.fig.axes:
|
||||
self.fig.delaxes(ax)
|
||||
if self.ax0 is not None:
|
||||
@ -1030,7 +1012,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
self.ax4.xaxis.set_major_formatter(ConfigParams.FORMATTER)
|
||||
|
||||
def redraw_calculate_coordination(self, plot_element=None):
|
||||
|
||||
if plot_element is not None and plot_element["mode"] == "select":
|
||||
if self.selected_point0 is not None:
|
||||
self.selected_point0.remove()
|
||||
@ -1065,7 +1046,7 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_SELECTED_POINT)
|
||||
self.stem_black0 = self.ax1.stem(arange(plot_element["front"]["shift"],
|
||||
plot_element["front"]["shift"] + len(plot_element["front"]["JJIVs"])),
|
||||
plot_element["front"]["JJIVs"], markerfmt="ko",
|
||||
plot_element["front"]["JJIVs"], markerfmt="ko", linefmt=Constants.PLOT_COLOR_GREEN,
|
||||
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JJIV)
|
||||
self.selected_point1, = self.ax2.plot(plot_element["back"]["shift"],
|
||||
plot_element["back"]["corre"][plot_element["back"]["shift"]] + 1, 'v',
|
||||
@ -1073,7 +1054,7 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_SELECTED_POINT)
|
||||
self.stem_black1 = self.ax3.stem(arange(plot_element["back"]["shift"],
|
||||
plot_element["back"]["shift"] + len(plot_element["back"]["JJIVs"])),
|
||||
plot_element["back"]["JJIVs"], markerfmt="ko",
|
||||
plot_element["back"]["JJIVs"], markerfmt="ko", linefmt=Constants.PLOT_COLOR_GREEN,
|
||||
label=Constants.PRECISELY_ALIGN_PLOT_LABEL_JJIV)
|
||||
|
||||
self.ax0.autoscale(False)
|
||||
@ -1090,7 +1071,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
return False, Constants.DRAWING_FAILURE
|
||||
|
||||
def redraw_correlation_align(self, plot_element=None):
|
||||
|
||||
if plot_element is not None and plot_element["mode"] == "select":
|
||||
if self.selected_point0 is not None:
|
||||
self.selected_point0.remove()
|
||||
@ -1129,7 +1109,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
return False, Constants.DRAWING_FAILURE
|
||||
|
||||
def toggle_home(self):
|
||||
|
||||
if self.ax0 is not None:
|
||||
self.ax0.autoscale(True)
|
||||
self.ax0.relim()
|
||||
@ -1164,7 +1143,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
PublicFunc.text_output(self.ui, Constants.LABEL_CHECK_RECOVER_SCALE, Constants.TIPS_TYPE_INFO)
|
||||
|
||||
def toggle_getRange(self, state):
|
||||
|
||||
if state:
|
||||
self.deactivate_figToolbar_buttons()
|
||||
self.figToolbar.action_Get_Range.setChecked(True)
|
||||
@ -1186,7 +1164,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
self.figToolbar.cid_mouse_hold = None
|
||||
|
||||
def deactivate_figToolbar_buttons(self):
|
||||
|
||||
for action in self.figToolbar._actions.values():
|
||||
if action.isChecked() == True:
|
||||
if action == self.figToolbar._actions['pan']:
|
||||
@ -1195,7 +1172,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
self.figToolbar.zoom()
|
||||
|
||||
def on_click(self, event):
|
||||
|
||||
if self.figToolbar.action_Get_Range.isChecked():
|
||||
if event.button == 1:
|
||||
self.is_left_button_pressed = True
|
||||
@ -1222,7 +1198,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
self.canvas.draw()
|
||||
|
||||
def on_release(self, event):
|
||||
|
||||
if self.figToolbar.action_Get_Range.isChecked():
|
||||
if self.figToolbar.rect_start_x is not None:
|
||||
self.figToolbar.rect_end_x = event.xdata
|
||||
@ -1321,7 +1296,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
self.canvas.draw()
|
||||
|
||||
def on_hold(self, event):
|
||||
|
||||
if event.button == 1:
|
||||
if self.figToolbar.rect_start_x is not None and event.xdata is not None:
|
||||
self.figToolbar.rect_end_x = event.xdata
|
||||
@ -1376,7 +1350,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
self.canvas.draw()
|
||||
|
||||
def on_pick(self, event):
|
||||
|
||||
this_line = event.artist
|
||||
if this_line.axes == self.ax0:
|
||||
xdata = this_line.get_xdata()
|
||||
@ -1412,20 +1385,6 @@ class MainWindow_precisely_align(QMainWindow):
|
||||
class Data:
|
||||
|
||||
def __init__(self):
|
||||
|
||||
self.file_path_input_orgBcg = Config["Path"]["Input_orgBcg"]
|
||||
self.file_path_input_BCG = Config["Path"]["Input_BCG"]
|
||||
self.file_path_input_Jpeak = Config["Path"]["Input_Jpeak"]
|
||||
self.file_path_input_ECG = Config["Path"]["Input_ECG"]
|
||||
self.file_path_input_Rpeak = Config["Path"]["Input_Rpeak"]
|
||||
self.file_path_save_BCG_AlignInfo = Config["Path"]["Save_BCG_AlignInfo"]
|
||||
self.file_path_save_ECG_AlignInfo = Config["Path"]["Save_ECG_AlignInfo"]
|
||||
self.file_path_save_orgBcg = Config["Path"]["Save_orgBcg"]
|
||||
self.file_path_save_BCG = Config["Path"]["Save_BCG"]
|
||||
self.file_path_save_ECG = Config["Path"]["Save_ECG"]
|
||||
self.file_path_save_Jpeak = Config["Path"]["Save_Jpeak"]
|
||||
self.file_path_save_Rpeak = Config["Path"]["Save_Rpeak"]
|
||||
|
||||
self.raw_orgBcg = None
|
||||
self.raw_BCG = None
|
||||
self.Jpeak = None
|
||||
@ -1461,7 +1420,6 @@ class Data:
|
||||
self.argmax_ECG = None
|
||||
|
||||
def open_file(self):
|
||||
|
||||
if ((not Path(Config["Path"]["Input_BCG"]).exists())
|
||||
or (not Path(Config["Path"]["Input_Jpeak"]).exists())
|
||||
or (not Path(Config["Path"]["Input_ECG"]).exists())
|
||||
@ -1469,19 +1427,19 @@ class Data:
|
||||
return False, Constants.INPUT_FAILURE + Constants.PRECISELY_ALIGN_FAILURE_REASON["Data_Path_Not_Exist"]
|
||||
|
||||
try:
|
||||
self.raw_orgBcg = read_csv(self.file_path_input_orgBcg,
|
||||
self.raw_orgBcg = read_csv(Config["Path"]["Input_orgBcg"],
|
||||
encoding=ConfigParams.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
self.raw_BCG = read_csv(Config["Path"]["Input_BCG"],
|
||||
encoding=ConfigParams.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
self.raw_BCG = read_csv(self.file_path_input_BCG,
|
||||
encoding=ConfigParams.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
self.Jpeak = read_csv(self.file_path_input_Jpeak,
|
||||
self.Jpeak = read_csv(Config["Path"]["Input_Jpeak"],
|
||||
encoding=ConfigParams.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
self.raw_ECG = read_csv(self.file_path_input_ECG,
|
||||
self.raw_ECG = read_csv(Config["Path"]["Input_ECG"],
|
||||
encoding=ConfigParams.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
self.Rpeak = read_csv(self.file_path_input_Rpeak,
|
||||
self.Rpeak = read_csv(Config["Path"]["Input_Rpeak"],
|
||||
encoding=ConfigParams.UTF8_ENCODING,
|
||||
header=None).to_numpy().reshape(-1)
|
||||
self.argmax_BCG = np_argmax(self.raw_BCG)
|
||||
@ -1492,7 +1450,6 @@ class Data:
|
||||
return True, Constants.INPUT_FINISHED
|
||||
|
||||
def data_process_for_calculate_correlation(self):
|
||||
|
||||
result = {}
|
||||
|
||||
if self.Jpeak is None or self.Rpeak is None:
|
||||
@ -1511,7 +1468,6 @@ class Data:
|
||||
return True, Constants.PRECISELY_ALIGN_PROCESS_FINISHED, result
|
||||
|
||||
def calculate_correlation_front(self, mode, shift_front=None):
|
||||
|
||||
result = {}
|
||||
|
||||
if ((Config["IV_Coordinate"]["BCG_front_1"] == Config["IV_Coordinate"]["BCG_front_2"])
|
||||
@ -1579,7 +1535,6 @@ class Data:
|
||||
return True, Constants.PRECISELY_ALIGN_CALCULATE_FINISHED_FRONT, result
|
||||
|
||||
def calculate_correlation_back(self, mode, shift_back=None):
|
||||
|
||||
result = {}
|
||||
|
||||
if ((Config["IV_Coordinate"]["BCG_back_1"] == Config["IV_Coordinate"]["BCG_back_2"])
|
||||
@ -1647,7 +1602,6 @@ class Data:
|
||||
return True, Constants.PRECISELY_ALIGN_CALCULATE_FINISHED_BACK, result
|
||||
|
||||
def correlation_align(self, mode):
|
||||
|
||||
result = {}
|
||||
|
||||
try:
|
||||
@ -1734,7 +1688,6 @@ class Data:
|
||||
return True, Constants.PRECISELY_ALIGN_ALIGN_CORRELATION_FINISHED, result
|
||||
|
||||
def data_postprocess(self):
|
||||
|
||||
try:
|
||||
if len(self.correlation_align_point_match_ECG) != 2 and len(self.correlation_align_point_match_BCG) != 2:
|
||||
off = 0
|
||||
@ -1790,7 +1743,6 @@ class Data:
|
||||
return True, f"{Constants.PRECISELY_ALIGN_POSTPROCESS_VIEW_FINISHED},BCG前后段被切割的坐标值为[{frontcut_index_BCG}, {backcut_index_BCG}],ECG前后段被切割的坐标值为[{frontcut_index_ECG}, {backcut_index_ECG}]"
|
||||
|
||||
def save_alignInfo(self):
|
||||
|
||||
try:
|
||||
save_data = {
|
||||
"front": {
|
||||
@ -1823,69 +1775,63 @@ class Data:
|
||||
}
|
||||
}
|
||||
save_data = [str(save_data)]
|
||||
DataFrame(save_data).to_csv(self.file_path_save_BCG_AlignInfo, index=False, header=False)
|
||||
DataFrame(save_data).to_csv(self.file_path_save_ECG_AlignInfo, index=False, header=False)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
DataFrame(save_data).to_csv(Config["Path"]["Save_BCG_AlignInfo"], index=False, header=False)
|
||||
DataFrame(save_data).to_csv(Config["Path"]["Save_ECG_AlignInfo"], index=False, header=False)
|
||||
except Exception:
|
||||
return False, Constants.PRECISELY_ALIGN_SAVING_ALIGNINFO_FAILURE + Constants.PRECISELY_ALIGN_FAILURE_REASON["Save_Exception"]
|
||||
|
||||
return True, Constants.PRECISELY_ALIGN_SAVING_ALIGNINFO_FINISHED
|
||||
|
||||
def save_res_orgBcg(self, chunk):
|
||||
|
||||
if self.res_orgBcg is None:
|
||||
return False, Constants.PRECISELY_ALIGN_SAVING_RES_ORGBCG_FAILURE + Constants.PRECISELY_ALIGN_FAILURE_REASON["res_orgBcg_Not_Exist"]
|
||||
|
||||
try:
|
||||
chunk.to_csv(self.file_path_save_orgBcg, mode='a', index=False, header=False)
|
||||
chunk.to_csv(Config["Path"]["Save_orgBcg"], mode='a', index=False, header=False)
|
||||
except Exception:
|
||||
return False, Constants.PRECISELY_ALIGN_SAVING_RES_ORGBCG_FAILURE + Constants.PRECISELY_ALIGN_FAILURE_REASON["Save_Exception"]
|
||||
|
||||
return True, Constants.PRECISELY_ALIGN_SAVING_RES_ORGBCG_FINISHED
|
||||
|
||||
def save_res_BCG(self, chunk):
|
||||
|
||||
if self.res_BCG is None:
|
||||
return False, Constants.PRECISELY_ALIGN_SAVING_RES_BCG_FAILURE + Constants.PRECISELY_ALIGN_FAILURE_REASON["res_BCG_Not_Exist"]
|
||||
|
||||
try:
|
||||
chunk.to_csv(self.file_path_save_BCG, mode='a', index=False, header=False)
|
||||
chunk.to_csv(Config["Path"]["Save_BCG"], mode='a', index=False, header=False)
|
||||
except Exception:
|
||||
return False, Constants.PRECISELY_ALIGN_SAVING_RES_BCG_FAILURE + Constants.PRECISELY_ALIGN_FAILURE_REASON["Save_Exception"]
|
||||
|
||||
return True, Constants.PRECISELY_ALIGN_SAVING_RES_BCG_FINISHED
|
||||
|
||||
def save_cut_ECG(self, chunk):
|
||||
|
||||
if self.cut_ECG is None:
|
||||
return False, Constants.PRECISELY_ALIGN_SAVING_CUT_ECG_FAILURE + Constants.PRECISELY_ALIGN_FAILURE_REASON["cut_ECG_Not_Exist"]
|
||||
|
||||
try:
|
||||
chunk.to_csv(self.file_path_save_ECG, mode='a', index=False, header=False)
|
||||
chunk.to_csv(Config["Path"]["Save_ECG"], mode='a', index=False, header=False)
|
||||
except Exception:
|
||||
return False, Constants.PRECISELY_ALIGN_SAVING_CUT_ECG_FAILURE + Constants.PRECISELY_ALIGN_FAILURE_REASON["Save_Exception"]
|
||||
|
||||
return True, Constants.PRECISELY_ALIGN_SAVING_CUT_ECG_FINISHED
|
||||
|
||||
def save_Jpeak(self, chunk):
|
||||
|
||||
if self.cut_Jpeak is None:
|
||||
return False, Constants.PRECISELY_ALIGN_SAVING_CUT_JPEAK_FAILURE + Constants.PRECISELY_ALIGN_FAILURE_REASON["cut_Jpeak_Not_Exist"]
|
||||
|
||||
try:
|
||||
chunk.to_csv(self.file_path_save_Jpeak, mode='a', index=False, header=False)
|
||||
chunk.to_csv(Config["Path"]["Save_Jpeak"], mode='a', index=False, header=False)
|
||||
except Exception:
|
||||
return False, Constants.PRECISELY_ALIGN_SAVING_CUT_JPEAK_FAILURE + Constants.PRECISELY_ALIGN_FAILURE_REASON["Save_Exception"]
|
||||
|
||||
return True, Constants.PRECISELY_ALIGN_SAVING_CUT_JPEAK_FINISHED
|
||||
|
||||
def save_Rpeak(self, chunk):
|
||||
|
||||
if self.cut_Rpeak is None:
|
||||
return False, Constants.PRECISELY_ALIGN_SAVING_CUT_RPEAK_FAILURE + Constants.PRECISELY_ALIGN_FAILURE_REASON["cut_Rpeak_Not_Exist"]
|
||||
|
||||
try:
|
||||
chunk.to_csv(self.file_path_save_Rpeak, mode='a', index=False, header=False)
|
||||
chunk.to_csv(Config["Path"]["Save_Rpeak"], mode='a', index=False, header=False)
|
||||
except Exception:
|
||||
return False, Constants.PRECISELY_ALIGN_SAVING_CUT_RPEAK_FAILURE + Constants.PRECISELY_ALIGN_FAILURE_REASON["Save_Exception"]
|
||||
|
||||
@ -1926,21 +1872,17 @@ class CustomNavigationToolbar(NavigationToolbar2QT):
|
||||
self.ax1_ECG_rectangle_back = None
|
||||
|
||||
def home(self, *args):
|
||||
|
||||
pass
|
||||
|
||||
def zoom(self, *args):
|
||||
|
||||
super().zoom(*args)
|
||||
self.deactivate_figToorbar_getRange_mode()
|
||||
|
||||
def pan(self, *args):
|
||||
|
||||
super().pan(*args)
|
||||
self.deactivate_figToorbar_getRange_mode()
|
||||
|
||||
def deactivate_figToorbar_getRange_mode(self):
|
||||
|
||||
if self.action_Get_Range.isChecked():
|
||||
self.action_Get_Range.setChecked(False)
|
||||
if self.cid_mouse_press is not None:
|
||||
|
||||
Reference in New Issue
Block a user