try to cleanup stuff

This commit is contained in:
2024-11-27 09:25:51 +01:00
parent b029cd62be
commit 24b7f1292d
2 changed files with 31 additions and 25 deletions

View File

@@ -518,21 +518,13 @@ class FixTargetFrame(UsrROI):
def get_scan_param(self):
'returns scan parameters for scanning with deltatau. the format is as used for shapepath'
scan=1 # snake motion Y fast, X slow (default)
grid=self._dscr['grid']
self._dscr['size']
cnt =np.array(grid['count'],np.int32)
xx, yy=np.meshgrid(range(cnt[0]), range(cnt[1]))
if scan==0: # snake motion X fast, Y slow
for i in range(1,cnt[1],2):
xx[i]=xx[i][::-1]
else: # scan==1 # snake motion Y fast, X slow (default)
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.float64).transpose() #*pitch
use_trf=self._param.get('use_trf', True) # do not use coordinate transformation
mode=self._param.get('mode',1)
cnt=np.array(grid['count'], np.int32)
num_pts=cnt.prod()
param={'num_pts':num_pts}
param.update(self._param)
# TODO: simplify !!!
t=self.transform() #obj_info(t)
@@ -549,9 +541,32 @@ class FixTargetFrame(UsrROI):
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={'grid':grid, 'points':pts, 'trf':trf}
param.update(self._param)
if mode in (1,3): # needs all points, not grid
scan=1 # snake motion Y fast, X slow (default)
xx, yy=np.meshgrid(range(cnt[0]), range(cnt[1]))
if scan==0: # snake motion X fast, Y slow
for i in range(1,cnt[1],2):
xx[i]=xx[i][::-1]
else: # scan==1 # snake motion Y fast, X slow (default)
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.float64).transpose() #*pitch
if not use_trf:
pts=(np.hstack((pts, np.ones((pts.shape[0], 1))))*trf).A
param['trf']=trf
param['points']=pts
else:
if use_trf:
param.update({'grid':grid, 'trf':trf})
else:
g=grid.copy() #has not be tested !
g['pos']=tuple((np.array((0,0,1))*trf).A.reshape(-1).tolist())
param.update({'grid':p, 'trf':trf})
return param