Basic matching by scripts is working. Program needs some serious clean-up

This commit is contained in:
2025-12-18 16:10:32 +01:00
parent a22a09d15a
commit 0d5f4c303e
8 changed files with 132 additions and 32 deletions

View File

@@ -1,17 +1,23 @@
import os
import re
from onlinemodel.madx import CMadX
class MatchMaker:
def __init__(self, scriptlocation = None):
self.scriptdir = scriptlocation
self.scriptInjector = 'matchInjector.madx'
self.scriptAramis = 'matchAramis.madx'
self.scriptAthos = 'matchAthos.madx'
def __init__(self):
self.matchlist={'SwissFEL+':'Scripts/SFPlus'}
def initScripts(self,target):
self.scriptdir = self.matchlist[target]
self.scriptInjector = os.path.exists(self.scriptdir+'/matchInjector.madx')
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')
def match(self, om, Injector=True, Athos = True, Aramis = False):
def match(self, om, Injector=True, Athos = True, Aramis = False, Porthos = False):
if Athos:
target = 'SATBD01'
@@ -37,6 +43,8 @@ class MatchMaker:
madx.commonHeader('SwissFEL', '#s/#e', None) # sets header
madx.madx.call(self.scriptdir + '/initTwiss.madx')
madx.madx.call(self.scriptdir + '/matchAramis.madx', chdir=True)
self.updateOnlineModel(om, madx.madx, 's[3a][0r].*k1|s20[bm][ca].*k1')
return madx.madx.table.twiss
def updateOnlineModel(self,om,madx,filter):
reg = re.compile(filter)