SFELPHOTON-1128: debug stup-and-go motion
This commit is contained in:
@@ -122,7 +122,7 @@ class AppCfg(QSettings):
|
|||||||
if AppCfg.DT_HOST not in keys:
|
if AppCfg.DT_HOST not in keys:
|
||||||
dflt.append((AppCfg.DT_HOST, 'SAR-CPPM-EXPMX1'))
|
dflt.append((AppCfg.DT_HOST, 'SAR-CPPM-EXPMX1'))
|
||||||
if AppCfg.DT_MISC not in keys:
|
if AppCfg.DT_MISC not in keys:
|
||||||
dflt.append((AppCfg.DT_MISC,{'show_plots':True, 'vel_scl':1.0, 'pt2pt_time':10.0, 'time_ofs':0.03, 'time_cor':0.0005, 'sync_mode':1, 'sync_flag':3, 'verbose':0xff}))
|
dflt.append((AppCfg.DT_MISC,{'show_plots':True, 'vel_scl':1.0, 'fel_per':10.0, 'time_ofs':0.03, 'time_cor':0.0005, 'sync_mode':1, 'sync_flag':3, 'verbose':0xff}))
|
||||||
if AppCfg.DAQ_DET not in keys:
|
if AppCfg.DAQ_DET not in keys:
|
||||||
dflt.append((AppCfg.DAQ_DET, {
|
dflt.append((AppCfg.DAQ_DET, {
|
||||||
"name" : "JF17T16V01",
|
"name" : "JF17T16V01",
|
||||||
@@ -308,7 +308,7 @@ bit 1=2 : simulated frame trigger
|
|||||||
1 : simulated start and real frame trigger
|
1 : simulated start and real frame trigger
|
||||||
2 : real start and simulated frame trigger
|
2 : real start and simulated frame trigger
|
||||||
3 : simulated start and frame trigger
|
3 : simulated start and frame trigger
|
||||||
pt2pt_time : time point to point (needed sor sync code)
|
fel_per : FEL-period: time FEL-pulse to FEL-pulse in ms (needed for sync code)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
tip_verbose='''\
|
tip_verbose='''\
|
||||||
@@ -406,7 +406,7 @@ verbose bits:
|
|||||||
{'name':AppCfg.DT_MISC, 'title':'miscellaneous', 'type':'group', 'children':[
|
{'name':AppCfg.DT_MISC, 'title':'miscellaneous', 'type':'group', 'children':[
|
||||||
{'name':'show_plots', 'value':dt_misc['show_plots'], 'type':'bool', 'title':'show plots after collection'},
|
{'name':'show_plots', 'value':dt_misc['show_plots'], 'type':'bool', 'title':'show plots after collection'},
|
||||||
{'name':'vel_scl', 'value':dt_misc['vel_scl'], 'type':'float', 'limits':(0, 1), 'step':0.1, 'title':'velocity_scale', 'tip':"scale between smooth(1.0) and stop and go(0.0)"},
|
{'name':'vel_scl', 'value':dt_misc['vel_scl'], 'type':'float', 'limits':(0, 1), 'step':0.1, 'title':'velocity_scale', 'tip':"scale between smooth(1.0) and stop and go(0.0)"},
|
||||||
{'name':'pt2pt_time', 'value':dt_misc['pt2pt_time'], 'type':'float', 'step':0.1,'tip':"time in ms from point to point"},
|
{'name':'fel_per', 'value':dt_misc['fel_per'], 'type':'float', 'step':0.1,'tip':"FEL-period: time FEL-pulse to FEL-pulse in ms"},
|
||||||
{'name':'time_ofs', 'value':dt_misc['time_ofs'], 'type':'float', 'step':0.001,'decimals':4,'tip':"time offset for triggerSync (once)"},
|
{'name':'time_ofs', 'value':dt_misc['time_ofs'], 'type':'float', 'step':0.001,'decimals':4,'tip':"time offset for triggerSync (once)"},
|
||||||
{'name':'time_cor', 'value':dt_misc['time_cor'], 'type':'float', 'step':0.0001,'decimals':5,'tip':"time correction for triggerSync (each frame)"},
|
{'name':'time_cor', 'value':dt_misc['time_cor'], 'type':'float', 'step':0.0001,'decimals':5,'tip':"time correction for triggerSync (each frame)"},
|
||||||
{'name':'sync_mode', 'value':dt_misc['sync_mode'], 'type':'int', 'tip':tip_sync_mode},
|
{'name':'sync_mode', 'value':dt_misc['sync_mode'], 'type':'int', 'tip':tip_sync_mode},
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ class Deltatau:
|
|||||||
app=QApplication.instance()
|
app=QApplication.instance()
|
||||||
cfg=app._cfg
|
cfg=app._cfg
|
||||||
host=cfg.value(AppCfg.DT_HOST)
|
host=cfg.value(AppCfg.DT_HOST)
|
||||||
|
# sim=False;host='localhost:10001:10002' # this only moves motors during acquisition
|
||||||
if sim:
|
if sim:
|
||||||
self._comm=comm=None
|
self._comm=comm=None
|
||||||
self._gather=gather=None
|
self._gather=gather=None
|
||||||
@@ -119,6 +120,7 @@ class Jungfrau:
|
|||||||
def config(self,**kwargs):
|
def config(self,**kwargs):
|
||||||
if getattr(self,'_sim',False):
|
if getattr(self,'_sim',False):
|
||||||
_log.info(f'simulated')
|
_log.info(f'simulated')
|
||||||
|
return
|
||||||
app=QApplication.instance() #temproary fix, couldnt access these in function, maybe the bt above needs to be self.detectors ... etc
|
app=QApplication.instance() #temproary fix, couldnt access these in function, maybe the bt above needs to be self.detectors ... etc
|
||||||
cfg=app._cfg
|
cfg=app._cfg
|
||||||
det = cfg.value(AppCfg.DAQ_DET)
|
det = cfg.value(AppCfg.DAQ_DET)
|
||||||
@@ -193,6 +195,9 @@ class Jungfrau:
|
|||||||
rate_multiplicator=1, append_user_tag_to_data_dir=True)
|
rate_multiplicator=1, append_user_tag_to_data_dir=True)
|
||||||
|
|
||||||
def acquire(self, n_pulses, wait=False):
|
def acquire(self, n_pulses, wait=False):
|
||||||
|
if getattr(self,'_sim',False):
|
||||||
|
_log.info(f'simulated')
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
daq=self._daq
|
daq=self._daq
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
@@ -218,6 +223,9 @@ class Jungfrau:
|
|||||||
cfg.setValue(AppCfg.DAQ_RUN,run)
|
cfg.setValue(AppCfg.DAQ_RUN,run)
|
||||||
|
|
||||||
def gather_upload(self):
|
def gather_upload(self):
|
||||||
|
if getattr(self,'_sim',False):
|
||||||
|
_log.info(f'simulated')
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
daq=self._daq
|
daq=self._daq
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|||||||
31
swissmx.py
31
swissmx.py
@@ -11,14 +11,15 @@ SwissMx experiment application.
|
|||||||
|
|
||||||
|
|
||||||
bitmask for simulation:
|
bitmask for simulation:
|
||||||
0x01: backlight
|
0x001: backlight
|
||||||
0x02: illumination
|
0x002: illumination
|
||||||
0x04: zoom
|
0x004: zoom
|
||||||
0x08: camera
|
0x008: camera
|
||||||
0x10: Deltatau motors and motion code
|
0x010: EPICS motors Deltatau
|
||||||
0x20: SmarAct motors
|
0x020: EPICS motors SmarAct
|
||||||
0x40: shutter
|
0x040: shutter
|
||||||
0x80: Jungfrau
|
0x080: Jungfrau
|
||||||
|
0x100: Deltatau motion code
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
@@ -2313,7 +2314,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
|||||||
try:
|
try:
|
||||||
dt=app._deltatau
|
dt=app._deltatau
|
||||||
except AttributeError:
|
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:
|
try:
|
||||||
jf=app._jungfrau
|
jf=app._jungfrau
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
@@ -2322,7 +2323,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
|||||||
sp=dt._shapepath
|
sp=dt._shapepath
|
||||||
sp.verbose=dt_misc['verbose']
|
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_mode']=dt_misc['sync_mode']
|
||||||
sp.meta['sync_flag']=dt_misc['sync_flag']
|
sp.meta['sync_flag']=dt_misc['sync_flag']
|
||||||
|
|
||||||
@@ -2340,9 +2341,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
|||||||
#dlg.setAutoClose(True)
|
#dlg.setAutoClose(True)
|
||||||
#dlg.show()
|
#dlg.show()
|
||||||
dlg.setLabelText("Setup Gather/Sync");dlg+=5
|
dlg.setLabelText("Setup Gather/Sync");dlg+=5
|
||||||
num_pts=kwargs['num_pts']
|
|
||||||
code_gen=kwargs.get('code_gen',0)
|
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'])
|
sp.setup_sync(verbose=sp.verbose&0x40, timeOfs=dt_misc['time_ofs'], timeCor=dt_misc['time_cor'])
|
||||||
dlg.setLabelText("Download motion program");dlg+=5
|
dlg.setLabelText("Download motion program");dlg+=5
|
||||||
if code_gen==0:
|
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'])
|
sp.setup_motion(fnPrg=fn+'.prg', mode=4, scale=1., dwell=10, grid=kwargs['grid'], trf=kwargs['trf'])
|
||||||
elif code_gen==3:
|
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_motion(fnPrg=fn+'.prg', mode=5, dwell=10, tmove=kwargs['tmove'] ,twait=kwargs['twait'], grid=kwargs['grid'],trf=kwargs['trf'])
|
||||||
|
sp.setup_gather()
|
||||||
try:
|
try:
|
||||||
p=geo._fitPlane
|
p=geo._fitPlane
|
||||||
# TODO: Cleanup
|
# TODO: Cleanup
|
||||||
@@ -2419,13 +2419,14 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
|||||||
sp.wait_armed() # wait until motors are at first position
|
sp.wait_armed() # wait until motors are at first position
|
||||||
shutter.open()
|
shutter.open()
|
||||||
time.sleep(1.1)
|
time.sleep(1.1)
|
||||||
|
num_pts=kwargs['num_pts']
|
||||||
jf.acquire(num_pts)
|
jf.acquire(num_pts)
|
||||||
sp.trigger(1.0) # send a start trigger (if needed) after given time
|
sp.trigger(1.0) # send a start trigger (if needed) after given time
|
||||||
_log.info('start trigger sent')
|
_log.info('start trigger sent')
|
||||||
if dt._comm is None:
|
if dt._comm is None:
|
||||||
dlg.setLabelText("run motion/acquisition (simulated)")
|
dlg.setLabelText("run motion/acquisition (simulated)")
|
||||||
dlg.setMaximum(num_pts)
|
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}')
|
#_log.info(f'progress {p}/{num_pts}')
|
||||||
dlg.setValue(p)
|
dlg.setValue(p)
|
||||||
time.sleep(.1)
|
time.sleep(.1)
|
||||||
@@ -2434,14 +2435,14 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
|||||||
dlg.setMaximum(num_pts)
|
dlg.setMaximum(num_pts)
|
||||||
while True:
|
while True:
|
||||||
p=int(sp.progress())
|
p=int(sp.progress())
|
||||||
#_log.info(f'progress {p}/{num_pts}')
|
_log.info(f'progress {p}/{num_pts}')
|
||||||
if p<0:
|
if p<0:
|
||||||
break
|
break
|
||||||
elif dlg.wasCanceled():
|
elif dlg.wasCanceled():
|
||||||
dt._comm.gpascii.send_block('&1a;Gather.Enable=0')
|
dt._comm.gpascii.send_block('&1a;Gather.Enable=0')
|
||||||
break
|
break
|
||||||
#_log.info(f'progress {p}/{sp.points.shape[0]}')
|
#_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
|
time.sleep(1.) #wait 1 sec instead of .1...hopefully less segmentation faults
|
||||||
if not dlg.wasCanceled():
|
if not dlg.wasCanceled():
|
||||||
jf.gather_upload()
|
jf.gather_upload()
|
||||||
|
|||||||
Reference in New Issue
Block a user