SFELPHOTON-927: Beamtime Feb24

This commit is contained in:
2024-01-18 13:23:29 +01:00
parent fc944cdc3b
commit 62cbf406f3

View File

@@ -705,12 +705,19 @@ class ShapePath(MotionBase):
numPad : number of padding points to reduce aliasing (default=16)
mode:4 pvt motion short code using grid parameters
common kwargs plus:
trf : transformation that will be done on 'grid points'
trf : transformation that will be done on 'grid points'
grid: grid parameters: {orig:(0,0),pitch(10,10),cnt:(10,10),mode:0}
scan=0 ->X,Y 'snake' scan
scan=1 ->Y,X 'snake' scan
mode:5 pvt motion short code using grid parameters. Instead of continous motion it moves and waits as give in the parameterstime
common kwargs plus:
trf : transformation that will be done on 'grid points'
grid: grid parameters: {orig:(0,0),pitch(10,10),cnt:(10,10),mode:0}
tmove: time to move in ms
twait: time to wait in ms
'''
#scan=0 # snake motion X fast, Y slow
scan=1 # snake motion Y fast, X slow (default)
prg=f'close all buffers\nopen prog {prgId}\n'
verb=self.verbose
@@ -720,7 +727,7 @@ class ShapePath(MotionBase):
except AttributeError:
_log.warning('missing motion sync code!')
# this uses Coord[1].Tm and limits with MaxSpeed
if mode in (1,3,4): #### pvt motion
if mode in (1,3,4,5): #### pvt motion
pt2pt_time=self.meta['pt2pt_time']
ts=self.meta['srv_per']
scale=kwargs.get('scale', 1.)
@@ -771,15 +778,14 @@ class ShapePath(MotionBase):
plt.show(block=False)
pv[1:-1, (2, 3)]*=CoordFeedTime #scaling for Deltatau
prg+=' linear abs\n X%g Y%g\n' % tuple(pv[0, (0,1)])
else: # mode==4: #### pvt motion, short code using grid parameters
else: # mode==(4,5): #### pvt motion, short code using grid parameters
g=kwargs['grid']
nx, ny=g['count']
scan=0x2
xx, yy=np.meshgrid(range(nx), range(ny))
if scan&0x01: #modify x scaning forward backward each line
if scan==0: # snake motion X fast, Y slow
for i in range(1,ny,2):
xx[i]=xx[i][::-1]
if scan&0x02: # modify y scaning forward backward each line
else: #scan==1 snake motion Y fast, X slow
xx=xx.T
yy=yy.T
for i in range(1, nx, 2):
@@ -810,9 +816,7 @@ class ShapePath(MotionBase):
#prg+=f'N{idx} ' + 'X%g:%g Y%g:%g\n'%tuple(pv[idx,(0,2,1,3)])
prg+=f' X%g:%g Y%g:%g\n'%tuple(pv[idx, (0, 2, 1, 3)])
prg+=f' X{pv[-1, 0]:g} Y{pv[-1, 1]:g}\n'
else: # mode=4
#scan=0 # X fast Y slow
scan=1 # X fast Y slow
elif mode==4:
if scan==0:
raise Exception('scan=0 not supported')
pass
@@ -821,49 +825,110 @@ class ShapePath(MotionBase):
vy=py/(pt2pt_time)*scale*CoordFeedTime #scaling for Deltatau
prg+=f'''\
//grid pvt motion
L1=0 //slow loop x
L0=0 //fast loop y
while(L1<{nx})
{{
//send 1"A:move X%g:%g Y%g:%g",{ox}+L1*{px},0,{oy}+L0*{py},{vy/2:g}
X({ox}+L1*{px}):0 Y({oy}+L0*{py}):{vy/2:g}
L0+=1
while(L0<{ny}-1)
//grid pvt motion
L1=0 //slow loop x
L0=0 //fast loop y
while(L1<{nx})
{{
//send 1"B:move X%g:%g Y%g:%g",{ox}+L1*{px},0,{oy}+L0*{py},{vy:g}
X({ox}+L1*{px}):0 Y({oy}+L0*{py}):{vy:g}
//send 1"A:move X%g:%g Y%g:%g",{ox}+L1*{px},0,{oy}+L0*{py},{vy/2:g}
X({ox}+L1*{px}):0 Y({oy}+L0*{py}):{vy/2:g}
L0+=1
while(L0<{ny}-1)
{{
//send 1"B:move X%g:%g Y%g:%g",{ox}+L1*{px},0,{oy}+L0*{py},{vy:g}
X({ox}+L1*{px}):0 Y({oy}+L0*{py}):{vy:g}
L0+=1
}}
if(L1>={nx}-1)
{{
break
}}
//send 1"C:move X%g:%g Y%g:%g",{ox}+L1*{px},{vx/2:g},{oy}+L0*{py},{vy/2:g}
X({ox}+L1*{px}):{vx/2:g} Y({oy}+L0*{py}):{vy/2:g}
L1+=1
//send 1"D:move X%g:%g Y%g:%g",{ox}+L1*{px},{vx/2:g},{oy}+L0*{py},{-vy/2:g}
X({ox}+L1*{px}):{vx/2:g} Y({oy}+L0*{py}):{-vy/2:g}
L0-=1
while(L0>=1)
{{
//send 1"E:move X%g:%g Y%g:%g",{ox}+L1*{px},0,{oy}+L0*{py},{-vy:g}
X({ox}+L1*{px}):0 Y({oy}+L0*{py}):{-vy:g}
L0-=1
}}
if(L1>={nx}-1)
{{
break
}}
//send 1"F:move X%g:%g Y%g:%g",{ox}+L1*{px},{vx/2:g},{oy}+L0*{py},{-vy/2:g}
X({ox}+L1*{px}):{vx/2:g} Y({oy}+L0*{py}):{-vy/2:g}
L1+=1
//send 1"G:move X%g:%g Y%g:%g",{ox}+L1*{px},{vx/2:g},{oy}+L0*{py},{vy/2:g}
X({ox}+L1*{px}):{vx/2:g} Y({oy}+L0*{py}):{vy/2:g}
L0+=1
}}
if(L1>={nx}-1)
//send 1"H:move X%g:%g Y%g:%g",{ox}+L1*{px},{0:g},{oy}+L0*{py},{0:g}
X({ox}+L1*{px}):{0:g} Y({oy}+L0*{py}):{0:g}
'''
else: # mode=5
if scan==0:
raise Exception('scan=0 not supported')
pass
else: # scan=1
tmove=kwargs['tmove']
twait=kwargs['twait']
prg+=f'''\
pvt{tmove} abs
//grid pvt motion
L1=0 //slow loop x
L0=0 //fast loop y
while(L1<{nx})
{{
break
}}
//send 1"C:move X%g:%g Y%g:%g",{ox}+L1*{px},{vx/2:g},{oy}+L0*{py},{vy/2:g}
X({ox}+L1*{px}):{vx/2:g} Y({oy}+L0*{py}):{vy/2:g}
L1+=1
//send 1"D:move X%g:%g Y%g:%g",{ox}+L1*{px},{vx/2:g},{oy}+L0*{py},{-vy/2:g}
X({ox}+L1*{px}):{vx/2:g} Y({oy}+L0*{py}):{-vy/2:g}
L0-=1
while(L0>=1)
{{
//send 1"E:move X%g:%g Y%g:%g",{ox}+L1*{px},0,{oy}+L0*{py},{-vy:g}
X({ox}+L1*{px}):0 Y({oy}+L0*{py}):{-vy:g}
//send 1"A:move X%g:%g Y%g:%g",{ox}+L1*{px},0,{oy}+L0*{py},0
X({ox}+L1*{px}):0 Y({oy}+L0*{py}):0
delay{twait}
L0+=1
while(L0<{ny}-1)
{{
//send 1"B:move X%g:%g Y%g:%g",{ox}+L1*{px},0,{oy}+L0*{py},0
X({ox}+L1*{px}):0 Y({oy}+L0*{py}):0
delay{twait}
L0+=1
}}
if(L1>={nx}-1)
{{
break
}}
//send 1"C:move X%g:%g Y%g:%g",{ox}+L1*{px},0,{oy}+L0*{py},0
X({ox}+L1*{px}):0 Y({oy}+L0*{py}):0
delay{twait}
L1+=1
//send 1"D:move X%g:%g Y%g:%g",{ox}+L1*{px},0,{oy}+L0*{py},0
X({ox}+L1*{px}):0 Y({oy}+L0*{py}):0
delay{twait}
L0-=1
while(L0>=1)
{{
//send 1"E:move X%g:%g Y%g:%g",{ox}+L1*{px},0,{oy}+L0*{py},0
X({ox}+L1*{px}):0 Y({oy}+L0*{py}):0
delay{twait}
L0-=1
}}
if(L1>={nx}-1)
{{
break
}}
//send 1"F:move X%g:%g Y%g:%g",{ox}+L1*{px},0,{oy}+L0*{py},0
X({ox}+L1*{px}):0 Y({oy}+L0*{py}):0
delay{twait}
L1+=1
//send 1"G:move X%g:%g Y%g:%g",{ox}+L1*{px},0,{oy}+L0*{py},0
X({ox}+L1*{px}):0 Y({oy}+L0*{py}):0
delay{twait}
L0+=1
}}
if(L1>={nx}-1)
{{
break
}}
//send 1"F:move X%g:%g Y%g:%g",{ox}+L1*{px},{vx/2:g},{oy}+L0*{py},{-vy/2:g}
X({ox}+L1*{px}):{vx/2:g} Y({oy}+L0*{py}):{-vy/2:g}
L1+=1
//send 1"G:move X%g:%g Y%g:%g",{ox}+L1*{px},{vx/2:g},{oy}+L0*{py},{vy/2:g}
X({ox}+L1*{px}):{vx/2:g} Y({oy}+L0*{py}):{vy/2:g}
L0+=1
}}
//send 1"H:move X%g:%g Y%g:%g",{ox}+L1*{px},{0:g},{oy}+L0*{py},{0:g}
X({ox}+L1*{px}):{0:g} Y({oy}+L0*{py}):{0:g}
//send 1"H:move X%g:%g Y%g:%g",{ox}+L1*{px},0,{oy}+L0*{py},0
X({ox}+L1*{px}):0 Y({oy}+L0*{py}):0
'''
#common code to repeat the motion multiple times
@@ -881,6 +946,7 @@ f(P100>0)
else:
prg+=f' dwell {dwell}\n Gather.Enable=0\nclose\n'
#prg+='&1\nb%dr\n'%prgId)
if verb&0x02:
DebugPlot.plot_points(self.mot_pts)
plt.show(block=False)