Fixing Matching
This commit is contained in:
@@ -1,6 +1,14 @@
|
||||
{
|
||||
"Label": "Reference",
|
||||
"Order": [
|
||||
{
|
||||
"Reference": null,
|
||||
"MatchID": "Preset",
|
||||
"End": null,
|
||||
"Destination": "SATBD01",
|
||||
"Sequence": null,
|
||||
"Save": null
|
||||
},
|
||||
{
|
||||
"Reference": "Start",
|
||||
"MatchID": "Laser Heater",
|
||||
@@ -107,6 +115,65 @@
|
||||
"Destination": "SATBD01",
|
||||
"Sequence": null,
|
||||
"Save": null
|
||||
},
|
||||
{
|
||||
"Reference": "Switchyard",
|
||||
"MatchID": "Athos Diagnostics",
|
||||
"End": "SATDI01",
|
||||
"Destination": "SATBD01",
|
||||
"Sequence": null,
|
||||
"Save": null
|
||||
},
|
||||
{
|
||||
"Reference": null,
|
||||
"MatchID": "Athos Linac",
|
||||
"End": null,
|
||||
"Destination": "SATBD01",
|
||||
"Sequence": "SATCB01",
|
||||
"Save": true
|
||||
},
|
||||
{
|
||||
"Reference": "HERO",
|
||||
"MatchID": "Athos Stopper",
|
||||
"End": "SATCL02",
|
||||
"Destination": "SATBD01",
|
||||
"Sequence": null,
|
||||
"Save": null
|
||||
},
|
||||
{
|
||||
"Reference": "HERO",
|
||||
"MatchID": "Athos EEHG",
|
||||
"End": "SATMA01",
|
||||
"Destination": "SATBD01",
|
||||
"Sequence": null,
|
||||
"Save": null
|
||||
},
|
||||
{
|
||||
"Reference": null,
|
||||
"MatchID": "Athos Undulator",
|
||||
"End": null,
|
||||
"Destination": "SATBD01",
|
||||
"Sequence": [
|
||||
"SATUN06",
|
||||
"SATUN07"
|
||||
],
|
||||
"Save": true
|
||||
},
|
||||
{
|
||||
"Reference": "EEHG",
|
||||
"MatchID": "Match to Athos Undulator",
|
||||
"End": "SATUN09",
|
||||
"Destination": "SATBD01",
|
||||
"Sequence": null,
|
||||
"Save": null
|
||||
},
|
||||
{
|
||||
"Reference": "EEHG",
|
||||
"MatchID": "Match to Athos Deflector",
|
||||
"End": "SATBD01",
|
||||
"Destination": "SATBD01",
|
||||
"Sequence": null,
|
||||
"Save": null
|
||||
}
|
||||
],
|
||||
"Dependence": {
|
||||
@@ -132,6 +199,30 @@
|
||||
],
|
||||
"S20CB01-MQUA430": [
|
||||
"S20CB03-MQUA430"
|
||||
],
|
||||
"SATCB01-MQUA230": [
|
||||
"SATCL02-MQUA430"
|
||||
],
|
||||
"SATCB01-MQUA430": [
|
||||
"SATCL02-MQUA430"
|
||||
],
|
||||
"SATUN06-MQUA080": [
|
||||
"SATUN08-MQUA080",
|
||||
"SATUN10-MQUA080",
|
||||
"SATUN12-MQUA080",
|
||||
"SATUN14-MQUA420",
|
||||
"SATUN16-MQUA080",
|
||||
"SATUN18-MQUA080",
|
||||
"SATUN20-MQUA080"
|
||||
],
|
||||
"SATUN07-MQUA080": [
|
||||
"SATUN09-MQUA080",
|
||||
"SATUN11-MQUA080",
|
||||
"SATUN13-MQUA080",
|
||||
"SATUN15-MQUA080",
|
||||
"SATUN17-MQUA080",
|
||||
"SATUN19-MQUA080",
|
||||
"SATUN21-MQUA080"
|
||||
]
|
||||
},
|
||||
"Reference": {
|
||||
@@ -198,7 +289,7 @@
|
||||
"alphay": -6.363
|
||||
}
|
||||
},
|
||||
"Athos HERO": {
|
||||
"HERO": {
|
||||
"Location": "satdi01.mqua250$start",
|
||||
"Twiss": {
|
||||
"betax": 35.76,
|
||||
@@ -215,9 +306,50 @@
|
||||
"betay": 50,
|
||||
"alphay": 0
|
||||
}
|
||||
},
|
||||
"EEHG": {
|
||||
"Location": "satma01.mqua610$start",
|
||||
"Twiss": {
|
||||
"betax": 10.0,
|
||||
"alphax": 0.027,
|
||||
"betay": 16.85,
|
||||
"alphay": 0.027
|
||||
}
|
||||
}
|
||||
},
|
||||
"Parameter": {
|
||||
"Preset": {
|
||||
"Variable": [],
|
||||
"Target": [
|
||||
{
|
||||
"Preset": {
|
||||
"sinlh01.mqsk030.k1": 0,
|
||||
"sinbc02.mqsk110.k1": 0,
|
||||
"sinbc02.mqsk350.k1": 0,
|
||||
"sindi01.mqsk030.k1": 0,
|
||||
"s10bc02.mqsk110.k1": 0,
|
||||
"s10bc02.mqsk350.k1": 0,
|
||||
"sarcl02.mqsk160.k1": 0,
|
||||
"sarcl02.mqsk300.k1": 0,
|
||||
"sarcl02.mqsk420.k1": 0,
|
||||
"satsy01.mqsk030.k1": 0,
|
||||
"satsy01.mqsk270.k1": 0,
|
||||
"sinbc02.mqua120.k1": 0,
|
||||
"sinbc02.mqua340.k1": 0,
|
||||
"s10bc02.mqua120.k1": 0,
|
||||
"s10bc02.mqua340.k1": 0,
|
||||
"sarcl02.mqua150.k1": 0,
|
||||
"sarcl02.mqua430.k1": 0,
|
||||
"satbd01.mqua010.k1": 0.50697,
|
||||
"satbd01.mqua030.k1": -0.618466,
|
||||
"satbd01.mqua050.k1": 0.13249,
|
||||
"satbd01.mqua070.k1": 0.47403,
|
||||
"satbd01.mqua090.k1": -0.74426,
|
||||
"satbd02.mqua030.k1": -1.05081
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Laser Heater": {
|
||||
"Variable": [
|
||||
"SINLH01-MQUA020",
|
||||
@@ -419,7 +551,7 @@
|
||||
"Location": "s20sy02$start",
|
||||
"Twiss": {
|
||||
"betax": 48.26,
|
||||
"alphax": 0,
|
||||
"alphax": 7.322,
|
||||
"betay": 14.293,
|
||||
"alphay": -3.513
|
||||
}
|
||||
@@ -449,13 +581,192 @@
|
||||
"SATSY01-MQUA020",
|
||||
"SATSY01-MQUA040",
|
||||
"SATSY01-MQUA070",
|
||||
"SATSY01-MQUA090"
|
||||
"SATSY01-MQUA090",
|
||||
"SATSY01-MQUA210",
|
||||
"SATSY01-MQUA230",
|
||||
"SATSY01-MQUA260",
|
||||
"SATSY01-MQUA280",
|
||||
"SATSY01-MQUA300",
|
||||
"SATSY02-MQUA010",
|
||||
"SATSY02-MQUA110",
|
||||
"SATSY02-MQUA120",
|
||||
"SATSY02-MQUA230",
|
||||
"SATSY03-MQUA010",
|
||||
"SATSY03-MQUA040",
|
||||
"SATSY03-MQUA070",
|
||||
"SATSY03-MQUA100",
|
||||
"SATSY03-MQUA130",
|
||||
"SATCL01-MQUA120",
|
||||
"SATCL01-MQUA130",
|
||||
"SATCL01-MQUA180",
|
||||
"SATCL01-MQUA190"
|
||||
],
|
||||
"Target": [
|
||||
{
|
||||
"Script": "Scripts/switchyard.madx"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Athos Diagnostics": {
|
||||
"Variable": [
|
||||
"SATDI01-MQUA025",
|
||||
"SATDI01-MQUA080",
|
||||
"SATDI01-MQUA220",
|
||||
"SATDI01-MQUA230"
|
||||
],
|
||||
"Target": [
|
||||
{
|
||||
"Location": "satdi01.mqua250$start",
|
||||
"Twiss": {
|
||||
"betax": 35.76,
|
||||
"alphax": -1.166,
|
||||
"betay": 24.087,
|
||||
"alphay": 0.648
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Athos Linac": {
|
||||
"Variable": [
|
||||
"SATCB01-MQUA230",
|
||||
"SATCB01-MQUA430"
|
||||
],
|
||||
"Target": [
|
||||
{
|
||||
"Location": "#e",
|
||||
"Twiss": {
|
||||
"MUX": 0.053,
|
||||
"MUY": 0.053
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Athos Stopper": {
|
||||
"Variable": [
|
||||
"SATDI01-MQUA250",
|
||||
"SATDI01-MQUA260",
|
||||
"SATDI01-MQUA280",
|
||||
"SATDI01-MQUA300"
|
||||
],
|
||||
"Target": [
|
||||
{
|
||||
"Location": "satcl01$start",
|
||||
"SavedID": "Athos Linac"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Athos EEHG": {
|
||||
"Variable": [
|
||||
"SATMA01-MQUA050",
|
||||
"SATMA01-MQUA120",
|
||||
"SATMA01-MQUA140",
|
||||
"SATMA01-MQUA160",
|
||||
"SATMA01-MQUA180",
|
||||
"SATMA01-MQUA230",
|
||||
"SATMA01-MQUA250"
|
||||
],
|
||||
"Target": [
|
||||
{
|
||||
"Location": "satma01.mqua610$start",
|
||||
"Twiss": {
|
||||
"betax": 10.0,
|
||||
"alphax": 0.027,
|
||||
"betay": 16.85,
|
||||
"alphay": 0.027
|
||||
}
|
||||
},
|
||||
{
|
||||
"Location": "satma01.mqua140$start",
|
||||
"Twiss": {
|
||||
"betax": 70,
|
||||
"betay": 70
|
||||
},
|
||||
"Limit": 1
|
||||
},
|
||||
{
|
||||
"Location": "satma01.mqua160$start",
|
||||
"Twiss": {
|
||||
"betax": 70,
|
||||
"betay": 70
|
||||
},
|
||||
"Limit": 1
|
||||
},
|
||||
{
|
||||
"Location": "satma01.mqua180$start",
|
||||
"Twiss": {
|
||||
"betax": 70,
|
||||
"betay": 70
|
||||
},
|
||||
"Limit": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Athos Undulator": {
|
||||
"Variable": [
|
||||
"SATUN06-MQUA080",
|
||||
"SATUN07-MQUA080"
|
||||
],
|
||||
"Target": [
|
||||
{
|
||||
"Location": "#e",
|
||||
"Twiss": {
|
||||
"MUX": 0.15,
|
||||
"MUY": 0.15
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Match to Athos Undulator": {
|
||||
"Variable": [
|
||||
"SATMA01-MQUA610",
|
||||
"SATMA01-MQUA630",
|
||||
"SATMA01-MQUA640",
|
||||
"SATUN04-MQUA060",
|
||||
"SATUN05-MQUA420"
|
||||
],
|
||||
"Target": [
|
||||
{
|
||||
"Location": "satun06$start",
|
||||
"SavedID": "Athos Undulator"
|
||||
},
|
||||
{
|
||||
"Location": "satun07$end",
|
||||
"Twiss": {
|
||||
"x": 10,
|
||||
"y": 10,
|
||||
"px": 10
|
||||
},
|
||||
"Limit": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"Match to Athos Deflector": {
|
||||
"Variable": [
|
||||
"SATUN22-MQUA080",
|
||||
"SATMA02-MQUA010",
|
||||
"SATMA02-MQUA020",
|
||||
"SATMA02-MQUA040",
|
||||
"SATMA02-MQUA050",
|
||||
"SATMA02-MQUA070"
|
||||
],
|
||||
"Target": [
|
||||
{
|
||||
"Location": "satbd01.mqua010$start",
|
||||
"Twiss": {
|
||||
"betax": 50,
|
||||
"alphax": 0,
|
||||
"betay": 50,
|
||||
"alphay": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"Location": "satun22$end",
|
||||
"Twiss": {
|
||||
"x": 0,
|
||||
"px": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
|
||||
self.setWindowTitle(title)
|
||||
|
||||
# initialization
|
||||
self.loadSettingsdirect("/sf/data/applications/BD-OpticsTools/reference/settings/ReferenceSetting.json")
|
||||
self.loadSettingsdirect("Settings/ReferenceSetting.json")
|
||||
self.sandbox.updateSandbox()
|
||||
self.reference = ReferenceManager(parent=self)
|
||||
self.matching = Matching(parent=self, model=self.model, reference = self.reference)
|
||||
|
||||
0
Scripts/athosundulator.madx
Normal file
0
Scripts/athosundulator.madx
Normal file
@@ -41,7 +41,7 @@ CONSTRAINT, SEQUENCE=swissfel, RANGE=satsy01$end, X<10;
|
||||
LMDIF, CALLS=1000, TOLERANCE=1.E-21;
|
||||
ENDMATCH;
|
||||
|
||||
satsy01.mqua280.k1 = satsy01.mqua280.k1*1.3;
|
||||
!satsy01.mqua280.k1 = satsy01.mqua280.k1*1.3;
|
||||
|
||||
!------------------------------------------
|
||||
! close vertical dispersion
|
||||
@@ -73,7 +73,7 @@ satcl01.mqua190.k1:=satcl011;
|
||||
|
||||
|
||||
|
||||
MATCH, SEQUENCE=swissfel, range=SATCL01$START/#SATCL01$END,betx=5,alfx=0,bety=30,alfy=0;
|
||||
MATCH, SEQUENCE=swissfel, range=SATCL01$START/SATCL01$END,betx=5,alfx=0,bety=30,alfy=0;
|
||||
VARY, NAME=satcl011, STEP=0.00001,LOWER=Kmin,UPPER=Kmax;
|
||||
VARY, NAME=satcl012, STEP=0.00001,LOWER=Kmin,UPPER=Kmax;
|
||||
CONSTRAINT, SEQUENCE=swissfel, RANGE=satcl01$end, DX = 0;
|
||||
@@ -107,5 +107,12 @@ LMDIF, CALLS=1000, TOLERANCE=1.E-21;
|
||||
ENDMATCH;
|
||||
|
||||
|
||||
MATCH, SEQUENCE=swissfel, range=s20SY02$start/satcl01$end,beta0=initcon;
|
||||
VARY, NAME= satcl01.mqua180.k1, STEP=0.00001,LOWER=Kmin,UPPER=Kmax;
|
||||
VARY, NAME= satcl01.mqua190.k1, STEP=0.00001,LOWER=Kmin,UPPER=Kmax;
|
||||
CONSTRAINT, SEQUENCE=swissfel, RANGE=satcl01$end, DX = 0;
|
||||
CONSTRAINT, SEQUENCE=swissfel, RANGE=satcl01$end, DPX = 0;
|
||||
LMDIF, CALLS=1000, TOLERANCE=1.E-21;
|
||||
ENDMATCH;
|
||||
|
||||
twiss,sequence=swissfel,range=s20sy02$start/satcl01$end,rmatrix,beta0=initcon;
|
||||
1776
Settings/ReferenceSetting.json
Normal file
1776
Settings/ReferenceSetting.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@ def MatchReference(loc,twiss,limit=None): # limit 1 -> smaller than, 2 -> large
|
||||
def MatchParameter(var0,tar0):
|
||||
return {'Variable':var0,'Target':tar0}
|
||||
|
||||
path ="Settings/"
|
||||
path ="MatchingConfig/"
|
||||
label='Reference'
|
||||
|
||||
order = []
|
||||
@@ -27,6 +27,7 @@ order = []
|
||||
# - sequence: sequence to use. If it is a list of sequence then a temporary sequence is used. Default to swissfel
|
||||
# - flag to last twiss parameters, needed for other routines to refer to.
|
||||
|
||||
order.append(MatchStep(None,'Preset',None,'SATBD01'))
|
||||
order.append(MatchStep('Start', 'Laser Heater','SINLH02','SATBD01'))
|
||||
order.append(MatchStep(None, 'SINSB04', None,'SATBD01','SINSB04',True))
|
||||
order.append(MatchStep('Laser Heater', 'Match to SINSB04','SINSB04','SATBD01'))
|
||||
@@ -40,7 +41,13 @@ order.append(MatchStep('Bunch Compressor 2', 'Match to Linac 2','S20CB04','SATBD
|
||||
order.append(MatchStep('Bunch Compressor 2', 'Match to Switchyard','S20SY02','SATBD01'))
|
||||
order.append(MatchStep('Switchyard', 'Resonant Kicker','S20SY02','SATBD01'))
|
||||
order.append(MatchStep('Switchyard', 'Switchyard','SATCL01','SATBD01'))
|
||||
#order.append(MatchStep('Switchyard', 'Switchyard','SATSY03','SATBD01'))
|
||||
order.append(MatchStep('Switchyard', 'Athos Diagnostics','SATDI01','SATBD01'))
|
||||
order.append(MatchStep(None, 'Athos Linac', None,'SATBD01','SATCB01',True))
|
||||
order.append(MatchStep('HERO','Athos Stopper', 'SATCL02','SATBD01'))
|
||||
order.append(MatchStep('HERO','Athos EEHG', 'SATMA01','SATBD01'))
|
||||
order.append(MatchStep(None, 'Athos Undulator', None,'SATBD01',['SATUN06','SATUN07'],True))
|
||||
order.append(MatchStep('EEHG','Match to Athos Undulator', 'SATUN09','SATBD01'))
|
||||
order.append(MatchStep('EEHG','Match to Athos Deflector', 'SATBD01','SATBD01'))
|
||||
|
||||
# list of references with fixed twiss parameters
|
||||
reference={}
|
||||
@@ -48,17 +55,29 @@ reference['Start'] = MatchReference('start',{'betax':29.971,'alphax':0.003,'beta
|
||||
reference['Laser Heater'] = MatchReference('sinlh02.mqua410$start',{'betax': 11.2, 'alphax': 3.2,'betay': 0.8, 'alphay': 0.75,})
|
||||
reference['Bunch Compressor 1'] = MatchReference('sindi02.mqua020$start',{'betax': 11.1557, 'alphax': -1.17,'betay': 50, 'alphay': 0.})
|
||||
reference['Bunch Compressor 2'] = MatchReference('s10ma01.mqua020$start',{'betax': 6.14, 'alphax': -0.83,'betay': 22.86, 'alphay': -1.18})
|
||||
#reference['Switchyard'] = MatchReference('s20sy02$start',{'betax': 48.26, 'alphax': 7.322,'betay': 14.293, 'alphay': -3.513})
|
||||
reference['Switchyard'] = MatchReference('s20sy02$start',{'betax': 48.26, 'alphax': 0,'betay': 14.293, 'alphay': -3.513})
|
||||
reference['Switchyard'] = MatchReference('s20sy02$start',{'betax': 48.26, 'alphax': 7.322,'betay': 14.293, 'alphay': -3.513})
|
||||
reference['Linac3'] = MatchReference('s30cb10.mqua430$start',{'betax': 8.83,'alphax': 0.548,'betay': 30.44,'alphay': -1.866})
|
||||
reference['Aramis Stopper'] = MatchReference('sarma01.mqua010$start',{'betax': 2.304, 'alphax': -1.4045, 'betay': 25.929, 'alphay': -6.363})
|
||||
reference['Athos HERO'] = MatchReference('satdi01.mqua250$start',{'betax': 35.76, 'alphax': -1.166,'betay': 24.087, 'alphay': 0.648})
|
||||
reference['HERO'] = MatchReference('satdi01.mqua250$start',{'betax': 35.76, 'alphax': -1.166,'betay': 24.087, 'alphay': 0.648})
|
||||
reference['Athos Deflector'] = MatchReference('satbd01.mqua010$start',{'betax': 50, 'alphax': 0,'betay': 50, 'alphay': 0})
|
||||
|
||||
|
||||
reference['EEHG'] = MatchReference('satma01.mqua610$start',{'betax': 10., 'alphax': 0.027,'betay': 16.85, 'alphay': 0.027})
|
||||
|
||||
|
||||
parameter={}
|
||||
var=[]
|
||||
tar = [{'Preset':{'sinlh01.mqsk030.k1':0,'sinbc02.mqsk110.k1':0,'sinbc02.mqsk350.k1':0,
|
||||
'sindi01.mqsk030.k1':0,'s10bc02.mqsk110.k1':0,'s10bc02.mqsk350.k1':0,
|
||||
'sarcl02.mqsk160.k1':0,'sarcl02.mqsk300.k1':0,'sarcl02.mqsk420.k1':0,
|
||||
'satsy01.mqsk030.k1':0,'satsy01.mqsk270.k1':0,
|
||||
'sinbc02.mqua120.k1':0,'sinbc02.mqua340.k1':0,
|
||||
's10bc02.mqua120.k1':0,'s10bc02.mqua340.k1':0,
|
||||
'sarcl02.mqua150.k1':0,'sarcl02.mqua430.k1':0,
|
||||
'satbd01.mqua010.k1':0.50697,'satbd01.mqua030.k1':-0.618466,
|
||||
'satbd01.mqua050.k1':0.13249,'satbd01.mqua070.k1':0.47403,
|
||||
'satbd01.mqua090.k1':-0.74426,'satbd02.mqua030.k1':-1.05081}}]
|
||||
|
||||
parameter['Preset'] = MatchParameter(var,tar)
|
||||
|
||||
var = ['SINLH01-MQUA020', 'SINLH01-MQUA040','SINLH01-MQUA050','SINLH01-MQUA070','SINLH02-MQUA010']
|
||||
tar = [reference['Laser Heater']]
|
||||
parameter['Laser Heater'] = MatchParameter(var,tar)
|
||||
@@ -115,47 +134,63 @@ tar=[{'Script':'Scripts/switchyard_kicker.madx'}]
|
||||
parameter['Resonant Kicker']=MatchParameter(var, tar)
|
||||
|
||||
|
||||
#var = ['SATSY01-MQUA020','SATSY01-MQUA040','SATSY01-MQUA070','SATSY01-MQUA090']
|
||||
#tar =[MatchReference('satsy01.mbnd200',{'etax':0.082,'etapx':0.0084}),
|
||||
# MatchReference('satsy01.mbnd200',{'etay':0.09,'etapy':1},1)]
|
||||
#parameter['SATSY01 - I']=MatchParameter(var, tar)
|
||||
|
||||
#var = ['SATSY01-MQUA280','SATSY01-MQUA300']
|
||||
#tar =[MatchReference('satsy01$end',{'etax':-0.030,'etapx':-0.001})]
|
||||
#parameter['SATSY01 - II']=MatchParameter(var, tar)
|
||||
|
||||
#var = ['SATSY02-MQUA010','SATSY02-MQUA110','SATSY02-MQUA120']
|
||||
#tar =[MatchReference('satsy02$end',{'etay':0.,'etapy':0.,'x':0})]
|
||||
#parameter['SATSY02']=MatchParameter(var, tar)
|
||||
|
||||
#var = ['SATSY02-MQUA210','SATSY03-MQUA010','SATSY03-MQUA040','SATSY03-MQUA070','SATSY03-MQUA100','SATSY03-MQUA130',
|
||||
# 'SATCL01-MQUA120','SATCL01-MQUA130','SATCL01-MQUA180','SATCL01-MQUA190']
|
||||
var=['SATSY01-MQUA020','SATSY01-MQUA040','SATSY01-MQUA070','SATSY01-MQUA090']
|
||||
var=['SATSY01-MQUA020','SATSY01-MQUA040','SATSY01-MQUA070','SATSY01-MQUA090','SATSY01-MQUA210','SATSY01-MQUA230','SATSY01-MQUA260','SATSY01-MQUA280',
|
||||
'SATSY01-MQUA300','SATSY02-MQUA010','SATSY02-MQUA110','SATSY02-MQUA120','SATSY02-MQUA230','SATSY03-MQUA010','SATSY03-MQUA040','SATSY03-MQUA070',
|
||||
'SATSY03-MQUA100','SATSY03-MQUA130','SATCL01-MQUA120','SATCL01-MQUA130','SATCL01-MQUA180','SATCL01-MQUA190']
|
||||
tar=[{'Script':'Scripts/switchyard.madx'}]
|
||||
parameter['Switchyard']=MatchParameter(var, tar)
|
||||
|
||||
var=['SATDI01-MQUA025','SATDI01-MQUA080','SATDI01-MQUA220','SATDI01-MQUA230']
|
||||
tar = [reference['HERO']]
|
||||
parameter['Athos Diagnostics'] = MatchParameter(var,tar)
|
||||
|
||||
var = ['SATCB01-MQUA230','SATCB01-MQUA430']
|
||||
tar =[MatchReference('#e',{'MUX':0.053,'MUY':0.053})]
|
||||
parameter['Athos Linac'] = MatchParameter(var,tar)
|
||||
|
||||
var=['SATDI01-MQUA250','SATDI01-MQUA260','SATDI01-MQUA280','SATDI01-MQUA300']
|
||||
tar =[{'Location':'satcl01$start','SavedID':'Athos Linac'}]
|
||||
parameter['Athos Stopper'] = MatchParameter(var,tar)
|
||||
|
||||
|
||||
var=['SATMA01-MQUA050','SATMA01-MQUA120','SATMA01-MQUA140','SATMA01-MQUA160','SATMA01-MQUA180','SATMA01-MQUA230','SATMA01-MQUA250']
|
||||
tar = [reference['EEHG'],
|
||||
MatchReference('satma01.mqua140$start', {'betax': 70, 'betay': 70}, 1),
|
||||
MatchReference('satma01.mqua160$start', {'betax': 70, 'betay': 70}, 1),
|
||||
MatchReference('satma01.mqua180$start', {'betax': 70, 'betay': 70}, 1)]
|
||||
parameter['Athos EEHG'] = MatchParameter(var,tar)
|
||||
|
||||
var = ['SATUN06-MQUA080','SATUN07-MQUA080']
|
||||
tar =[MatchReference('#e',{'MUX':0.15,'MUY':0.15})]
|
||||
parameter['Athos Undulator'] = MatchParameter(var,tar)
|
||||
|
||||
var=['SATMA01-MQUA610','SATMA01-MQUA630','SATMA01-MQUA640','SATUN04-MQUA060','SATUN05-MQUA420']
|
||||
tar =[{'Location':'satun06$start','SavedID':'Athos Undulator'},
|
||||
MatchReference('satun07$end', {'x': 10, 'y': 10,'px':10}, 1)]
|
||||
parameter['Match to Athos Undulator'] = MatchParameter(var,tar)
|
||||
|
||||
var = ['SATUN22-MQUA080','SATMA02-MQUA010','SATMA02-MQUA020','SATMA02-MQUA040','SATMA02-MQUA050','SATMA02-MQUA070']
|
||||
tar = [reference['Athos Deflector'],
|
||||
MatchReference('satun22$end', {'x':0, 'px': 0})]
|
||||
parameter['Match to Athos Deflector'] = MatchParameter(var,tar)
|
||||
|
||||
|
||||
dependence={}
|
||||
dependence['SINSB04-MQUA230']=['SINSB03-MQUA230']
|
||||
dependence['S10CB02-MQUA230']=['S10DI01-MQUA120'] + ['S10CB%2.2d-MQUA430' % i for i in range(3,9)]
|
||||
dependence['S10CB02-MQUA430']=['S10CB%2.2d-MQUA230' % i for i in range(3,9)]
|
||||
dependence['S20CB01-MQUA430']=['S20CB03-MQUA430']
|
||||
dependence['SATCB01-MQUA230']=['SATCL02-MQUA430']
|
||||
dependence['SATCB01-MQUA430']=['SATCL02-MQUA430']
|
||||
dependence['SATUN06-MQUA080']=['SATUN%2.2d-MQUA080' % (2*i+6) for i in range(1,4)] +['SATUN14-MQUA420']+['SATUN%d-MQUA080' % (2*i+16) for i in range(3)]
|
||||
dependence['SATUN07-MQUA080']=['SATUN%2.2d-MQUA080' % (2*i+7) for i in range(1,8)]
|
||||
|
||||
|
||||
|
||||
reference={}
|
||||
reference['Start'] = MatchReference('start',{'betax':29.971,'alphax':0.003,'betay':26.00,'alphay':-0.288})
|
||||
reference['Laser Heater'] = MatchReference('sinlh02.mqua410$start',{'betax': 11.2, 'alphax': 3.2,'betay': 0.8, 'alphay': 0.75,})
|
||||
reference['Bunch Compressor 1'] = MatchReference('sindi02.mqua020$start',{'betax': 11.1557, 'alphax': -1.17,'betay': 50, 'alphay': 0.})
|
||||
reference['Bunch Compressor 2'] = MatchReference('s10ma01.mqua020$start',{'betax': 6.14, 'alphax': -0.83,'betay': 22.86, 'alphay': -1.18})
|
||||
reference['Switchyard'] = MatchReference('s20sy02$start',{'betax': 48.26, 'alphax': 7.322,'betay': 14.293, 'alphay': -3.513})
|
||||
reference['Linac3'] = MatchReference('s30cb10.mqua430$start',{'betax': 8.83,'alphax': 0.548,'betay': 30.44,'alphay': -1.866})
|
||||
reference['Aramis Stopper'] = MatchReference('sarma01.mqua010$start',{'betax': 2.304, 'alphax': -1.4045, 'betay': 25.929, 'alphay': -6.363})
|
||||
reference['Athos HERO'] = MatchReference('satdi01.mqua250$start',{'betax': 35.76, 'alphax': -1.166,'betay': 24.087, 'alphay': 0.648})
|
||||
reference['Athos Deflector'] = MatchReference('satbd01.mqua010$start',{'betax': 50, 'alphax': 0,'betay': 50, 'alphay': 0})
|
||||
|
||||
|
||||
settings={'Label':label,'Order':order,'Dependence':dependence,'Reference':reference,'Parameter':parameter}
|
||||
|
||||
print('Reference Locations:')
|
||||
for key in settings['Reference']:
|
||||
print(key,settings['Reference'][key])
|
||||
with open(path+label+'.json', 'w', encoding='utf-8') as f:
|
||||
json.dump(settings, f, ensure_ascii=False, indent=4)
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
1) Mark in matching list groups with reference points
|
||||
|
||||
3) export to machine for magnet settings
|
||||
4) export elegant lattice
|
||||
|
||||
9
model.py
9
model.py
@@ -145,7 +145,7 @@ class Model:
|
||||
elif 'RACC' in ele.Name:
|
||||
rf[ele.Name]={'Gradient':ele.Gradient*ele.Length,'Phase':ele.Phase}
|
||||
elif 'MKAC' in ele.Name or 'MKDC' in ele.Name:
|
||||
kicker[ele.Name] = {'cory': ele.cory}
|
||||
kicker[ele.Name] = {'cory': ele.cory,'design_kick':ele.design_kick}
|
||||
return {'Quadrupole':quadrupoles,'Sextupole':sextupoles,'Dipole':dipoles,'RF':rf,'Undulator':undulators,
|
||||
'Kicker':kicker,'Energy':energy, 'InitialCondition':self.startTwiss}
|
||||
|
||||
@@ -164,7 +164,7 @@ class Model:
|
||||
self.loadSettingsGroup(settings['RF'], ['Gradient'],normalized=True)
|
||||
self.loadSettingsGroup(settings['RF'], ['Phase'])
|
||||
self.loadSettingsGroup(settings['Undulator'], ['K','kx','ky'])
|
||||
self.loadSettingsGroup(settings['Kicker'], ['cory'])
|
||||
self.loadSettingsGroup(settings['Kicker'], ['cory','design_kick'])
|
||||
self.startEnergy = settings['Energy']['energy']
|
||||
self.energyReference = settings['Energy']['location']
|
||||
self.startTwiss = settings['InitialCondition']
|
||||
@@ -245,6 +245,11 @@ class Model:
|
||||
var[key0]=config['variable'][key]
|
||||
|
||||
target = config['target']
|
||||
if 'Preset' in target:
|
||||
self.updateModelFromMatching(target['Preset'])
|
||||
self.parent.reference.updateMatchPoint(ID, 0)
|
||||
return
|
||||
|
||||
if 'Script' in target.keys():
|
||||
res,twiss,err = self.madx.callScript(script = target['Script'],sequence=sequence, start=start, end=end,init=itwiss,var=var)
|
||||
|
||||
|
||||
31
reference.py
31
reference.py
@@ -27,7 +27,7 @@ class ReferenceManager:
|
||||
'px':self.parent.UIPX,'py':self.parent.UIPY}
|
||||
|
||||
|
||||
self.loadReference('Settings/Reference.json')
|
||||
self.loadReference('MatchingConfig/Reference.json')
|
||||
self.parent.UITrackReference.currentIndexChanged.connect(self.updateReferenceWidgets)
|
||||
self.parent.UIMatchOrder.itemClicked.connect(self.displayMatchingPoint)
|
||||
|
||||
@@ -37,10 +37,24 @@ class ReferenceManager:
|
||||
self.updateMatchOrder()
|
||||
|
||||
def updateMatchOrder(self):
|
||||
secs={}
|
||||
self.parent.UIMatchOrder.clear()
|
||||
for i,ele in enumerate(self.settings['Order']):
|
||||
self.parent.UIMatchOrder.addItem(ele['MatchID'])
|
||||
self.parent.UIMatchOrder.item(i).setBackground(CBeige)
|
||||
label = ele['MatchID']
|
||||
ref = ele['Reference']
|
||||
if ref is None:
|
||||
color = CBeige
|
||||
else:
|
||||
if ref in secs.keys():
|
||||
color = secs[ref]
|
||||
else:
|
||||
idx = len(secs)+2
|
||||
color = QtGui.QColor(220, 240-idx*5, 200+idx*4)
|
||||
secs[ref]=color
|
||||
if not ref is None:
|
||||
label += ' ('+ref+')'
|
||||
self.parent.UIMatchOrder.addItem(label)
|
||||
self.parent.UIMatchOrder.item(i).setBackground(color)
|
||||
if self.parent.UIMatchOrder.count() > 0:
|
||||
self.parent.UIMatchOrder.setCurrentRow(0)
|
||||
self.displayMatchingPoint()
|
||||
@@ -67,8 +81,8 @@ class ReferenceManager:
|
||||
idx = self.parent.UIMatchOrder.currentRow()
|
||||
if idx < 0:
|
||||
return None
|
||||
|
||||
ID = str(self.parent.UIMatchOrder.item(idx).text())
|
||||
ID = ID.split('(')[0].strip()
|
||||
idx = self.order[ID] # get index in the list
|
||||
order = copy.deepcopy(self.settings['Order'][idx])
|
||||
destination = order['Destination']
|
||||
@@ -122,6 +136,8 @@ class ReferenceManager:
|
||||
cond[loc].append(target['SavedID'])
|
||||
elif 'Script' in target.keys():
|
||||
cond['Script']=target['Script']
|
||||
elif 'Preset' in target.keys():
|
||||
cond['Preset']=target['Preset']
|
||||
|
||||
config={'ID':ID,'start':twiss0,'end':end,
|
||||
'destination':destination,'sequence':sequence,
|
||||
@@ -183,6 +199,13 @@ class ReferenceManager:
|
||||
self.parent.UIMatchTargets.insertRow(0)
|
||||
self.parent.UIMatchTargets.setItem(0, 0, QtWidgets.QTableWidgetItem('Script'))
|
||||
self.parent.UIMatchTargets.setItem(0, 1, QtWidgets.QTableWidgetItem(config['target']['Script']))
|
||||
elif 'Preset' in config['target'].keys():
|
||||
irow = 0
|
||||
for key in config['target']['Preset'].keys():
|
||||
self.parent.UIMatchTargets.insertRow(irow)
|
||||
self.parent.UIMatchTargets.setItem(irow, 0, QtWidgets.QTableWidgetItem(key))
|
||||
self.parent.UIMatchTargets.setItem(irow, 1, QtWidgets.QTableWidgetItem('%7.3f' % config['target']['Preset'][key]))
|
||||
irow +=1
|
||||
else:
|
||||
irow = 0
|
||||
for key in config['target'].keys():
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'ui/OpticsPlotGui.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.9.2
|
||||
# Created by: PyQt5 UI code generator 5.15.10
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_OpticsPlotGUI(object):
|
||||
def setupUi(self, OpticsPlotGUI):
|
||||
OpticsPlotGUI.setObjectName("OpticsPlotGUI")
|
||||
@@ -311,7 +314,7 @@ class Ui_OpticsPlotGUI(object):
|
||||
|
||||
self.retranslateUi(OpticsPlotGUI)
|
||||
self.TabMaster.setCurrentIndex(0)
|
||||
self.actionQuit.triggered.connect(OpticsPlotGUI.close)
|
||||
self.actionQuit.triggered.connect(OpticsPlotGUI.close) # type: ignore
|
||||
QtCore.QMetaObject.connectSlotsByName(OpticsPlotGUI)
|
||||
|
||||
def retranslateUi(self, OpticsPlotGUI):
|
||||
@@ -401,4 +404,3 @@ class Ui_OpticsPlotGUI(object):
|
||||
self.actionLoad_Reference.setText(_translate("OpticsPlotGUI", "Load Reference..."))
|
||||
self.actionSave_Reference.setText(_translate("OpticsPlotGUI", "Save Reference"))
|
||||
self.actionNew_Reference.setText(_translate("OpticsPlotGUI", "New Reference"))
|
||||
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'ui/OpticsToolsGui.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.9.2
|
||||
# Created by: PyQt5 UI code generator 5.15.10
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_OpticsGUI(object):
|
||||
def setupUi(self, OpticsGUI):
|
||||
OpticsGUI.setObjectName("OpticsGUI")
|
||||
@@ -390,6 +393,7 @@ class Ui_OpticsGUI(object):
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.UIMatchOrder.sizePolicy().hasHeightForWidth())
|
||||
self.UIMatchOrder.setSizePolicy(sizePolicy)
|
||||
self.UIMatchOrder.setMinimumSize(QtCore.QSize(350, 0))
|
||||
self.UIMatchOrder.setObjectName("UIMatchOrder")
|
||||
self.verticalLayout_6.addWidget(self.UIMatchOrder)
|
||||
self.UIMatchRandom = QtWidgets.QCheckBox(self.tab_2)
|
||||
@@ -471,7 +475,7 @@ class Ui_OpticsGUI(object):
|
||||
self.verticalLayout_4.addWidget(self.TabMaster)
|
||||
OpticsGUI.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(OpticsGUI)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 813, 20))
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 813, 22))
|
||||
self.menubar.setObjectName("menubar")
|
||||
self.menuFile = QtWidgets.QMenu(self.menubar)
|
||||
self.menuFile.setObjectName("menuFile")
|
||||
@@ -597,8 +601,8 @@ class Ui_OpticsGUI(object):
|
||||
self.menubar.addAction(self.menuHelp.menuAction())
|
||||
|
||||
self.retranslateUi(OpticsGUI)
|
||||
self.TabMaster.setCurrentIndex(0)
|
||||
self.actionQuit.triggered.connect(OpticsGUI.close)
|
||||
self.TabMaster.setCurrentIndex(2)
|
||||
self.actionQuit.triggered.connect(OpticsGUI.close) # type: ignore
|
||||
QtCore.QMetaObject.connectSlotsByName(OpticsGUI)
|
||||
|
||||
def retranslateUi(self, OpticsGUI):
|
||||
@@ -647,7 +651,7 @@ class Ui_OpticsGUI(object):
|
||||
self.TabMaster.setTabText(self.TabMaster.indexOf(self.tab_8), _translate("OpticsGUI", "Sandbox"))
|
||||
self.UIMatchSelected.setText(_translate("OpticsGUI", "Match Selected"))
|
||||
self.label_14.setText(_translate("OpticsGUI", "Label"))
|
||||
self.label_15.setText(_translate("OpticsGUI", "Matching Point Order"))
|
||||
self.label_15.setText(_translate("OpticsGUI", "Matching Point Order (Closest Ref. Point)"))
|
||||
self.UIMatchRandom.setText(_translate("OpticsGUI", "Random Initialization"))
|
||||
self.label_21.setText(_translate("OpticsGUI", "Matching Point"))
|
||||
self.label_17.setText(_translate("OpticsGUI", "Start"))
|
||||
@@ -723,4 +727,3 @@ class Ui_OpticsGUI(object):
|
||||
self.actionSave_Reference.setText(_translate("OpticsGUI", "Save Reference"))
|
||||
self.actionNew_Reference.setText(_translate("OpticsGUI", "New Reference"))
|
||||
self.actionSave.setText(_translate("OpticsGUI", "Save Settings..."))
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
@@ -636,7 +636,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Matching Point Order</string>
|
||||
<string>Matching Point Order (Closest Ref. Point)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -648,6 +648,12 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -799,7 +805,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>813</width>
|
||||
<height>20</height>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
||||
Reference in New Issue
Block a user