major fixes
This commit is contained in:
@@ -138,6 +138,9 @@ git remote add sf-cristallina gac-cristall@saresc-cons-03:/sf/cristallina/applic
|
|||||||
|
|
||||||
git fetch sf-cristallina
|
git fetch sf-cristallina
|
||||||
|
|
||||||
|
# do local changes and commit stuff
|
||||||
|
git push sf-cristallina
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
----------------------------------- SCRATCH -----------------------------------
|
----------------------------------- SCRATCH -----------------------------------
|
||||||
|
|||||||
@@ -131,7 +131,10 @@ class AppCfg(QSettings):
|
|||||||
"factor" : 11.33,
|
"factor" : 11.33,
|
||||||
"geometry" : True,
|
"geometry" : True,
|
||||||
"double_pixel_action" : "mask",
|
"double_pixel_action" : "mask",
|
||||||
"remove_raw_files" : False
|
"remove_raw_files" : False,
|
||||||
|
"save_dap_results" : True,
|
||||||
|
"make_crystfel_files" : True,
|
||||||
|
"crystfel_lists_laser" : True,
|
||||||
}))
|
}))
|
||||||
if AppCfg.DAQ_LOC not in keys:
|
if AppCfg.DAQ_LOC not in keys:
|
||||||
dflt.append((AppCfg.DAQ_LOC, {'end_station':"cristallina", 'p_group':"p20516"}))
|
dflt.append((AppCfg.DAQ_LOC, {'end_station':"cristallina", 'p_group':"p20516"}))
|
||||||
@@ -387,6 +390,9 @@ verbose bits:
|
|||||||
{'name':'geometry', 'value':daq_det['geometry'], 'type':'bool'},
|
{'name':'geometry', 'value':daq_det['geometry'], 'type':'bool'},
|
||||||
{'name':'double_pixel_action', 'value':daq_det['double_pixel_action'], 'type':'str'},
|
{'name':'double_pixel_action', 'value':daq_det['double_pixel_action'], 'type':'str'},
|
||||||
{'name':'remove_raw_files', 'value':daq_det['remove_raw_files'], 'type':'bool'},
|
{'name':'remove_raw_files', 'value':daq_det['remove_raw_files'], 'type':'bool'},
|
||||||
|
{'name':'save_dap_results', 'value':daq_det['save_dap_results'], 'type':'bool'},
|
||||||
|
{'name':'make_crystfel_files', 'value':daq_det['make_crystfel_files'], 'type':'bool'},
|
||||||
|
{'name':'crystfel_lists_laser','value':daq_det['crystfel_lists_laser'],'type':'bool'}
|
||||||
]},
|
]},
|
||||||
{'name':AppCfg.DAQ_LOC, 'title':'location', 'type':'group', 'children':[
|
{'name':AppCfg.DAQ_LOC, 'title':'location', 'type':'group', 'children':[
|
||||||
{'name':'end_station', 'value':daq_loc['end_station'], 'type':'str',},
|
{'name':'end_station', 'value':daq_loc['end_station'], 'type':'str',},
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ def assert_tweaker_positions(targets, timeout=60.0):
|
|||||||
summary=[]
|
summary=[]
|
||||||
for i, m in enumerate(targets):
|
for i, m in enumerate(targets):
|
||||||
mot_tw, target, tolerance=m
|
mot_tw, target, tolerance=m
|
||||||
name=mot_tw._motor._short_name
|
label=mot_tw._label
|
||||||
notSim=not type(mot_tw).__name__.startswith('Sim')
|
notSim=not type(mot_tw).__name__.startswith('Sim')
|
||||||
|
|
||||||
if notSim: pend_event()
|
if notSim: pend_event()
|
||||||
cur=mot_tw.get_rbv()
|
cur=mot_tw.get_rbv()
|
||||||
done=mot_tw.is_done()
|
done=mot_tw.is_done()
|
||||||
s=f"check {name} {cur:.5g} == {target:.5g} [done={done}]"
|
s=f"check {label} {cur:.5g} == {target:.5g} [done={done}]"
|
||||||
_log.debug(s)
|
_log.debug(s)
|
||||||
summary.append(s)
|
summary.append(s)
|
||||||
if done and tolerance>=abs(cur-target):
|
if done and tolerance>=abs(cur-target):
|
||||||
|
|||||||
@@ -33,22 +33,23 @@ class MotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
self._locked = False
|
self._locked = False
|
||||||
self._label_style = 'basic'
|
self._label_style = 'basic'
|
||||||
self._templates_source = {
|
self._templates_source = {
|
||||||
'basic': '<b>{short_name}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>',
|
'basic': '<b>{label}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>',
|
||||||
'small': '<small>{short_name} <font size="small" color="#080">{{rbv:.{precision}f}} {units}</font><small>',
|
'small': '<small>{label} <font size="small" color="#080">{{rbv:.{precision}f}} {units}</font><small>',
|
||||||
'2 lines': '<b>{short_name}</b><br><font size="small" color="#080">{{rbv:.{precision}f}} {units}</font>',
|
'2 lines': '<b>{label}</b><br><font size="small" color="#080">{{rbv:.{precision}f}} {units}</font>',
|
||||||
'busy': '<b>{short_name}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>'
|
'busy': '<b>{label}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>'
|
||||||
}
|
}
|
||||||
self._templates = {}
|
self._templates = {}
|
||||||
|
|
||||||
|
|
||||||
def connect_motor(self, rec_name, short_name, **kwargs):
|
def connect_motor(self, rec_name, **kwargs):
|
||||||
# TODO: DO NOT USE Motor base class, but reduce to the only really needed PV: s.a. class QopticZoom(object)
|
# TODO: DO NOT USE Motor base class, but reduce to the only really needed PV: s.a. class QopticZoom(object)
|
||||||
# TODO: have a own motor Class as class SimMotor:
|
# TODO: have a own motor Class as class SimMotor:
|
||||||
m = Motor(motor_base)
|
label=kwargs['label']
|
||||||
|
self._label=label
|
||||||
|
m = Motor(rec_name)
|
||||||
m.get_position()
|
m.get_position()
|
||||||
self._ignore_limits = m.HLM == m.LLM # if both high/low limits are equal they are meaningless
|
self._ignore_limits = m.HLM == m.LLM # if both high/low limits are equal they are meaningless
|
||||||
self._motor = m
|
self._motor = m
|
||||||
m._short_name = short_name
|
|
||||||
self._rec_name = rec_name
|
self._rec_name = rec_name
|
||||||
|
|
||||||
for attr in ['RTYP', 'JVEL', 'HLS', 'LLS', 'TWV', 'RBV', 'VAL', 'LVIO', 'HLM', 'LLM']:
|
for attr in ['RTYP', 'JVEL', 'HLS', 'LLS', 'TWV', 'RBV', 'VAL', 'LVIO', 'HLM', 'LLM']:
|
||||||
@@ -96,6 +97,7 @@ class MotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
def set_val(self, **kw):
|
def set_val(self, **kw):
|
||||||
v = kw['char_value']
|
v = kw['char_value']
|
||||||
_log.debug('updating VAL = {}'.format(v))
|
_log.debug('updating VAL = {}'.format(v))
|
||||||
|
self._val=float(v) # rewrite in case of tweaking
|
||||||
self._drive_val.setText(v)
|
self._drive_val.setText(v)
|
||||||
|
|
||||||
|
|
||||||
@@ -187,7 +189,7 @@ class MotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
'''
|
'''
|
||||||
field = kw['motor_field']
|
field = kw['motor_field']
|
||||||
src = kw['source_field']
|
src = kw['source_field']
|
||||||
kw['alias'] = self.short_name
|
kw['alias'] = self._label
|
||||||
if field != src:
|
if field != src:
|
||||||
return
|
return
|
||||||
if field == 'VAL':
|
if field == 'VAL':
|
||||||
@@ -243,7 +245,7 @@ class MotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
def contextMenuEvent(self, event):
|
def contextMenuEvent(self, event):
|
||||||
m = self._motor
|
m = self._motor
|
||||||
menu = QMenu(self)
|
menu = QMenu(self)
|
||||||
menu.setTitle(self.short_name)
|
menu.setTitle(self._label)
|
||||||
|
|
||||||
lockmotor = QAction('lock motor', menu, checkable=True)
|
lockmotor = QAction('lock motor', menu, checkable=True)
|
||||||
lockmotor.setChecked(self._locked)
|
lockmotor.setChecked(self._locked)
|
||||||
@@ -336,7 +338,7 @@ class MotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
|
|
||||||
for k in source:
|
for k in source:
|
||||||
target[k] = source[k].format(
|
target[k] = source[k].format(
|
||||||
short_name=self.short_name,
|
label=self._label,
|
||||||
precision=m.PREC,
|
precision=m.PREC,
|
||||||
units=m.units)
|
units=m.units)
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -22,14 +22,13 @@ _log = logging.getLogger(__name__)
|
|||||||
#logger.setLevel(logging.INFO)
|
#logger.setLevel(logging.INFO)
|
||||||
|
|
||||||
class SimMotor:
|
class SimMotor:
|
||||||
def __init__(self,rec_name, short_name):
|
def __init__(self,rec_name):
|
||||||
self._llm = -10
|
self._llm = -10
|
||||||
self._hlm = 10
|
self._hlm = 10
|
||||||
self._prec = 5
|
self._prec = 5
|
||||||
self._twv = 0.1
|
self._twv = 0.1
|
||||||
self._units = 'mm'
|
self._units = 'mm'
|
||||||
self._pos = 3.1415
|
self._pos = 3.1415
|
||||||
self._short_name=short_name
|
|
||||||
self._rec_name=rec_name
|
self._rec_name=rec_name
|
||||||
|
|
||||||
class SimMotorTweak(QWidget, Ui_MotorTweak):
|
class SimMotorTweak(QWidget, Ui_MotorTweak):
|
||||||
@@ -48,17 +47,19 @@ class SimMotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
self._locked = False
|
self._locked = False
|
||||||
self._label_style = 'basic'
|
self._label_style = 'basic'
|
||||||
self._templates_source = {
|
self._templates_source = {
|
||||||
'basic': '<b>{short_name}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>',
|
'basic': '<b>{label}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>',
|
||||||
'small': '<small>{short_name} <font size="small" color="#080">{{rbv:.{precision}f}} {units}</font><small>',
|
'small': '<small>{label} <font size="small" color="#080">{{rbv:.{precision}f}} {units}</font><small>',
|
||||||
'2 lines': '<b>{short_name}</b><br><font size="small" color="#080">{{rbv:.{precision}f}} {units}</font>',
|
'2 lines': '<b>{label}</b><br><font size="small" color="#080">{{rbv:.{precision}f}} {units}</font>',
|
||||||
'busy': '<b>{short_name}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>'
|
'busy': '<b>{label}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>'
|
||||||
}
|
}
|
||||||
self._templates = {}
|
self._templates = {}
|
||||||
|
|
||||||
|
|
||||||
def connect_motor(self, rec_name, short_name, *args, **kwargs):
|
def connect_motor(self, rec_name, **kwargs):
|
||||||
self.label.setToolTip('{} => {}'.format(rec_name, short_name))
|
label=kwargs['label']
|
||||||
self._motor=m=SimMotor(rec_name, short_name)
|
self._label=label
|
||||||
|
self.label.setToolTip('{} => {}'.format(rec_name, label))
|
||||||
|
self._motor=m=SimMotor(rec_name)
|
||||||
self.set_motor_validator()
|
self.set_motor_validator()
|
||||||
self._drive_val.setText(str(m._pos))
|
self._drive_val.setText(str(m._pos))
|
||||||
self._drive_val.returnPressed.connect(self.move_abs)
|
self._drive_val.returnPressed.connect(self.move_abs)
|
||||||
@@ -107,7 +108,7 @@ class SimMotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
m._pos += dist
|
m._pos += dist
|
||||||
if delay:
|
if delay:
|
||||||
sleep(delay)
|
sleep(delay)
|
||||||
_log.debug('{} rel move => {}'.format(m._short_name, dist))
|
_log.debug('{} rel move => {} {:5.4g}'.format(self._label, dist,m._pos))
|
||||||
self.update_label()
|
self.update_label()
|
||||||
self.emit_signals(source_field='VAL')
|
self.emit_signals(source_field='VAL')
|
||||||
|
|
||||||
@@ -149,9 +150,9 @@ class SimMotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
if assert_position:
|
if assert_position:
|
||||||
wait=True
|
wait=True
|
||||||
if drive is None:
|
if drive is None:
|
||||||
_log.debug('{} abs target from widget'.format(m._short_name))
|
_log.debug('{} abs target from widget'.format(self._label))
|
||||||
drive = float(self._drive_val.text())
|
drive = float(self._drive_val.text())
|
||||||
_log.debug('{} abs move => {}'.format(m._short_name, drive))
|
_log.debug('{} abs move => {}'.format(self._label, drive))
|
||||||
m._pos=drive
|
m._pos=drive
|
||||||
self.update_label()
|
self.update_label()
|
||||||
self.emit_signals(source_field='VAL')
|
self.emit_signals(source_field='VAL')
|
||||||
@@ -225,7 +226,7 @@ class SimMotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
prec = self._prec
|
prec = self._prec
|
||||||
|
|
||||||
menu = QMenu(self)
|
menu = QMenu(self)
|
||||||
menu.setTitle(self.short_name)
|
menu.setTitle(self._label)
|
||||||
|
|
||||||
lockmotor = QAction('lock motor', menu, checkable=True)
|
lockmotor = QAction('lock motor', menu, checkable=True)
|
||||||
lockmotor.setChecked(self._locked)
|
lockmotor.setChecked(self._locked)
|
||||||
@@ -292,7 +293,7 @@ class SimMotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
|
|
||||||
for k in source:
|
for k in source:
|
||||||
target[k] = source[k].format(
|
target[k] = source[k].format(
|
||||||
short_name=m._short_name,
|
label=self._label,
|
||||||
precision=m._prec,
|
precision=m._prec,
|
||||||
units=m._units)
|
units=m._units)
|
||||||
self.label.setText(target[self._label_style].format(rbv=m._pos))
|
self.label.setText(target[self._label_style].format(rbv=m._pos))
|
||||||
|
|||||||
@@ -36,31 +36,33 @@ class SmaractMotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
self._locked = False
|
self._locked = False
|
||||||
self._label_style = 'basic'
|
self._label_style = 'basic'
|
||||||
self._templates_source = {
|
self._templates_source = {
|
||||||
'basic': '<b>{short_name}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>',
|
'basic': '<b>{label}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>',
|
||||||
'small': '<small>{short_name} <font size="small" color="#080">{{rbv:.{precision}f}} {units}</font><small>',
|
'small': '<small>{label} <font size="small" color="#080">{{rbv:.{precision}f}} {units}</font><small>',
|
||||||
'2 lines': '<b>{short_name}</b><br><font size="small" color="#080">{{rbv:.{precision}f}} {units}</font>',
|
'2 lines': '<b>{label}</b><br><font size="small" color="#080">{{rbv:.{precision}f}} {units}</font>',
|
||||||
'busy': '<b>{short_name}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>'
|
'busy': '<b>{label}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>'
|
||||||
}
|
}
|
||||||
self._templates = {}
|
self._templates = {}
|
||||||
|
|
||||||
|
|
||||||
def connect_motor(self, motor_base, short_name=None, *args, **kwargs):
|
def connect_motor(self, rec_name, **kwargs):
|
||||||
# TODO: DO NOT USE so many PVs, but reduce to the only really needed PV: s.a. class QopticZoom(object)
|
# TODO: DO NOT USE so many PVs, but reduce to the only really needed PV: s.a. class QopticZoom(object)
|
||||||
self._pvname = motor_base+':DRIVE'
|
label=kwargs['label']
|
||||||
self._pv_name = PV(motor_base+':NAME')
|
self._label=label
|
||||||
self._pv_drive = PV(motor_base+':DRIVE')
|
self._pvname = rec_name+':DRIVE'
|
||||||
self._pv_readback = PV(motor_base+':MOTRBV')
|
self._pv_name = PV(rec_name+':NAME')
|
||||||
self._pv_tweak_r = PV(motor_base+':TWR.PROC')
|
self._pv_drive = PV(rec_name+':DRIVE')
|
||||||
self._pv_tweak_f = PV(motor_base+':TWF.PROC')
|
self._pv_readback = PV(rec_name+':MOTRBV')
|
||||||
self._pv_tweak_val = PV(motor_base+':TWV')
|
self._pv_tweak_r = PV(rec_name+':TWR.PROC')
|
||||||
self._pv_status = PV(motor_base + ':STATUS')
|
self._pv_tweak_f = PV(rec_name+':TWF.PROC')
|
||||||
self._pv_home_f = PV(motor_base + ':FRM_FORW.PROC')
|
self._pv_tweak_val = PV(rec_name+':TWV')
|
||||||
self._pv_home_b = PV(motor_base + ':FRM_BACK.PROC')
|
self._pv_status = PV(rec_name + ':STATUS')
|
||||||
self._pv_is_homed = PV(motor_base + ':GET_HOMED')
|
self._pv_home_f = PV(rec_name + ':FRM_FORW.PROC')
|
||||||
self._pv_llm = PV(motor_base + ':LLM')
|
self._pv_home_b = PV(rec_name + ':FRM_BACK.PROC')
|
||||||
self._pv_hlm = PV(motor_base + ':HLM')
|
self._pv_is_homed = PV(rec_name + ':GET_HOMED')
|
||||||
|
self._pv_llm = PV(rec_name + ':LLM')
|
||||||
|
self._pv_hlm = PV(rec_name + ':HLM')
|
||||||
|
|
||||||
self.label.setToolTip('{} => {}'.format(motor_base, self._pv_name.get()))
|
self.label.setToolTip('{} => {}'.format(rec_name, self._pv_name.get()))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._prec = kwargs['prec']
|
self._prec = kwargs['prec']
|
||||||
@@ -73,9 +75,6 @@ class SmaractMotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
self._units = 'mm'
|
self._units = 'mm'
|
||||||
|
|
||||||
self._ignore_limits = self._pv_llm.get() == self._pv_hlm.get() # if both high/low limits are equal they are meaningless
|
self._ignore_limits = self._pv_llm.get() == self._pv_hlm.get() # if both high/low limits are equal they are meaningless
|
||||||
if not short_name:
|
|
||||||
short_name = self._pv_name.value
|
|
||||||
self.short_name = short_name
|
|
||||||
|
|
||||||
self.set_motor_validator()
|
self.set_motor_validator()
|
||||||
self._drive_val.setText(self._pv_drive.get(as_string=True))
|
self._drive_val.setText(self._pv_drive.get(as_string=True))
|
||||||
@@ -169,9 +168,9 @@ class SmaractMotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
if assert_position:
|
if assert_position:
|
||||||
wait=True
|
wait=True
|
||||||
if drive is None:
|
if drive is None:
|
||||||
logger.debug('{} abs target from widget'.format(self.short_name))
|
logger.debug('{} abs target from widget'.format(self._label))
|
||||||
drive = float(self._drive_val.text())
|
drive = float(self._drive_val.text())
|
||||||
logger.debug('{} abs move => {}'.format(self.short_name, drive))
|
logger.debug('{} abs move => {}'.format(self._label, drive))
|
||||||
self._pv_drive.put(drive)
|
self._pv_drive.put(drive)
|
||||||
if wait:
|
if wait:
|
||||||
self.wait()
|
self.wait()
|
||||||
@@ -243,7 +242,7 @@ class SmaractMotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
prec = self._prec
|
prec = self._prec
|
||||||
|
|
||||||
menu = QMenu(self)
|
menu = QMenu(self)
|
||||||
menu.setTitle(self.short_name)
|
menu.setTitle(self._label)
|
||||||
|
|
||||||
lockmotor = QAction('lock motor', menu, checkable=True)
|
lockmotor = QAction('lock motor', menu, checkable=True)
|
||||||
lockmotor.setChecked(self._locked)
|
lockmotor.setChecked(self._locked)
|
||||||
@@ -309,7 +308,7 @@ class SmaractMotorTweak(QWidget, Ui_MotorTweak):
|
|||||||
|
|
||||||
for k in source:
|
for k in source:
|
||||||
target[k] = source[k].format(
|
target[k] = source[k].format(
|
||||||
short_name=self.short_name,
|
label=self._label,
|
||||||
precision=self._prec,
|
precision=self._prec,
|
||||||
units=self._units)
|
units=self._units)
|
||||||
self.label.setText(target[self._label_style].format(rbv=self._pv_readback.get()))
|
self.label.setText(target[self._label_style].format(rbv=self._pv_readback.get()))
|
||||||
|
|||||||
66
swissmx.py
66
swissmx.py
@@ -88,6 +88,7 @@ import pyqtUsrObj as UsrGO
|
|||||||
from epics_widgets.MotorTweak import MotorTweak
|
from epics_widgets.MotorTweak import MotorTweak
|
||||||
from epics_widgets.SmaractMotorTweak import SmaractMotorTweak
|
from epics_widgets.SmaractMotorTweak import SmaractMotorTweak
|
||||||
from epics_widgets.SimMotorTweak import SimMotorTweak
|
from epics_widgets.SimMotorTweak import SimMotorTweak
|
||||||
|
# from epics import caput, caget # TODO: shutter
|
||||||
ts.log('Import part 5/8:')
|
ts.log('Import part 5/8:')
|
||||||
import numpy as np
|
import numpy as np
|
||||||
np.set_printoptions(suppress=True,linewidth=196)
|
np.set_printoptions(suppress=True,linewidth=196)
|
||||||
@@ -811,22 +812,22 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
|||||||
self.move_post_tube("out")
|
self.move_post_tube("out")
|
||||||
bl.move(pos)
|
bl.move(pos)
|
||||||
|
|
||||||
def get_tweaker(self, rec, alias=None, label=None, mtype="epics_motor", layout=None, **kwargs):
|
def get_tweaker(self, rec, mtype=0, **kwargs):
|
||||||
app = QApplication.instance()
|
app = QApplication.instance()
|
||||||
sim=app._args.sim
|
sim=app._args.sim
|
||||||
if mtype == "epics_motor":
|
if mtype == 0: # default epics motor record
|
||||||
if sim&0x10:
|
if sim&0x10:
|
||||||
m=SimMotorTweak()
|
m_tw=SimMotorTweak()
|
||||||
else:
|
else:
|
||||||
m = MotorTweak()
|
m_tw=MotorTweak()
|
||||||
else:
|
elif mtype==1: # smaract motor record
|
||||||
if sim&0x20:
|
if sim&0x20:
|
||||||
m=SimMotorTweak()
|
m_tw=SimMotorTweak()
|
||||||
else:
|
else:
|
||||||
m = SmaractMotorTweak()
|
m_tw=SmaractMotorTweak()
|
||||||
m.connect_motor(rec, label, **kwargs)
|
m_tw.connect_motor(rec, **kwargs)
|
||||||
self.tweakers[alias] = m
|
self.tweakers[kwargs['alias']] = m_tw
|
||||||
return m
|
return m_tw
|
||||||
|
|
||||||
def build_post_tube_tandem_tweaker(self):
|
def build_post_tube_tandem_tweaker(self):
|
||||||
block = QWidget()
|
block = QWidget()
|
||||||
@@ -922,8 +923,8 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
|||||||
but.clicked.connect(f(v))
|
but.clicked.connect(f(v))
|
||||||
c.layout().addWidget(but, 0, i)
|
c.layout().addWidget(but, 0, i)
|
||||||
widgets = [
|
widgets = [
|
||||||
self.get_tweaker(f"{pfx}1", alias="colli_x", label="colli X", mtype="smaract_motor",),
|
self.get_tweaker(f"{pfx}1", alias="colli_x", label="colli X", mtype=1,),
|
||||||
self.get_tweaker(f"{pfx}2", alias="colli_y", label="colli Y", mtype="smaract_motor",),
|
self.get_tweaker(f"{pfx}2", alias="colli_y", label="colli Y", mtype=1,),
|
||||||
c,
|
c,
|
||||||
]
|
]
|
||||||
qutilities.add_item_to_toolbox(toolbox,"Collimator",widget_list=widgets)
|
qutilities.add_item_to_toolbox(toolbox,"Collimator",widget_list=widgets)
|
||||||
@@ -931,11 +932,11 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
|||||||
def build_group_posttube(self, toolbox):
|
def build_group_posttube(self, toolbox):
|
||||||
pfx=QApplication.instance()._cfg.value(AppCfg.GBL_DEV_PREFIX)[1]
|
pfx=QApplication.instance()._cfg.value(AppCfg.GBL_DEV_PREFIX)[1]
|
||||||
widgets = [
|
widgets = [
|
||||||
self.get_tweaker(f"{pfx}4", alias="tube_usx", label="upstream X", mtype="smaract_motor",),
|
self.get_tweaker(f"{pfx}4", alias="tube_usx", label="upstream X", mtype=1,),
|
||||||
self.get_tweaker(f"{pfx}6", alias="tube_usy", label="upstream Y", mtype="smaract_motor",),
|
self.get_tweaker(f"{pfx}6", alias="tube_usy", label="upstream Y", mtype=1,),
|
||||||
self.get_tweaker(f"{pfx}5", alias="tube_dsx", label="downstream X", mtype="smaract_motor",),
|
self.get_tweaker(f"{pfx}5", alias="tube_dsx", label="downstream X", mtype=1,),
|
||||||
self.get_tweaker(f"{pfx}7", alias="tube_dsy", label="downstream Y", mtype="smaract_motor",),
|
self.get_tweaker(f"{pfx}7", alias="tube_dsy", label="downstream Y", mtype=1,),
|
||||||
self.get_tweaker(f"{pfx}8", alias="tube_z", label="tube Z", mtype="smaract_motor"),
|
self.get_tweaker(f"{pfx}8", alias="tube_z", label="tube Z", mtype=1),
|
||||||
]
|
]
|
||||||
c = QWidget()
|
c = QWidget()
|
||||||
c.setLayout(QGridLayout())
|
c.setLayout(QGridLayout())
|
||||||
@@ -962,8 +963,8 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
|||||||
def build_group_xeye(self, toolbox):
|
def build_group_xeye(self, toolbox):
|
||||||
pfx=QApplication.instance()._cfg.value(AppCfg.GBL_DEV_PREFIX)[1]
|
pfx=QApplication.instance()._cfg.value(AppCfg.GBL_DEV_PREFIX)[1]
|
||||||
widgets=[
|
widgets=[
|
||||||
self.get_tweaker(f"{pfx}14", alias="xeye_x", label="X", mtype="smaract_motor"),
|
self.get_tweaker(f"{pfx}14", alias="xeye_x", label="X", mtype=1),
|
||||||
self.get_tweaker(f"{pfx}15", alias="xeye_y", label="Y", mtype="smaract_motor"),
|
self.get_tweaker(f"{pfx}15", alias="xeye_y", label="Y", mtype=1),
|
||||||
]
|
]
|
||||||
qutilities.add_item_to_toolbox(toolbox,"X-Ray Eye",widget_list=widgets)
|
qutilities.add_item_to_toolbox(toolbox,"X-Ray Eye",widget_list=widgets)
|
||||||
|
|
||||||
@@ -1539,6 +1540,7 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
|||||||
app=QApplication.instance()
|
app=QApplication.instance()
|
||||||
steps = [
|
steps = [
|
||||||
# lambda: sample_selection.tell.set_current(30.0),
|
# lambda: sample_selection.tell.set_current(30.0),
|
||||||
|
lambda:self.move_detector("out"),
|
||||||
lambda: self.move_collimator("out"),
|
lambda: self.move_collimator("out"),
|
||||||
lambda:self.move_detector("out"),
|
lambda:self.move_detector("out"),
|
||||||
lambda:self.move_post_tube("out"),
|
lambda:self.move_post_tube("out"),
|
||||||
@@ -2158,6 +2160,16 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
|||||||
return
|
return
|
||||||
dlg.setLabelText("Homing and get ready");dlg+=5
|
dlg.setLabelText("Homing and get ready");dlg+=5
|
||||||
sp.homing() # homing if needed
|
sp.homing() # homing if needed
|
||||||
|
|
||||||
|
# TODO: shutter
|
||||||
|
# open laser shutter
|
||||||
|
# caput("SLAAR02-LMOT-M262:MOT.VAL", 1)
|
||||||
|
# time.sleep(4)
|
||||||
|
|
||||||
|
# TODO: shutter
|
||||||
|
# open fast shutter
|
||||||
|
#caput("SARES30-LTIM01-EVR0:RearUniv0-Ena-SP", 1)
|
||||||
|
|
||||||
sp.run() # start motion program
|
sp.run() # start motion program
|
||||||
sp.wait_armed() # wait until motors are at first position
|
sp.wait_armed() # wait until motors are at first position
|
||||||
#time.sleep(1.0) # wait armed does not wor yet ?!?
|
#time.sleep(1.0) # wait armed does not wor yet ?!?
|
||||||
@@ -2186,6 +2198,14 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
|||||||
plt.show(block=False)
|
plt.show(block=False)
|
||||||
#plt.show(block=True)
|
#plt.show(block=True)
|
||||||
|
|
||||||
|
# TODO: shutter
|
||||||
|
# clos fast shutter
|
||||||
|
# caput("SARES30-LTIM01-EVR0:RearUniv0-Ena-SP", 0)
|
||||||
|
|
||||||
|
# TODO: shutter
|
||||||
|
# close laser shutter
|
||||||
|
# caput("SLAAR02-LMOT-M262:MOT.VAL", 40)
|
||||||
|
|
||||||
def esc_run_steps(self, steps, title, esc_state):
|
def esc_run_steps(self, steps, title, esc_state):
|
||||||
self._esc_state ="busy"
|
self._esc_state ="busy"
|
||||||
with pg.ProgressDialog(title, 0, len(steps)) as dlg:
|
with pg.ProgressDialog(title, 0, len(steps)) as dlg:
|
||||||
@@ -3034,10 +3054,10 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
|||||||
toolbox,
|
toolbox,
|
||||||
"Slits",
|
"Slits",
|
||||||
widget_list=[
|
widget_list=[
|
||||||
self.get_tweaker(f"{pfx}10", alias="slit_right", label="left", mtype="smaract_motor", ),
|
self.get_tweaker(f"{pfx}10", alias="slit_right", label="left", mtype=1, ),
|
||||||
self.get_tweaker(f"{pfx}11", alias="slit_left", label="right", mtype="smaract_motor",),
|
self.get_tweaker(f"{pfx}11", alias="slit_left", label="right", mtype=1,),
|
||||||
self.get_tweaker(f"{pfx}12", alias="slit_bottom", label="bottom", mtype="smaract_motor",),
|
self.get_tweaker(f"{pfx}12", alias="slit_bottom", label="bottom", mtype=1,),
|
||||||
self.get_tweaker(f"{pfx}13",alias="slit_top",label="top",mtype="smaract_motor",),
|
self.get_tweaker(f"{pfx}13",alias="slit_top",label="top",mtype=1,),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user