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()
|
porthos = self.UIMatchPorthos.isChecked()
|
||||||
twiss = self.match.match(self.model.om,Injector = injector,Athos = athos, Aramis = aramis, Porthos = porthos)
|
twiss = self.match.match(self.model.om,Injector = injector,Athos = athos, Aramis = aramis, Porthos = porthos)
|
||||||
energy = self.model.calcEnergyProfile(twiss)
|
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)
|
self.plot.newData(twiss, energy)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
4) Save matched values (e.g. automatically)
|
4) Save matched values (e.g. automatically)
|
||||||
5) Load Reference
|
5) Load Reference
|
||||||
6) filter for curent, planned and final phase for matching scripts
|
6) filter for curent, planned and final phase for matching scripts
|
||||||
|
7) support for start twiss for tracking
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from onlinemodel.core import Facility
|
|||||||
from onlinemodel.madx import CMadX
|
from onlinemodel.madx import CMadX
|
||||||
#from sipbuild.generator.outputs.formatters import variable
|
#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',
|
'etax':'dx','etay':'dy','etapx':'dpx','etapy':'dpy','mux':'mux','muy':'muy',
|
||||||
'x':'x','y':'y','px':'px','py':'py','energy':'energy'}
|
'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):
|
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())
|
self.setBranch(end.upper())
|
||||||
if not refloc == start:
|
print("Tracking:",refloc[0:7],start)
|
||||||
twiss0 = self.doBackTrack(refloc,start,twiss0)
|
if not refloc[0:7] == start:
|
||||||
print('Back Tracking Done')
|
twiss0 = self.doBackTrack(refloc,start,twiss0) # track backwards to get new initial twiss values
|
||||||
for key in twiss_in.keys():
|
|
||||||
if converttwiss[key] in twiss0.keys():
|
|
||||||
self.startTwiss[key+'0'] = twiss0[converttwiss[key]]
|
|
||||||
# self.madx.updateVariables(twiss0)
|
|
||||||
twiss = self.madx.track('swissfel',start+'$START',end+'$END',twiss0)
|
twiss = self.madx.track('swissfel',start+'$START',end+'$END',twiss0)
|
||||||
energy = self.calcEnergyProfile(twiss)
|
energy = self.calcEnergyProfile(twiss)
|
||||||
if plot:
|
if plot:
|
||||||
|
|||||||
Reference in New Issue
Block a user