first simulated datapoint collection... but something wrong in coord trf

This commit is contained in:
2022-08-30 18:08:53 +02:00
parent 7deda365c1
commit e651fddd56
3 changed files with 129 additions and 33 deletions

View File

@@ -190,26 +190,6 @@ class Grid(pg.ROI):
self.addScaleHandle([0, 0], [1, 1])
self.addScaleRotateHandle([1, 0], [0, 0])
def get_points(self,mode=0x2):
'generates points of the roi for scanning with deltatau'
#pos=np.array(self.pos())
cnt=np.array(self._cnt,np.int32)
sz=np.array(self.size())
pitch=sz/cnt
xx, yy=np.meshgrid(range(cnt[0]), range(cnt[1]))
if mode&0x01: #modify x scaning forward backward each line
for i in range(1,cnt[1],2):
xx[i]=xx[i][::-1]
if mode&0x02: # modify y scaning forward backward each line
xx=xx.T
yy=yy.T
for i in range(1, cnt[0], 2):
yy[i]=yy[i][::-1]
pts=np.array([xx.reshape(-1), yy.reshape(-1)], dtype=np.float).transpose()*pitch
#pts+=pos
return pts
def paint(self, p, *args):
#pg.ROI.paint(self, p, *args)
sz=self.state['size']
@@ -255,6 +235,26 @@ class Grid(pg.ROI):
}
return jsn
def get_scan_param(self,mode=0x2):
'returns scan parameters for scanning with deltatau. the format is as used for shapepath'
#pos=np.array(self.pos())
cnt=np.array(self._cnt,np.int32)
sz=np.array(self.size())
pitch=sz/cnt
xx, yy=np.meshgrid(range(cnt[0]), range(cnt[1]))
if mode&0x01: #modify x scaning forward backward each line
for i in range(1,cnt[1],2):
xx[i]=xx[i][::-1]
if mode&0x02: # modify y scaning forward backward each line
xx=xx.T
yy=yy.T
for i in range(1, cnt[0], 2):
yy[i]=yy[i][::-1]
pts=np.array([xx.reshape(-1), yy.reshape(-1)], dtype=np.float).transpose()*pitch
#pts+=pos
return pts
class Path(pg.ROI):
'''
@@ -461,11 +461,37 @@ class FixTargetFrame(pg.ROI):
}
trf=self.transform()
if not trf.isIdentity():
obj_info(trf)
#obj_info(trf)
trf=((trf.m11(),trf.m12()),(trf.m21(),trf.m22()))
jsn['trf']=trf
return jsn
def get_scan_param(self,mode=0x2):
'returns scan parameters for scanning with deltatau. the format is as used for shapepath'
grid=self._dscr['grid']
#pos=np.array(self.pos())
cnt =np.array(grid['count'],np.int32)
#pos =np.array(grid['pos'],np.float)
#pitch=np.array(grid['pitch'],np.float)
xx, yy=np.meshgrid(range(cnt[0]), range(cnt[1]))
if mode&0x01: #modify x scaning forward backward each line
for i in range(1,cnt[1],2):
xx[i]=xx[i][::-1]
if mode&0x02: # modify y scaning forward backward each line
xx=xx.T
yy=yy.T
for i in range(1, cnt[0], 2):
yy[i]=yy[i][::-1]
pts=np.array([xx.reshape(-1), yy.reshape(-1)], dtype=np.float).transpose() #*pitch
param={'grid':grid, 'points':pts}
trf=self.transform()
if not trf.isIdentity():
#obj_info(trf)
trf=np.array(((trf.m11(),trf.m12()),(trf.m21(),trf.m22())))
param['trf']=trf
return param
class TxtROI(pg.ROI):
def __init__(self, pos, size, **kargs):