From a1ceef7de9a53775fa911497e42e1c68dd7f9ac6 Mon Sep 17 00:00:00 2001 From: Thierry Zamofing Date: Fri, 16 Sep 2022 18:36:05 +0200 Subject: [PATCH] sign changes for collect --- Readme.md | 36 +++++++++++++++++++++++++++++++++++- swissmx.py | 14 ++++++++++++-- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 4b240cc..d15beac 100644 --- a/Readme.md +++ b/Readme.md @@ -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 \ No newline at end of file + 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 ! \ No newline at end of file diff --git a/swissmx.py b/swissmx.py index 59670fc..78d79c3 100755 --- a/swissmx.py +++ b/swissmx.py @@ -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