SFELPHOTON-927: Beamtime Feb24

This commit is contained in:
2024-01-10 16:19:30 +01:00
parent e41a3ed7ed
commit 681d42dc2e
3 changed files with 75 additions and 53 deletions

View File

@@ -1992,7 +1992,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
mft.setAccessibleName(TASK_FIX_TARGET)
self._tabs_daq_methods.setCurrentWidget(mft) #set this as the active tabs
mft._cbType.addItems(["Fiducial", "FixTarget(12.5x12.5)", "FixTarget(23.0x23.0)", "FixTarget(<param>)", "Grid(<param>)", "SwissMX(<param>)", "SwissFEL(<param>)"])
mft._cbType.addItems(["Fiducial", "FixTarget(12.5x12.5)", "FixTarget(23.0x23.0)", "FixTarget(test)", "Grid()", "SwissMX()", "SwissFEL()"])
mft._btnAdd.clicked.connect(self.module_fix_target_add_obj)
mft._btnDelAll.clicked.connect(self.module_fix_target_del_all_obj)
mft._btnFit.clicked.connect(self.module_fix_target_fit_fiducial)
@@ -2110,15 +2110,38 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
#bm_pos_eu=self._goBeamMarker._pos_eu
#bm_size_eu=self._goBeamMarker._size_eu
try:
pLst=param.split(',')
pStr='{'
#parse the parameters: 'key:value [,key:value]'
# as key value separator : and = are allowed
#examples:
#Fiducial:
# no param
#FixTarget(12.5x12.5), FixTarget(23.0x23.0), FixTarget(test):
# code_gen:2
# code_gen=3 | tmove=10 | twait=30
#Grid():
# size:(30, 20)
# cnt:(30, 22)
# fiducialSize:0.1
#SwissMX():
# ofs:(.2, .2)
# width:10
# fidScl:.02
# fiducial:((.1, .1), (.1, 2.7), (10.3, .1), (10.3, 2.7))
#SwissFEL():
# ofs:(.2, .2)
# width:10
# fidScl:.02
# fiducial:((.1, .1), (.1, 2.2), (10.3, .1), (10.3, 2.2))
pLst=param.split('|')
pStr=list()
for p in pLst:
if not p: continue
m=re.match('\s*(.*?)\s*[=:]\s*(.*)\s*', p)
k, v=m.groups()
v=v.replace('(', '[').replace(')', ']')
pStr+=f'"{k}":{v}'
pStr+='}'
pStr.append(f'"{k}":{v}')
pStr='{'+','.join(pStr)+'}'
param=json.loads(pStr) # "ofs":[10, 5],"width":200,"fidScl":0.5,"fiducial":[[18,7],[25,16],[70, 20]]
except json.decoder.JSONDecodeError as e:
_log.error(f'{e}:{param}')
@@ -2162,9 +2185,9 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
fidScl=param.pop('fidScl',.02)
fiducial=param.pop('fiducial',((.1, .1), (.1, 2.2), (10.3, .1), (10.3, 2.2)))
fiducial=np.array(fiducial)
gp=psi_device.shapepath.GenPath(); gp.swissfel(ofs=ofs, width=width,flipy=True,**param)
gp=psi_device.shapepath.GenPath(); gp.swissfel(ofs=ofs, width=width,flipy=True)
sz=gp.points.max(0)+np.array(ofs)*2
go=UsrGO.Path((fx-sz[0]/2, fy-sz[1]/2), sz, gp.points, fiducial, fidScl)
go=UsrGO.Path((fx-sz[0]/2, fy-sz[1]/2), sz, gp.points, fiducial, fidScl,**param)
else:
_log.error('index not handeled')
@@ -2258,6 +2281,11 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
code_gen: 0 pvt motion using ptsTrf
1 pvt motion using trf and points
2 pvt motion, compact grid code
3 pvt motion, compact grid code move and wait
tmove: time to move
twait: time to wait
grid: grid dictionary with orig, pitch, count
trf: transformation matrix
points: list of points without transformation
@@ -2301,7 +2329,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
#dlg.show()
dlg.setLabelText("Setup Gather/Sync");dlg+=5
num_pts=kwargs['num_pts']
code_gen=kwargs['code_gen']
code_gen=kwargs.get('code_gen',0)
sp.setup_gather(num_pts)
sp.setup_sync(verbose=sp.verbose&0x40, timeOfs=dt_misc['time_ofs'], timeCor=dt_misc['time_cor'])
dlg.setLabelText("Download motion program");dlg+=5
@@ -2310,7 +2338,9 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
elif code_gen==1:
sp.setup_motion(fnPrg=fn+'.prg', mode=3, scale=1., dwell=10, points=kwargs['points'],trf=kwargs['trf'])
elif code_gen==2:
sp.setup_motion(fnPrg=fn+'.prg', mode=4, scale=1., dwell=10, grid=kwargs['grid'],trf=kwargs['trf'])
sp.setup_motion(fnPrg=fn+'.prg', mode=4, scale=1., dwell=10, grid=kwargs['grid'], trf=kwargs['trf'])
elif code_gen==3:
sp.setup_motion(fnPrg=fn+'.prg', mode=5, dwell=10, tmove=kwargs['tmove'] ,twait=kwargs['twait'], grid=kwargs['grid'],trf=kwargs['trf'])
try:
p=geo._fitPlane
# TODO: Cleanup