SFELPHOTON-1128: debug stup-and-go motion
This commit is contained in:
31
swissmx.py
31
swissmx.py
@@ -11,14 +11,15 @@ SwissMx experiment application.
|
||||
|
||||
|
||||
bitmask for simulation:
|
||||
0x01: backlight
|
||||
0x02: illumination
|
||||
0x04: zoom
|
||||
0x08: camera
|
||||
0x10: Deltatau motors and motion code
|
||||
0x20: SmarAct motors
|
||||
0x40: shutter
|
||||
0x80: Jungfrau
|
||||
0x001: backlight
|
||||
0x002: illumination
|
||||
0x004: zoom
|
||||
0x008: camera
|
||||
0x010: EPICS motors Deltatau
|
||||
0x020: EPICS motors SmarAct
|
||||
0x040: shutter
|
||||
0x080: Jungfrau
|
||||
0x100: Deltatau motion code
|
||||
|
||||
"""
|
||||
import logging
|
||||
@@ -2313,7 +2314,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
try:
|
||||
dt=app._deltatau
|
||||
except AttributeError:
|
||||
app._deltatau=dt=psi_device.Deltatau(app._args.sim&0x10!=0)
|
||||
app._deltatau=dt=psi_device.Deltatau(app._args.sim&0x100!=0)
|
||||
try:
|
||||
jf=app._jungfrau
|
||||
except AttributeError:
|
||||
@@ -2322,7 +2323,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
sp=dt._shapepath
|
||||
sp.verbose=dt_misc['verbose']
|
||||
|
||||
sp.meta['pt2pt_time']=dt_misc['pt2pt_time']
|
||||
sp.meta['fel_per']=dt_misc['fel_per']
|
||||
sp.meta['sync_mode']=dt_misc['sync_mode']
|
||||
sp.meta['sync_flag']=dt_misc['sync_flag']
|
||||
|
||||
@@ -2340,9 +2341,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
#dlg.setAutoClose(True)
|
||||
#dlg.show()
|
||||
dlg.setLabelText("Setup Gather/Sync");dlg+=5
|
||||
num_pts=kwargs['num_pts']
|
||||
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
|
||||
if code_gen==0:
|
||||
@@ -2353,6 +2352,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
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'])
|
||||
sp.setup_gather()
|
||||
try:
|
||||
p=geo._fitPlane
|
||||
# TODO: Cleanup
|
||||
@@ -2419,13 +2419,14 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
sp.wait_armed() # wait until motors are at first position
|
||||
shutter.open()
|
||||
time.sleep(1.1)
|
||||
num_pts=kwargs['num_pts']
|
||||
jf.acquire(num_pts)
|
||||
sp.trigger(1.0) # send a start trigger (if needed) after given time
|
||||
_log.info('start trigger sent')
|
||||
if dt._comm is None:
|
||||
dlg.setLabelText("run motion/acquisition (simulated)")
|
||||
dlg.setMaximum(num_pts)
|
||||
for p in range(0,num_pts,int(num_pts/100)):
|
||||
for p in range(0,num_pts,1+int(num_pts/100)):
|
||||
#_log.info(f'progress {p}/{num_pts}')
|
||||
dlg.setValue(p)
|
||||
time.sleep(.1)
|
||||
@@ -2434,14 +2435,14 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
dlg.setMaximum(num_pts)
|
||||
while True:
|
||||
p=int(sp.progress())
|
||||
#_log.info(f'progress {p}/{num_pts}')
|
||||
_log.info(f'progress {p}/{num_pts}')
|
||||
if p<0:
|
||||
break
|
||||
elif dlg.wasCanceled():
|
||||
dt._comm.gpascii.send_block('&1a;Gather.Enable=0')
|
||||
break
|
||||
#_log.info(f'progress {p}/{sp.points.shape[0]}')
|
||||
dlg.setValue(p)
|
||||
dlg.setValue(max(p,num_pts))
|
||||
time.sleep(1.) #wait 1 sec instead of .1...hopefully less segmentation faults
|
||||
if not dlg.wasCanceled():
|
||||
jf.gather_upload()
|
||||
|
||||
Reference in New Issue
Block a user