wip
This commit is contained in:
@@ -450,7 +450,8 @@ class FixTargetFrame(UsrROI):
|
||||
def __init__( self, pos=(0,0), size=(100,100), tpl='test', dscr=None, **kwargs):
|
||||
self.code_gen=kwargs.pop('code_gen',0)
|
||||
trf=kwargs.pop('trf',None)
|
||||
pg.ROI.__init__(self, pos, size, **kwargs)
|
||||
assert(kwargs==dict())
|
||||
pg.ROI.__init__(self, pos, size)#, **kwargs)
|
||||
if trf is not None:
|
||||
t=self.transform()
|
||||
t.setMatrix(trf[0][0], trf[0][1], 0,
|
||||
@@ -552,7 +553,7 @@ class FixTargetFrame(UsrROI):
|
||||
|
||||
def get_scan_param(self):
|
||||
'returns scan parameters for scanning with deltatau. the format is as used for shapepath'
|
||||
mode=0x2 #default fast y axis
|
||||
scan=0x2 #default fast y axis
|
||||
grid=self._dscr['grid']
|
||||
self._dscr['size']
|
||||
#pos=np.array(self.pos())
|
||||
@@ -560,10 +561,10 @@ class FixTargetFrame(UsrROI):
|
||||
#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
|
||||
if scan&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
|
||||
if scan&0x02: # modify y scaning forward backward each line
|
||||
xx=xx.T
|
||||
yy=yy.T
|
||||
for i in range(1, cnt[0], 2):
|
||||
@@ -573,15 +574,22 @@ class FixTargetFrame(UsrROI):
|
||||
|
||||
param={'grid':grid, 'points':pts, 'code_gen': self.code_gen}
|
||||
|
||||
# TODO: simplify !!!
|
||||
t=self.transform()
|
||||
p=np.array(self.pos())
|
||||
s=self.size()/self._dscr['size']
|
||||
trf=np.array(((t.m11(),t.m12()),(t.m21(),t.m22()),(0,0)))
|
||||
trf[2,:]=p # shift origin
|
||||
#trf[:2, 0]*=s[0];trf[:2, 1]*=s[1] #scaling (before rotation shear)
|
||||
trf[:2,:]=(trf[:2,:].T*s).T # same as np.asmatrix(np.diag(s))*trf[:2,:], trf[:2,:]*=s not working, scale before rot / shear
|
||||
|
||||
# trf*'gridpos in um' -> motor pos in mm
|
||||
pos=np.array(param['grid']['pos']) # in um
|
||||
pitch=np.array(param['grid']['pitch']) # in um
|
||||
trf2=np.asmatrix(np.identity(3))
|
||||
trf2[:, :2]=trf
|
||||
trf2*=np.asmatrix(((-1000, 0, 0), (0, 1000, 0), (0, 0, 1)))
|
||||
trf3=np.asmatrix(((pitch[0], 0, 0), (0, pitch[1], 0), (pos[0], pos[1], 1)))
|
||||
trf=(trf3*trf2)[:, :2]
|
||||
param['trf']=trf
|
||||
return param
|
||||
|
||||
|
||||
Reference in New Issue
Block a user