other debug version
This commit is contained in:
@@ -171,7 +171,7 @@ class geometry:
|
||||
# [c d] [my] [py]
|
||||
|
||||
K, AA=self._lut_pix2pos
|
||||
pix2pos=self._pix2pos=np.asmatrix(np.ndarray((2, 2), np.float))
|
||||
pix2pos=self._pix2pos=np.asmatrix(np.ndarray((2, 2), np.float64))
|
||||
pix2pos[0, 0]=np.interp(zoom, K, AA[:, 0, 0])
|
||||
pix2pos[0, 1]=np.interp(zoom, K, AA[:, 0, 1])
|
||||
pix2pos[1, 0]=np.interp(zoom, K, AA[:, 1, 0])
|
||||
|
||||
@@ -29,6 +29,35 @@ try:
|
||||
except ImportError as e:
|
||||
_log.warning(e)
|
||||
|
||||
class Shutter:
|
||||
|
||||
def __init__(self,mode=1):
|
||||
self._mode=mode
|
||||
|
||||
def open(self):
|
||||
mode=self._mode
|
||||
if mode==0:
|
||||
_log.info('open simulated shutter')
|
||||
elif mode==1:
|
||||
# open laser shutter
|
||||
# epics.caput("SLAAR02-LMOT-M262:MOT.VAL", 1)
|
||||
# time.sleep(4)
|
||||
|
||||
# open fast shutter
|
||||
epics.caput("SARES30-LTIM01-EVR0:RearUniv0-Ena-SP", 1)
|
||||
_log.info('shutter opened')
|
||||
|
||||
def close(self):
|
||||
mode=self._mode
|
||||
if mode==0:
|
||||
_log.info('close simulated shutter')
|
||||
elif mode==1:
|
||||
# close fast shutter
|
||||
epics.caput("SARES30-LTIM01-EVR0:RearUniv0-Ena-SP", 0)
|
||||
|
||||
# close laser shutter
|
||||
# caput("SLAAR02-LMOT-M262:MOT.VAL", 40)
|
||||
_log.info('shutter closed')
|
||||
|
||||
class Deltatau:
|
||||
def __init__(self):
|
||||
|
||||
@@ -527,7 +527,7 @@ class FixTargetFrame(UsrROI):
|
||||
lh=QLineF(x-rx, y, x+rx, y)
|
||||
lv=QLineF(x, y-ry, x, y+ry)
|
||||
p.drawLines(lh, lv)
|
||||
p.drawEllipse(x-rx/2, y-ry/2, rx, ry)
|
||||
p.drawEllipse(int(x-rx/2), int(y-ry/2), int(rx), int(ry))
|
||||
|
||||
else:
|
||||
assert('unknown feducial type')
|
||||
|
||||
49
swissmx.py
49
swissmx.py
@@ -17,6 +17,7 @@ bitmask for simulation:
|
||||
0x08: camera
|
||||
0x10: Deltatau motors
|
||||
0x20: SmarAct motors
|
||||
0x40: shutter
|
||||
|
||||
"""
|
||||
import logging
|
||||
@@ -143,7 +144,6 @@ import pyqtUsrObj as UsrGO
|
||||
from epics_widgets.MotorTweak import MotorTweak
|
||||
from epics_widgets.SmaractMotorTweak import SmaractMotorTweak
|
||||
from epics_widgets.SimMotorTweak import SimMotorTweak
|
||||
from epics import caput, caget # TODO: shutter
|
||||
ts.log('Import part 5/8:')
|
||||
import numpy as np
|
||||
np.set_printoptions(suppress=True,linewidth=196)
|
||||
@@ -1759,7 +1759,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
exp_tab = self._tab_experiment
|
||||
|
||||
# add layouts
|
||||
exp_tab.setLayout(QVBoxLayout())
|
||||
#exp_tab.setLayout(QVBoxLayout())
|
||||
setup_tab.setLayout(QVBoxLayout())
|
||||
setup_tab.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
|
||||
self._setup_toolbox = tbox = QToolBox()
|
||||
@@ -2212,6 +2212,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
|
||||
#_log.critical('abort for test');return # RET
|
||||
geo = app._geometry
|
||||
shutter=app._shutter
|
||||
fn='/tmp/shapepath'
|
||||
try:
|
||||
dt=app._deltatau
|
||||
@@ -2293,26 +2294,24 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
return
|
||||
dlg.setLabelText("Homing and get ready");dlg+=5
|
||||
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.wait_armed() # wait until motors are at first position
|
||||
#time.sleep(1.0) # wait armed does not wor yet ?!?
|
||||
shutter.open()
|
||||
jf.acquire(num_pts)
|
||||
sp.trigger(0.5) # send a start trigger (if needed) after given time
|
||||
if not dt._comm is None:
|
||||
if dt._comm is None:
|
||||
dlg.setLabelText("run motion/acquisition")
|
||||
dlg.setMaximum(num_pts)
|
||||
for p in range(0,num_pts,int(num_pts/1000)):
|
||||
#_log.info(f'progress {p}/{num_pts}')
|
||||
dlg.setValue(p)
|
||||
time.sleep(.1)
|
||||
else:
|
||||
dlg.setLabelText("run motion/acquisition")
|
||||
dlg.setMaximum(num_pts)
|
||||
while True:
|
||||
p=sp.progress()
|
||||
p=int(sp.progress())
|
||||
#_log.info(f'progress {p}/{num_pts}')
|
||||
if p<0:
|
||||
break
|
||||
elif dlg.wasCanceled():
|
||||
@@ -2320,7 +2319,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
break
|
||||
#_log.info(f'progress {p}/{sp.points.shape[0]}')
|
||||
dlg.setValue(p)
|
||||
time.sleep(.1)
|
||||
time.sleep(1.) #wait 1 sec instead of .1...hopefully less segmentation faults
|
||||
if not dlg.wasCanceled():
|
||||
jf.gather_upload()
|
||||
dlg.setLabelText("upload gather data")
|
||||
@@ -2331,13 +2330,7 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
plt.show(block=False)
|
||||
#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)
|
||||
shutter.close()
|
||||
|
||||
def esc_run_steps(self, steps, title, esc_state):
|
||||
self._esc_state ="busy"
|
||||
@@ -3400,9 +3393,9 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
|
||||
sp.trigger(0.5) # send a start trigger (if needed) ater given time
|
||||
if not dt._comm is None:
|
||||
while True:
|
||||
p=sp.progress()
|
||||
p=int(sp.progress())
|
||||
if p<0: break
|
||||
print('progress %d/%d'%(p, sp.points.shape[0]));
|
||||
#print('progress %d/%d'%(p, num_pts))
|
||||
time.sleep(.1)
|
||||
sp.gather_upload(fnRec=fn+'.npz')
|
||||
#dp=deltatau.shapepath.DebugPlot(sp)
|
||||
@@ -4144,6 +4137,12 @@ if __name__=="__main__":
|
||||
app._camera.sim_gen(mode=1)
|
||||
else:
|
||||
app._camera = camera.epics_cam()
|
||||
|
||||
if args.sim&0x80:
|
||||
app._shutter = psi_device.Shutter(0)
|
||||
else:
|
||||
app._shutter = psi_device.Shutter(1)
|
||||
|
||||
#app._camera.run() is called in center_piece_update
|
||||
|
||||
startupWin.set(60, f'start main window')
|
||||
|
||||
Reference in New Issue
Block a user