towards python 3
This commit is contained in:
@@ -64,7 +64,7 @@ class ShapePath:
|
||||
fh=open(args.cfg,'r')
|
||||
s=fh.read()
|
||||
cfg=json.loads(s, object_hook=ConvUtf8)
|
||||
s=json.dumps(cfg, indent=2, separators=(',', ': '));print s
|
||||
s=json.dumps(cfg, indent=2, separators=(',', ': '));print(s)
|
||||
else:
|
||||
fn='/tmp/shapepath4'
|
||||
#fn='/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/data/'+time.strftime('%y-%m-%d-%H_%M_%S')
|
||||
@@ -88,9 +88,11 @@ class ShapePath:
|
||||
cfg = {"sequencer": ['gen_grid_points(w=5,h=5,pitch=100,rnd=0.4)', 'sort_points()','gen_prog(file="'+fn+'.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=10,cnt=1)', '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")']}
|
||||
cfg = {"sequencer": ['opt_pts("'+fn+'.npz")','gen_prog(file="'+fn+'_corr.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=10,cnt=1)', 'plot_gather("'+fn+'_corr.npz")']}
|
||||
#cfg = {"sequencer": ['opt_pts("'+fn+'.npz")','gen_prog(file="'+fn+'_corr.prg",host="SAR-CPPM-EXPMX1",mode=1,pt2pt_time=10,cnt=1)', 'plot_gather("'+fn+'_corr.npz")']}
|
||||
#cfg = {"sequencer": ['opt_pts("'+fn+'.npz")','gen_prog(file="'+fn+'.prg",mode=1,pt2pt_time=10,cnt=1)']}
|
||||
|
||||
#cfg = {"sequencer": ['gen_grid_points(w=5,h=5,pitch=100,rnd=0.4)', 'sort_points()','gen_prog(file="'+fn+'.prg",mode=1,pt2pt_time=10,cnt=1)']}
|
||||
|
||||
self.cfg=dotdict(cfg)
|
||||
self.args=args
|
||||
|
||||
@@ -108,7 +110,7 @@ class ShapePath:
|
||||
else:
|
||||
dryrun=self.args.dryrun
|
||||
for cmd in sequencer:
|
||||
print '>'*5+' '+cmd+' '+'<'*5
|
||||
print('>'*5+' '+cmd+' '+'<'*5)
|
||||
if not dryrun:
|
||||
eval('self.' + cmd)
|
||||
|
||||
@@ -164,7 +166,7 @@ class ShapePath:
|
||||
ptsCorr=(pts-recPts[:,1:3]+recPts[:,4:6])
|
||||
self.points=pts
|
||||
self.ptsCorr=ptsCorr
|
||||
print ptsCorr
|
||||
print(ptsCorr)
|
||||
|
||||
def gen_prog(self,prgId=2,file=None,host=None,mode=0,**kwargs):
|
||||
'''
|
||||
@@ -221,7 +223,7 @@ class ShapePath:
|
||||
try:
|
||||
pt2pt_time=kwargs['pt2pt_time'] #how many ms to move to next point (pt2pt_time)
|
||||
except KeyError:
|
||||
print 'missing pt2pt_time, use default=100ms'
|
||||
print('missing pt2pt_time, use default=100ms')
|
||||
pt2pt_time=100.
|
||||
try:
|
||||
cnt=kwargs['cnt'] #move path multiple times
|
||||
@@ -273,7 +275,7 @@ class ShapePath:
|
||||
try:
|
||||
pt2pt_time=kwargs['pt2pt_time'] #how many ms to move to next point (pt2pt_time)
|
||||
except KeyError:
|
||||
print 'missing pt2pt_time, use default=100ms'
|
||||
print('missing pt2pt_time, use default=100ms')
|
||||
pt2pt_time=100.
|
||||
pos=self.points
|
||||
pcor=np.ndarray(pos.shape,dtype=pos.dtype);pcor[:]=np.NaN
|
||||
@@ -302,13 +304,13 @@ class ShapePath:
|
||||
fh.close()
|
||||
if host is not None:
|
||||
cmd ='gpasciiCommander --host '+host+' '+ file
|
||||
print cmd
|
||||
print(cmd)
|
||||
p = sprc.Popen(cmd, shell=True)#, stdout=sprc.PIPE, stderr=sprc.STDOUT)
|
||||
#res=p.stdout.readlines(); print res
|
||||
retval = p.wait()
|
||||
#gather -u /var/ftp/gather/out.txt
|
||||
cmd ='PBGatherPlot -m24 -v7 --host '+host
|
||||
print cmd
|
||||
print(cmd)
|
||||
p = sprc.Popen(cmd, shell=True)#, stdout=sprc.PIPE, stderr=sprc.STDOUT)
|
||||
retval = p.wait()
|
||||
self.prg=prg
|
||||
@@ -349,8 +351,8 @@ class ShapePath:
|
||||
|
||||
@staticmethod
|
||||
def onclick(event):
|
||||
print 'button=%s, x=%d, y=%d, xdata=%f, ydata=%f'%(
|
||||
event.button, event.x, event.y, event.xdata, event.ydata)
|
||||
print('button=%s, x=%d, y=%d, xdata=%f, ydata=%f'%(
|
||||
event.button, event.x, event.y, event.xdata, event.ydata))
|
||||
obj=event.canvas.figure.obj
|
||||
|
||||
def plot_points(self,pts):
|
||||
|
||||
Reference in New Issue
Block a user