diff --git a/OpticsTools.py b/OpticsTools.py
index 5263b22..089c67a 100644
--- a/OpticsTools.py
+++ b/OpticsTools.py
@@ -45,30 +45,25 @@ 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.sandbox.updateSandbox()
+ self.reference = ReferenceManager(parent=self)
+ self.reference.initReferencePoints(self.match)
title = "SwissFEL Optics Tools - Lattice %s (Phase %d)" % (self.model.getLatticeVersion(),phase)
if office:
title += " - offline"
self.setWindowTitle(title)
- # initialization
-# self.loadSettingsdirect("Settings/ReferenceSetting.json")
- self.sandbox.updateSandbox()
-# self.reference = ReferenceManager(parent=self)
-# self.matching = Matching(parent=self, model=self.model, reference = self.reference)
# events handling
self.UIMatchOpticsSelect.currentIndexChanged.connect(self.updateMatchingCase)
self.UIMatchSelected.clicked.connect(self.doMatch)
-# self.actionOpen_2.triggered.connect(self.loadSettings)
-# self.actionSave.triggered.connect(self.saveSettings)
-# 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)
+ self.actionOpen_2.triggered.connect(self.loadSettings)
+ self.actionSave.triggered.connect(self.saveSettings)
+ self.UIUpdateFromMachine.clicked.connect(self.fullUpdate)
+ self.actionHelp.triggered.connect(self.openGit)
+ self.actionAbout.triggered.connect(self.about)
+ self.actionOpenScriptEditor.triggered.connect(self.editMatchingScript)
def doMatch(self):
@@ -120,29 +115,6 @@ 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
@@ -153,6 +125,7 @@ class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
return
subprocess.Popen(["emacs", fileName])
+##################################################
def saveSettings(self):
options = QtWidgets.QFileDialog.Options()
options |= QtWidgets.QFileDialog.DontUseNativeDialog
@@ -161,10 +134,7 @@ class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
"Json Files (*.json)", options=options)
if not fileName:
return
- settings=self.model.getSettings()
- with open(fileName, 'w', encoding='utf-8') as f:
- json.dump(settings, f, ensure_ascii=False, indent=4)
-
+ self.saveSettingDirect(fileName)
def loadSettings(self):
@@ -183,6 +153,12 @@ class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
self.model.loadSettings(settings)
self.status('Reference loaded')
+ def saveSettingsdirect(self,fileName):
+ settings = self.model.getSettings()
+ with open(fileName, 'w', encoding='utf-8') as f:
+ json.dump(settings, f, ensure_ascii=False, indent=4)
+
+####################################################
def fullUpdate(self):
machine = self.machine.getMachineStatus()
self.model.updateFromMachine(machine)
diff --git a/Scripts/Reference-SwissFEL/initTwiss.madx b/Scripts/Reference-SwissFEL/initTwiss.madx
index cc33b02..dc0c2d9 100644
--- a/Scripts/Reference-SwissFEL/initTwiss.madx
+++ b/Scripts/Reference-SwissFEL/initTwiss.madx
@@ -1,9 +1,8 @@
option,-echo;
! starting condition
-Twiss0: beta0, betx = 29.971, alfx = 0.003, bety = 26., alfy = -0.288; ! location:Start
-Twisssep: beta0,betx = 48.26, alfx = 7.322, bety = 14.293, alfy = -3.513; ! location:sinsy02$start
-TwissM1: beta0, betx = 11.2, alfx = 3.2, bety = 0.8, alfy = 0.75; ! location:sinlh02.mqua410$end
+Twiss0: beta0, betx = 29.971, alfx = 0.003, bety = 26., alfy = -0.288; ! location:swissfel$start
+TwissM1: beta0, betx = 11.2, alfx = 3.2, bety = 0.8, alfy = 0.75; ! location:sinlh02.mqua410$start
TwissM2: beta0, betx = 11.1557, alfx = -1.17, bety = 50, alfy = 0.; ! location:sindi02.mqua020$start
TwissM3: beta0, betx = 4.88, alfx = 0.5546, bety = 16.11, alfy = -1.81; ! location:s10bc01.mqua020$start
TwissM4: beta0, betx = 6.14, alfx = -0.83, bety = 22.86, alfy = -1.18; ! location:s10ma01.mqua020$start
-
+Twisssep: beta0,betx = 48.26, alfx = 7.322, bety = 14.293, alfy = -3.513; ! location:s20sy02$start
\ No newline at end of file
diff --git a/Scripts/Reference-SwissFEL/matchInjector.madx b/Scripts/Reference-SwissFEL/matchInjector.madx
index e887c8b..844483c 100644
--- a/Scripts/Reference-SwissFEL/matchInjector.madx
+++ b/Scripts/Reference-SwissFEL/matchInjector.madx
@@ -8,10 +8,10 @@ VARY,NAME=sinlh01.MQUA040.k1,STEP=0.0001;
VARY,NAME=sinlh01.MQUA050.k1,STEP=0.0001;
VARY,NAME=sinlh01.MQUA070.k1,STEP=0.0001;
VARY,NAME=sinlh02.MQUA010.k1,STEP=0.0001;
-CONSTRAINT,SEQUENCE=SwissFEL,range=sinlh02.mqua410$end, alfx = TwissM1->ALFX;
-CONSTRAINT,SEQUENCE=SwissFEL,range=sinlh02.mqua410$end, alfy = TwissM1->ALFY;
-CONSTRAINT,SEQUENCE=SwissFEL,range=sinlh02.mqua410$end, betx = TwissM1->BETX;
-CONSTRAINT,SEQUENCE=SwissFEL,range=sinlh02.mqua410$end, bety = TwissM1->BETY;
+CONSTRAINT,SEQUENCE=SwissFEL,range=sinlh02.mqua410$start, alfx = TwissM1->ALFX;
+CONSTRAINT,SEQUENCE=SwissFEL,range=sinlh02.mqua410$start, alfy = TwissM1->ALFY;
+CONSTRAINT,SEQUENCE=SwissFEL,range=sinlh02.mqua410$start, betx = TwissM1->BETX;
+CONSTRAINT,SEQUENCE=SwissFEL,range=sinlh02.mqua410$start, bety = TwissM1->BETY;
CONSTRAINT,SEQUENCE=SwissFEL,range=sinsb04.mqua130$end, X < 10;
LMDIF,CALLS=1000,TOLERANCE=1.e-21;
SIMPLEX,CALLS=1000,TOLERANCE=1.e-21;
diff --git a/issues.txt b/issues.txt
index 08e8c80..b36c72d 100644
--- a/issues.txt
+++ b/issues.txt
@@ -1,7 +1,10 @@
1) Initialize all quadrupoles at the beginning!
2) Allow for parameter inputs, e.g. phase advance
-3) make initTwiss to alist of several reference points
-4) match to beta0 and not individual elements
+3) matching output on a log
+4) Save matched values (e.g. automatically)
+5) Load Reference
+6) filter for curent, planned and final phase for matching scripts
+
diff --git a/matchmaker.py b/matchmaker.py
index 9eda9ac..c90b72c 100644
--- a/matchmaker.py
+++ b/matchmaker.py
@@ -6,9 +6,12 @@ from onlinemodel.madx import CMadX
class MatchMaker:
def __init__(self):
self.matchlist={'Reference-SwissFEL':'Scripts/Reference-SwissFEL','SwissFEL+':'Scripts/SFPlus'}
+ self.referencePoints={}
def initScripts(self,target):
self.scriptdir = self.matchlist[target]
+ if os.path.exists(self.scriptdir+'/initTwiss.madx'):
+ self.parseReferencePoints()
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')
@@ -16,6 +19,20 @@ class MatchMaker:
self.settings = os.path.exists(self.scriptdir + '/ReferenceSettings')
+ def parseReferencePoints(self):
+ file = self.scriptdir+'/initTwiss.madx'
+ self.referencePoints.clear()
+ with open(file,'r') as f:
+ lines = f.readlines()
+ for line in lines:
+ if 'location:' in line:
+ tags = line.split('location:')
+ location = tags[1].strip()
+ fields_all = tags[0].split(',')
+ fields = [fld.split(';')[0].strip() for fld in fields_all if "=" in fld]
+ self.referencePoints[location] = {twiss.split('=')[0].strip().lower():float(twiss.split('=')[1].strip()) for twiss in fields}
+ print('##### Reference Twiss values parsed')
+
def match(self, om, Injector=True, Athos = True, Aramis = False, Porthos = False):
diff --git a/model.py b/model.py
index 3bd3836..f34028a 100644
--- a/model.py
+++ b/model.py
@@ -29,12 +29,10 @@ class Model:
# flag to enfore new lattice
self.forceLat=True
# hook up events
- self.matchplot=True
self.eventHandling()
def eventHandling(self):
self.parent.UITrack.clicked.connect(self.track)
- #self.parent.UIMatchSelected.clicked.connect(self.match)
def forceLatticeUpdate(self):
self.forceLat=True
@@ -45,33 +43,6 @@ class Model:
def getInitialEnergy(self):
return self.om.EnergyAt(self.energyReference)[0]
- def getVariableInfo(self,varlist):
- variable = {}
- for var in varlist:
- if isinstance(var,dict):
- for key in var.keys():
- variable[key] = {'Val':var[key],'Max':None}
- continue
- ele = self.om.getElement(var.replace('-','.'))
- if ele is None:
- variable[var]={'Val':0,'Max':None}
- else:
- if 'MQUA' in var or 'MQSK' in var or 'MSEX' in var:
- bg = ele.Baugruppe
- Brho = self.om.EnergyAt(var.replace('-','.'))[0]/3e8
- if bg in maxgradient.keys():
- mgrad=maxgradient[bg]/Brho
- else:
- mgrad=None
- if 'MSEX' in var:
- variable[var]={'Val':ele.k2,'Max':mgrad}
- else:
- variable[var] = {'Val': ele.k1, 'Max': mgrad}
- else:
- variable[var]={'Val':0,'Max':None}
- return variable
-
-
def updateFromMachine(self,machine):
pol = ['LH', 'LV+', 'LV-', 'C+', 'C-', 'ZL']
mag = machine['Magnet']
@@ -180,106 +151,10 @@ class Model:
self.startEnergy = settings['Energy']['energy']
self.energyReference = settings['Energy']['location']
self.startTwiss = settings['InitialCondition']
- print(self.startTwiss)
self.updateEnergy(self.startEnergy)
- print(settings['Energy']['energy'])
- print('Energy in system',self.om.EnergyAt(self.energyReference)[0])
+ print('Settings loaded (Reference Energy:',self.om.EnergyAt(self.energyReference)[0],')')
self.forceLat=True
-
-##############################33
-# tracking
-
-
- def match(self):
- config = self.parent.reference.getMatchingPoint()
- if config is False:
- return
- self.setBranch(config['destination'])
- sequence = config['sequence']
- ID = config['ID']
- start=config['start']['Location']
- end=config['end']
- if len(end) == 7:
- end=end+'$end'
- if 'Twiss' in config['start']:
- itwiss = {converttwiss[key.lower()]: config['start']['Twiss'][key] for key in
- config['start']['Twiss'].keys()}
- else:
- itwiss = None
-
-
- var={}
- nvar=0
- for key in config['variable'].keys():
- nvar+=1
- key0=key.replace('-','.').lower()
- if 'mqua' in key0 or 'mqsk' in key0:
- key0+='.k1'
- elif 'msex' in key0:
- key0+='.k2'
- elif 'mkac' in key0 or 'mkdc' in key0:
- key0+='.cory'
- 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():
- print(var)
- res,twiss,err = self.madx.callScript(script = target['Script'],sequence=sequence, start=start, end=end,init=itwiss,var=var,preset=True)
- self.updateModelFromMatching(res)
- self.parent.reference.updateMatchPoint(ID, err)
- if self.matchplot:
- energy = self.calcEnergyProfile(twiss)
- self.parent.plot.newData(twiss, energy)
- return
-
- ncon = 0
- condilist = {}
- for key in target.keys():
- condi={}
- for ele in target[key]:
- if isinstance(ele,tuple):
- condi[converttwiss[ele[0].lower()]]={'Condition': ele[1],'Val':ele[2]}
- ncon+=1
- elif isinstance(ele,str):
- print('Needs matching results from', ele)
- return
- condilist[key]=condi
- print('Variables:',nvar)
- print('Conditions:',ncon)
- if nvar > ncon:
- print('Adding dummy constraints from initial conditions')
- if not start in condilist.keys():
- condilist[start]={}
- condi={}
- for twkey in itwiss.keys():
- if ncon < nvar:
- condi[twkey]={'Condition':0,'Val':itwiss[twkey]}
- ncon+=1
- condilist[start]=condi
-
- for key in condilist.keys():
- print(key,condilist[key])
-
- random = self.parent.UIMatchRandom.isChecked()
- res,twiss,err=self.madx.match(sequence=sequence, start=start, end=end,
- init=itwiss, var=var, const=condilist,
- preset=False,random=random)
-
- self.updateModelFromMatching(res)
- if config['save'] == True:
- self.parent.reference.saveTwiss(ID,twiss)
- self.parent.reference.updateMatchPoint(ID,err)
- if self.matchplot:
- energy = self.calcEnergyProfile(twiss)
- self.parent.plot.newData(twiss,energy)
-
-
def updateModelFromMatching(self,var):
for magm in var.keys():
mag0 = magm[0:15]
@@ -301,6 +176,7 @@ class Model:
ele.design_kick = val
ele.cory = val
print('Updating %s to design_kick: %8.4f' % (mag0, val))
+
##################
# tracking
@@ -313,8 +189,12 @@ class Model:
end = end[0:7]
refloc, twiss0 = self.parent.reference.getReference()
+ if 'SWISSFEL' in refloc.upper():
+ refloc = 'SINLH01$START'
if refloc.upper() == 'START':
refloc = start.upper()
+ if self.startEnergy is None:
+ self.startEnergy = self.om.EnergyAt(self.energyReference)[0]*1e-6
twiss0['energy'] = self.startEnergy*1e-3 # convert to GeV for madx
start, end = self.checkRange(start, end, refloc[0:7])
if start is None:
diff --git a/reference.py b/reference.py
index 9a01b05..13c733e 100644
--- a/reference.py
+++ b/reference.py
@@ -11,240 +11,68 @@ CYellow = QtGui.QColor(255, 255, 0)
CRed = QtGui.QColor(255, 100, 100)
-
-
class ReferenceManager:
def __init__(self, parent):
self.parent = parent
- self.settings={}
- self.reference={}
- self.save={}
- self.label=None
- self.matchfile=''
+ self.reference={} # list of location with twiss parameters
+ self.locationDict={}
- self.twisswidget={'betax':self.parent.UIBetax,'betay':self.parent.UIBetay,
- 'alphax':self.parent.UIAlphax,'alphay':self.parent.UIAlphay,
+ self.twisswidget={'betx':self.parent.UIBetax,'bety':self.parent.UIBetay,
+ 'alfx':self.parent.UIAlphax,'alfy':self.parent.UIAlphay,
'etax':self.parent.UIEtax,'etay':self.parent.UIEtay,
'etapx':self.parent.UIEtapx,'etapy':self.parent.UIEtapy,
'x':self.parent.UIX,'y':self.parent.UIY,
'px':self.parent.UIPX,'py':self.parent.UIPY}
-
- 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)
+ ####################################33
+ # handling the reference point system
-
- def clearMatching(self):
- self.save.clear()
- self.updateMatchOrder()
-
- def updateMatchOrder(self):
- secs={}
- self.parent.UIMatchOrder.clear()
- for i,ele in enumerate(self.settings['Order']):
- label = ele['MatchID']
- ref = ele['Reference']
- if ref is None:
- color = CBeige
+ def initReferencePoints(self,matchmaker):
+ self.reference.clear()
+ self.locationDict.clear()
+ for i, key in enumerate(matchmaker.referencePoints.keys()):
+ if i is 0:
+ tag = 'Start'
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()
-
- def loadReference(self, filename):
- with open(filename) as f:
- self.settings = json.load(f)
- self.matchfile=filename
- self.order={ele['MatchID']:i for i,ele in enumerate(self.settings['Order'])}
- self.reference=self.settings['Reference'] # this are fixed points in the lattice
- self.label=self.settings['Label']
- self.parameter=self.settings['Parameter']
- self.dependence=self.settings['Dependence']
- self.parent.UIMatchSequenceLabel.setText(self.label)
- self.clearMatching()
+ tag = 'Matchpoint %d' % i
+ self.reference[tag]= {'Location':key,'Twiss':matchmaker.referencePoints[key]}
self.updateReferenceComboBox()
- self.updateReferenceWidgets()
+ def swithToUserDefinedLocation(self):
+ n = self.parent.UITrackReference.count()
+ self.parent.UITrackReference.setCurrentIndex(n - 1)
- def saveTwiss(self, ID, twiss):
- 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 getMatchingPoint(self):
- 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']
- save = order['Save']
-
- sequence = order['Sequence']
- if not sequence is None:
- if isinstance(sequence,str):
- start = sequence+'$start'
- end = sequence+'$end'
- elif isinstance(sequence,list):
- start = sequence[0]+'$start'
- end = sequence[-1]+'$end'
- twiss0 = {'Location': start, 'twiss': {}}
- else:
- end = order['End']
- if end is None:
- end = '#e'
- start = order['Reference']
- if start is None:
- twiss0 = {'Location':'#s','twiss':{}}
- else:
- twiss0 = self.getReferenceByTag(order['Reference'])
- if twiss0['Location'].upper() == 'START':
- twiss0['Location']= '#s'
- sequence='swissfel'
-
- varlist = self.parameter[ID]['Variable']
- variable = self.parent.model.getVariableInfo(varlist)
- if 'User' in self.parameter[ID]:
- for key in self.parameter[ID]['User'].keys():
- variable[key]={'Val':self.parameter[ID]['User'][key],'Max':None}
-
- cond = {}
- targets = self.parameter[ID]['Target']
- for target in targets:
- if 'Location' in target.keys():
- loc = target['Location']
- if not loc in cond.keys():
- cond[loc]=[]
- if 'Limit' in target.keys():
- limit = target['Limit']
- else:
- limit = 0
- if 'Twiss' in target.keys():
- for key0 in target['Twiss'].keys():
- cond[loc].append((key0,limit,target['Twiss'][key0]))
- elif 'SavedID':
- if target['SavedID'] in self.save.keys():
- twisssaved = self.save[target['SavedID']]
- for twkey in twisssaved.keys():
- cond[loc].append((twkey,0,twisssaved[twkey]))
- else:
- 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,
- 'variable':variable,'target':cond,'save':save}
- return config
-
-
-
- def updateMatchPoint(self,ID,val):
- idx = self.order[ID]
- if val < 1e-6:
- color = CGreen
- elif val < 1:
- color = CYellow
- else:
- color = CRed
- self.parent.UIMatchOrder.item(idx).setBackground(color)
- if val<1:
- idx = self.parent.UIMatchOrder.currentRow()+1
- if idx < self.parent.UIMatchOrder.count():
- self.parent.UIMatchOrder.setCurrentRow(idx)
- self.displayMatchingPoint()
-
-
- def getDependence(self,ele):
- eletag=ele.upper().replace('.','-')
- if eletag in self.dependence.keys():
- return [mag.lower().replace('-','.') for mag in self.dependence[eletag]]
- else:
- return None
-#--------------------------------
-# match info
-
- def displayMatchingPoint(self):
- config = self.getMatchingPoint()
- if config is None:
+ def updateReferenceWidgets(self):
+ key = str(self.parent.UITrackReference.currentText())
+ if key == 'User Defined':
return
- self.parent.UIMatchLabel.setText(config['ID'])
- self.parent.UIMatchStart.setText(config['start']['Location'])
- self.parent.UIMatchEnd.setText(config['end'])
- self.parent.UIMatchSequence.setText(config['sequence'])
-
- self.parent.UIMatchKnobs.setColumnCount(3)
- self.parent.UIMatchKnobs.setRowCount(len(config['variable'].keys()))
- for i , key in enumerate(config['variable'].keys()):
- self.parent.UIMatchKnobs.setItem(i, 0, QtWidgets.QTableWidgetItem(key))
- self.parent.UIMatchKnobs.setItem(i, 1, QtWidgets.QTableWidgetItem('%7.3f' % config['variable'][key]['Val']))
- arg = config['variable'][key]['Max']
- if arg is None:
- self.parent.UIMatchKnobs.setItem(i, 2, QtWidgets.QTableWidgetItem(''))
+ 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_orig = self.reference[key]['Location']
+ name = name_orig.upper().replace('.','-')
+ if '$' in name:
+ name=name.replace('$',' (')+')'
+ self.locationDict[name]=name_orig
+ self.parent.UITrackLocation.setText(name)
+ for key in self.twisswidget.keys():
+ if key in twiss.keys():
+ value = twiss[key]
else:
- self.parent.UIMatchKnobs.setItem(i, 2, QtWidgets.QTableWidgetItem('%7.3f' % arg))
- self.parent.UIMatchKnobs.resizeColumnsToContents()
- self.parent.UIMatchKnobs.verticalHeader().hide()
+ value = 0
+ if 'beta' in key:
+ value = 30
+ self.twisswidget[key].setText('%7.3f' % value)
- self.parent.UIMatchTargets.setColumnCount(2)
- self.parent.UIMatchTargets.setRowCount(0)
- if 'Script' in config['target'].keys():
- 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():
- for ele in config['target'][key]:
- self.parent.UIMatchTargets.insertRow(irow)
- self.parent.UIMatchTargets.setItem(irow, 0, QtWidgets.QTableWidgetItem(key))
- if isinstance(ele, tuple):
- fld = self.convertTargetTuple(ele)
- self.parent.UIMatchTargets.setItem(irow, 1, QtWidgets.QTableWidgetItem(fld))
- elif isinstance(ele,str):
- self.parent.UIMatchTargets.setItem(irow, 1, QtWidgets.QTableWidgetItem('Result from: %s ' % ele))
- self.parent.UIMatchTargets.resizeColumnsToContents()
- self.parent.UIMatchTargets.verticalHeader().hide()
- return
+ def updateReferenceComboBox(self):
+ self.parent.UITrackReference.clear()
+ for ref in self.reference.keys():
+ self.parent.UITrackReference.addItem(ref)
+ self.parent.UITrackReference.addItem('User Defined')
- def convertTargetTuple(self,tuple_in):
- sym = ['=', '<', '>']
- retval = tuple_in[0]+sym[int(tuple_in[1])]
- if tuple_in[2] is None:
- return retval+'undefined'
- flt = '%7.3f' % tuple_in[2]
- return retval + flt.strip()
+###########################################
#--------------------------------
# obtaining reference data
@@ -263,37 +91,6 @@ class ReferenceManager:
return twiss
def getReferenceLocation(self):
- return str(self.parent.UITrackLocation.text())
-
-####################################################
-###### only relevant for tracking
-##### interaction of the tracking reference point
-
- def swithToUserDefinedLocation(self):
- n = self.parent.UITrackReference.count()
- self.parent.UITrackReference.setCurrentIndex(n-1)
-
- def updateReferenceWidgets(self):
- 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)
- for key in self.twisswidget.keys():
- if key in twiss.keys():
- value = twiss[key]
- else:
- value = 0
- if 'beta' in key:
- value = 30
- self.twisswidget[key].setText('%7.3f' % value)
-
- def updateReferenceComboBox(self):
- self.parent.UITrackReference.clear()
- for ref in self.reference.keys():
- self.parent.UITrackReference.addItem(ref)
- self.parent.UITrackReference.addItem('User Defined')
+ tag = str(self.parent.UITrackLocation.text())
+ return self.locationDict[tag]
diff --git a/ui/OpticsToolsGui.py b/ui/OpticsToolsGui.py
index 55ebd0f..eacd9e0 100644
--- a/ui/OpticsToolsGui.py
+++ b/ui/OpticsToolsGui.py
@@ -28,8 +28,8 @@ class Ui_OpticsGUI(object):
self.TabMaster.setObjectName("TabMaster")
self.tab_3 = QtWidgets.QWidget()
self.tab_3.setObjectName("tab_3")
- self.horizontalLayout = QtWidgets.QHBoxLayout(self.tab_3)
- self.horizontalLayout.setObjectName("horizontalLayout")
+ self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.tab_3)
+ self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.widget_2 = QtWidgets.QWidget(self.tab_3)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
@@ -270,9 +270,121 @@ class Ui_OpticsGUI(object):
self.UIStatus.setMinimumSize(QtCore.QSize(150, 0))
self.UIStatus.setObjectName("UIStatus")
self.verticalLayout.addWidget(self.UIStatus)
- self.horizontalLayout.addWidget(self.widget_2)
- spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
- self.horizontalLayout.addItem(spacerItem1)
+ self.horizontalLayout_4.addWidget(self.widget_2)
+ self.widget = QtWidgets.QWidget(self.tab_3)
+ self.widget.setObjectName("widget")
+ self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.widget)
+ self.verticalLayout_3.setObjectName("verticalLayout_3")
+ self.UIMatchSelected = QtWidgets.QPushButton(self.widget)
+ font = QtGui.QFont()
+ font.setPointSize(12)
+ font.setBold(True)
+ font.setWeight(75)
+ self.UIMatchSelected.setFont(font)
+ self.UIMatchSelected.setStyleSheet("background-color: rgb(255, 255, 127);")
+ self.UIMatchSelected.setObjectName("UIMatchSelected")
+ self.verticalLayout_3.addWidget(self.UIMatchSelected)
+ self.horizontalLayout = QtWidgets.QHBoxLayout()
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.label_31 = QtWidgets.QLabel(self.widget)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.label_31.sizePolicy().hasHeightForWidth())
+ self.label_31.setSizePolicy(sizePolicy)
+ font = QtGui.QFont()
+ font.setPointSize(10)
+ font.setBold(True)
+ font.setWeight(75)
+ self.label_31.setFont(font)
+ self.label_31.setObjectName("label_31")
+ self.horizontalLayout.addWidget(self.label_31)
+ self.UIMatchOpticsSelect = QtWidgets.QComboBox(self.widget)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.UIMatchOpticsSelect.sizePolicy().hasHeightForWidth())
+ self.UIMatchOpticsSelect.setSizePolicy(sizePolicy)
+ font = QtGui.QFont()
+ font.setPointSize(10)
+ font.setBold(True)
+ font.setWeight(75)
+ self.UIMatchOpticsSelect.setFont(font)
+ self.UIMatchOpticsSelect.setObjectName("UIMatchOpticsSelect")
+ self.horizontalLayout.addWidget(self.UIMatchOpticsSelect)
+ self.verticalLayout_3.addLayout(self.horizontalLayout)
+ self.matchbranches = QtWidgets.QGroupBox(self.widget)
+ font = QtGui.QFont()
+ font.setBold(True)
+ font.setWeight(75)
+ self.matchbranches.setFont(font)
+ self.matchbranches.setObjectName("matchbranches")
+ self.gridLayout_5 = QtWidgets.QGridLayout(self.matchbranches)
+ self.gridLayout_5.setObjectName("gridLayout_5")
+ self.UIMatchInjector = QtWidgets.QCheckBox(self.matchbranches)
+ font = QtGui.QFont()
+ font.setBold(False)
+ font.setWeight(50)
+ self.UIMatchInjector.setFont(font)
+ self.UIMatchInjector.setObjectName("UIMatchInjector")
+ self.gridLayout_5.addWidget(self.UIMatchInjector, 0, 0, 1, 1)
+ self.UIMatchPorthos = QtWidgets.QCheckBox(self.matchbranches)
+ font = QtGui.QFont()
+ font.setBold(False)
+ font.setWeight(50)
+ self.UIMatchPorthos.setFont(font)
+ self.UIMatchPorthos.setObjectName("UIMatchPorthos")
+ self.gridLayout_5.addWidget(self.UIMatchPorthos, 0, 1, 1, 1)
+ self.UIMatchAthos = QtWidgets.QCheckBox(self.matchbranches)
+ font = QtGui.QFont()
+ font.setBold(False)
+ font.setWeight(50)
+ self.UIMatchAthos.setFont(font)
+ self.UIMatchAthos.setObjectName("UIMatchAthos")
+ self.gridLayout_5.addWidget(self.UIMatchAthos, 1, 0, 1, 1)
+ self.UIMatchAramis = QtWidgets.QCheckBox(self.matchbranches)
+ font = QtGui.QFont()
+ font.setBold(False)
+ font.setWeight(50)
+ self.UIMatchAramis.setFont(font)
+ self.UIMatchAramis.setObjectName("UIMatchAramis")
+ self.gridLayout_5.addWidget(self.UIMatchAramis, 1, 1, 1, 1)
+ self.verticalLayout_3.addWidget(self.matchbranches)
+ self.checkBox_3 = QtWidgets.QCheckBox(self.widget)
+ self.checkBox_3.setObjectName("checkBox_3")
+ self.verticalLayout_3.addWidget(self.checkBox_3)
+ self.checkBox = QtWidgets.QCheckBox(self.widget)
+ self.checkBox.setObjectName("checkBox")
+ self.verticalLayout_3.addWidget(self.checkBox)
+ self.checkBox_2 = QtWidgets.QCheckBox(self.widget)
+ self.checkBox_2.setObjectName("checkBox_2")
+ self.verticalLayout_3.addWidget(self.checkBox_2)
+ self.label_19 = QtWidgets.QLabel(self.widget)
+ font = QtGui.QFont()
+ font.setBold(True)
+ font.setWeight(75)
+ self.label_19.setFont(font)
+ self.label_19.setObjectName("label_19")
+ self.verticalLayout_3.addWidget(self.label_19)
+ self.UIMatchKnobs = QtWidgets.QTableWidget(self.widget)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.UIMatchKnobs.sizePolicy().hasHeightForWidth())
+ self.UIMatchKnobs.setSizePolicy(sizePolicy)
+ self.UIMatchKnobs.setObjectName("UIMatchKnobs")
+ self.UIMatchKnobs.setColumnCount(2)
+ self.UIMatchKnobs.setRowCount(0)
+ item = QtWidgets.QTableWidgetItem()
+ self.UIMatchKnobs.setHorizontalHeaderItem(0, item)
+ item = QtWidgets.QTableWidgetItem()
+ self.UIMatchKnobs.setHorizontalHeaderItem(1, item)
+ self.verticalLayout_3.addWidget(self.UIMatchKnobs)
+ spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.verticalLayout_3.addItem(spacerItem1)
+ self.horizontalLayout_4.addWidget(self.widget)
+ spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.horizontalLayout_4.addItem(spacerItem2)
self.TabMaster.addTab(self.tab_3, "")
self.tab_8 = QtWidgets.QWidget()
self.tab_8.setObjectName("tab_8")
@@ -359,197 +471,6 @@ class Ui_OpticsGUI(object):
self.verticalLayout_17.addWidget(self.SB2ModUnd)
self.horizontalLayout_5.addWidget(self.groupBox_9)
self.TabMaster.addTab(self.tab_8, "")
- self.tab_2 = QtWidgets.QWidget()
- self.tab_2.setObjectName("tab_2")
- self.horizontalLayout_9 = QtWidgets.QHBoxLayout(self.tab_2)
- self.horizontalLayout_9.setObjectName("horizontalLayout_9")
- self.verticalLayout_6 = QtWidgets.QVBoxLayout()
- self.verticalLayout_6.setObjectName("verticalLayout_6")
- self.label_31 = QtWidgets.QLabel(self.tab_2)
- self.label_31.setObjectName("label_31")
- self.verticalLayout_6.addWidget(self.label_31)
- self.UIMatchOpticsSelect = QtWidgets.QComboBox(self.tab_2)
- self.UIMatchOpticsSelect.setObjectName("UIMatchOpticsSelect")
- self.verticalLayout_6.addWidget(self.UIMatchOpticsSelect)
- self.UIMatchInjector = QtWidgets.QCheckBox(self.tab_2)
- self.UIMatchInjector.setObjectName("UIMatchInjector")
- self.verticalLayout_6.addWidget(self.UIMatchInjector)
- self.UIMatchAthos = QtWidgets.QCheckBox(self.tab_2)
- self.UIMatchAthos.setObjectName("UIMatchAthos")
- self.verticalLayout_6.addWidget(self.UIMatchAthos)
- self.UIMatchPorthos = QtWidgets.QCheckBox(self.tab_2)
- self.UIMatchPorthos.setObjectName("UIMatchPorthos")
- self.verticalLayout_6.addWidget(self.UIMatchPorthos)
- self.UIMatchAramis = QtWidgets.QCheckBox(self.tab_2)
- self.UIMatchAramis.setObjectName("UIMatchAramis")
- self.verticalLayout_6.addWidget(self.UIMatchAramis)
- self.UIMatchSelected = QtWidgets.QPushButton(self.tab_2)
- font = QtGui.QFont()
- font.setPointSize(12)
- font.setBold(True)
- font.setWeight(75)
- self.UIMatchSelected.setFont(font)
- self.UIMatchSelected.setStyleSheet("background-color: rgb(255, 255, 127);")
- self.UIMatchSelected.setObjectName("UIMatchSelected")
- self.verticalLayout_6.addWidget(self.UIMatchSelected)
- self.horizontalLayout_8 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_8.setObjectName("horizontalLayout_8")
- self.label_14 = QtWidgets.QLabel(self.tab_2)
- self.label_14.setObjectName("label_14")
- self.horizontalLayout_8.addWidget(self.label_14)
- self.UIMatchSequenceLabel = QtWidgets.QLineEdit(self.tab_2)
- self.UIMatchSequenceLabel.setText("")
- self.UIMatchSequenceLabel.setObjectName("UIMatchSequenceLabel")
- self.horizontalLayout_8.addWidget(self.UIMatchSequenceLabel)
- self.verticalLayout_6.addLayout(self.horizontalLayout_8)
- self.label_15 = QtWidgets.QLabel(self.tab_2)
- self.label_15.setObjectName("label_15")
- self.verticalLayout_6.addWidget(self.label_15)
- self.UIMatchOrder = QtWidgets.QListWidget(self.tab_2)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding)
- sizePolicy.setHorizontalStretch(0)
- 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)
- self.UIMatchRandom.setObjectName("UIMatchRandom")
- self.verticalLayout_6.addWidget(self.UIMatchRandom)
- self.horizontalLayout_9.addLayout(self.verticalLayout_6)
- self.verticalLayout_7 = QtWidgets.QVBoxLayout()
- self.verticalLayout_7.setObjectName("verticalLayout_7")
- self.label_21 = QtWidgets.QLabel(self.tab_2)
- font = QtGui.QFont()
- font.setPointSize(12)
- font.setBold(True)
- font.setWeight(75)
- self.label_21.setFont(font)
- self.label_21.setObjectName("label_21")
- self.verticalLayout_7.addWidget(self.label_21)
- self.gridLayout_5 = QtWidgets.QGridLayout()
- self.gridLayout_5.setObjectName("gridLayout_5")
- self.label_17 = QtWidgets.QLabel(self.tab_2)
- self.label_17.setObjectName("label_17")
- self.gridLayout_5.addWidget(self.label_17, 1, 0, 1, 1)
- self.UIMatchSequence = QtWidgets.QLineEdit(self.tab_2)
- self.UIMatchSequence.setReadOnly(True)
- self.UIMatchSequence.setObjectName("UIMatchSequence")
- self.gridLayout_5.addWidget(self.UIMatchSequence, 3, 1, 1, 1)
- self.UIMatchLabel = QtWidgets.QLineEdit(self.tab_2)
- self.UIMatchLabel.setReadOnly(True)
- self.UIMatchLabel.setObjectName("UIMatchLabel")
- self.gridLayout_5.addWidget(self.UIMatchLabel, 0, 1, 1, 1)
- self.label_11 = QtWidgets.QLabel(self.tab_2)
- self.label_11.setObjectName("label_11")
- self.gridLayout_5.addWidget(self.label_11, 3, 0, 1, 1)
- self.label_16 = QtWidgets.QLabel(self.tab_2)
- self.label_16.setObjectName("label_16")
- self.gridLayout_5.addWidget(self.label_16, 0, 0, 1, 1)
- self.UIMatchStart = QtWidgets.QLineEdit(self.tab_2)
- self.UIMatchStart.setReadOnly(True)
- self.UIMatchStart.setObjectName("UIMatchStart")
- self.gridLayout_5.addWidget(self.UIMatchStart, 1, 1, 1, 1)
- self.label_12 = QtWidgets.QLabel(self.tab_2)
- self.label_12.setObjectName("label_12")
- self.gridLayout_5.addWidget(self.label_12, 2, 0, 1, 1)
- self.UIMatchEnd = QtWidgets.QLineEdit(self.tab_2)
- self.UIMatchEnd.setReadOnly(True)
- self.UIMatchEnd.setObjectName("UIMatchEnd")
- self.gridLayout_5.addWidget(self.UIMatchEnd, 2, 1, 1, 1)
- self.verticalLayout_7.addLayout(self.gridLayout_5)
- self.label_19 = QtWidgets.QLabel(self.tab_2)
- self.label_19.setObjectName("label_19")
- self.verticalLayout_7.addWidget(self.label_19)
- self.UIMatchKnobs = QtWidgets.QTableWidget(self.tab_2)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.UIMatchKnobs.sizePolicy().hasHeightForWidth())
- self.UIMatchKnobs.setSizePolicy(sizePolicy)
- self.UIMatchKnobs.setObjectName("UIMatchKnobs")
- self.UIMatchKnobs.setColumnCount(3)
- self.UIMatchKnobs.setRowCount(0)
- item = QtWidgets.QTableWidgetItem()
- self.UIMatchKnobs.setHorizontalHeaderItem(0, item)
- item = QtWidgets.QTableWidgetItem()
- self.UIMatchKnobs.setHorizontalHeaderItem(1, item)
- item = QtWidgets.QTableWidgetItem()
- self.UIMatchKnobs.setHorizontalHeaderItem(2, item)
- self.verticalLayout_7.addWidget(self.UIMatchKnobs)
- self.label_20 = QtWidgets.QLabel(self.tab_2)
- self.label_20.setObjectName("label_20")
- self.verticalLayout_7.addWidget(self.label_20)
- self.UIMatchTargets = QtWidgets.QTableWidget(self.tab_2)
- self.UIMatchTargets.setObjectName("UIMatchTargets")
- self.UIMatchTargets.setColumnCount(2)
- self.UIMatchTargets.setRowCount(0)
- item = QtWidgets.QTableWidgetItem()
- self.UIMatchTargets.setHorizontalHeaderItem(0, item)
- item = QtWidgets.QTableWidgetItem()
- self.UIMatchTargets.setHorizontalHeaderItem(1, item)
- self.verticalLayout_7.addWidget(self.UIMatchTargets)
- self.horizontalLayout_9.addLayout(self.verticalLayout_7)
- 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)
@@ -559,8 +480,6 @@ class Ui_OpticsGUI(object):
self.menuFile.setObjectName("menuFile")
self.menuHelp = QtWidgets.QMenu(self.menubar)
self.menuHelp.setObjectName("menuHelp")
- self.menuMatching = QtWidgets.QMenu(self.menubar)
- self.menuMatching.setObjectName("menuMatching")
OpticsGUI.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(OpticsGUI)
self.statusbar.setObjectName("statusbar")
@@ -685,21 +604,15 @@ class Ui_OpticsGUI(object):
self.menuFile.addAction(self.actionOpen_2)
self.menuFile.addAction(self.actionSave)
self.menuFile.addSeparator()
- 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.actionOpenMatchEditor)
- self.menuMatching.addAction(self.actionOpenScriptEditor)
self.menubar.addAction(self.menuFile.menuAction())
- self.menubar.addAction(self.menuMatching.menuAction())
self.menubar.addAction(self.menuHelp.menuAction())
self.retranslateUi(OpticsGUI)
- self.TabMaster.setCurrentIndex(2)
+ self.TabMaster.setCurrentIndex(0)
self.actionQuit.triggered.connect(OpticsGUI.close) # type: ignore
QtCore.QMetaObject.connectSlotsByName(OpticsGUI)
@@ -735,6 +648,21 @@ class Ui_OpticsGUI(object):
self.UIPY.setText(_translate("OpticsGUI", "30"))
self.UIUpdateFromMachine.setText(_translate("OpticsGUI", "Update Model from Machine"))
self.label_13.setText(_translate("OpticsGUI", "Status"))
+ self.UIMatchSelected.setText(_translate("OpticsGUI", "Match Selected"))
+ self.label_31.setText(_translate("OpticsGUI", "Matched Optics"))
+ self.matchbranches.setTitle(_translate("OpticsGUI", "Branches"))
+ self.UIMatchInjector.setText(_translate("OpticsGUI", "Injector"))
+ self.UIMatchPorthos.setText(_translate("OpticsGUI", "Porthos"))
+ self.UIMatchAthos.setText(_translate("OpticsGUI", "Athos"))
+ self.UIMatchAramis.setText(_translate("OpticsGUI", "Aramis"))
+ self.checkBox_3.setText(_translate("OpticsGUI", "Save matched machine settings automtically"))
+ self.checkBox.setText(_translate("OpticsGUI", "Initialize all magnets to zero before matching"))
+ self.checkBox_2.setText(_translate("OpticsGUI", "Overwrite default values for matching variables "))
+ self.label_19.setText(_translate("OpticsGUI", "Matching Variables"))
+ item = self.UIMatchKnobs.horizontalHeaderItem(0)
+ item.setText(_translate("OpticsGUI", "Parameter"))
+ item = self.UIMatchKnobs.horizontalHeaderItem(1)
+ item.setText(_translate("OpticsGUI", "Value"))
self.TabMaster.setTabText(self.TabMaster.indexOf(self.tab_3), _translate("OpticsGUI", "Track"))
self.groupBox_8.setTitle(_translate("OpticsGUI", "Magnets (Angle/ k1L / k2L)"))
self.label_23.setText(_translate("OpticsGUI", "Start"))
@@ -747,49 +675,8 @@ class Ui_OpticsGUI(object):
self.Mach2ModUnd.setText(_translate("OpticsGUI", "Model <- Sandbox <- Machine"))
self.SB2ModUnd.setText(_translate("OpticsGUI", "Model <- Sandbox"))
self.TabMaster.setTabText(self.TabMaster.indexOf(self.tab_8), _translate("OpticsGUI", "Sandbox"))
- self.label_31.setText(_translate("OpticsGUI", "Optics"))
- self.UIMatchInjector.setText(_translate("OpticsGUI", "Injector"))
- self.UIMatchAthos.setText(_translate("OpticsGUI", "Athos"))
- self.UIMatchPorthos.setText(_translate("OpticsGUI", "Porthos"))
- self.UIMatchAramis.setText(_translate("OpticsGUI", "Aramis"))
- self.UIMatchSelected.setText(_translate("OpticsGUI", "Match Selected"))
- self.label_14.setText(_translate("OpticsGUI", "Label"))
- self.label_15.setText(_translate("OpticsGUI", "Matching Order (Closest Reference Point)"))
- self.UIMatchRandom.setText(_translate("OpticsGUI", "Random Initialization"))
- self.label_21.setText(_translate("OpticsGUI", "Matching Point"))
- self.label_17.setText(_translate("OpticsGUI", "Start"))
- self.label_11.setText(_translate("OpticsGUI", "Sequence"))
- self.label_16.setText(_translate("OpticsGUI", "Match"))
- self.label_12.setText(_translate("OpticsGUI", "End"))
- self.label_19.setText(_translate("OpticsGUI", "Knobs"))
- item = self.UIMatchKnobs.horizontalHeaderItem(0)
- item.setText(_translate("OpticsGUI", "Parameter"))
- item = self.UIMatchKnobs.horizontalHeaderItem(1)
- item.setText(_translate("OpticsGUI", "Value"))
- item = self.UIMatchKnobs.horizontalHeaderItem(2)
- item.setText(_translate("OpticsGUI", "Limit"))
- self.label_20.setText(_translate("OpticsGUI", "Target"))
- item = self.UIMatchTargets.horizontalHeaderItem(0)
- item.setText(_translate("OpticsGUI", "Location"))
- 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"))
self.actionOpen_2.setText(_translate("OpticsGUI", "Open Settings..."))
self.actionOpen_2.setShortcut(_translate("OpticsGUI", "Ctrl+O"))
self.actionOpen.setText(_translate("OpticsGUI", "Open Model..."))
diff --git a/ui/OpticsToolsGui.ui b/ui/OpticsToolsGui.ui
index 3de848e..09a6bec 100644
--- a/ui/OpticsToolsGui.ui
+++ b/ui/OpticsToolsGui.ui
@@ -24,13 +24,13 @@
- 2
+ 0
Track
-
+
-
@@ -439,6 +439,204 @@
+ -
+
+
+
-
+
+
+
+ 12
+ 75
+ true
+
+
+
+ background-color: rgb(255, 255, 127);
+
+
+ Match Selected
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 10
+ 75
+ true
+
+
+
+ Matched Optics
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 10
+ 75
+ true
+
+
+
+
+
+
+ -
+
+
+
+ 75
+ true
+
+
+
+ Branches
+
+
+
-
+
+
+
+ 50
+ false
+
+
+
+ Injector
+
+
+
+ -
+
+
+
+ 50
+ false
+
+
+
+ Porthos
+
+
+
+ -
+
+
+
+ 50
+ false
+
+
+
+ Athos
+
+
+
+ -
+
+
+
+ 50
+ false
+
+
+
+ Aramis
+
+
+
+
+
+
+ -
+
+
+ Save matched machine settings automtically
+
+
+
+ -
+
+
+ Initialize all magnets to zero before matching
+
+
+
+ -
+
+
+ Overwrite default values for matching variables
+
+
+
+ -
+
+
+
+ 75
+ true
+
+
+
+ Matching Variables
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ Parameter
+
+
+
+
+ Value
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
-
@@ -591,396 +789,6 @@
-
-
- Matching
-
-
- -
-
-
-
-
-
- Optics
-
-
-
- -
-
-
- -
-
-
- Injector
-
-
-
- -
-
-
- Athos
-
-
-
- -
-
-
- Porthos
-
-
-
- -
-
-
- Aramis
-
-
-
- -
-
-
-
- 12
- 75
- true
-
-
-
- background-color: rgb(255, 255, 127);
-
-
- Match Selected
-
-
-
- -
-
-
-
-
-
- Label
-
-
-
- -
-
-
-
-
-
-
-
-
- -
-
-
- Matching Order (Closest Reference Point)
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 350
- 0
-
-
-
-
- -
-
-
- Random Initialization
-
-
-
-
-
- -
-
-
-
-
-
-
- 12
- 75
- true
-
-
-
- Matching Point
-
-
-
- -
-
-
-
-
-
- Start
-
-
-
- -
-
-
- true
-
-
-
- -
-
-
- true
-
-
-
- -
-
-
- Sequence
-
-
-
- -
-
-
- Match
-
-
-
- -
-
-
- true
-
-
-
- -
-
-
- End
-
-
-
- -
-
-
- true
-
-
-
-
-
- -
-
-
- Knobs
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- Parameter
-
-
-
-
- Value
-
-
-
-
- Limit
-
-
-
-
- -
-
-
- Target
-
-
-
- -
-
-
-
- Location
-
-
-
-
- Condition
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 242
- 20
-
-
-
-
-
-
-
-
- Matching Config (Expert)
-
-
- -
-
-
-
-
-
- Generate Matching File
-
-
-
- -
-
-
-
-
-
- Label
-
-
-
- -
-
-
- Custom
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Compression in Switchyard (%)
-
-
-
- -
-
-
- 0
-
-
-
- -
-
-
- Focal Strength Aramis (%)
-
-
-
- -
-
-
- 100
-
-
-
- -
-
-
- Focal Strength Aramis (%)
-
-
-
- -
-
-
- 100
-
-
-
- -
-
-
- SARCL02 as BC
-
-
-
- -
-
-
- R56 in SARCL02 (mm)
-
-
-
- -
-
-
- 0
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 380
- 20
-
-
-
-
-
-
@@ -1001,8 +809,6 @@
-
-
@@ -1013,16 +819,7 @@
-
-