This commit is contained in:
2024-11-25 14:04:26 +01:00
parent bea723d7f8
commit f545812bc1
2 changed files with 99 additions and 64 deletions

View File

@@ -60,13 +60,6 @@ class HitReturnEval:
#vgrid: grid parameters: {orig:(0,0),pitch(10,10),cnt:(10,10),mode:0}
#vp0: x/y koordinates of well to start (default 0,0)
#vsz: size of wells to cycle (must be 2n x m)
g=kwargs['grid']
ox,oy=g['pos'] #origin position in um (or counts if scaled)
px,py=g['pitch'] #pitch to next position in um (or 1 if scaled)
nx,ny=g['count'] #total count of wells
sx,sy=kwargs['ssz'] #section size (in wells)
tx,ty=nx//sx,ny//sy #total sections
#smv=kwargs['smv'] #time(in num of shots) to move to next section (horiz/vert)
#swait=kwargs['smv'] #wait after <swait> section for motion trigger. swait=0:never wait
@@ -81,11 +74,30 @@ class HitReturnEval:
# | | | | | | | | | | | |
# 1-2 1-2 1-2 1-2 1-2 1-2
g=kwargs['grid']
ox,oy=g['pos'] #origin position in um (or counts if scaled)
px,py=g['pitch'] #pitch to next position in um (or 1 if scaled)
nx,ny=g['count'] #total count of wells
sx,sy=kwargs['ssz'] #section size (in wells)
try:
tsx, tsy=kwargs['smv'] # time(in num of shots) to move to next section (horiz/vert)
except KeyError as e:
tsx=sx-1
tsy=sy
try:
tsd=kwargs['sdelay']
except KeyError as e:
tsd=sx*sy
tsd+=1-sx*sy # sdl are shots to wait at position #(6)
tx,ty=nx//sx,ny//sy #total sections
vsx=vsy=1 # scaled velocity
t=1 #motion pvt tome scaling
k=-1 # key position
cx,cy=0,0 # section counter
x0,y0,n=0,0,0 # counter well in region
dx,dy=0,1 # motion pitch
vsx=vsy=1 # scaled velocity
vx,vy=0,vsy # scaled velocity
mv=list()
while(True):
@@ -98,6 +110,8 @@ class HitReturnEval:
print(f'X{x}:{vx} Y{y}:{vy} ({k}|{dx}|{dy}|{n})')
mv.append((x+.1*n,y+.1*n,n))
self.updatePlt(mv,vx,vy)
if t !=1:
print('pvt 10')
if k>=0: #if keypoint not directly followed by an other keypoint, define future velocity
if k in (0,4):
vx,vy=0,vsy
@@ -107,10 +121,14 @@ class HitReturnEval:
vx,vy=-vsx,0
elif k==6:
n+=1
if tsd!=1:
print(f'pvt {10*tsd}');t=tsd;time.sleep(.1*tsd)
elif k==7:
print('next h section')
cx+=1
x0,y0,n,dx,dy=0,0,0,0,0
if tsx!=1:
print(f'pvt {10*tsx}');t=tsx;time.sleep(.1*tsx)
elif k==8:
print('next v section')
cx=0;cy+=1
@@ -118,6 +136,8 @@ class HitReturnEval:
if cy>=ty:
print('finished whole grid')
break #
if tsy!=1:
print(f'pvt {10*tsy}');t=tsy;time.sleep(.1*tsy)
else:
raise ValueError('should never happened')
print(f'vx|vy after keypoint {k}: ({vx}|{vy})')
@@ -220,7 +240,7 @@ if __name__=='__main__':
grid={'pos':(-1000, -1200), 'pitch':(120, 120), 'count':(20, 25)}
grid={'pos':(0, 0), 'pitch':(1, 1), 'count':(16, 20)}
obj.initPlt(grid)
obj.setup_motion(grid=grid,ssz=(4,5))
obj.setup_motion(grid=grid,ssz=(4,5),smv=(4-1,5+1),sdelay=4*5)
obj.initPlt(grid)
obj.setup_motion(grid=grid,ssz=(6,10))
obj.initPlt(grid)