1、完成了<数据精对齐>的所有代码

This commit is contained in:
2025-05-08 15:51:32 +08:00
parent b4c4e124f8
commit 6a250a64a0
12 changed files with 2662 additions and 480 deletions

View File

@ -144,10 +144,6 @@ class MainWindow_detect_Jpeak(QMainWindow):
self.gs = None
self.ax0 = None
self.line_data = None
self.point_peak = None
self.line_interval = None
self.msgBox = QMessageBox()
self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE)
@ -207,11 +203,7 @@ class MainWindow_detect_Jpeak(QMainWindow):
QApplication.processEvents()
# 清空画框
if self.line_data and self.point_peak:
del self.line_data
del self.point_peak
del self.line_interval
self.canvas.draw()
self.ax0.clear()
# 释放资源
del self.data
@ -232,24 +224,18 @@ class MainWindow_detect_Jpeak(QMainWindow):
def __plot__(self):
# 清空画框
if self.line_data and self.point_peak and self.line_interval:
try:
self.line_data.remove()
self.point_peak.remove()
self.line_interval.remove()
except ValueError:
pass
self.reset_axes()
sender = self.sender()
if sender == self.ui.pushButton_view:
self.line_data, = self.ax0.plot(self.data.processed_data,
self.ax0.plot(self.data.processed_data,
color=Constants.PLOT_COLOR_BLUE,
label=Constants.DETECT_JPEAK_PLOT_LABEL_BCG)
self.point_peak, = self.ax0.plot(self.data.peak, self.data.processed_data[self.data.peak],
self.ax0.plot(self.data.peak, self.data.processed_data[self.data.peak],
'r.',
label=Constants.DETECT_JPEAK_PLOT_LABEL_J_PEAKS)
self.line_interval, = self.ax0.plot(self.data.interval,
self.ax0.plot(self.data.interval,
color=Constants.PLOT_COLOR_ORANGE,
label=Constants.DETECT_JPEAK_PLOT_LABEL_INTERVAL)
self.ax0.legend(loc=Constants.PLOT_UPPER_RIGHT)
@ -278,13 +264,7 @@ class MainWindow_detect_Jpeak(QMainWindow):
PublicFunc.__disableAllButton__(self, ButtonState)
# 清空画框
if self.line_data and self.point_peak and self.line_interval:
try:
self.line_data.remove()
self.point_peak.remove()
self.line_interval.remove()
except ValueError:
pass
self.reset_axes()
self.canvas.draw()
# 清空模型列表
@ -401,6 +381,12 @@ class MainWindow_detect_Jpeak(QMainWindow):
PublicFunc.finish_operation(self, ButtonState)
def reset_axes(self):
self.ax0.clear()
self.ax0.grid(True)
self.ax0.xaxis.set_major_formatter(ConfigParams.FORMATTER)
def update_ui_comboBox_model(self, model_list):
self.ui.comboBox_model.clear()
@ -479,8 +465,7 @@ class Data:
try:
# DataFrame(self.processed_data.reshape(-1)).to_csv(self.file_path_save,
# index=False,
# header=False,
# float_format='%.4f')
# header=False)
chunk.to_csv(self.file_path_save, mode='a', index=False, header=False)
except Exception:
return False, Constants.SAVING_FAILURE + Constants.DETECT_JPEAK_FAILURE_REASON["Save_Exception"]