SF+ matching and support for ELegant lattice export

This commit is contained in:
reiche committed 2026-10-13 09:39:40 +02:00
1 parent 85b8e89917
commit 4e9a35b0e7
8 files changed
+818 -323

No files matched your search

+10
View File
@@ -13,6 +13,7 @@ from machine import Machine
from reference import ReferenceManager
from sandbox import Sandbox
from matchmaker import MatchMaker
from elegant import Elegant
@@ -35,6 +36,7 @@ class OpticsTools(QtWidgets.QMainWindow, QtCore.QObject, Ui_OpticsGUI):
# initialize online model
self.model = Model(phase=phase,parent=self)
self.elegant=Elegant(onlinemodel=self.model,parent=self)
# initialize modeling
self.match = MatchMaker(signal=self.sigStatus,phase=phase)
@@ -64,6 +66,7 @@ class OpticsTools(QtWidgets.QMainWindow, QtCore.QObject, Ui_OpticsGUI):
self.UIMatchSelected.clicked.connect(self.doMatch)
self.actionOpen_2.triggered.connect(self.loadSettings)
self.actionSave.triggered.connect(self.saveSettings)
self.actionExport_Elegant.triggered.connect(self.exportElegant)
self.UIUpdateFromMachine.clicked.connect(self.fullUpdate)
self.actionHelp.triggered.connect(self.openGit)
self.actionAbout.triggered.connect(self.about)
@@ -88,11 +91,16 @@ class OpticsTools(QtWidgets.QMainWindow, QtCore.QObject, Ui_OpticsGUI):
vars = self.getMatchVariables()
else:
vars = None
if self.UIDoInitialEnergy.isChecked():
erg0 =float(str(self.UIInitialEnergy.text()))
else:
erg0=-1
inittwiss={}
inittwiss['betax']=float(str(self.UIInitBetax.text()))
inittwiss['betay'] = float(str(self.UIInitBetay.text()))
inittwiss['alphax'] = float(str(self.UIInitAlphax.text()))
inittwiss['alphay'] = float(str(self.UIInitAlphay.text()))
inittwiss['energy'] = erg0
twiss = self.match.match(self.model.om, variables = vars, initCond = inittwiss, Injector = injector,Athos = athos, Aramis = aramis, Porthos = porthos, full = fullOutput)
self.updateMatchResult(self.match.matchresult)
energy = self.model.calcEnergyProfile(twiss)
@@ -162,6 +170,8 @@ class OpticsTools(QtWidgets.QMainWindow, QtCore.QObject, Ui_OpticsGUI):
variables[name]={'Val':val}
return variables
def exportElegant(self):
self.elegant.export()
def closeEvent(self, event):
self.plot.close()