SFELPHOTON-1128: debug stup-and-go motion

This commit is contained in:
2024-05-15 11:12:12 +02:00
parent 992826346a
commit 13d010dd7e

View File

@@ -713,7 +713,6 @@ class ShapePath(MotionBase):
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}
tmove: time to move in ms tmove: time to move in ms
twait: time to wait in ms twait: time to wait in ms
''' '''
#scan=0 # snake motion X fast, Y slow #scan=0 # snake motion X fast, Y slow
scan=1 # snake motion Y fast, X slow (default) scan=1 # snake motion Y fast, X slow (default)
@@ -796,7 +795,8 @@ class ShapePath(MotionBase):
except KeyError as e: except KeyError as e:
ox, oy=g['pos'] ox, oy=g['pos']
px, py=g['pitch'] px, py=g['pitch']
self.mot_pts=pt #self.mot_pts=pt
self.mot_pts=pt*np.array(g['pitch'], np.float)+np.array(g['pos'], np.float)
else: else:
ox, oy=(0,0) ox, oy=(0,0)
px, py=(1,1) px, py=(1,1)
@@ -1069,25 +1069,28 @@ if __name__=='__main__':
#gp.spiral(rStart=100,rInc=130,numSeg=4,numCir=2, ofs=(0, 0)) #gp.spiral(rStart=100,rInc=130,numSeg=4,numCir=2, ofs=(0, 0))
#gp.grid(w=20,h=20,pitch=100,rnd=0,ofs=(0,+2000));gp.sort() #gp.grid(w=20,h=20,pitch=100,rnd=0,ofs=(0,+2000));gp.sort()
#gp.grid(w=5,h=10,pitch=100,rnd=0,ofs=(0,+2000));gp.sort(grp_sz=10) #gp.grid(w=5,h=10,pitch=100,rnd=0,ofs=(0,+2000));gp.sort(grp_sz=10)
#gp.grid(w=50,h=50,pitch=120,rnd=0,ofs=(0,+2000));gp.sort(grp_sz=50)
#gp.grid(w=50,h=50,pitch=120,rnd=0,ofs=(0,+2000));gp.sort(grp_sz=50); sp.meta['pt2pt_time']=10 #gp.grid(w=16,h=16,pitch=120,rnd=0,ofs=(0,+2000));gp.sort(grp_sz=16)
#gp.grid(w=16,h=16,pitch=120,rnd=0,ofs=(0,+2000));gp.sort(grp_sz=16); sp.meta['pt2pt_time']=10
#12.5x12.5 #12.5x12.5
#gp.grid(w=78,h=78,pitch=120,rnd=0,ofs=(-10000,-12000));gp.sort(grp_sz=78); sp.meta['pt2pt_time']=10 #gp.grid(w=78,h=78,pitch=120,rnd=0,ofs=(-10000,-12000));gp.sort(grp_sz=78)
#23.0x23.0 -> only 3 data points from shot to shot: 6,9,12,14,17,20... #23.0x23.0 -> only 3 data points from shot to shot: 6,9,12,14,17,20...
#gp.grid(w=162,h=162,pitch=120,rnd=0,ofs=(-10000,-12000));gp.sort(grp_sz=162); sp.meta['pt2pt_time']=10 #gp.grid(w=162,h=162,pitch=120,rnd=0,ofs=(-10000,-12000));gp.sort(grp_sz=162)
#gp.grid(w=1,h=10,pitch=100,rnd=0,ofs=(0,0)) #gp.grid(w=1,h=10,pitch=100,rnd=0,ofs=(0,0))
#gp.spiral(rStart=100,rInc=20,numSeg=8,numCir=32, ofs=(0, 0)) #gp.spiral(rStart=100,rInc=20,numSeg=8,numCir=32, ofs=(0, 0))
#gp.spiral(rStart=100,rInc=10,numSeg=2,numCir=32, phase=45, ofs=(0, 0)) #gp.spiral(rStart=100,rInc=10,numSeg=2,numCir=32, phase=45, ofs=(0, 0))
#gp.spiral(rStart=100,rInc=10,numSeg=4,numCir=32, ofs=(0, 0)) #gp.spiral(rStart=100,rInc=10,numSeg=4,numCir=32, ofs=(0, 0))
#gp.closed_shifted() #gp.closed_shifted()
gp.grid(w=10,h=15,pitch=120,rnd=0,ofs=(-1000,-1200));gp.sort(grp_sz=15); sp.meta['pt2pt_time']=10 #gp.grid(w=10,h=15,pitch=120,rnd=0,ofs=(-1000,-1200));gp.sort(mode=0,grp_sz=10)
#gp.grid(w=10,h=15,pitch=120,rnd=0,ofs=(-1000,-1200));gp.sort(mode=0,grp_sz=10); sp.meta['pt2pt_time']=10 #gp.grid(w=10,h=15,pitch=120,rnd=0,ofs=(-1000,-1200));gp.sort(grp_sz=15)
grid={'pos':(-1000, -1200),'pitch':(120,120),'count':(10,11)} # for motion mode 4,5
#grid={'pos':(-500, -600),'pitch':(120,120),'count':(40,45)} grid={'pos':(-1000, -1200), 'pitch':(120, 120), 'count':(10, 11)}
#grid={'pos':(-500, -600),'pitch':(12,12),'count':(400,450)}
sp.meta['pt2pt_time']=10
try:
num_pts=gp.points.shape[0]
except AttributeError as e:
num_pts=np.array(grid['count'], np.int32).prod()
if sp.comm: if sp.comm:
gtMaxLn=int(sp.comm.gpascii.get_variable('Gather.MaxLines')) # 116508 gtMaxLn=int(sp.comm.gpascii.get_variable('Gather.MaxLines')) # 116508
@@ -1096,7 +1099,7 @@ if __name__=='__main__':
gtMaxLn=int(sp.comm.gpascii.get_variable('Gather.MaxLines')) # 116508 gtMaxLn=int(sp.comm.gpascii.get_variable('Gather.MaxLines')) # 116508
ovhdTime=100 ovhdTime=100
acq_per=int(np.ceil((sp.meta['pt2pt_time']*sp.mot_pts.shape[0]+ovhdTime)/(gtMaxLn*sp.meta['srv_per']))) acq_per=int(np.ceil((sp.meta['pt2pt_time']*num_pts+ovhdTime)/(gtMaxLn*sp.meta['srv_per'])))
if args.verbose&0x01: if args.verbose&0x01:
_log.info(f'''\ _log.info(f'''\
Gather.MaxLines:{gtMaxLn} Gather.MaxLines:{gtMaxLn}
@@ -1107,12 +1110,22 @@ if __name__=='__main__':
sp.setup_gather(acq_per=acq_per) sp.setup_gather(acq_per=acq_per)
sp.setup_sync(verbose=args.verbose&0x40,timeOfs=0.03,timeCor=0.0005) sp.setup_sync(verbose=args.verbose&0x40,timeOfs=0.03,timeCor=0.0005)
sp.setup_coord_trf() # reset to shape path system sp.setup_coord_trf() # reset to shape path system
sp.meta['pt2pt_time']=10 #put between setup_sync and setup_motion to have more motion points than FEL syncs
# mode:0 unused
sp.setup_motion(fnPrg=fn+'.prg', mode=1, scale=1.,dwell=10,points=gp.points) # mode:1 pvt motion
#sp.setup_motion(fnPrg=fn+'.prg', mode=3, scale=1.,dwell=10,points=gp.points) # mode:2 unused
#sp.setup_motion(fnPrg=fn+'.prg', mode=4, scale=1.,dwell=10,grid=grid) # mode:3 pvt motion using inverse fft velocity
# mode:4 pvt motion short code using grid parameters
# mode:5 pvt motion short code using grid parameters. Instead of continous motion it moves and waits as give in the parameter time
mode=4
if mode==1:
sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=mode,points=sp.mot_pts)
elif mode==3:
sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=mode,points=sp.mot_pts)
elif mode==4:
sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=4,grid=grid)
elif mode==5:
sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=5,tmove=20 ,twait=30, grid=grid)
sp.homing() #homing if needed sp.homing() #homing if needed
sp.run() #start motion program sp.run() #start motion program
@@ -1125,7 +1138,7 @@ if __name__=='__main__':
while True: while True:
p=sp.progress() p=sp.progress()
if p<0: break if p<0: break
_log.info('progress %d/%d'%(p,sp.points.shape[0]));time.sleep(.1) _log.info('progress %d/%d'%(p,sp.mot_pts.shape[0]));time.sleep(.1)
sp.gather_upload(fnRec=fn+'.npz') sp.gather_upload(fnRec=fn+'.npz')
dp=DebugPlot(sp);dp.plot_gather(mode=11) dp=DebugPlot(sp);dp.plot_gather(mode=11)
_log.info('done') _log.info('done')