sign changes for collect

This commit is contained in:
2022-09-16 18:36:05 +02:00
parent 33ce6c99f3
commit a1ceef7de9
2 changed files with 47 additions and 3 deletions

View File

@@ -284,4 +284,38 @@ caput SAR-EXPMX:MOT_CZ.RBV 1.509
#ZAC: orig. code
git dt 98297263 swissmx.py
git dt 7445a5aa CustomROI.py app_config.py app_utils.py epics_widgets/MotorTweak.py epics_widgets/SmaractMotorTweak.py
git dt 7445a5aa CustomROI.py app_config.py app_utils.py epics_widgets/MotorTweak.py epics_widgets/SmaractMotorTweak.py
zamofing_t@ganymede:~$ PPMAC=SAR-CPPM-EXPMX1
zamofing_t@ganymede:~$ gpasciiCommander --host $PPMAC -i
> &1p
X10194.8 Y-88923
-8892.32 10193.94 1000.950000000004
> #1..8->
&1#1->y
#2->x
&1#5->0.08084227555726195x+0.0370261645412808399y+157.349115566995778
plane=0.0808X+0.037Y+0.15
0.0808*10193.94-8892.32+ 0.037* + 1000.950000000004
plane=0.0808*-8.8923 +0.037Y+0.15
> cpx X10194 Y-8892
> &1p
X10193.88 Y-8892
> #1,2,5p
-8892.02 10193.9 -996.5999999999985
-> z has wrong sign !

View File

@@ -1114,7 +1114,10 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
else:
cz_motor=self.tweakers["base_z"]
cz=pln[0]*pTrk[0]+pln[1]*pTrk[1]+pln[2] #z=ax+by+c
cz_motor.move_abs(cz)
if cz:
cz_motor.move_abs(cz)
else:
_log.critical(f'{cz} {pTrk} {pln}')
_log.debug(f'cz={pln[0]:.4g}*{pTrk[0]:.4g}+{pln[1]:.4g}*{pTrk[1]:.4g}+{pln[2]:.4g}={cz}')
pass
elif mod&Qt.AltModifier:
@@ -1432,6 +1435,8 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
# Same but much faster !
m=np.hstack((p*pitch+pos,np.ones((p.shape[0],1))))
p=(np.asmatrix(m)*trf).A
p[:,0]*=-1 #X axis has inverted sign !
param['points']=p
# add up to 100 test fiducial
@@ -1450,6 +1455,7 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
n=int(p.shape[0]/100)+1
for i in range(0,p.shape[0],n):
fx,fy=p[i, :]/1000
fx=-fx #X axis has inverted sign !
l=.06
go=UsrGO.Fiducial((fx-l/2, fy-l/2), (l, l), i)
grp.addItem(go)
@@ -2086,7 +2092,11 @@ Author Thierry Zamofing (thierry.zamofing@psi.ch)
sp.setup_sync(verbose=sp.verbose&0x40, timeOfs=0.05)
try:
p=geo._fitPlane
sp.setup_coord_trf(cz=f'{p[0]:+.18g}X{p[1]:+.18g}Y{p[2]:+.18g}') # reset to shape path system
#X has inverted sign !
#Z is in um -> therefore the offset must be multiplied with 1000!
#Z motor has opposite sign !!!
#sp.setup_coord_trf(cz=f'{-p[0]:+.18g}X{p[1]:+.18g}Y{p[2]*1000:+.18g}') # reset to shape path system
sp.setup_coord_trf(cz=f'{+p[0]:+.18g}X{-p[1]:+.18g}Y{-p[2]*1000:+.18g}') # reset to shape path system
except AttributeError:
_log.warning('no plane fitting done. z does not move')
sp.setup_coord_trf() # reset to shape path system