Skip to content
Snippets Groups Projects

Multi-thread TPS plot

Merged Kien Le requested to merge featured-threading_TPS_plot into master
1 unresolved thread
3 files
+ 38
6
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -28,6 +28,7 @@ from sohstationviewer.conf import constants as const
class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
stopped = QtCore.Signal()
"""
Widget to display time power square data for waveform channels
"""
@@ -131,6 +132,7 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
self.each_day5_min_list
)
channel_processor.signals.finished.connect(self.channel_done)
channel_processor.signals.stopped.connect(self.channel_done)
self.tps_processors.append(channel_processor)
# Because the widget determine if processing is done by comparing the
@@ -145,11 +147,16 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
@QtCore.Slot()
def channel_done(self, chan_id):
self.finished_lock.lock()
ax = self.plot_channel(self.plotting_data1[chan_id], chan_id)
self.axes.append(ax)
if chan_id != '':
ax = self.plot_channel(self.plotting_data1[chan_id], chan_id)
self.axes.append(ax)
self.processed_channels.append(chan_id)
if len(self.processed_channels) == len(self.channels):
self.done()
if chan_id == '':
display_tracking_info(self.tracking_box, 'Stopped TPS plot.')
else:
self.done()
self.stopped.emit()
self.finished_lock.unlock()
def done(self):
@@ -159,6 +166,7 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
self.main_widget.setFixedHeight(self.plotting_bot_pixel)
self.set_lim_markers()
self.draw()
self.stopped.emit()
def plot_channel(self, c_data, chan_id):
"""
@@ -412,6 +420,10 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
for zm2 in self.zoom_marker2s:
zm2.set_data(x_idx, y_idx)
def request_stop(self):
for processor in self.tps_processors:
processor.request_stop()
class TimePowerSquaredDialog(QtWidgets.QWidget):
def __init__(self, parent):
Loading