From 641dd5ab6b023bcac9f281b2d4c82ba8de8ed062 Mon Sep 17 00:00:00 2001 From: leloup314 Date: Thu, 10 Oct 2019 13:07:49 +0200 Subject: [PATCH] FIX: add temperature monitor, fixes #11 --- irrad_control/gui/tabs/monitor_tab.py | 8 +++++++- irrad_control/gui/widgets/plot_widgets.py | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/irrad_control/gui/tabs/monitor_tab.py b/irrad_control/gui/tabs/monitor_tab.py index dbea3a18..6517e88e 100644 --- a/irrad_control/gui/tabs/monitor_tab.py +++ b/irrad_control/gui/tabs/monitor_tab.py @@ -1,6 +1,6 @@ from PyQt5 import QtCore, QtWidgets from collections import OrderedDict -from irrad_control.gui.widgets import RawDataPlot, BeamPositionPlot, PlotWrapperWidget, BeamCurrentPlot, FluenceHist +from irrad_control.gui.widgets import RawDataPlot, BeamPositionPlot, PlotWrapperWidget, BeamCurrentPlot, FluenceHist, TemperatureDataPlot class IrradMonitorTab(QtWidgets.QWidget): @@ -59,6 +59,12 @@ def _init_tabs(self): monitor_widget.addWidget(beam_current_wrapper) monitor_widget.addWidget(beam_pos_wrapper) + if 'temp' in self.setup[server]['devices']: + + if monitor == 'temp': + self.plots[server]['temp_plot'] = TemperatureDataPlot(self.setup[server], daq_device=self.setup[server]['devices']['daq']['sem']) + monitor_widget = PlotWrapperWidget(self.plots[server]['temp_plot']) + if monitor_widget is not None: self.monitor_tabs[server].addTab(monitor_widget, monitor.capitalize()) diff --git a/irrad_control/gui/widgets/plot_widgets.py b/irrad_control/gui/widgets/plot_widgets.py index 5293b341..60ab51dc 100644 --- a/irrad_control/gui/widgets/plot_widgets.py +++ b/irrad_control/gui/widgets/plot_widgets.py @@ -463,6 +463,22 @@ def __init__(self, beam_current_setup=None, daq_device=None, parent=None): self.plt.setLabel('right', text='Beam current', units='A') +class TemperatureDataPlot(ScrollingIrradDataPlot): + + def __init__(self, temp_setup, daq_device=None, parent=None): + + self.temp_setup = temp_setup + + super(TemperatureDataPlot, self).__init__(channels=temp_setup['devices']['temp'].values(), units={'right': 'C', 'left': 'C'}, + name=type(self).__name__ + ('' if daq_device is None else ' ' + daq_device), + parent=parent) + + self.plt.setLabel('left', text='Temperature', units='C') + self.plt.hideAxis('left') + self.plt.showAxis('right') + self.plt.setLabel('right', text='Temperature', units='C') + + class BeamPositionItem: """This class implements three pyqtgraph items in order to display a reticle with a circle in its intersection."""