Debugging machine interface

This commit is contained in:
2025-05-28 11:13:52 +02:00
committed by Sven
parent 365137a305
commit ead833a380
3 changed files with 17 additions and 14 deletions

View File

@@ -2,6 +2,7 @@ import sys
import json
from datetime import datetime
import time
from argparse import ArgumentParser
from PyQt5 import QtWidgets,QtGui
@@ -85,11 +86,13 @@ class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
if __name__ == '__main__':
QtWidgets.QApplication.setStyle(QtWidgets.QStyleFactory.create("plastique"))
parser = ArgumentParser()
parser.add_argument('-phase', type=int, help='Disable any action on the machine', default=0)
parser.add_argument('-offline', type=int, help='Excludes any connection to control system', default=0)
args = parser.parse_args()
app = QtWidgets.QApplication(sys.argv)
if len(sys.argv) > 1:
arg=int(sys.argv[1])
else:
arg=0
main = OpticsTools(phase = 0 , office = True)
main.show()
main = OpticsTools(phase = args.phase, office = args.offline)
if main:
main.show()
sys.exit(app.exec_())

View File

@@ -1,5 +1,5 @@
import re
import numpy as np
from epics import PV
class Machine:
@@ -56,9 +56,10 @@ class Machine:
for key in self.PVs.keys():
if 'MQUA' in key or 'MQSK' in key or 'MSEX' in key:
magnets[key[0:15]]=values[key]
if 'MBND' in key:
if 'MBND' in key and 'K0L-SET' in key:
if 'SINBC' in key or 'SINLH' in key or 'S10BC' in key or 'SATMA' in key or 'SATUN' in key:
magnets[key[0:15]] = values[key]
print(key,values[key])
magnets[key[0:15]] = values[key]*180./np.pi
if 'UMOD' in key:
und[key[0:12]]=[values[key],0.]
if 'UIND' in key:
@@ -85,8 +86,8 @@ class Machine:
if values[key] == 0:
rf[key[0:7] + '-RSYS'] = [0, 0]
else:
key1 = key.replace('SM-SET','SET-ACC-VOLT')
key2 = key.replace('SM-SET', 'SET-BEAM-PHASE')
key1 = key.replace('REQUIRED-OP','SET-ACC-VOLT')
key2 = key.replace('REQUIRED-OP','SET-BEAM-PHASE')
rf[key[0:7] + '-RSYS'] = [values[key1], values[key2]]
if 'ENERGY-OP' in key:
energy[key[0:15]]=values[key]

View File

@@ -110,7 +110,7 @@ class Sandbox:
sbvalue += ['---', '---']
sbcolor += [CGrey, CGrey]
else:
sbvalue += ['%f' % machine[key]['Gradient'], '%f' % machine[key]['Phase']]
sbvalue += ['%7.3f' % machine[key][0], '%7.3f' % machine[key][1]]
sbcolor += [CBeige, CBeige]
values.append(sbvalue)
colors.append(sbcolor)
@@ -181,7 +181,6 @@ class Sandbox:
continue
sbval=[key]
sbcol=[CWhite]
maval = machine[key]
moval=None
mokey = key.replace('-','.')
@@ -206,7 +205,7 @@ class Sandbox:
sbval.append('---')
sbcol.append(CGrey)
else:
sbval.append('%7.3' % maval)
sbval.append('%7.3f' % maval)
if moval is None:
sbcol.append(CGrey)
else: