Elegant export
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,3 +6,4 @@
|
||||
/.idea/inspectionProfiles/Project_Default.xml
|
||||
/.idea/vcs.xml
|
||||
/.idea/workspace.xml
|
||||
/Elegant/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import sys
|
||||
import json
|
||||
import webbrowser
|
||||
import subprocess
|
||||
from argparse import ArgumentParser
|
||||
|
||||
from PyQt5 import QtWidgets,QtGui
|
||||
@@ -12,6 +13,7 @@ from machine import Machine
|
||||
from reference import ReferenceManager
|
||||
from sandbox import Sandbox
|
||||
from matching import Matching
|
||||
from elegant import Elegant
|
||||
|
||||
class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
|
||||
def __init__(self,phase=0, office= 1):
|
||||
@@ -33,6 +35,7 @@ class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
|
||||
self.machine = Machine(parent = True, office = office)
|
||||
self.machine.initPVs(self.model.getElements())
|
||||
self.sandbox = Sandbox(parent = self, machine = self.machine)
|
||||
self.elegant=Elegant(parent=self,model=self.model)
|
||||
|
||||
title = "SwissFEL Optics Tools - Lattice %s (Phase %d)" % (self.model.getLatticeVersion(),phase)
|
||||
if office:
|
||||
@@ -51,6 +54,10 @@ class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
|
||||
self.UIUpdateFromMachine.clicked.connect(self.fullUpdate)
|
||||
self.actionHelp.triggered.connect(self.openGit)
|
||||
self.actionAbout.triggered.connect(self.about)
|
||||
self.actionOpenMatch.triggered.connect(self.loadMatchingConfig)
|
||||
self.actionOpenMatchEditor.triggered.connect(self.editMatchingConfig)
|
||||
self.actionOpenScriptEditor.triggered.connect(self.editMatchingScript)
|
||||
self.actionExportElegant.triggered.connect(self.exportElegant)
|
||||
|
||||
def closeEvent(self, event):
|
||||
self.plot.close()
|
||||
@@ -63,12 +70,44 @@ class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
|
||||
def openGit(self):
|
||||
webbrowser.open("https://gitea.psi.ch/reiche/opticstool")
|
||||
|
||||
def exportElegant(self):
|
||||
self.elegant.writeElegantFiles('Elegant','dummy','SATBD01')
|
||||
|
||||
def loadMatchingConfig(self):
|
||||
options = QtWidgets.QFileDialog.Options()
|
||||
options |= QtWidgets.QFileDialog.DontUseNativeDialog
|
||||
fileName, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Open Matching Config File",
|
||||
"MatchingConfig/Reference.json",
|
||||
"Json Files (*.json)", options=options)
|
||||
if not fileName:
|
||||
return
|
||||
self.reference.loadReference(fileName)
|
||||
|
||||
def editMatchingConfig(self):
|
||||
options = QtWidgets.QFileDialog.Options()
|
||||
options |= QtWidgets.QFileDialog.DontUseNativeDialog
|
||||
fileName, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Open Matching Config File",
|
||||
"MatchingConfig/Reference.json",
|
||||
"Json Files (*.json)", options=options)
|
||||
if not fileName:
|
||||
return
|
||||
subprocess.Popen(["emacs", fileName])
|
||||
|
||||
def editMatchingScript(self):
|
||||
options = QtWidgets.QFileDialog.Options()
|
||||
options |= QtWidgets.QFileDialog.DontUseNativeDialog
|
||||
fileName, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Open Matching Script File",
|
||||
"Scripts/switchyard.madx",
|
||||
"MadX Files (*.madx)", options=options)
|
||||
if not fileName:
|
||||
return
|
||||
subprocess.Popen(["emacs", fileName])
|
||||
|
||||
def saveSettings(self):
|
||||
options = QtWidgets.QFileDialog.Options()
|
||||
options |= QtWidgets.QFileDialog.DontUseNativeDialog
|
||||
fileName, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Save Settings",
|
||||
"/sf/data/applications/BD-OpticsTools/saved_settings/newSetting.json",
|
||||
"Settings/newSetting.json",
|
||||
"Json Files (*.json)", options=options)
|
||||
if not fileName:
|
||||
return
|
||||
@@ -77,11 +116,12 @@ class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
|
||||
json.dump(settings, f, ensure_ascii=False, indent=4)
|
||||
|
||||
|
||||
|
||||
def loadSettings(self):
|
||||
options = QtWidgets.QFileDialog.Options()
|
||||
options |= QtWidgets.QFileDialog.DontUseNativeDialog
|
||||
fileName, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Open Settings",
|
||||
"/sf/data/applications/BD-OpticsTools/saved_settings/newSetting.json",
|
||||
"Settings/ReferenceSetting.json",
|
||||
"Json Files (*.json)", options=options)
|
||||
if not fileName:
|
||||
return
|
||||
|
||||
103
elegant.py
Normal file
103
elegant.py
Normal file
@@ -0,0 +1,103 @@
|
||||
from onlinemodel.code import OMElegant
|
||||
|
||||
class Elegant:
|
||||
def __init__(self,parent=None,model=None):
|
||||
self.parent=parent
|
||||
self.model=model
|
||||
self.elegant=OMElegant.ElegantLattice()
|
||||
|
||||
def writeElegantFiles(self,path ='Elegant', filename='dummy',end='SARBD02'):
|
||||
self.writeElegantInput(path,filename)
|
||||
self.writeElegantLattice(path, filename,end)
|
||||
|
||||
def writeElegantInput(self,path,name):
|
||||
|
||||
filename = '%s/%s.ele' % (path, name)
|
||||
with open(filename, 'w') as fid:
|
||||
fid.write('&run_setup\n')
|
||||
fid.write('\tlattice\t\t= %s.lat,\n' % (name))
|
||||
fid.write('\tuse_beamline\t= SwissFEL,\n')
|
||||
fid.write('\trootname\t= %s,\n' % name)
|
||||
fid.write('\toutput\t\t= %s.out,\n')
|
||||
fid.write('\tcentroid\t\t= %s.cen,\n')
|
||||
fid.write('\tsigma\t\t= %s.sig,\n')
|
||||
fid.write('\tfinal\t\t= %s.fin,\n')
|
||||
fid.write('\tparameters\t= %s.par,\n')
|
||||
fid.write('\tmagnets\t\t= %s.mag,\n')
|
||||
fid.write('\tcombine_bunch_statistics = 0,\n')
|
||||
fid.write('\tdefault_order\t= 2,\n')
|
||||
fid.write('\tconcat_order\t= 0,\n')
|
||||
fid.write('\tprint_statistics\t= 0,\n')
|
||||
fid.write('\trandom_number_seed\t= 9876543210,\n')
|
||||
p0 = self.model.getInitialEnergy()
|
||||
fid.write('\tp_central\t= %f,\n' % p0)
|
||||
fid.write('\ttracking_updates\t= 1\n')
|
||||
fid.write('\talways_change_p0\t= 1\n')
|
||||
fid.write('&end\n\n')
|
||||
fid.write('&run_control\n')
|
||||
fid.write('\tn_steps\t= 1,\n')
|
||||
fid.write('\treset_rf_for_each_step = 1\n')
|
||||
fid.write('&end\n\n')
|
||||
|
||||
twiss=self.parent.reference.reference['Start']['Twiss']
|
||||
print(twiss)
|
||||
fid.write('&twiss_output\n')
|
||||
fid.write('\tfilename\t= %s.twi,\n')
|
||||
fid.write('\tmatched\t\t= 0,\n')
|
||||
fid.write('\tbeta_x\t\t= %f,\n' % twiss['betax'])
|
||||
fid.write('\tbeta_y\t\t= %f,\n' % twiss['betay'])
|
||||
fid.write('\talpha_x\t\t= %f,\n' % twiss['alphax'])
|
||||
fid.write('\talpha_y\t\t= %f,\n' % twiss['alphay'])
|
||||
fid.write('&end\n\n')
|
||||
|
||||
fid.write('&sdds_beam\n')
|
||||
fid.write('\tinput_type= "elegant",\n')
|
||||
fid.write('\tsample_interval\t= 1,\n')
|
||||
fid.write('\tinput = MyInputDist.sdds,\n')
|
||||
fid.write('\treuse_bunch\t= 0 \n')
|
||||
fid.write('&end\n\n')
|
||||
|
||||
fid.write('&alter_elements\n')
|
||||
fid.write('\tname = *,\n')
|
||||
fid.write('\ttype = LSCDRIFT,\n')
|
||||
fid.write('\titem = LSC,\n')
|
||||
fid.write('\tvalue = 1\n')
|
||||
fid.write('&end\n\n')
|
||||
|
||||
fid.write('&alter_elements\n')
|
||||
fid.write('\tname = *,\n')
|
||||
fid.write('\ttype = RFCW,\n')
|
||||
fid.write('\titem = LSC,\n')
|
||||
fid.write('\tvalue = 1\n')
|
||||
fid.write('&end\n\n')
|
||||
|
||||
fid.write('&alter_elements\n')
|
||||
fid.write('\tname = *,\n')
|
||||
fid.write('\ttype = CSRDRIFT,\n')
|
||||
fid.write('\titem = CSR,\n')
|
||||
fid.write('\tvalue = 1\n')
|
||||
fid.write('&end\n\n')
|
||||
|
||||
fid.write('&alter_elements\n')
|
||||
fid.write('\tname = *,\n')
|
||||
fid.write('\ttype = CSRCSBEND,\n')
|
||||
fid.write('\titem = CSR,\n')
|
||||
fid.write('\tvalue = 1\n')
|
||||
fid.write('&end\n\n')
|
||||
|
||||
fid.write('&track\n')
|
||||
fid.write('&end\n\n')
|
||||
fid.close()
|
||||
|
||||
def writeElegantLattice(self,path, filename,end):
|
||||
destination = 'ARAMIS'
|
||||
if 'SPO' in end:
|
||||
destination = 'PORTHOS'
|
||||
elif 'SAT' in end:
|
||||
destination = 'ATHOS'
|
||||
elif 'S10BD' in end or 'SIN' in end:
|
||||
destination = 'INJECTOR'
|
||||
self.model.om.setBranch(destination, 'SINLH01')
|
||||
self.elegant.openLatticeStream(path, filename)
|
||||
self.model.om.exportBranch(self.elegant)
|
||||
self.elegant.closeLatticeStream()
|
||||
@@ -1,199 +1,231 @@
|
||||
import json
|
||||
|
||||
def configMatching(label_in = 'Reference',var={}):
|
||||
path = "MatchingConfig/"
|
||||
label = label_in
|
||||
print(var)
|
||||
dependence = generateDependences()
|
||||
reference = generateReferences()
|
||||
order = generateOrder()
|
||||
parameter = generateMatchingSteps(reference,var)
|
||||
|
||||
def MatchStep(ref,id,end, dest,sequence=None,saveTwiss=None):
|
||||
match={'Reference':ref,'MatchID':id,'End':end, 'Destination':dest,'Sequence':sequence,'Save':saveTwiss}
|
||||
return match
|
||||
|
||||
settings={'Label':label,'Order':order,'Dependence':dependence,'Reference':reference,'Parameter':parameter}
|
||||
fname=path+label+'.json'
|
||||
with open(fname, 'w', encoding='utf-8') as f:
|
||||
json.dump(settings, f, ensure_ascii=False, indent=4)
|
||||
return fname
|
||||
#######
|
||||
# some internal functions
|
||||
def MatchReference(loc,twiss,limit=None): # limit 1 -> smaller than, 2 -> larger than (default is euqal)
|
||||
match ={'Location': loc, 'Twiss': twiss}
|
||||
if not limit is None:
|
||||
match['Limit'] = limit
|
||||
return match
|
||||
|
||||
def MatchStep(ref,id,end, dest,sequence=None,saveTwiss=None):
|
||||
match={'Reference':ref,'MatchID':id,'End':end, 'Destination':dest,'Sequence':sequence,'Save':saveTwiss}
|
||||
return match
|
||||
|
||||
def MatchParameter(var0,tar0,user0=None):
|
||||
if user0 is None:
|
||||
return {'Variable':var0,'Target':tar0}
|
||||
return {'Variable':var0,'Target':tar0,'User':user0}
|
||||
path ="MatchingConfig/"
|
||||
label='Reference'
|
||||
|
||||
order = []
|
||||
# order of elements:
|
||||
# - Match starting point with Twiss, None has no initial condition and starts with #s
|
||||
# - ID to find additional parameteters
|
||||
# - Last section in tracking/matching. If none it tracks to the end (#e)
|
||||
# - destination: selection of branch by giving a unique section name (e.g. SARBD01 for Aramis)
|
||||
# - 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.
|
||||
############
|
||||
# generating functions
|
||||
|
||||
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'))
|
||||
order.append(MatchStep('Laser Heater', 'Bunch Compressor 1','SINDI02','SATBD01'))
|
||||
order.append(MatchStep(None, 'Linac 1', None,'SATBD01','S10CB02',True))
|
||||
order.append(MatchStep('Bunch Compressor 1', 'Match to Linac 1','S10CB02','SATBD01'))
|
||||
order.append(MatchStep('Bunch Compressor 1', 'End of Linac 1','S10BC01','SATBD01'))
|
||||
order.append(MatchStep('Bunch Compressor 1', 'Bunch Compressor 2','S10MA01','SATBD01'))
|
||||
order.append(MatchStep(None, 'Linac 2', None,'SATBD01',['S20CB01','S20CB02'],True))
|
||||
order.append(MatchStep('Bunch Compressor 2', 'Match to Linac 2','S20CB04','SATBD01'))
|
||||
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', '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={}
|
||||
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['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})
|
||||
def generateReferences():
|
||||
# list of references with fixed twiss parameters
|
||||
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['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})
|
||||
return reference
|
||||
|
||||
|
||||
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}}]
|
||||
def generateDependences():
|
||||
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)]
|
||||
return dependence
|
||||
|
||||
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)
|
||||
|
||||
var = ['SINSB04-MQUA130','SINSB04-MQUA230']
|
||||
tar =[MatchReference('#e',{'MUX':0.2,'MUY':0.2})]
|
||||
parameter['SINSB04'] = MatchParameter(var,tar)
|
||||
|
||||
var = ['SINLH02-MQUA410','SINLH03-MQUA030','SINLH03-MQUA040','SINLH03-MQUA060','SINLH03-MQUA080','SINSB03-MQUA130']
|
||||
tar =[{'Location':'sinsb04$start','SavedID':'SINSB04'}]
|
||||
parameter['Match to SINSB04']=MatchParameter(var,tar)
|
||||
|
||||
var = ['SINBC01-MQUA020','SINBC01-MQUA050','SINBC01-MQUA070','SINBC01-MQUA090','SINBC01-MQUA110','SINDI01-MQUA020','SINDI01-MQUA070']
|
||||
tar =[reference['Bunch Compressor 1'],
|
||||
MatchReference('sinbc02.mbnd400',{'betax':5.1,'betay':100},1),
|
||||
MatchReference('sinbc01.mqua110$end',{'betax':100},1)]
|
||||
parameter['Bunch Compressor 1']=MatchParameter(var, tar)
|
||||
|
||||
var = ['S10CB02-MQUA230','S10CB02-MQUA430']
|
||||
tar = [MatchReference('#e',{'MUX':0.1883,'MUY':0.1883})]
|
||||
parameter['Linac 1'] = MatchParameter(var, tar)
|
||||
def generateOrder():
|
||||
order = []
|
||||
# order of elements:
|
||||
# - Match starting point with Twiss, None has no initial condition and starts with #s
|
||||
# - ID to find additional parameteters
|
||||
# - Last section in tracking/matching. If none it tracks to the end (#e)
|
||||
# - destination: selection of branch by giving a unique section name (e.g. SARBD01 for Aramis)
|
||||
# - 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'))
|
||||
order.append(MatchStep('Laser Heater', 'Bunch Compressor 1', 'SINDI02', 'SATBD01'))
|
||||
order.append(MatchStep(None, 'Linac 1', None, 'SATBD01', 'S10CB02', True))
|
||||
order.append(MatchStep('Bunch Compressor 1', 'Match to Linac 1', 'S10CB02', 'SATBD01'))
|
||||
order.append(MatchStep('Bunch Compressor 1', 'End of Linac 1', 'S10BC01', 'SATBD01'))
|
||||
order.append(MatchStep('Bunch Compressor 1', 'Bunch Compressor 2', 'S10MA01', 'SATBD01'))
|
||||
order.append(MatchStep(None, 'Linac 2', None, 'SATBD01', ['S20CB01', 'S20CB02'], True))
|
||||
order.append(MatchStep('Bunch Compressor 2', 'Match to Linac 2', 'S20CB04', 'SATBD01'))
|
||||
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', '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'))
|
||||
return order
|
||||
|
||||
|
||||
var = ['S10CB01-MQUA230','S10CB01-MQUA430','SINDI02-MQUA020','SINDI02-MQUA030','SINDI02-MQUA050','SINDI02-MQUA060','SINDI02-MQUA090']
|
||||
tar =[{'Location':'s10cb02$start','SavedID':'Linac 1'}]
|
||||
parameter['Match to Linac 1']=MatchParameter(var,tar)
|
||||
def generateMatchingSteps(reference,var_ext):
|
||||
|
||||
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)
|
||||
|
||||
var = ['SINSB04-MQUA130','SINSB04-MQUA230']
|
||||
tar =[MatchReference('#e',{'MUX':0.2,'MUY':0.2})]
|
||||
parameter['SINSB04'] = MatchParameter(var,tar)
|
||||
|
||||
var = ['SINLH02-MQUA410','SINLH03-MQUA030','SINLH03-MQUA040','SINLH03-MQUA060','SINLH03-MQUA080','SINSB03-MQUA130']
|
||||
tar =[{'Location':'sinsb04$start','SavedID':'SINSB04'}]
|
||||
parameter['Match to SINSB04']=MatchParameter(var,tar)
|
||||
|
||||
var = ['SINBC01-MQUA020','SINBC01-MQUA050','SINBC01-MQUA070','SINBC01-MQUA090','SINBC01-MQUA110','SINDI01-MQUA020','SINDI01-MQUA070']
|
||||
tar =[reference['Bunch Compressor 1'],
|
||||
MatchReference('sinbc02.mbnd400',{'betax':5.1,'betay':100},1),
|
||||
MatchReference('sinbc01.mqua110$end',{'betax':100},1)]
|
||||
parameter['Bunch Compressor 1']=MatchParameter(var, tar)
|
||||
|
||||
var = ['S10CB02-MQUA230','S10CB02-MQUA430']
|
||||
tar = [MatchReference('#e',{'MUX':0.1883,'MUY':0.1883})]
|
||||
parameter['Linac 1'] = MatchParameter(var, tar)
|
||||
|
||||
|
||||
var = ['S10CB07-MQUA430','S10CB08-MQUA230','S10CB08-MQUA430','S10CB09-MQUA230']
|
||||
tar = [MatchReference('s10bc01.mqua020$start',{'betax':4.88,'betay':16.11,'alphax':0.5546,'alphay':-1.81})]
|
||||
parameter['End of Linac 1']=MatchParameter(var, tar)
|
||||
var = ['S10CB01-MQUA230','S10CB01-MQUA430','SINDI02-MQUA020','SINDI02-MQUA030','SINDI02-MQUA050','SINDI02-MQUA060','SINDI02-MQUA090']
|
||||
tar =[{'Location':'s10cb02$start','SavedID':'Linac 1'}]
|
||||
parameter['Match to Linac 1']=MatchParameter(var,tar)
|
||||
|
||||
|
||||
var = ['S10BC01-MQUA020','S10BC01-MQUA040','S10BC01-MQUA060','S10BC01-MQUA080','S10BC01-MQUA100']
|
||||
tar = [reference['Bunch Compressor 2']]
|
||||
parameter['Bunch Compressor 2']=MatchParameter(var,tar)
|
||||
|
||||
var = ['S20CB01-MQUA430','S20CB02-MQUA430']
|
||||
tar = [MatchReference('#e', {'MUX': 0.2, 'MUY': 0.2})]
|
||||
parameter['Linac 2'] = MatchParameter(var, tar)
|
||||
var = ['S10CB07-MQUA430','S10CB08-MQUA230','S10CB08-MQUA430','S10CB09-MQUA230']
|
||||
tar = [MatchReference('s10bc01.mqua020$start',{'betax':4.88,'betay':16.11,'alphax':0.5546,'alphay':-1.81})]
|
||||
parameter['End of Linac 1']=MatchParameter(var, tar)
|
||||
|
||||
|
||||
var = ['S10MA01-MQUA020','S10MA01-MQUA050','S10MA01-MQUA070','S10MA01-MQUA110','S10MA01-MQUA130']
|
||||
tar =[{'Location':'s20cb01$start','SavedID':'Linac 2'}]
|
||||
parameter['Match to Linac 2']=MatchParameter(var, tar)
|
||||
var = ['S10BC01-MQUA020','S10BC01-MQUA040','S10BC01-MQUA060','S10BC01-MQUA080','S10BC01-MQUA100']
|
||||
tar = [reference['Bunch Compressor 2']]
|
||||
parameter['Bunch Compressor 2']=MatchParameter(var,tar)
|
||||
|
||||
var = ['S20SY01-MQUA020','S20SY01-MQUA030','S20SY01-MQUA050','S20SY01-MQUA080']
|
||||
tar = [reference['Switchyard']]
|
||||
parameter['Match to Switchyard']=MatchParameter(var, tar)
|
||||
var = ['S20CB01-MQUA430','S20CB02-MQUA430']
|
||||
tar = [MatchReference('#e', {'MUX': 0.2, 'MUY': 0.2})]
|
||||
parameter['Linac 2'] = MatchParameter(var, tar)
|
||||
|
||||
|
||||
var = ['S20SY02-MQUA070','S20SY02-MQUA100','S20SY02-MQUA140','S20SY02-MQUA180','S20SY02-MKDC010','S20SY02-MKAC020','S20SY02-MKDC030','S20SY02-MKAC040','S20SY02-MKDC050']
|
||||
tar=[{'Script':'Scripts/switchyard_kicker.madx'}]
|
||||
parameter['Resonant Kicker']=MatchParameter(var, tar)
|
||||
var = ['S10MA01-MQUA020','S10MA01-MQUA050','S10MA01-MQUA070','S10MA01-MQUA110','S10MA01-MQUA130']
|
||||
tar =[{'Location':'s20cb01$start','SavedID':'Linac 2'}]
|
||||
parameter['Match to Linac 2']=MatchParameter(var, tar)
|
||||
|
||||
var = ['S20SY01-MQUA020','S20SY01-MQUA030','S20SY01-MQUA050','S20SY01-MQUA080']
|
||||
tar = [reference['Switchyard']]
|
||||
parameter['Match to Switchyard']=MatchParameter(var, tar)
|
||||
|
||||
|
||||
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'}]
|
||||
uservar = {'LEAKDISP':0.0}
|
||||
parameter['Switchyard']=MatchParameter(var, tar,uservar)
|
||||
var = ['S20SY02-MQUA070','S20SY02-MQUA100','S20SY02-MQUA140','S20SY02-MQUA180','S20SY02-MKDC010','S20SY02-MKAC020','S20SY02-MKDC030','S20SY02-MKAC040','S20SY02-MKDC050']
|
||||
tar=[{'Script':'Scripts/switchyard_kicker.madx'}]
|
||||
parameter['Resonant Kicker']=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=['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'}]
|
||||
val = 0.0
|
||||
if 'SYR56' in var_ext:
|
||||
val = var_ext['SYR56']
|
||||
uservar = {'LEAKDISP':val}
|
||||
parameter['Switchyard']=MatchParameter(var, tar, uservar)
|
||||
|
||||
|
||||
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=['SATDI01-MQUA025','SATDI01-MQUA080','SATDI01-MQUA220','SATDI01-MQUA230']
|
||||
tar = [reference['HERO']]
|
||||
parameter['Athos Diagnostics'] = MatchParameter(var,tar)
|
||||
|
||||
var = ['SATUN06-MQUA080','SATUN07-MQUA080']
|
||||
tar =[MatchReference('#e',{'MUX':0.15,'MUY':0.15})]
|
||||
parameter['Athos Undulator'] = MatchParameter(var,tar)
|
||||
var = ['SATCB01-MQUA230','SATCB01-MQUA430']
|
||||
tar =[MatchReference('#e',{'MUX':0.053,'MUY':0.053})]
|
||||
parameter['Athos Linac'] = 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)
|
||||
var=['SATDI01-MQUA250','SATDI01-MQUA260','SATDI01-MQUA280','SATDI01-MQUA300']
|
||||
tar =[{'Location':'satcl01$start','SavedID':'Athos Linac'}]
|
||||
parameter['Athos Stopper'] = 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)]
|
||||
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)
|
||||
|
||||
return parameter
|
||||
|
||||
|
||||
|
||||
|
||||
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,8 +1,4 @@
|
||||
1) if plotting window is closed, reopen it
|
||||
2) make matching targets editable
|
||||
4) export elegant lattice
|
||||
5) support of other reference files -> fill up the selection list
|
||||
8) Elegant support?
|
||||
10) Prepare several settings files
|
||||
1) Finish reference lattice for SwissFEL
|
||||
|
||||
|
||||
|
||||
|
||||
3
model.py
3
model.py
@@ -38,6 +38,9 @@ class Model:
|
||||
def getLatticeVersion(self):
|
||||
return self.om.Version
|
||||
|
||||
def getInitialEnergy(self):
|
||||
return self.om.EnergyAt(self.energyReference)[0]
|
||||
|
||||
def getVariableInfo(self,varlist):
|
||||
variable = {}
|
||||
for var in varlist:
|
||||
|
||||
2
plot.py
2
plot.py
@@ -104,6 +104,8 @@ class OpticsPlot(QtWidgets.QMainWindow, Ui_OpticsPlotGUI):
|
||||
self.energyref=copy.deepcopy(self.energy)
|
||||
|
||||
def newData(self,twiss,energy):
|
||||
if not self.isVisible():
|
||||
self.show()
|
||||
print('Updating Plotting Data')
|
||||
self.twiss=twiss
|
||||
self.energy=energy
|
||||
|
||||
29
reference.py
29
reference.py
@@ -3,7 +3,7 @@ import copy
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from numpy.ma.core import floor_divide
|
||||
|
||||
#from fontTools.misc.cython import returns
|
||||
from generateMatchSettings import configMatching
|
||||
|
||||
CBeige = QtGui.QColor(250, 240, 200)
|
||||
CGreen = QtGui.QColor(100, 255, 100)
|
||||
@@ -33,6 +33,14 @@ class ReferenceManager:
|
||||
self.loadReference('MatchingConfig/Reference.json')
|
||||
self.parent.UITrackReference.currentIndexChanged.connect(self.updateReferenceWidgets)
|
||||
self.parent.UIMatchOrder.itemClicked.connect(self.displayMatchingPoint)
|
||||
self.parent.UIConfigMatching.clicked.connect(self.configMatching)
|
||||
|
||||
def configMatching(self):
|
||||
label=str(self.parent.UIMatchingConfigLabel.text())
|
||||
var = {}
|
||||
var['SYR56'] = float(str(self.parent.UIMatchConfigSYComp.text())) * 0.01
|
||||
fname = configMatching(label,var)
|
||||
self.loadReference(fname)
|
||||
|
||||
|
||||
def clearMatching(self):
|
||||
@@ -81,22 +89,6 @@ class ReferenceManager:
|
||||
self.save[ID]={'betax':twiss.betx[0],'betay':twiss.bety[0],'alphax':twiss.alfx[0],'alphay':twiss.alfy[0]}
|
||||
print('saving twissvalue for',ID,':',self.save[ID])
|
||||
|
||||
def updateUserVariables(self):
|
||||
ID = str(self.parent.UIMatchLabel.text())
|
||||
print(self.settings['Parameter'][ID])
|
||||
|
||||
return
|
||||
# ncol = table.columnCount()
|
||||
# nrow = table.rowCount()
|
||||
# content={}
|
||||
# for irow in range(nrow):
|
||||
# tag = str(table.item(irow,0).text())
|
||||
# content[tag]={}
|
||||
# for icol in range(1,ncol):
|
||||
# fld = str(table.item(irow,icol).text())
|
||||
# content[tag][icol]=fld
|
||||
# return content
|
||||
|
||||
|
||||
|
||||
def getMatchingPoint(self):
|
||||
@@ -285,7 +277,8 @@ class ReferenceManager:
|
||||
key = str(self.parent.UITrackReference.currentText())
|
||||
if key == 'User Defined':
|
||||
return
|
||||
|
||||
if key=='': # some quick solution in the case that the referenc epoints are regenerated, generating a signal for empty table
|
||||
return
|
||||
twiss = self.reference[key]['Twiss']
|
||||
name = self.reference[key]['Location']
|
||||
self.parent.UITrackLocation.setText(name)
|
||||
|
||||
@@ -476,6 +476,62 @@ class Ui_OpticsGUI(object):
|
||||
spacerItem2 = QtWidgets.QSpacerItem(242, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_9.addItem(spacerItem2)
|
||||
self.TabMaster.addTab(self.tab_2, "")
|
||||
self.tab = QtWidgets.QWidget()
|
||||
self.tab.setObjectName("tab")
|
||||
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.tab)
|
||||
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.UIConfigMatching = QtWidgets.QPushButton(self.tab)
|
||||
self.UIConfigMatching.setObjectName("UIConfigMatching")
|
||||
self.verticalLayout_2.addWidget(self.UIConfigMatching)
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.label_18 = QtWidgets.QLabel(self.tab)
|
||||
self.label_18.setObjectName("label_18")
|
||||
self.horizontalLayout_2.addWidget(self.label_18)
|
||||
self.UIMatchingConfigLabel = QtWidgets.QLineEdit(self.tab)
|
||||
self.UIMatchingConfigLabel.setObjectName("UIMatchingConfigLabel")
|
||||
self.horizontalLayout_2.addWidget(self.UIMatchingConfigLabel)
|
||||
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
|
||||
self.line = QtWidgets.QFrame(self.tab)
|
||||
self.line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
self.line.setObjectName("line")
|
||||
self.verticalLayout_2.addWidget(self.line)
|
||||
self.label_22 = QtWidgets.QLabel(self.tab)
|
||||
self.label_22.setObjectName("label_22")
|
||||
self.verticalLayout_2.addWidget(self.label_22)
|
||||
self.UIMatchConfigSYComp = QtWidgets.QLineEdit(self.tab)
|
||||
self.UIMatchConfigSYComp.setObjectName("UIMatchConfigSYComp")
|
||||
self.verticalLayout_2.addWidget(self.UIMatchConfigSYComp)
|
||||
self.label_25 = QtWidgets.QLabel(self.tab)
|
||||
self.label_25.setObjectName("label_25")
|
||||
self.verticalLayout_2.addWidget(self.label_25)
|
||||
self.UIMatchConfigARFoc = QtWidgets.QLineEdit(self.tab)
|
||||
self.UIMatchConfigARFoc.setObjectName("UIMatchConfigARFoc")
|
||||
self.verticalLayout_2.addWidget(self.UIMatchConfigARFoc)
|
||||
self.label_27 = QtWidgets.QLabel(self.tab)
|
||||
self.label_27.setObjectName("label_27")
|
||||
self.verticalLayout_2.addWidget(self.label_27)
|
||||
self.UIMatchConfigATFoc = QtWidgets.QLineEdit(self.tab)
|
||||
self.UIMatchConfigATFoc.setObjectName("UIMatchConfigATFoc")
|
||||
self.verticalLayout_2.addWidget(self.UIMatchConfigATFoc)
|
||||
self.UIMatchConfigECOLAsBC = QtWidgets.QCheckBox(self.tab)
|
||||
self.UIMatchConfigECOLAsBC.setObjectName("UIMatchConfigECOLAsBC")
|
||||
self.verticalLayout_2.addWidget(self.UIMatchConfigECOLAsBC)
|
||||
self.label_28 = QtWidgets.QLabel(self.tab)
|
||||
self.label_28.setObjectName("label_28")
|
||||
self.verticalLayout_2.addWidget(self.label_28)
|
||||
self.UIMatchConfigECOLR56 = QtWidgets.QLineEdit(self.tab)
|
||||
self.UIMatchConfigECOLR56.setObjectName("UIMatchConfigECOLR56")
|
||||
self.verticalLayout_2.addWidget(self.UIMatchConfigECOLR56)
|
||||
spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.verticalLayout_2.addItem(spacerItem3)
|
||||
self.horizontalLayout_3.addLayout(self.verticalLayout_2)
|
||||
spacerItem4 = QtWidgets.QSpacerItem(380, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_3.addItem(spacerItem4)
|
||||
self.TabMaster.addTab(self.tab, "")
|
||||
self.verticalLayout_4.addWidget(self.TabMaster)
|
||||
OpticsGUI.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(OpticsGUI)
|
||||
@@ -596,8 +652,8 @@ class Ui_OpticsGUI(object):
|
||||
self.actionNew_Reference.setObjectName("actionNew_Reference")
|
||||
self.actionSave = QtWidgets.QAction(OpticsGUI)
|
||||
self.actionSave.setObjectName("actionSave")
|
||||
self.actionExport_Elegant_Lattice = QtWidgets.QAction(OpticsGUI)
|
||||
self.actionExport_Elegant_Lattice.setObjectName("actionExport_Elegant_Lattice")
|
||||
self.actionExportElegant = QtWidgets.QAction(OpticsGUI)
|
||||
self.actionExportElegant.setObjectName("actionExportElegant")
|
||||
self.actionOpen_Matching_Script = QtWidgets.QAction(OpticsGUI)
|
||||
self.actionOpen_Matching_Script.setObjectName("actionOpen_Matching_Script")
|
||||
self.actionReloadMatch = QtWidgets.QAction(OpticsGUI)
|
||||
@@ -611,14 +667,13 @@ class Ui_OpticsGUI(object):
|
||||
self.menuFile.addAction(self.actionOpen_2)
|
||||
self.menuFile.addAction(self.actionSave)
|
||||
self.menuFile.addSeparator()
|
||||
self.menuFile.addAction(self.actionExport_Elegant_Lattice)
|
||||
self.menuFile.addAction(self.actionExportElegant)
|
||||
self.menuFile.addSeparator()
|
||||
self.menuFile.addAction(self.actionQuit)
|
||||
self.menuFile.addSeparator()
|
||||
self.menuHelp.addAction(self.actionAbout)
|
||||
self.menuHelp.addAction(self.actionHelp)
|
||||
self.menuMatching.addAction(self.actionOpenMatch)
|
||||
self.menuMatching.addAction(self.actionReloadMatch)
|
||||
self.menuMatching.addAction(self.actionOpenMatchEditor)
|
||||
self.menuMatching.addAction(self.actionOpenScriptEditor)
|
||||
self.menubar.addAction(self.menuFile.menuAction())
|
||||
@@ -696,6 +751,19 @@ class Ui_OpticsGUI(object):
|
||||
item = self.UIMatchTargets.horizontalHeaderItem(1)
|
||||
item.setText(_translate("OpticsGUI", "Condition"))
|
||||
self.TabMaster.setTabText(self.TabMaster.indexOf(self.tab_2), _translate("OpticsGUI", "Matching"))
|
||||
self.UIConfigMatching.setText(_translate("OpticsGUI", "Generate Matching File"))
|
||||
self.label_18.setText(_translate("OpticsGUI", "Label"))
|
||||
self.UIMatchingConfigLabel.setText(_translate("OpticsGUI", "Custom"))
|
||||
self.label_22.setText(_translate("OpticsGUI", "Compression in Switchyard (%)"))
|
||||
self.UIMatchConfigSYComp.setText(_translate("OpticsGUI", "0"))
|
||||
self.label_25.setText(_translate("OpticsGUI", "Focal Strength Aramis (%)"))
|
||||
self.UIMatchConfigARFoc.setText(_translate("OpticsGUI", "100"))
|
||||
self.label_27.setText(_translate("OpticsGUI", "Focal Strength Aramis (%)"))
|
||||
self.UIMatchConfigATFoc.setText(_translate("OpticsGUI", "100"))
|
||||
self.UIMatchConfigECOLAsBC.setText(_translate("OpticsGUI", "SARCL02 as BC"))
|
||||
self.label_28.setText(_translate("OpticsGUI", "R56 in SARCL02 (mm)"))
|
||||
self.UIMatchConfigECOLR56.setText(_translate("OpticsGUI", "0"))
|
||||
self.TabMaster.setTabText(self.TabMaster.indexOf(self.tab), _translate("OpticsGUI", "Matching Config (Expert)"))
|
||||
self.menuFile.setTitle(_translate("OpticsGUI", "File"))
|
||||
self.menuHelp.setTitle(_translate("OpticsGUI", "Help"))
|
||||
self.menuMatching.setTitle(_translate("OpticsGUI", "Matching"))
|
||||
@@ -754,9 +822,9 @@ 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..."))
|
||||
self.actionExport_Elegant_Lattice.setText(_translate("OpticsGUI", "Export Elegant Lattice..."))
|
||||
self.actionExportElegant.setText(_translate("OpticsGUI", "Export Elegant Lattice..."))
|
||||
self.actionOpen_Matching_Script.setText(_translate("OpticsGUI", "Open Matching Script..."))
|
||||
self.actionReloadMatch.setText(_translate("OpticsGUI", "Reload Current Matching File"))
|
||||
self.actionOpenMatch.setText(_translate("OpticsGUI", "Open New Matching File..."))
|
||||
self.actionOpenMatchEditor.setText(_translate("OpticsGUI", "Open Current Matching File in Editor"))
|
||||
self.actionOpenScriptEditor.setText(_translate("OpticsGUI", "Open Script in Editor"))
|
||||
self.actionOpenMatchEditor.setText(_translate("OpticsGUI", "Open Matching File in Editor..."))
|
||||
self.actionOpenScriptEditor.setText(_translate("OpticsGUI", "Open Script in Editor..."))
|
||||
|
||||
@@ -811,6 +811,138 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>Matching Config (Expert)</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="UIConfigMatching">
|
||||
<property name="text">
|
||||
<string>Generate Matching File</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>Label</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="UIMatchingConfigLabel">
|
||||
<property name="text">
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>Compression in Switchyard (%)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="UIMatchConfigSYComp">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string>Focal Strength Aramis (%)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="UIMatchConfigARFoc">
|
||||
<property name="text">
|
||||
<string>100</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="text">
|
||||
<string>Focal Strength Aramis (%)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="UIMatchConfigATFoc">
|
||||
<property name="text">
|
||||
<string>100</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="UIMatchConfigECOLAsBC">
|
||||
<property name="text">
|
||||
<string>SARCL02 as BC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="text">
|
||||
<string>R56 in SARCL02 (mm)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="UIMatchConfigECOLR56">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>380</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -831,7 +963,7 @@
|
||||
<addaction name="actionOpen_2"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExport_Elegant_Lattice"/>
|
||||
<addaction name="actionExportElegant"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionQuit"/>
|
||||
<addaction name="separator"/>
|
||||
@@ -848,7 +980,6 @@
|
||||
<string>Matching</string>
|
||||
</property>
|
||||
<addaction name="actionOpenMatch"/>
|
||||
<addaction name="actionReloadMatch"/>
|
||||
<addaction name="actionOpenMatchEditor"/>
|
||||
<addaction name="actionOpenScriptEditor"/>
|
||||
</widget>
|
||||
@@ -1169,7 +1300,7 @@
|
||||
<string>Save Settings...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExport_Elegant_Lattice">
|
||||
<action name="actionExportElegant">
|
||||
<property name="text">
|
||||
<string>Export Elegant Lattice...</string>
|
||||
</property>
|
||||
@@ -1191,12 +1322,12 @@
|
||||
</action>
|
||||
<action name="actionOpenMatchEditor">
|
||||
<property name="text">
|
||||
<string>Open Current Matching File in Editor</string>
|
||||
<string>Open Matching File in Editor...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenScriptEditor">
|
||||
<property name="text">
|
||||
<string>Open Script in Editor</string>
|
||||
<string>Open Script in Editor...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user