Ejemplo n.º 1
0
    def __init__(self):
        super(TestApp, self).__init__()
        # Form plotnames
        self.plots_l = ['signal1', 'signal2']
        self.plots_r = ['aux_signal1']

        self.plotter = DataPlotter(self.plots_l,
                                   right_plotlist=self.plots_r,
                                   parent=self,
                                   left_log=True,
                                   title='Awesome plots',
                                   yaxis_left_label='Log sine, cos',
                                   yaxis_right_label='Noisy line',
                                   xaxis_label='Time since start [s]',
                                   legend='right',
                                   left_thickness=[2, 8],
                                   right_thickness=6,
                                   left_colors=['firebrick', 'darkolivegreen'],
                                   right_colors=['darksalmon'])

        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(self.plotter.plot)
        self.setLayout(hbox)
        self.setGeometry(5, 5, 500, 500)

        self.start = time.time()
        QtCore.QTimer.singleShot(10, self.main)
Ejemplo n.º 2
0
    def __init__(self, temp_control_comp):
        super(SimplePlot, self).__init__()
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.sock.settimeout(0.5)

        self.tcc = temp_control_comp

        # Set up the user interface from Designer.
        self.gui = Ui_temp_control()
        self.gui.setupUi(self)

        # Init local variables
        self.scale = 1E-8
        self.active = False
        self.start = None
        self.ramp_start = 0
        self.ramp = {}
        self.ramp['time'] = {}
        self.ramp['temp'] = {}
        self.ramp['step'] = {}
        # Set up plot (using pretty much all the possible options)
        self.plots_l = ['temperature', 'setpoint']
        self.plots_r = ['dutycycle']
        self.plotter = DataPlotter(self.plots_l,
                                   right_plotlist=self.plots_r,
                                   parent=self,
                                   left_log=False,
                                   title='Temperature control',
                                   yaxis_left_label='Temperature',
                                   yaxis_right_label='Dutycycle',
                                   xaxis_label='Time since start [s]',
                                   legend='right',
                                   left_thickness=[2, 3],
                                   right_thickness=2,
                                   left_colors=['firebrick', 'darkolivegreen'],
                                   right_colors=['darksalmon'])
        self.gui.horizontalLayout.removeWidget(self.gui.place_holder_qwt)
        self.gui.place_holder_qwt.setParent(None)
        self.gui.horizontalLayout.addWidget(self.plotter.plot)

        # Connect signals
        QtCore.QObject.connect(self.gui.start_ramp_button,
                               QtCore.SIGNAL('clicked()'), self.on_start_ramp)
        QtCore.QObject.connect(self.gui.stop_ramp_button,
                               QtCore.SIGNAL('clicked()'), self.on_stop_ramp)
        QtCore.QObject.connect(self.gui.start_button,
                               QtCore.SIGNAL('clicked()'), self.on_start)
        QtCore.QObject.connect(self.gui.stop_button,
                               QtCore.SIGNAL('clicked()'), self.on_stop)
        QtCore.QObject.connect(self.gui.quit_button,
                               QtCore.SIGNAL('clicked()'),
                               QtCore.QCoreApplication.instance().quit)
        QtCore.QObject.connect(self.gui.new_setpoint,
                               QtCore.SIGNAL('returnPressed()'),
                               self.update_setpoint)
Ejemplo n.º 3
0
    def __init__(self, sputtergun):
        super(SimplePlot, self).__init__()

        self.sputtergun = sputtergun

        # Set up the user interface from Designer.
        self.gui = Ui_Specs()
        self.gui.setupUi(self)

        # Init local variables
        self.scale = 1E-8
        self.active = False
        self.start = None
        self.plot_length = 200

        # Set up plot (using pretty much all the possible options)
        self.plots_l = ['filament_current', 'emission_current']
        self.plots_r = ['sputter_current']
        self.plotter = DataPlotter(self.plots_l,
                                   right_plotlist=self.plots_r,
                                   parent=self,
                                   left_log=False,
                                   title='Ion Gun Data',
                                   yaxis_left_label='Currents',
                                   yaxis_right_label='Noisy line',
                                   xaxis_label='Time since start [s]',
                                   legend='right',
                                   left_thickness=[2, 8],
                                   right_thickness=6,
                                   left_colors=['firebrick', 'darkolivegreen'],
                                   right_colors=['darksalmon'])
        self.gui.horizontalLayout.removeWidget(self.gui.place_holder_qwt)
        self.gui.place_holder_qwt.setParent(None)
        self.gui.horizontalLayout.addWidget(self.plotter.plot)

        # Connect signals
        QtCore.QObject.connect(self.gui.operate_button,
                               QtCore.SIGNAL('clicked()'), self.on_operate)
        QtCore.QObject.connect(self.gui.standby_button,
                               QtCore.SIGNAL('clicked()'), self.on_standby)
        QtCore.QObject.connect(self.gui.start_button,
                               QtCore.SIGNAL('clicked()'), self.on_start)
        QtCore.QObject.connect(self.gui.stop_button,
                               QtCore.SIGNAL('clicked()'), self.on_stop)
        QtCore.QObject.connect(self.gui.quit_button,
                               QtCore.SIGNAL('clicked()'),
                               QtCore.QCoreApplication.instance().quit)
Ejemplo n.º 4
0
    def __init__(self, temp_control_comp):
        super(SimplePlot, self).__init__()
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.sock.settimeout(0.5)

        self.tcc = temp_control_comp

        # Set up the user interface from Designer.
        self.gui = Ui_temp_control()
        self.gui.setupUi(self)

        # Init local variables
        self.scale = 1E-8
        self.active = False
        self.start = None
        self.ramp_start = 0
        self.ramp = {}
        self.ramp['time'] = {}
        self.ramp['temp'] = {}
        self.ramp['step'] = {}
        # Set up plot (using pretty much all the possible options)
        self.plots_l = ['temperature', 'setpoint']
        self.plots_r = ['dutycycle']
        self.plotter = DataPlotter(
            self.plots_l, right_plotlist=self.plots_r, parent=self,
            left_log=False, title='Temperature control',
            yaxis_left_label='Temperature', yaxis_right_label='Dutycycle',
            xaxis_label='Time since start [s]',
            legend='right', left_thickness=[2, 3], right_thickness=2,
            left_colors=['firebrick', 'darkolivegreen'],
            right_colors=['darksalmon'])
        self.gui.horizontalLayout.removeWidget(self.gui.place_holder_qwt)
        self.gui.place_holder_qwt.setParent(None)
        self.gui.horizontalLayout.addWidget(self.plotter.plot)

        # Connect signals
        QtCore.QObject.connect(self.gui.start_ramp_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_start_ramp)
        QtCore.QObject.connect(self.gui.stop_ramp_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_stop_ramp)
        QtCore.QObject.connect(self.gui.start_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_start)
        QtCore.QObject.connect(self.gui.stop_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_stop)
        QtCore.QObject.connect(self.gui.quit_button,
                               QtCore.SIGNAL('clicked()'),
                               QtCore.QCoreApplication.instance().quit)
        QtCore.QObject.connect(self.gui.new_setpoint,
                               QtCore.SIGNAL('returnPressed()'),
                               self.update_setpoint)
Ejemplo n.º 5
0
    def __init__(self):
        super(SimplePlot, self).__init__()

        # Set up the user interface from Designer.
        self.gui = Ui_PlotTest()
        self.gui.setupUi(self)

        # Init local variables
        self.scale = 1E-8
        self.active = False
        self.start = None
        self.plot_length = 20

        # Set up plot (using pretty much all the possible options)
        self.plots_l = ['signal1', 'signal2']
        self.plots_r = ['aux_signal1']
        self.plotter = DataPlotter(
            self.plots_l, right_plotlist=self.plots_r, parent=self,
            left_log=True, title='Awesome plots',
            yaxis_left_label='Log sine, cos', yaxis_right_label='Noisy line',
            xaxis_label='Time since start [s]',
            legend='right', left_thickness=[2, 8], right_thickness=6,
            left_colors=['firebrick', 'darkolivegreen'],
            right_colors=['darksalmon'])
        self.gui.horizontalLayout.addWidget(self.plotter.plot)
        # Make the content scale with the Window
        self.setLayout(self.gui.horizontalLayout)

        # Connect signals
        QtCore.QObject.connect(self.gui.start_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_start)
        QtCore.QObject.connect(self.gui.stop_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_stop)
        QtCore.QObject.connect(self.gui.scale_spinbutton,
                               QtCore.SIGNAL('valueChanged(int)'),
                               self.on_scale)
        QtCore.QObject.connect(self.gui.quit_button,
                               QtCore.SIGNAL('clicked()'),
                               QtCore.QCoreApplication.instance().quit)
Ejemplo n.º 6
0
    def __init__(self, temp_control_comp):
        super(SimplePlot, self).__init__()

        self.tcc = temp_control_comp

        # Set up the user interface from Designer.
        self.gui = Ui_temp_control()
        self.gui.setupUi(self)

        # Init local variables
        self.scale = 1e-8
        self.active = False
        self.start = None
        self.ramp_start = 0
        self.ramp = {}
        self.ramp["time"] = {}
        self.ramp["temp"] = {}
        self.ramp["step"] = {}
        # Set up plot (using pretty much all the possible options)
        self.plots_l = ["temperature", "setpoint"]
        self.plots_r = ["dutycycle"]
        self.plotter = DataPlotter(
            self.plots_l,
            right_plotlist=self.plots_r,
            parent=self,
            left_log=False,
            title="Temperature control",
            yaxis_left_label="Temperature",
            yaxis_right_label="Dutycycle",
            xaxis_label="Time since start [s]",
            legend="right",
            left_thickness=[2, 3],
            right_thickness=2,
            left_colors=["firebrick", "darkolivegreen"],
            right_colors=["darksalmon"],
        )
        self.gui.horizontalLayout.removeWidget(self.gui.place_holder_qwt)
        self.gui.place_holder_qwt.setParent(None)
        self.gui.horizontalLayout.addWidget(self.plotter.plot)

        # Connect signals
        QtCore.QObject.connect(self.gui.start_ramp_button, QtCore.SIGNAL("clicked()"), self.on_start_ramp)
        QtCore.QObject.connect(self.gui.stop_ramp_button, QtCore.SIGNAL("clicked()"), self.on_stop_ramp)
        QtCore.QObject.connect(self.gui.start_button, QtCore.SIGNAL("clicked()"), self.on_start)
        QtCore.QObject.connect(self.gui.stop_button, QtCore.SIGNAL("clicked()"), self.on_stop)
        QtCore.QObject.connect(
            self.gui.quit_button, QtCore.SIGNAL("clicked()"), QtCore.QCoreApplication.instance().quit
        )
        QtCore.QObject.connect(self.gui.new_setpoint, QtCore.SIGNAL("returnPressed()"), self.update_setpoint)
Ejemplo n.º 7
0
    def __init__(self, sputtergun):
        super(SimplePlot, self).__init__()

        self.sputtergun = sputtergun

        # Set up the user interface from Designer.
        self.gui = Ui_Specs()
        self.gui.setupUi(self)

        # Init local variables
        self.scale = 1E-8
        self.active = False
        self.start = None
        self.plot_length = 200

        # Set up plot (using pretty much all the possible options)
        self.plots_l = ['filament_current', 'emission_current']
        self.plots_r = ['sputter_current']
        self.plotter = DataPlotter(
            self.plots_l, right_plotlist=self.plots_r, parent=self,
            left_log=False, title='Ion Gun Data',
            yaxis_left_label='Currents', yaxis_right_label='Noisy line',
            xaxis_label='Time since start [s]',
            legend='right', left_thickness=[2, 8], right_thickness=6,
            left_colors=['firebrick', 'darkolivegreen'],
            right_colors=['darksalmon'])
        self.gui.horizontalLayout.removeWidget(self.gui.place_holder_qwt)
        self.gui.place_holder_qwt.setParent(None)
        self.gui.horizontalLayout.addWidget(self.plotter.plot)

        # Connect signals
        QtCore.QObject.connect(self.gui.operate_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_operate)        
        QtCore.QObject.connect(self.gui.standby_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_standby)        
        QtCore.QObject.connect(self.gui.start_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_start)
        QtCore.QObject.connect(self.gui.stop_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_stop)
        QtCore.QObject.connect(self.gui.quit_button,
                               QtCore.SIGNAL('clicked()'),
                               QtCore.QCoreApplication.instance().quit)
Ejemplo n.º 8
0
    def __init__(self):
        super(TestApp, self).__init__()
        # Form plotnames
        self.plots_l = ['signal1', 'signal2']
        self.plots_r = ['aux_signal1']
        
        self.plotter = DataPlotter(
            self.plots_l, right_plotlist=self.plots_r, parent=self,
            left_log=True, title='Awesome plots',
            yaxis_left_label='Log sine, cos', yaxis_right_label='Noisy line',
            xaxis_label='Time since start [s]',
            legend='right', left_thickness=[2, 8], right_thickness=6,
            left_colors=['firebrick', 'darkolivegreen'],
            right_colors=['darksalmon'])

        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(self.plotter.plot)
        self.setLayout(hbox)
        self.setGeometry(5, 5, 500, 500)

        self.start = time.time()
        QtCore.QTimer.singleShot(10, self.main)
Ejemplo n.º 9
0
class TestApp(QtGui.QWidget):
    """Test Qt application"""
    def __init__(self):
        super(TestApp, self).__init__()
        # Form plotnames
        self.plots_l = ['signal1', 'signal2']
        self.plots_r = ['aux_signal1']

        self.plotter = DataPlotter(self.plots_l,
                                   right_plotlist=self.plots_r,
                                   parent=self,
                                   left_log=True,
                                   title='Awesome plots',
                                   yaxis_left_label='Log sine, cos',
                                   yaxis_right_label='Noisy line',
                                   xaxis_label='Time since start [s]',
                                   legend='right',
                                   left_thickness=[2, 8],
                                   right_thickness=6,
                                   left_colors=['firebrick', 'darkolivegreen'],
                                   right_colors=['darksalmon'])

        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(self.plotter.plot)
        self.setLayout(hbox)
        self.setGeometry(5, 5, 500, 500)

        self.start = time.time()
        QtCore.QTimer.singleShot(10, self.main)

    def main(self):
        """Simulate gathering one set of points and adding them to plot"""
        elapsed = time.time() - self.start
        value = (np.sin(elapsed) + 1.1) * 1E-9
        self.plotter.add_point('signal1', (elapsed, value))
        value = (np.cos(elapsed) + 1.1) * 1E-8
        self.plotter.add_point('signal2', (elapsed, value))
        value = elapsed + random.random()
        self.plotter.add_point('aux_signal1', (elapsed, value))

        QtCore.QTimer.singleShot(100, self.main)
Ejemplo n.º 10
0
class TestApp(QtGui.QWidget):
    """Test Qt application"""

    def __init__(self):
        super(TestApp, self).__init__()
        # Form plotnames
        self.plots_l = ['signal1', 'signal2']
        self.plots_r = ['aux_signal1']
        
        self.plotter = DataPlotter(
            self.plots_l, right_plotlist=self.plots_r, parent=self,
            left_log=True, title='Awesome plots',
            yaxis_left_label='Log sine, cos', yaxis_right_label='Noisy line',
            xaxis_label='Time since start [s]',
            legend='right', left_thickness=[2, 8], right_thickness=6,
            left_colors=['firebrick', 'darkolivegreen'],
            right_colors=['darksalmon'])

        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(self.plotter.plot)
        self.setLayout(hbox)
        self.setGeometry(5, 5, 500, 500)

        self.start = time.time()
        QtCore.QTimer.singleShot(10, self.main)

    def main(self):
        """Simulate gathering one set of points and adding them to plot"""
        elapsed = time.time() - self.start
        value = (np.sin(elapsed) + 1.1) * 1E-9
        self.plotter.add_point('signal1', (elapsed, value))
        value = (np.cos(elapsed) + 1.1) * 1E-8
        self.plotter.add_point('signal2', (elapsed, value))
        value = elapsed + random.random()
        self.plotter.add_point('aux_signal1', (elapsed, value))

        QtCore.QTimer.singleShot(100, self.main)
Ejemplo n.º 11
0
class SimplePlot(QWidget):
    """Simple example with a Qwt plot in a Qt GUI"""
    def __init__(self, temp_control_comp):
        super(SimplePlot, self).__init__()
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.sock.settimeout(0.5)

        self.tcc = temp_control_comp

        # Set up the user interface from Designer.
        self.gui = Ui_temp_control()
        self.gui.setupUi(self)

        # Init local variables
        self.scale = 1E-8
        self.active = False
        self.start = None
        self.ramp_start = 0
        self.ramp = {}
        self.ramp['time'] = {}
        self.ramp['temp'] = {}
        self.ramp['step'] = {}
        # Set up plot (using pretty much all the possible options)
        self.plots_l = ['temperature', 'setpoint']
        self.plots_r = ['dutycycle']
        self.plotter = DataPlotter(self.plots_l,
                                   right_plotlist=self.plots_r,
                                   parent=self,
                                   left_log=False,
                                   title='Temperature control',
                                   yaxis_left_label='Temperature',
                                   yaxis_right_label='Dutycycle',
                                   xaxis_label='Time since start [s]',
                                   legend='right',
                                   left_thickness=[2, 3],
                                   right_thickness=2,
                                   left_colors=['firebrick', 'darkolivegreen'],
                                   right_colors=['darksalmon'])
        self.gui.horizontalLayout.removeWidget(self.gui.place_holder_qwt)
        self.gui.place_holder_qwt.setParent(None)
        self.gui.horizontalLayout.addWidget(self.plotter.plot)

        # Connect signals
        QtCore.QObject.connect(self.gui.start_ramp_button,
                               QtCore.SIGNAL('clicked()'), self.on_start_ramp)
        QtCore.QObject.connect(self.gui.stop_ramp_button,
                               QtCore.SIGNAL('clicked()'), self.on_stop_ramp)
        QtCore.QObject.connect(self.gui.start_button,
                               QtCore.SIGNAL('clicked()'), self.on_start)
        QtCore.QObject.connect(self.gui.stop_button,
                               QtCore.SIGNAL('clicked()'), self.on_stop)
        QtCore.QObject.connect(self.gui.quit_button,
                               QtCore.SIGNAL('clicked()'),
                               QtCore.QCoreApplication.instance().quit)
        QtCore.QObject.connect(self.gui.new_setpoint,
                               QtCore.SIGNAL('returnPressed()'),
                               self.update_setpoint)

    def on_start(self):
        """Start button method"""
        print('<< start pressed >>')
        if not self.active:
            self.start = time.time()
            self.active = True
            # Reset plot
            for key in self.plotter.data.keys():
                self.plotter.data[key] = []
            QtCore.QTimer.singleShot(0, self.plot_iteration)
        else:
            print('...already running!')

    def update_setpoint(self):
        """Update setpoint button method"""
        print('<< Updating setpoint >>')
        new_setpoint = self.gui.new_setpoint.text()
        try:
            float(new_setpoint)
        except ValueError:
            message = '...ValueError: {}\nOriginal setpoint used instead.'.format(
                repr(new_setpoint))
            new_setpoint = str(self.tcc.status['setpoint'])
            print(message)
        self.gui.new_setpoint.setProperty("text", new_setpoint)
        data = 'raw_wn#setpoint:float:' + str(new_setpoint)
        self.sock.sendto(
            data, (config.controller_hostname, config.controller_push_port))
        received = self.sock.recv(1024)
        print(received)

    def on_start_ramp(self):
        """Start temperature ramp"""
        print('<< Start ramp pressed >>')
        print('Current ramp settings:')
        print(self.ramp)
        self.ramp_start = time.time()
        for i in range(0, 11):
            self.ramp['time'][i] = int(
                self.gui.temperature_ramp.item(i, 0).text())
            self.ramp['temp'][i] = int(
                self.gui.temperature_ramp.item(i, 1).text())
            self.ramp['step'][i] = int(
                self.gui.temperature_ramp.item(i, 2).checkState()) == 2
        data = 'raw_wn#ramp:str:' + pickle.dumps(self.ramp)
        print(data)
        self.sock.sendto(
            data, (config.controller_hostname, config.controller_push_port))
        received = self.sock.recv(1024)
        print(received)
        print('New ramp settings:')
        print(self.ramp)

    def on_stop_ramp(self):
        """Stop temperature ramp"""
        print('<< Stop ramp pressed >>')
        data = 'raw_wn#ramp:str:stop'
        self.sock.sendto(
            data, (config.controller_hostname, config.controller_push_port))
        received = self.sock.recv(1024)
        print(received)

    def on_stop(self):
        """Stop button method"""
        print('<< Stop pressed >>')
        self.active = False

    def plot_iteration(self):
        """method that emulates a single data gathering and plot update"""
        elapsed = time.time() - self.start
        if self.tcc.status['connected'] is True:
            self.gui.temperature.setProperty(
                "text",
                str(self.tcc.status['temperature']) + 'C')
            self.gui.power.setProperty("text",
                                       str(self.tcc.status['dutycycle']) + 'W')
            self.gui.setpoint.setProperty(
                "text",
                str(self.tcc.status['setpoint']) + 'C')

        else:
            self.gui.current.setProperty("text", '-')
            self.gui.voltage.setProperty("text", '-')
            self.gui.temperature.setProperty("text", '-')
            self.gui.power.setProperty("text", '-')
            self.gui.resistance.setProperty("text", '-')
            self.gui.setpoint.setProperty("text", '-')
        try:
            if self.tcc.status['temp_connected'] is True:
                self.plotter.add_point(
                    'temperature', (elapsed, self.tcc.status['temperature']))
            if self.tcc.status['connected'] is True:
                self.plotter.add_point('setpoint',
                                       (elapsed, self.tcc.status['setpoint']))
                self.plotter.add_point('dutycycle',
                                       (elapsed, self.tcc.status['dutycycle']))
        except TypeError:
            pass

        if self.active:
            # Under normal curcumstances we would not add a delay
            QtCore.QTimer.singleShot(500, self.plot_iteration)
Ejemplo n.º 12
0
class SimplePlot(QWidget):
    """Simple example with a Qwt plot in a Qt GUI"""
    def __init__(self, temp_control_comp):
        super(SimplePlot, self).__init__()

        self.tcc = temp_control_comp

        # Set up the user interface from Designer.
        self.gui = Ui_temp_control()
        self.gui.setupUi(self)

        # Init local variables
        self.scale = 1E-8
        self.active = False
        self.start = None
        self.ramp_start = 0
        self.ramp = {}
        self.ramp['time'] = {}
        self.ramp['temp'] = {}
        self.ramp['step'] = {}
        # Set up plot (using pretty much all the possible options)
        self.plots_l = ['temperature', 'setpoint']
        self.plots_r = ['power']
        self.plotter = DataPlotter(
            self.plots_l, right_plotlist=self.plots_r, parent=self,
            left_log=False, title='Temperature control',
            yaxis_left_label='Temperature', yaxis_right_label='Power',
            xaxis_label='Time since start [s]',
            legend='right', left_thickness=[2, 3], right_thickness=2,
            left_colors=['firebrick', 'darkolivegreen'],
            right_colors=['darksalmon'])
        self.gui.horizontalLayout.removeWidget(self.gui.place_holder_qwt)
        self.gui.place_holder_qwt.setParent(None)
        self.gui.horizontalLayout.addWidget(self.plotter.plot)

        # Connect signals
        QtCore.QObject.connect(self.gui.start_ramp_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_start_ramp)        
        QtCore.QObject.connect(self.gui.standby_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_standby)        
        QtCore.QObject.connect(self.gui.start_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_start)
        QtCore.QObject.connect(self.gui.stop_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_stop)
        QtCore.QObject.connect(self.gui.quit_button,
                               QtCore.SIGNAL('clicked()'),
                               QtCore.QCoreApplication.instance().quit)
        QtCore.QObject.connect(self.gui.new_setpoint,
                               QtCore.SIGNAL('returnPressed()'),
                               self.update_setpoint)
    def on_start(self):
        """Start button method"""
        print 'start pressed'
        if not self.active:
            self.start = time.time()
            self.active = True
            # Reset plot
            for key in self.plotter.data.keys():
                self.plotter.data[key] = []

            QtCore.QTimer.singleShot(0, self.plot_iteration)

    def on_standby(self):
        """Standby button method"""
        self.sputtergun.goto_standby = True

    def update_setpoint(self):
        """Standby button method"""
        new_setpoint = self.gui.new_setpoint.text()
        try:
            float(new_setpoint)
        except ValueError:
            new_setpoint = str(self.tcc.status['setpoint'])
        self.gui.new_setpoint.setProperty("text", new_setpoint)
        data = 'set_setpoint' + str(new_setpoint)
        host = '130.225.87.213'
        port = 9999
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.settimeout(0.2)
        sock.sendto(data, (host, port))
        received = sock.recv(1024)


    def on_start_ramp(self):
        """Start temperature ramp"""
        self.ramp_start = time.time()
        for i in range(0,5):
            self.ramp['time'][i] = int(self.gui.temperature_ramp.item(i,0).text())
            self.ramp['temp'][i] = int(self.gui.temperature_ramp.item(i,1).text())
            self.ramp['step'][i] = int(self.gui.temperature_ramp.item(i,2).checkState()) == 2
        data = 'set_ramp' +  pickle.dumps(self.ramp)
        host = '130.225.87.213'
        port = 9999
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.settimeout(0.2)
        sock.sendto(data, (host, port))
        received = sock.recv(1024)


    def on_stop(self):
        """Stop button method"""
        print 'stop pressed'
        self.active = False

    def plot_iteration(self):
        """method that emulates a single data gathering and plot update"""
        elapsed = time.time() - self.start
        if self.tcc.status['connected'] is True:
            self.gui.current.setProperty("text", str(self.tcc.status['current']) + 'A')
            self.gui.voltage.setProperty("text", str(self.tcc.status['voltage']) + 'V')
            self.gui.temperature.setProperty("text", str(self.tcc.status['temperature']) + 'C')
            self.gui.power.setProperty("text", str(self.tcc.status['power']) + 'W')
            self.gui.resistance.setProperty("text", '{0:.3f}Ohm'.format(self.tcc.status['resistance']))
            self.gui.setpoint.setProperty("text", str(self.tcc.status['setpoint']) + 'C')

        else:
            self.gui.current.setProperty("text", '-')
            self.gui.voltage.setProperty("text", '-')
            self.gui.temperature.setProperty("text", '-')
            self.gui.power.setProperty("text", '-')
            self.gui.resistance.setProperty("text", '-')
            self.gui.setpoint.setProperty("text", '-')
        try:
            if self.tcc.status['temp_connected'] is True:
                self.plotter.add_point('temperature', (elapsed, self.tcc.status['temperature']))
            if self.tcc.status['connected'] is True:
                self.plotter.add_point('setpoint', (elapsed, self.tcc.status['setpoint']))
                self.plotter.add_point('power', (elapsed, self.tcc.status['power']))
        except TypeError:
            pass

        if self.active:
            # Under normal curcumstances we would not add a delay
            QtCore.QTimer.singleShot(500, self.plot_iteration)
Ejemplo n.º 13
0
class SimplePlot(QWidget):
    """Simple example with a Qwt plot in a Qt GUI"""
    def __init__(self):
        super(SimplePlot, self).__init__()

        # Set up the user interface from Designer.
        self.gui = Ui_PlotTest()
        self.gui.setupUi(self)

        # Init local variables
        self.scale = 1E-8
        self.active = False
        self.start = None
        self.plot_length = 20

        # Set up plot (using pretty much all the possible options)
        self.plots_l = ['signal1', 'signal2']
        self.plots_r = ['aux_signal1']
        self.plotter = DataPlotter(
            self.plots_l, right_plotlist=self.plots_r, parent=self,
            left_log=True, title='Awesome plots',
            yaxis_left_label='Log sine, cos', yaxis_right_label='Noisy line',
            xaxis_label='Time since start [s]',
            legend='right', left_thickness=[2, 8], right_thickness=6,
            left_colors=['firebrick', 'darkolivegreen'],
            right_colors=['darksalmon'])
        self.gui.horizontalLayout.addWidget(self.plotter.plot)
        # Make the content scale with the Window
        self.setLayout(self.gui.horizontalLayout)

        # Connect signals
        QtCore.QObject.connect(self.gui.start_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_start)
        QtCore.QObject.connect(self.gui.stop_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_stop)
        QtCore.QObject.connect(self.gui.scale_spinbutton,
                               QtCore.SIGNAL('valueChanged(int)'),
                               self.on_scale)
        QtCore.QObject.connect(self.gui.quit_button,
                               QtCore.SIGNAL('clicked()'),
                               QtCore.QCoreApplication.instance().quit)

    def on_start(self):
        """Start button method"""
        print 'start pressed'
        if not self.active:
            self.start = time.time()
            self.active = True

            # Reset plot
            for key in self.plotter.data.keys():
                self.plotter.data[key] = []

            QtCore.QTimer.singleShot(0, self.plot_iteration)

    def on_stop(self):
        """Stop button method"""
        print 'stop pressed'
        self.active = False

    def on_scale(self, value):
        """Scale spin button method"""
        print 'scale change, new value'.format(self.scale)
        self.scale = 10 ** value
        self.gui.scale_label.setText('1E' + str(value))

    def plot_iteration(self):
        """method that emulates a single data gathering and plot update"""
        elapsed = time.time() - self.start
        if elapsed <= self.plot_length:

            value = (np.sin(elapsed) + 1.1) * self.scale
            self.plotter.add_point('signal1', (elapsed, value))
            value = (np.cos(elapsed) + 1.1) * self.scale
            self.plotter.add_point('signal2', (elapsed, value))
            value = elapsed + random.random()
            self.plotter.add_point('aux_signal1', (elapsed, value))
        else:
            self.active = False

        if self.active:
            # Under normal curcumstances we would not add a delay
            QtCore.QTimer.singleShot(100, self.plot_iteration)
Ejemplo n.º 14
0
class SimplePlot(QWidget):
    """Simple example with a Qwt plot in a Qt GUI"""
    def __init__(self, sputtergun):
        super(SimplePlot, self).__init__()

        self.sputtergun = sputtergun

        # Set up the user interface from Designer.
        self.gui = Ui_Specs()
        self.gui.setupUi(self)

        # Init local variables
        self.scale = 1E-8
        self.active = False
        self.start = None
        self.plot_length = 200

        # Set up plot (using pretty much all the possible options)
        self.plots_l = ['filament_current', 'emission_current']
        self.plots_r = ['sputter_current']
        self.plotter = DataPlotter(self.plots_l,
                                   right_plotlist=self.plots_r,
                                   parent=self,
                                   left_log=False,
                                   title='Ion Gun Data',
                                   yaxis_left_label='Currents',
                                   yaxis_right_label='Noisy line',
                                   xaxis_label='Time since start [s]',
                                   legend='right',
                                   left_thickness=[2, 8],
                                   right_thickness=6,
                                   left_colors=['firebrick', 'darkolivegreen'],
                                   right_colors=['darksalmon'])
        self.gui.horizontalLayout.removeWidget(self.gui.place_holder_qwt)
        self.gui.place_holder_qwt.setParent(None)
        self.gui.horizontalLayout.addWidget(self.plotter.plot)

        # Connect signals
        QtCore.QObject.connect(self.gui.operate_button,
                               QtCore.SIGNAL('clicked()'), self.on_operate)
        QtCore.QObject.connect(self.gui.standby_button,
                               QtCore.SIGNAL('clicked()'), self.on_standby)
        QtCore.QObject.connect(self.gui.start_button,
                               QtCore.SIGNAL('clicked()'), self.on_start)
        QtCore.QObject.connect(self.gui.stop_button,
                               QtCore.SIGNAL('clicked()'), self.on_stop)
        QtCore.QObject.connect(self.gui.quit_button,
                               QtCore.SIGNAL('clicked()'),
                               QtCore.QCoreApplication.instance().quit)

    def on_start(self):
        """Start button method"""
        print 'start pressed'
        if not self.active:
            self.start = time.time()
            self.active = True

            # Reset plot
            for key in self.plotter.data.keys():
                self.plotter.data[key] = []

            QtCore.QTimer.singleShot(0, self.plot_iteration)

    def on_standby(self):
        """Standby button method"""
        self.sputtergun.goto_standby = True

    def on_operate(self):
        """Standby button method"""
        self.sputtergun.goto_operate = True
        print "!"

    def on_stop(self):
        """Stop button method"""
        print 'stop pressed'
        self.active = False

    def plot_iteration(self):
        """method that emulates a single data gathering and plot update"""
        elapsed = time.time() - self.start
        #print str(elapsed) + ' current ' + str(self.sputtergun.status['sputter_current'])
        #print str(elapsed) + ' bias ' + str(self.sputtergun.status['filament_bias'])
        if self.sputtergun.status['sputter_current'] is not None:
            self.gui.sputter_current.setProperty(
                "text",
                str(self.sputtergun.status['sputter_current']) + 'mA')
            self.gui.filament_bias.setProperty(
                "text",
                str(self.sputtergun.status['filament_bias']) + 'V')
            self.gui.temp_energy_module.setProperty(
                "text",
                str(self.sputtergun.status['temperature']) + 'C')
            self.gui.filament_current.setProperty(
                "text",
                str(self.sputtergun.status['filament_current']) + 'mA')
            self.gui.accel_voltage.setProperty(
                "text",
                str(self.sputtergun.status['accel_voltage']) + 'V')
            self.gui.emission_current.setProperty(
                "text",
                str(self.sputtergun.status['emission_current']) + 'mA')
        else:
            self.gui.sputter_current.setProperty("value", '-')
            self.gui.filament_bias.setProperty("text", '-')
            self.gui.temp_energy_module.setProperty("text", '-')
            self.gui.filament_current.setProperty("text", '-')
            self.gui.accel_voltage.setProperty("text", '-')
            self.gui.emission_current.setProperty("text", '-')
        self.gui.operate_button.setProperty('checked',
                                            self.sputtergun.status['operate'])
        print self.sputtergun.status['operate']
        self.gui.standby_button.setProperty('checked',
                                            self.sputtergun.status['standby'])

        if elapsed <= self.plot_length:
            try:
                self.plotter.add_point(
                    'sputter_current',
                    (elapsed, self.sputtergun.status['sputter_current']))
                self.plotter.add_point(
                    'filament_current',
                    (elapsed, self.sputtergun.status['filament_current']))
                self.plotter.add_point(
                    'emission_current',
                    (elapsed, self.sputtergun.status['emission_current']))
            except TypeError:
                pass
        else:
            self.active = False

        if self.active:
            # Under normal curcumstances we would not add a delay
            QtCore.QTimer.singleShot(500, self.plot_iteration)
Ejemplo n.º 15
0
class SimplePlot(QWidget):
    """Simple example with a Qwt plot in a Qt GUI"""

    def __init__(self, temp_control_comp):
        super(SimplePlot, self).__init__()

        self.tcc = temp_control_comp

        # Set up the user interface from Designer.
        self.gui = Ui_temp_control()
        self.gui.setupUi(self)

        # Init local variables
        self.scale = 1e-8
        self.active = False
        self.start = None
        self.ramp_start = 0
        self.ramp = {}
        self.ramp["time"] = {}
        self.ramp["temp"] = {}
        self.ramp["step"] = {}
        # Set up plot (using pretty much all the possible options)
        self.plots_l = ["temperature", "setpoint"]
        self.plots_r = ["dutycycle"]
        self.plotter = DataPlotter(
            self.plots_l,
            right_plotlist=self.plots_r,
            parent=self,
            left_log=False,
            title="Temperature control",
            yaxis_left_label="Temperature",
            yaxis_right_label="Dutycycle",
            xaxis_label="Time since start [s]",
            legend="right",
            left_thickness=[2, 3],
            right_thickness=2,
            left_colors=["firebrick", "darkolivegreen"],
            right_colors=["darksalmon"],
        )
        self.gui.horizontalLayout.removeWidget(self.gui.place_holder_qwt)
        self.gui.place_holder_qwt.setParent(None)
        self.gui.horizontalLayout.addWidget(self.plotter.plot)

        # Connect signals
        QtCore.QObject.connect(self.gui.start_ramp_button, QtCore.SIGNAL("clicked()"), self.on_start_ramp)
        QtCore.QObject.connect(self.gui.stop_ramp_button, QtCore.SIGNAL("clicked()"), self.on_stop_ramp)
        QtCore.QObject.connect(self.gui.start_button, QtCore.SIGNAL("clicked()"), self.on_start)
        QtCore.QObject.connect(self.gui.stop_button, QtCore.SIGNAL("clicked()"), self.on_stop)
        QtCore.QObject.connect(
            self.gui.quit_button, QtCore.SIGNAL("clicked()"), QtCore.QCoreApplication.instance().quit
        )
        QtCore.QObject.connect(self.gui.new_setpoint, QtCore.SIGNAL("returnPressed()"), self.update_setpoint)

    def on_start(self):
        """Start button method"""
        print "start pressed"
        if not self.active:
            self.start = time.time()
            self.active = True
            # Reset plot
            for key in self.plotter.data.keys():
                self.plotter.data[key] = []

            QtCore.QTimer.singleShot(0, self.plot_iteration)

    def update_setpoint(self):
        """Standby button method"""
        new_setpoint = self.gui.new_setpoint.text()
        try:
            float(new_setpoint)
        except ValueError:
            new_setpoint = str(self.tcc.status["setpoint"])
        self.gui.new_setpoint.setProperty("text", new_setpoint)
        data = "raw_wn#setpoint:float:" + str(new_setpoint)
        host = "10.54.7.47"
        port = 8500
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.settimeout(0.2)
        sock.sendto(data, (host, port))
        received = sock.recv(1024)
        print received

    def on_start_ramp(self):
        """Start temperature ramp"""
        self.ramp_start = time.time()
        for i in range(0, 11):
            self.ramp["time"][i] = int(self.gui.temperature_ramp.item(i, 0).text())
            self.ramp["temp"][i] = int(self.gui.temperature_ramp.item(i, 1).text())
            self.ramp["step"][i] = int(self.gui.temperature_ramp.item(i, 2).checkState()) == 2
        data = "raw_wn#ramp:str:" + pickle.dumps(self.ramp)
        print data
        host = "10.54.7.47"
        port = 8500
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.settimeout(0.2)
        sock.sendto(data, (host, port))
        received = sock.recv(1024)

    def on_stop_ramp(self):
        """Start temperature ramp"""
        data = "raw_wn#ramp:str:stop"
        host = "10.54.7.47"
        port = 8500
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.settimeout(0.2)
        sock.sendto(data, (host, port))
        received = sock.recv(1024)

    def on_stop(self):
        """Stop button method"""
        print "stop pressed"
        self.active = False

    def plot_iteration(self):
        """method that emulates a single data gathering and plot update"""
        elapsed = time.time() - self.start
        if self.tcc.status["connected"] is True:
            self.gui.temperature.setProperty("text", str(self.tcc.status["temperature"]) + "C")
            self.gui.power.setProperty("text", str(self.tcc.status["dutycycle"]) + "W")
            self.gui.setpoint.setProperty("text", str(self.tcc.status["setpoint"]) + "C")

        else:
            self.gui.current.setProperty("text", "-")
            self.gui.voltage.setProperty("text", "-")
            self.gui.temperature.setProperty("text", "-")
            self.gui.power.setProperty("text", "-")
            self.gui.resistance.setProperty("text", "-")
            self.gui.setpoint.setProperty("text", "-")
        try:
            if self.tcc.status["temp_connected"] is True:
                self.plotter.add_point("temperature", (elapsed, self.tcc.status["temperature"]))
            if self.tcc.status["connected"] is True:
                self.plotter.add_point("setpoint", (elapsed, self.tcc.status["setpoint"]))
                self.plotter.add_point("dutycycle", (elapsed, self.tcc.status["dutycycle"]))
        except TypeError:
            pass

        if self.active:
            # Under normal curcumstances we would not add a delay
            QtCore.QTimer.singleShot(500, self.plot_iteration)
Ejemplo n.º 16
0
class SimplePlot(QWidget):
    """Simple example with a Qwt plot in a Qt GUI"""
    def __init__(self, sputtergun):
        super(SimplePlot, self).__init__()

        self.sputtergun = sputtergun

        # Set up the user interface from Designer.
        self.gui = Ui_Specs()
        self.gui.setupUi(self)

        # Init local variables
        self.scale = 1E-8
        self.active = False
        self.start = None
        self.plot_length = 200

        # Set up plot (using pretty much all the possible options)
        self.plots_l = ['filament_current', 'emission_current']
        self.plots_r = ['sputter_current']
        self.plotter = DataPlotter(
            self.plots_l, right_plotlist=self.plots_r, parent=self,
            left_log=False, title='Ion Gun Data',
            yaxis_left_label='Currents', yaxis_right_label='Noisy line',
            xaxis_label='Time since start [s]',
            legend='right', left_thickness=[2, 8], right_thickness=6,
            left_colors=['firebrick', 'darkolivegreen'],
            right_colors=['darksalmon'])
        self.gui.horizontalLayout.removeWidget(self.gui.place_holder_qwt)
        self.gui.place_holder_qwt.setParent(None)
        self.gui.horizontalLayout.addWidget(self.plotter.plot)

        # Connect signals
        QtCore.QObject.connect(self.gui.operate_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_operate)        
        QtCore.QObject.connect(self.gui.standby_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_standby)        
        QtCore.QObject.connect(self.gui.start_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_start)
        QtCore.QObject.connect(self.gui.stop_button,
                               QtCore.SIGNAL('clicked()'),
                               self.on_stop)
        QtCore.QObject.connect(self.gui.quit_button,
                               QtCore.SIGNAL('clicked()'),
                               QtCore.QCoreApplication.instance().quit)

    def on_start(self):
        """Start button method"""
        print 'start pressed'
        if not self.active:
            self.start = time.time()
            self.active = True

            # Reset plot
            for key in self.plotter.data.keys():
                self.plotter.data[key] = []

            QtCore.QTimer.singleShot(0, self.plot_iteration)

    def on_standby(self):
        """Standby button method"""
        self.sputtergun.goto_standby = True

    def on_operate(self):
        """Standby button method"""
        self.sputtergun.goto_operate = True
        print "!"

    def on_stop(self):
        """Stop button method"""
        print 'stop pressed'
        self.active = False

    def plot_iteration(self):
        """method that emulates a single data gathering and plot update"""
        elapsed = time.time() - self.start
        #print str(elapsed) + ' current ' + str(self.sputtergun.status['sputter_current'])
        #print str(elapsed) + ' bias ' + str(self.sputtergun.status['filament_bias'])
        if self.sputtergun.status['sputter_current'] is not None:
            self.gui.sputter_current.setProperty("text", str(self.sputtergun.status['sputter_current']) + 'mA')
            self.gui.filament_bias.setProperty("text", str(self.sputtergun.status['filament_bias']) + 'V')
            self.gui.temp_energy_module.setProperty("text", str(self.sputtergun.status['temperature']) + 'C')
            self.gui.filament_current.setProperty("text", str(self.sputtergun.status['filament_current']) + 'mA')
            self.gui.accel_voltage.setProperty("text", str(self.sputtergun.status['accel_voltage']) + 'V')
            self.gui.emission_current.setProperty("text", str(self.sputtergun.status['emission_current']) + 'mA')
        else:
            self.gui.sputter_current.setProperty("value", '-')
            self.gui.filament_bias.setProperty("text", '-')
            self.gui.temp_energy_module.setProperty("text", '-')
            self.gui.filament_current.setProperty("text", '-')
            self.gui.accel_voltage.setProperty("text", '-')
            self.gui.emission_current.setProperty("text", '-')
        self.gui.operate_button.setProperty('checked', self.sputtergun.status['operate'])
        print self.sputtergun.status['operate']
        self.gui.standby_button.setProperty('checked', self.sputtergun.status['standby'])

        if elapsed <= self.plot_length:
            try:
                self.plotter.add_point('sputter_current', (elapsed, self.sputtergun.status['sputter_current']))
                self.plotter.add_point('filament_current', (elapsed, self.sputtergun.status['filament_current']))
                self.plotter.add_point('emission_current', (elapsed, self.sputtergun.status['emission_current']))
            except TypeError:
                pass
        else:
            self.active = False

        if self.active:
            # Under normal curcumstances we would not add a delay
            QtCore.QTimer.singleShot(500, self.plot_iteration)