Indication of magnet strengths and matching results in GUI

This commit is contained in:
2026-01-20 15:12:12 +01:00
parent 906890da98
commit 60b9643568
9 changed files with 192 additions and 38 deletions

View File

@@ -91,6 +91,7 @@ class OpticsTools(QtWidgets.QMainWindow, QtCore.QObject, Ui_OpticsGUI):
else:
vars = None
twiss = self.match.match(self.model.om, variables = vars, Injector = injector,Athos = athos, Aramis = aramis, Porthos = porthos)
self.updateMatchResult(self.match.matchresult)
energy = self.model.calcEnergyProfile(twiss)
#enfore the writing of a new lattice so that the magnet settings are in the new lattice
self.model.forceLat = True
@@ -100,7 +101,18 @@ class OpticsTools(QtWidgets.QMainWindow, QtCore.QObject, Ui_OpticsGUI):
self.saveSettingsdirect(fileName)
def updateMatchResult(self,result):
self.UIReportMatchResult.clear()
for ele in result:
label = '%s (%6.2e)' % (ele['Location'],ele['Error'])
listitem = QtWidgets.QListWidgetItem(label)
color = QtGui.QColor(100, 255, 100) # white
if ele['Error'] > 1e-5:
color = QtGui.QColor(255, 255, 100)
if ele['Error'] > 1:
color = QtGui.QColor(255, 100, 100)
listitem.setBackground(color)
self.UIReportMatchResult.addItem(listitem)
def updateMatchingCase(self):
"""