Added matching into Porthos for P-cube experiment
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
use,sequence=swissfel;
|
||||
Print,text='MATCH POINT: Match into Porthos switchyard';
|
||||
MATCH,SEQUENCE=swissfel,range=s20SY02$start/sarma02$start,beta0=twisssep;
|
||||
VARY,NAME=sposy01.mqua030.k1,STEP=0.0001;
|
||||
VARY,NAME=sposy01.mqua060.k1,STEP=0.0001;
|
||||
VARY,NAME=sposy01.mqua100.k1,STEP=0.0001;
|
||||
VARY,NAME=sposy01.mqua130.k1,STEP=0.0001;
|
||||
CONSTRAINT,SEQUENCE=swissfel,range=sposy01.dbpm080$end, dx = -0.2;
|
||||
CONSTRAINT,SEQUENCE=swissfel,range=sposy01.dbpm080$end, dpx = 0;
|
||||
CONSTRAINT,SEQUENCE=swissfel,range=sposy01$end, dx = 0.;
|
||||
CONSTRAINT,SEQUENCE=swissfel,range=sposy01$end, dpx = 0;
|
||||
LMDIF,CALLS=100,TOLERANCE=1.e-21;
|
||||
ENDMATCH;
|
||||
|
||||
twiss,sequence=swissfel,range=s20SY02$start/sposy01$end,beta0=twisssep;
|
||||
plot,haxis=s,vaxis=betx,bety,range=S30CB15$START/sposy01$end,colour=100;
|
||||
|
||||
Print,text='MATCH POINT: Match symmetric optics in Porthos switchyard';
|
||||
MATCH,SEQUENCE=swissfel,range=s20SY02$start/sposy02$start,beta0=twisssep;
|
||||
VARY,NAME=s30cb12.mqua430.k1,STEP=0.0001,lower=-1,upper=1;
|
||||
VARY,NAME=s30cb13.mqua430.k1,STEP=0.0001,lower=-1,upper=1;
|
||||
VARY,NAME=s30cb14.mqua430.k1,STEP=0.0001,lower=-1,upper=1;
|
||||
VARY,NAME=s30cb15.mqua430.k1,STEP=0.0001,lower=-1,upper=1;
|
||||
CONSTRAINT,SEQUENCE=swissfel,range=sposy01.dbpm080$end, alfx = 0;
|
||||
CONSTRAINT,SEQUENCE=swissfel,range=sposy01.dbpm080$end, alfy =0;
|
||||
CONSTRAINT,SEQUENCE=swissfel,range=s30cb15.mqua430$end, betx < 10;
|
||||
CONSTRAINT,SEQUENCE=swissfel,range=s30cb15.mqua430$end, bety < 80;
|
||||
LMDIF,CALLS=100,TOLERANCE=1.e-21;
|
||||
ENDMATCH;
|
||||
|
||||
sposy02.mqua010.k1=-2.5;
|
||||
sposy02.mqua110.k1=2.5;
|
||||
sposy03.mqua020.k1=-2;
|
||||
sposy03.mqua120.k1=2;
|
||||
sposy03.mqua220.k1=0;
|
||||
use,sequence=swissfel;
|
||||
|
||||
Print,text='MATCH POINT: Match onto SPOP301-Screen';
|
||||
MATCH,SEQUENCE=swissfel,range=s20SY02$start/spop301$end,beta0=twisssep;
|
||||
VARY,NAME=sposy03.mqua020.k1,STEP=0.0001,lower=-3,upper=3;
|
||||
VARY,NAME=sposy03.mqua120.k1,STEP=0.0001,lower=-3,upper=3;
|
||||
CONSTRAINT,SEQUENCE=swissfel,range=spop301.dscr002.mark, betx = 10000;
|
||||
CONSTRAINT,SEQUENCE=swissfel,range=spop301.dscr002.mark, bety = 10000;
|
||||
|
||||
LMDIF,CALLS=100,TOLERANCE=1.e-21;
|
||||
ENDMATCH;
|
||||
|
||||
twiss,sequence=swissfel,range=s20SY02$start/spop301$end,beta0=twisssep;
|
||||
plot,haxis=s,vaxis=betx,bety,range=S30CB12$START/spop301$end,colour=100;
|
||||
plot,haxis=s,vaxis=dx,dy,range=S30CB12$START/spop301$end,colour=100;
|
||||
+17
-2
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user