From c935f8dcc2f9822e99384d792136bf3dcfc634c7 Mon Sep 17 00:00:00 2001
From: lpbsscientist <48595116+lpbsscientist@users.noreply.github.com>
Date: Mon, 28 Mar 2022 16:54:54 +0200
Subject: [PATCH] BUGFIX : correct angles in cell stats

---
 GUI_main.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/GUI_main.py b/GUI_main.py
index acdac2a..d2d2b64 100644
--- a/GUI_main.py
+++ b/GUI_main.py
@@ -591,9 +591,9 @@ class App(QMainWindow):
             
             # PCA only works for multiple points
             if area > 1:
-                pca = PCA().fit(np.array([y,x]).T)
+                pca = PCA().fit(np.array([x,y]).T)
                 pc1_x, pc1_y = pca.components_[0,:]
-                angle = np.arctan(pc1_y / pc1_x) / np.pi * 360
+                angle = np.arctan(pc1_y / pc1_x) / (2*np.pi) * 360
                 v1, v2 = pca.explained_variance_
                 
                 len_maj = 4*np.sqrt(v1)
-- 
GitLab