Initial tracking done, needs check for other twiss parameters in user defined
This commit is contained in:
@@ -79,6 +79,8 @@ class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
|
||||
porthos = self.UIMatchPorthos.isChecked()
|
||||
twiss = self.match.match(self.model.om,Injector = injector,Athos = athos, Aramis = aramis, Porthos = porthos)
|
||||
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
|
||||
self.plot.newData(twiss, energy)
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
4) Save matched values (e.g. automatically)
|
||||
5) Load Reference
|
||||
6) filter for curent, planned and final phase for matching scripts
|
||||
|
||||
7) support for start twiss for tracking
|
||||
|
||||
|
||||
|
||||
|
||||
15
model.py
15
model.py
@@ -6,7 +6,7 @@ from onlinemodel.core import Facility
|
||||
from onlinemodel.madx import CMadX
|
||||
#from sipbuild.generator.outputs.formatters import variable
|
||||
|
||||
converttwiss= {'betax':'betx','betay':'bety','alphax':'alfx','alphay':'alfy',
|
||||
converttwiss= {'betx':'betx','bety':'bety','alfx':'alfx','alfy':'alfy',
|
||||
'etax':'dx','etay':'dy','etapx':'dpx','etapy':'dpy','mux':'mux','muy':'muy',
|
||||
'x':'x','y':'y','px':'px','py':'py','energy':'energy'}
|
||||
|
||||
@@ -204,15 +204,12 @@ class Model:
|
||||
|
||||
|
||||
def doTrack(self, start,end, refloc, twiss_in, plot = True):
|
||||
twiss0 = {converttwiss[key]:twiss_in[key] for key in twiss_in.keys()}
|
||||
print(twiss_in)
|
||||
twiss0 = {converttwiss[key]:twiss_in[key] for key in twiss_in.keys()} # follows the madx format
|
||||
self.setBranch(end.upper())
|
||||
if not refloc == start:
|
||||
twiss0 = self.doBackTrack(refloc,start,twiss0)
|
||||
print('Back Tracking Done')
|
||||
for key in twiss_in.keys():
|
||||
if converttwiss[key] in twiss0.keys():
|
||||
self.startTwiss[key+'0'] = twiss0[converttwiss[key]]
|
||||
# self.madx.updateVariables(twiss0)
|
||||
print("Tracking:",refloc[0:7],start)
|
||||
if not refloc[0:7] == start:
|
||||
twiss0 = self.doBackTrack(refloc,start,twiss0) # track backwards to get new initial twiss values
|
||||
twiss = self.madx.track('swissfel',start+'$START',end+'$END',twiss0)
|
||||
energy = self.calcEnergyProfile(twiss)
|
||||
if plot:
|
||||
|
||||
Reference in New Issue
Block a user