Commit df3c91e6 authored by Martin Drechsler's avatar Martin Drechsler

Main change: save and load functions addes.

parent 376b2636
......@@ -14,16 +14,20 @@ from PyQt5.QtWidgets import (QPushButton, QWidget)
#An example of a class
class anal_control_signal(QWidget):
def __init__(self, name, channel):
_registry = []
def __init__(self, name, channel, out_minimum = -10, out_maximum = 10, out_step = 0.1):
super().__init__()
self._registry.append(self)
self.name = name
self.ch = channel
self.initial_value = 0
self.max = 10
self.min = -10
self.step = 0.1
self.max = out_maximum
self.min = out_minimum
self.step = out_step
self.siPrefix = True
self.suffix = 'V'
......@@ -43,6 +47,14 @@ class anal_control_signal(QWidget):
self.scan_direction = 0
self.scan_button.clicked.connect(self.doAction)
self.sb.sigValueChanging.connect(self.sb_analog_change)
self.spin_boxes = [('sb', self.sb), ('scan_sb_start', self.scan_sb_start), ('scan_sb_stop', self.scan_sb_stop), ('scan_sb_period', self.scan_sb_period)]
def sb_analog_change(self):
self.AO.set_out(self.sb.val)
def set_name(self, name):
self.name = name
......@@ -50,15 +62,8 @@ class anal_control_signal(QWidget):
def set_initial_value(self, value):
self.initial_value = value
def set_max(self, value):
self.max = value
def set_min(self, value):
self.min = value
def set_step(self, value):
self.step = value
def set_siPrefix(self, value):
self.siPrefix = value
......@@ -114,37 +119,4 @@ class digital_control_signal(QWidget):
self.name = name
def set_initial_value(self, value):
self.initial_value = value
"""
class analog_scan:
def __init__(self, signal):
self.signal = signal
self.sb_start = pg.SpinBox(value = 0, bounds=[signal.min, signal.max], step = signal.step, siPrefix = signal.siPrefix, suffix = signal.suffix)
self.sb_stop = pg.SpinBox(value = 0, bounds=[signal.min, signal.max], step = signal.step, siPrefix = signal.siPrefix, suffix = signal.suffix)
self.sb_period = pg.SpinBox(value = 1, bounds=[0, 100], step = 0.1, siPrefix = True, suffix = 's')
self.cb = QtGui.QCheckBox()
self.cb.stateChanged.connect(self.scan)
def scan(self):
ao = self.signal
start, stop, period = self.sb_start.value(), self.sb_stop.value(), self.sb_period.value()
dt = 1e-3
n = period / (2*dt)
voltages = np.linspace(start, stop, n)
i = 0
scanning = self.cb.isChecked()
while(scanning):
while( i<len(voltages)-1 ):
ao.set_out(voltages[i])
i = i + 1
time.sleep(dt)
while(i>0):
ao.set_out(voltages[i])
i = i - 1
time.sleep(dt)
scanning = self.cb.isChecked()
"""
\ No newline at end of file
self.initial_value = value
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment