homing plc and fixes
This commit is contained in:
@@ -83,11 +83,11 @@ class ShapePath:
|
||||
#cfg = {"points": [[0, 0],[100, 0],[200, 0],[300, 0],[400, 0],[400, 100],[300, 100],[200, 100],[100, 100],[0, 100],[10, 200],[100, 200],[200, 200],[300, 200],[400, 200],[410, 300],[300, 300],[200, 300],[100, 300],[0, 300],[0, 400],[100, 400],[200, 400],[300, 400],[400, 400]],"sequencer": ['gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=0)', 'plot_gather("'+fn+'.npz")']}
|
||||
#cfg = {"sequencer": ['gen_grid_points(w=2,h=2,pitch=10000,rnd=0)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=-1)', 'plot_gather("'+fn+'.npz")']}
|
||||
#cfg = {"sequencer": ['gen_grid_points(w=2,h=2,pitch=10000,rnd=0)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=1000)', 'plot_gather("'+fn+'.npz")']}
|
||||
cfg = {"sequencer": ['gen_grid_points(w=20,h=20,pitch=50,rnd=0.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=10,acq_per=10)', 'plot_gather("'+fn+'.npz")']}
|
||||
#cfg = {"sequencer": ['gen_grid_points(w=20,h=20,pitch=50,rnd=0.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=10,acq_per=10)', 'plot_gather("'+fn+'.npz")']}
|
||||
#cfg = {"sequencer": ['gen_rand_points(n=400, scale=1000)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=10)', 'plot_gather("'+fn+'.npz")']}
|
||||
#cfg = {"sequencer": ['gen_grid_points(w=5,h=5,pitch=100,rnd=0.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=2,pt2pt_time=10)', 'plot_gather("'+fn+'.npz")']}
|
||||
#cfg = {"sequencer":['gen_rand_points(n=400, scale=1000)','sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=10,acq_per=1)','plot_gather("'+fn+'.npz")']}
|
||||
cfg = {"sequencer": ['gen_swissfel_points(scale=300)','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=100,acq_per=10)', 'plot_gather("'+fn+'.npz")']}
|
||||
cfg = {"sequencer": ['gen_grid_points(w=15,h=15,pitch=100,rnd=0.2)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=2,pt2pt_time=10)', 'plot_gather("'+fn+'.npz")']}
|
||||
#cfg = {"sequencer":['gen_rand_points(n=400, scale=1000)','sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=20,acq_per=10)','plot_gather("'+fn+'.npz")']}
|
||||
#cfg = {"sequencer": ['gen_swissfel_points(scale=300)','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=100,acq_per=10)', 'plot_gather("'+fn+'.npz")']}
|
||||
|
||||
self.cfg=dotdict(cfg)
|
||||
self.args=args
|
||||
@@ -281,10 +281,10 @@ class ShapePath:
|
||||
idx=np.ndarray(cnt,dtype=np.int32)
|
||||
grp_cnt=int(np.sqrt(cnt))
|
||||
grp_sz=int(np.ceil(float(cnt)/grp_cnt))
|
||||
if self.args.yx==True:
|
||||
idxA=0;idxB=1
|
||||
else:
|
||||
if self.args.xy==True:
|
||||
idxA=1;idxB=0
|
||||
else:
|
||||
idxA=0;idxB=1
|
||||
|
||||
#sort points along idxA
|
||||
pts=pts[pts[:,idxA].argsort()]
|
||||
@@ -327,10 +327,10 @@ class ShapePath:
|
||||
pts=self.points # X,Y array
|
||||
rec = np.genfromtxt(fnLoc, delimiter=' ')
|
||||
#rec=Motor[1].ActPos,Motor[2].ActPos,Motor[3].ActPos,Motor[1].DesPos,Motor[2].DesPos,Motor[3].DesPos
|
||||
#res=rot.ActPos,y.ActPos,x.ActPos,rot.DesPos,y.DesPos,x.DesPos
|
||||
#res=rot.ActPos,x.ActPos,y.ActPos,rot.DesPos,x.DesPos,y.DesPos
|
||||
#idx 0 1 2 3 4 5
|
||||
ofsy=-rec[0,4]+pts[0,1]
|
||||
ofsx=-rec[0,5]+pts[0,0]
|
||||
ofsy=-rec[0,4]+pts[0,0]
|
||||
ofsx=-rec[0,5]+pts[0,1]
|
||||
rec[:,(1,4)]+=ofsy
|
||||
rec[:,(2,5)]+=ofsx
|
||||
if fnOut:
|
||||
@@ -345,8 +345,8 @@ class ShapePath:
|
||||
#hl=ax[0].plot(x, y, color=col)
|
||||
hl=ax.plot(pts[:,0],pts[:,1],'r.')
|
||||
hl=ax.plot(pts[:,0],pts[:,1],'y--')
|
||||
hl = ax.plot(rec[:, 5], rec[:, 4], 'b-') # desired path
|
||||
hl=ax.plot(rec[:,2],rec[:,1],'g-') # actual path
|
||||
hl = ax.plot(rec[:, 4], rec[:, 5], 'b-') # desired path
|
||||
hl=ax.plot(rec[:,1],rec[:,2],'g-') # actual path
|
||||
ax.xaxis.set_label_text('x-pos um')
|
||||
ax.yaxis.set_label_text('y-pos um')
|
||||
cid = fig.canvas.mpl_connect('button_press_event', self.onclick)
|
||||
@@ -356,8 +356,8 @@ class ShapePath:
|
||||
|
||||
fig = plt.figure()
|
||||
ax = fig.add_subplot(1, 1, 1)
|
||||
errx=rec[:,2]-rec[:,5]
|
||||
erry=rec[:,1]-rec[:,4]
|
||||
errx=rec[:,1]-rec[:,4]
|
||||
erry=rec[:,2]-rec[:,5]
|
||||
err=np.sqrt(errx**2+erry**2)
|
||||
|
||||
hl = []
|
||||
@@ -388,11 +388,8 @@ if __name__=='__main__':
|
||||
'main command line interpreter function'
|
||||
#usage: gpasciiCommunicator.py --host=PPMACZT84 myPowerBRICK.cfg
|
||||
(h, t)=os.path.split(sys.argv[0]);cmd='\n '+(t if len(h)>3 else sys.argv[0])+' '
|
||||
exampleCmd=('--host=PPMAC1391 -m 63 --cfg gather.cfg',
|
||||
'samplePowerBrick.cfg',
|
||||
'-n stackCheck1.cfg',
|
||||
'--host=PPMACZT84 stackCheck1.cfg',
|
||||
'--host=PPMACZT84 stackCheck1.cfg -v15',
|
||||
exampleCmd=('-n',
|
||||
'-v15'
|
||||
)
|
||||
epilog=__doc__+'''
|
||||
Examples:'''+''.join(map(lambda s:cmd+s, exampleCmd))+'\n '
|
||||
@@ -402,7 +399,7 @@ Examples:'''+''.join(map(lambda s:cmd+s, exampleCmd))+'\n '
|
||||
|
||||
parser.add_option('-v', '--verbose', type="int", dest='verbose', help='verbosity bits (see below)', default=0)
|
||||
parser.add_option('-n', '--dryrun', action='store_true', help='dryrun to stdout')
|
||||
parser.add_option('--yx', action='store_true', help='sort y,x instead x,y')
|
||||
parser.add_option('--xy', action='store_true', help='sort x,y instead y,x')
|
||||
parser.add_option('--cfg', help='config file containing json configuration structure')
|
||||
|
||||
(args, other)=parser.parse_args()
|
||||
|
||||
Reference in New Issue
Block a user