hit return motion code gen

This commit is contained in:
2024-11-21 12:22:10 +01:00
parent 949a00b432
commit c0ded6f683
2 changed files with 124 additions and 25 deletions

View File

@@ -20,13 +20,13 @@ import matplotlib.pyplot as plt
class HitReturnEval:
def initPlt(self,grid):
cx,cy=grid['count']
nx,ny=grid['count']
fig=plt.figure()
ax = fig.add_subplot(1,1,1)
#ax.invert_xaxis()
ax.invert_yaxis()
#hl=ax[0].plot(x, y, color=col)
pts=np.array(((0,0),(cx-1,0),(cx-1,cy-1),(0,cy-1),(0,0)))
pts=np.array(((0,0),(nx-1,0),(nx-1,ny-1),(0,ny-1),(0,0)))
h3=ax.plot(pts[:,0],pts[:,1],'g-')
h2=ax.plot(pts[:,0],pts[:,1],'y-')
h1=ax.plot(pts[:,0],pts[:,1],'r.')
@@ -53,11 +53,14 @@ 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)
grid=kwargs['grid']
ox, oy=grid['pos'] #origin position in um (or counts if scaled)
px, py=grid['pitch'] #pitch to next position in um (or 1 if scaled)
cx,cy=grid['count'] #total count of wells
rx,ry=kwargs['sz'] #region size of wells (sign shows direction)
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)
#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
#fast y (up/down) slow x(left/right)
# 8
# 7 8 8
@@ -79,22 +82,22 @@ class HitReturnEval:
print(f'{x0+x1} {y0+y1} ({dx}|{dy}|{n})')
mv.append((x0+x1+.1*n,y0+y1+.1*n,n))
self.updatePlt(mv)
if y0==ry-1:
if y0==sy-1:
if dy==1: #(1)
dx,dy=1,0
else:
dx,dy=0,-1#(2)
elif y0==1 and x0<rx-1:
elif y0==1 and x0<sx-1:
if dy==-1: #(3)
dx,dy=1,0
else:
dx,dy=0,1 #(4)
elif y0==0:
if n==1 and x0==1: #(7 or 8)
if x1+2*rx<=cx:#(7)
x1+=rx
elif y1+2*ry<=cy:#(8)
x1=0;y1+=ry
if x1+2*sx<=nx:#(7)
x1+=sx
elif y1+2*sy<=ny:#(8)
x1=0;y1+=sy
else:
break #finished whole grid
print('next regionA')
@@ -173,11 +176,11 @@ 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,p0=(0,0),sz=(4,5))
obj.setup_motion(grid=grid,ssz=(4,5))
obj.initPlt(grid)
obj.setup_motion(grid=grid,p0=(0,0),sz=(6,10))
obj.setup_motion(grid=grid,ssz=(6,10))
obj.initPlt(grid)
obj.setup_motion(grid=grid,p0=(0,0),sz=(2,5))
obj.setup_motion(grid=grid,ssz=(2,5))
print('done')
#------------------ Main Code ----------------------------------