Added matching into Porthos for P-cube experiment

This commit is contained in:
2026-05-04 16:19:43 +02:00
parent 9bef0adc13
commit 30b4a33ffd
2 changed files with 67 additions and 2 deletions
+17 -2
View File
@@ -50,6 +50,7 @@ class MatchMaker:
self.filter['injector']='s[i1].*k[12]|s20cb.*k1|s20sy01.*k1'
self.filter['athos']='sat.*mqua.*k1|sat.*msex.*k2|s20sy02.*m[kq]'
self.filter['aramis'] = 's[3a][0r].*k[12]|s20sy03.*k1'
self.filter['porthos'] = 'spo.*k[12]'
with open(file,'r') as f:
lines = f.readlines()
for line in lines:
@@ -88,6 +89,8 @@ class MatchMaker:
os.chdir(self.scriptdir)
if Athos:
target = 'SATBD02'
elif Porthos:
target = 'SPOP301'
else:
target = 'SARBD02'
@@ -117,7 +120,7 @@ class MatchMaker:
if Aramis:
f.truncate(0)
print('Matching Aramis ...')
if target=='SATBD02':
if target=='SATBD02' or target=='SPOP301':
target = 'SARUN20'
om.setBranch(target, 'SINLH01')
madx.updateLattice(om, target) # write lattice
@@ -126,8 +129,20 @@ class MatchMaker:
madx.madx.call('matchAramis.madx')
self.updateOnlineModel(om, madx.madx, self.filter['aramis'])
self.parseMatchOutput(f.getvalue().split('\n'), 'Aramis')
os.chdir(cwd)
if Porthos:
f.truncate(0)
print('Matching Porthos ...')
if target == 'SATBD02' or target == 'SARUN20':
target = 'SPOP301'
om.setBranch(target, 'SINLH01')
madx.updateLattice(om, target) # write lattice
madx.commonHeader('SwissFEL', '#s/#e', None) # sets header
madx.madx.call('initTwiss.madx')
madx.madx.call('matchPorthos.madx')
self.updateOnlineModel(om, madx.madx, self.filter['porthos'])
self.parseMatchOutput(f.getvalue().split('\n'), 'Porthos')
os.chdir(cwd)
return madx.madx.table.twiss
def parseMatchOutput(self, result,prefix,full=False):