turn of monitors during data collection
This commit is contained in:
33
swissmx.py
33
swissmx.py
@@ -715,6 +715,7 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
||||
_log.debug(f'diff:{k},{v} != {paramSv[k]}')
|
||||
|
||||
cam.run(self.cb_new_frame_pv)
|
||||
app._pv_mon_lst.append(cam._pv['pic'])
|
||||
|
||||
def cb_new_frame_pv(self, **kwargs):
|
||||
try: #pv-monitor-func
|
||||
@@ -995,11 +996,19 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
||||
|
||||
#pv-monitor-func
|
||||
#_log.info('modify monitors')
|
||||
#for w in widgets[1:-1]: #ignore last item
|
||||
# for k,pv in w._motor._pvs.items():
|
||||
# pv.auto_monitor=False
|
||||
# for k,pv in w._motor._pvs.items():
|
||||
# pv.auto_monitor=True
|
||||
app=QApplication.instance()
|
||||
pv_mon_lst=app._pv_mon_lst
|
||||
try:
|
||||
for w in widgets[:-1]: #ignore last item
|
||||
for pv in w._motor._pvs.values():
|
||||
pv_mon_lst.append(pv)
|
||||
# for k,pv in w._motor._pvs.items():
|
||||
# pv.auto_monitor=False
|
||||
# for k,pv in w._motor._pvs.items():
|
||||
# pv.auto_monitor=True
|
||||
except AttributeError as e:
|
||||
sim=app._args.sim
|
||||
assert(sim&0x10,'assuming simulated motors')
|
||||
|
||||
def build_group_collimator(self, toolbox):
|
||||
pfx=QApplication.instance()._cfg.value(AppCfg.GBL_DEV_PREFIX)[1]
|
||||
@@ -2262,6 +2271,11 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
sp.meta['sync_mode']=dt_misc['sync_mode']
|
||||
sp.meta['sync_flag']=dt_misc['sync_flag']
|
||||
|
||||
#pv-monitor-func: stop monitors
|
||||
pv_mon_lst=app._pv_mon_lst
|
||||
for pv in pv_mon_lst:
|
||||
pv.auto_monitor=False
|
||||
|
||||
with pg.ProgressDialog('Progress', 0, 100) as dlg:
|
||||
dlg.setWindowModality(Qt.WindowModal)
|
||||
#dlg.setRange(0, 0)
|
||||
@@ -2325,6 +2339,9 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
comm.gpascii._cb_func=lambda i, sz:self.cb_progress(i, sz, dlg)
|
||||
|
||||
if dlg.wasCanceled():
|
||||
# pv-monitor-func: start monitors
|
||||
for pv in pv_mon_lst:
|
||||
pv.auto_monitor=True
|
||||
return
|
||||
dlg.setLabelText("Homing and get ready");dlg+=5
|
||||
sp.homing() # homing if needed
|
||||
@@ -2365,6 +2382,9 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
#plt.show(block=True)
|
||||
|
||||
shutter.close()
|
||||
# pv-monitor-func: start monitors
|
||||
for pv in pv_mon_lst:
|
||||
pv.auto_monitor=True
|
||||
|
||||
def esc_run_steps(self, steps, title, esc_state):
|
||||
self._esc_state ="busy"
|
||||
@@ -4139,6 +4159,9 @@ if __name__=="__main__":
|
||||
|
||||
app._args=args
|
||||
|
||||
app._pv_mon_lst=list() #pv-monitor-func: list of all pv that are monitored and that should
|
||||
# be turned on/off during data collection to avoid (hopefully) segmentation fault
|
||||
|
||||
startupWin.set(5, f'load settings')
|
||||
app._cfg=cfg=AppCfg()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user