add gonio default positions
This commit is contained in:
17
app_utils.py
17
app_utils.py
@@ -6,7 +6,6 @@ _log=logging.getLogger(__name__)
|
||||
|
||||
from epics.ca import pend_event
|
||||
|
||||
|
||||
class PositionsNotReached(Exception):
|
||||
pass
|
||||
|
||||
@@ -29,20 +28,22 @@ def assert_tweaker_positions(targets, timeout=60.0):
|
||||
count=0
|
||||
summary=[]
|
||||
for i, m in enumerate(targets):
|
||||
motor, target, tolerance=m
|
||||
name=motor.short_name
|
||||
pend_event()
|
||||
cur=motor.get_rbv()
|
||||
done=motor.is_done()
|
||||
mot_tw, target, tolerance=m
|
||||
name=mot_tw._motor._short_name
|
||||
notSim=not type(mot_tw).__name__.startswith('Sim')
|
||||
|
||||
if notSim: pend_event()
|
||||
cur=mot_tw.get_rbv()
|
||||
done=mot_tw.is_done()
|
||||
s=f"check {name} {cur:.5g} == {target:.5g} [done={done}]"
|
||||
_log.debug(s)
|
||||
summary.append(s)
|
||||
if done and tolerance>=abs(cur-target):
|
||||
count+=1
|
||||
pend_event(0.1)
|
||||
if notSim: pend_event(0.1)
|
||||
if count==num_motors:
|
||||
break
|
||||
pend_event(0.1)
|
||||
if notSim: pend_event(0.1)
|
||||
|
||||
if count!=num_motors:
|
||||
raise PositionsNotReached("failed to reach target positions: {}".format("#".join(summary)))
|
||||
|
||||
Reference in New Issue
Block a user