From 56d626e312ba5aaedb122e5f321ae43c3f3dc93e Mon Sep 17 00:00:00 2001
From: Ivan Usov <ivan.usov@psi.ch>
Date: Thu, 25 Aug 2022 16:47:15 +0200
Subject: [PATCH] Display the same UB matrix as in the spind table

---
 pyzebra/app/panel_spind.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/pyzebra/app/panel_spind.py b/pyzebra/app/panel_spind.py
index 709cf7f..ab8a99b 100644
--- a/pyzebra/app/panel_spind.py
+++ b/pyzebra/app/panel_spind.py
@@ -143,8 +143,7 @@ def create():
                         # last digits are spind UB matrix
                         vals = list(map(float, c_rest))
                         ub_matrix_spind = np.transpose(np.array(vals).reshape(3, 3))
-                        ub_matrix = np.linalg.inv(ub_matrix_spind)
-                        ub_matrices.append(ub_matrix)
+                        ub_matrices.append(ub_matrix_spind)
                         spind_res["ub_matrix"].append(str(ub_matrix_spind * 1e-10))
 
                 print(f"Content of {spind_out_file}:")
@@ -168,11 +167,11 @@ def create():
     def results_table_select_callback(_attr, old, new):
         if new:
             ind = new[0]
-            ub_matrix = ub_matrices[ind]
+            ub_matrix_spind = ub_matrices[ind]
             res = ""
             for vec in diff_vec:
-                res += f"{ub_matrix @ vec}\n"
-            ub_matrix_textareainput.value = str(ub_matrix * 1e10)
+                res += f"{np.linalg.inv(ub_matrix_spind) @ vec}\n"
+            ub_matrix_textareainput.value = str(ub_matrix_spind * 1e-10)
             hkl_textareainput.value = res
         else:
             ub_matrix_textareainput.value = ""
-- 
GitLab