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