Support for different phases. Settings have to match the loaded phase

This commit is contained in:
2026-01-21 14:41:19 +01:00
parent d168cd2a69
commit 1bbf5c0ba5
23 changed files with 6599 additions and 236 deletions
+18 -4
View File
@@ -8,8 +8,8 @@ import copy
class MatchMaker:
def __init__(self,signal = None):
self.matchlist={'Reference-SwissFEL':'Scripts/Reference-SwissFEL','SwissFEL+':'Scripts/SFPlus'}
def __init__(self,signal = None,phase = 0):
self.matchlist = self.getAllScripts(phase)
self.referencePoints={}
self.variables={}
self.scriptdir = None
@@ -17,6 +17,17 @@ class MatchMaker:
self.matchresult=[]
self.filter={}
def getAllScripts(self,phase):
phases = ['Current','Planned','Final']
path = 'Scripts/%s' % phases[phase]
print(path)
res={}
dirs = [f.path for f in os.scandir(path) if f.is_dir()]
for ele in dirs:
tags=ele.split('/')[-1]
res[tags]=ele
return res
def initScripts(self,target):
self.scriptdir = self.matchlist[target]
if os.path.exists(self.scriptdir+'/initTwiss.madx'):
@@ -25,8 +36,10 @@ class MatchMaker:
self.scriptAramis = os.path.exists(self.scriptdir+'/matchAramis.madx')
self.scriptAthos = os.path.exists(self.scriptdir + '/matchAthos.madx')
self.scriptPorthos = os.path.exists(self.scriptdir + '/matchPorthos.madx')
self.settings = os.path.exists(self.scriptdir + '/ReferenceSettings')
if os.path.exists(self.scriptdir + '/settings.json'):
self.settings=self.scriptdir + '/settings.json'
else:
self.settings=None
def parseReferencePoints(self):
file = self.scriptdir+'/initTwiss.madx'
@@ -67,6 +80,7 @@ class MatchMaker:
print('##### Reference Twiss values parsed')
def match(self, om, variables = None, Injector=True, Athos = True, Aramis = False, Porthos = False):
self.matchresult.clear()