Skip to content
Snippets Groups Projects

Replot for TPS to apply colorange inside TPS only

Merged Lan Dam requested to merge i85_replot_tps into master
1 file
+ 33
14
Compare changes
  • Side-by-side
  • Inline
@@ -86,18 +86,9 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
:param start_tm: requested start time to read
:param end_tm: requested end time to read
"""
self.is_working = True
self.plotting_data1 = d_obj.waveform_data[key]
self.plotting_bot = const.BOTTOM
self.processed_channels = []
self.channels = []
self.tps_processors = []
start_msg = 'Plotting TPS data...'
display_tracking_info(self.tracking_box, start_msg)
self.plotting_data1 = d_obj.waveform_data[key]
self.processing_log = [] # [(message, type)]
self.gap_bar = None
self.min_x = max(d_obj.data_time[key][0], start_tm)
self.max_x = min(d_obj.data_time[key][1], end_tm)
@@ -119,6 +110,18 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
self.start_5mins_of_diff_days = get_start_5mins_of_diff_days(
self.min_x, self.max_x)
self.replot()
def replot(self):
print("replot")
self.is_working = True
self.plotting_bot = const.BOTTOM
self.processed_channels = []
self.channels = []
self.tps_processors = []
start_msg = 'Plotting TPS data...'
display_tracking_info(self.tracking_box, start_msg)
for chan_id in self.plotting_data1:
c_data = self.plotting_data1[chan_id]
if 'tps_data' not in c_data:
@@ -186,6 +189,7 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
def done(self):
"""Add finishing touches to the plot and display it on the screen."""
print("done")
self.set_legend()
# Set view size fit with the given data
if self.main_widget.geometry().height() < self.plotting_bot_pixel:
@@ -503,8 +507,13 @@ class TimePowerSquaredDialog(QtWidgets.QWidget):
bottom_layout.addSpacing(20)
main_layout.addLayout(bottom_layout)
buttons_layout = QtWidgets.QVBoxLayout()
bottom_layout.addLayout(buttons_layout)
# ################ Color range #################
bottom_layout.addWidget(QtWidgets.QLabel("Color Range"))
color_layout = QtWidgets.QHBoxLayout()
buttons_layout.addLayout(color_layout)
color_layout.addWidget(QtWidgets.QLabel("Color Range"))
"""
color_def: [str,] - list of color codes in order of values to be
@@ -537,10 +546,14 @@ class TimePowerSquaredDialog(QtWidgets.QWidget):
self.color_range_choice = QtWidgets.QComboBox(self)
self.color_range_choice.addItems(self.color_ranges)
self.color_range_choice.setCurrentText('high')
bottom_layout.addWidget(self.color_range_choice)
################################################
color_layout.addWidget(self.color_range_choice)
# ##################### Replot button ########################
self.replot_button = QtWidgets.QPushButton("RePlot", self)
buttons_layout.addWidget(self.replot_button)
# ##################### Save button ##########################
self.save_button = QtWidgets.QPushButton('Save', self)
bottom_layout.addWidget(self.save_button)
buttons_layout.addWidget(self.save_button)
self.info_text_browser.setFixedHeight(60)
bottom_layout.addWidget(self.info_text_browser)
@@ -574,6 +587,7 @@ class TimePowerSquaredDialog(QtWidgets.QWidget):
Connect functions to widgets
"""
self.save_button.clicked.connect(self.save)
self.replot_button.clicked.connect(self.replot)
self.color_range_choice.currentTextChanged.connect(
self.color_range_changed)
@@ -594,3 +608,8 @@ class TimePowerSquaredDialog(QtWidgets.QWidget):
Save the plotting to a file
"""
print("save")
@QtCore.Slot()
def replot(self):
self.plotting_widget.clear()
self.plotting_widget.replot()
\ No newline at end of file
Loading