Commit aa030d56 authored by Martin Drechsler's avatar Martin Drechsler

The number of steps in the scan functions is now limited to a minimum of 5.

parent 5695a92f
...@@ -12,7 +12,7 @@ from PyQt5.QtCore import QTimer ...@@ -12,7 +12,7 @@ from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import (QPushButton, QWidget, QVBoxLayout, QLCDNumber, QProgressBar, QLabel) from PyQt5.QtWidgets import (QPushButton, QWidget, QVBoxLayout, QLCDNumber, QProgressBar, QLabel)
import telnetlib import telnetlib
import os import os
import numpy as np
#An example of a class #An example of a class
class anal_control_signal(QWidget): class anal_control_signal(QWidget):
...@@ -100,6 +100,8 @@ class anal_control_signal(QWidget): ...@@ -100,6 +100,8 @@ class anal_control_signal(QWidget):
self.scan_step = self.scan_step + self.scan_direction self.scan_step = self.scan_step + self.scan_direction
self.AO.set_out(self.scan_step) self.AO.set_out(self.scan_step)
print(self.scan_step)
def PbarEvent(self): def PbarEvent(self):
try: try:
...@@ -132,7 +134,7 @@ class anal_control_signal(QWidget): ...@@ -132,7 +134,7 @@ class anal_control_signal(QWidget):
a = float(self.scan_sb_start.val) a = float(self.scan_sb_start.val)
dt = 5.0e-3 dt = 5.0e-3
T = float(self.scan_sb_period.val) T = float(self.scan_sb_period.val)
n = T/(2*dt) n = int( T/(2*dt) )
self.scan_direction = -abs(b-a)/n # this is the size in voltage of each step self.scan_direction = -abs(b-a)/n # this is the size in voltage of each step
self.scan_step = float(self.sb.val) # from here it beggins self.scan_step = float(self.sb.val) # from here it beggins
...@@ -141,6 +143,9 @@ class anal_control_signal(QWidget): ...@@ -141,6 +143,9 @@ class anal_control_signal(QWidget):
if self.scan_step > b or self.scan_step < a: if self.scan_step > b or self.scan_step < a:
print('scan can not start outside scan range and scan start should be lower than scan stop') print('scan can not start outside scan range and scan start should be lower than scan stop')
elif n < 5:
print('%i steps are too few, you need at least 5 steps' % (n) )
pass
else: else:
self.sb.setEnabled(False) self.sb.setEnabled(False)
self.scan_button.setStyleSheet("background-color: green") self.scan_button.setStyleSheet("background-color: green")
...@@ -236,6 +241,7 @@ class burleighWM(QWidget): ...@@ -236,6 +241,7 @@ class burleighWM(QWidget):
self.layoutWM.addWidget(lcd) self.layoutWM.addWidget(lcd)
self.dockWM.addWidget(self.layoutWM) self.dockWM.addWidget(self.layoutWM)
\ 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