1、完成了<数据精对齐>的所有代码
This commit is contained in:
@ -192,9 +192,6 @@ class MainWindow_preprocess(QMainWindow):
|
||||
self.gs = None
|
||||
self.ax0 = None
|
||||
|
||||
self.line_raw_data = None
|
||||
self.line_processed_data = None
|
||||
|
||||
self.msgBox = QMessageBox()
|
||||
self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE)
|
||||
|
||||
@ -254,10 +251,7 @@ class MainWindow_preprocess(QMainWindow):
|
||||
QApplication.processEvents()
|
||||
|
||||
# 清空画框
|
||||
if self.line_raw_data and self.line_processed_data:
|
||||
del self.line_raw_data
|
||||
del self.line_processed_data
|
||||
self.canvas.draw()
|
||||
self.ax0.clear()
|
||||
|
||||
# 释放资源
|
||||
del self.data
|
||||
@ -277,22 +271,17 @@ class MainWindow_preprocess(QMainWindow):
|
||||
def __plot__(self):
|
||||
|
||||
# 清空画框
|
||||
if self.line_raw_data and self.line_processed_data:
|
||||
try:
|
||||
self.line_raw_data.remove()
|
||||
self.line_processed_data.remove()
|
||||
except ValueError:
|
||||
pass
|
||||
self.reset_axes()
|
||||
|
||||
sender = self.sender()
|
||||
|
||||
if sender == self.ui.pushButton_view:
|
||||
self.line_raw_data, = self.ax0.plot(self.data.raw_data,
|
||||
color=Constants.PLOT_COLOR_RED,
|
||||
label=Constants.PREPROCESS_PLOT_LABEL_ORIGINAL_DATA)
|
||||
self.line_processed_data, = self.ax0.plot(self.data.processed_data + Constants.PREPROCESS_OUTPUT_INPUT_AMP_OFFSET,
|
||||
color=Constants.PLOT_COLOR_BLUE,
|
||||
label=Constants.PREPROCESS_PLOT_LABEL_PROCESSED_DATA)
|
||||
self.ax0.plot(self.data.raw_data,
|
||||
color=Constants.PLOT_COLOR_RED,
|
||||
label=Constants.PREPROCESS_PLOT_LABEL_ORIGINAL_DATA)
|
||||
self.ax0.plot(self.data.processed_data + Constants.PREPROCESS_OUTPUT_INPUT_AMP_OFFSET,
|
||||
color=Constants.PLOT_COLOR_BLUE,
|
||||
label=Constants.PREPROCESS_PLOT_LABEL_PROCESSED_DATA)
|
||||
self.ax0.legend(loc=Constants.PLOT_UPPER_RIGHT)
|
||||
status = True
|
||||
info = Constants.DRAWING_FINISHED
|
||||
@ -321,12 +310,8 @@ class MainWindow_preprocess(QMainWindow):
|
||||
PublicFunc.__disableAllButton__(self, ButtonState)
|
||||
|
||||
# 清空画框
|
||||
if self.line_raw_data and self.line_processed_data:
|
||||
try:
|
||||
self.line_raw_data.remove()
|
||||
self.line_processed_data.remove()
|
||||
except ValueError:
|
||||
pass
|
||||
self.reset_axes()
|
||||
|
||||
self.canvas.draw()
|
||||
|
||||
self.data = Data()
|
||||
@ -408,6 +393,12 @@ class MainWindow_preprocess(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)
|
||||
|
||||
|
||||
class Data:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user