From f8eac91596ea0e773deea9c291bb248a754a8221 Mon Sep 17 00:00:00 2001
From: Danilo Ferreira de Lima <danilo.enoque.ferreira.de.lima@xfel.de>
Date: Tue, 10 Jan 2023 10:03:03 +0100
Subject: [PATCH] Fixed compatibility check calculation.

---
 pes_to_spec/model.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pes_to_spec/model.py b/pes_to_spec/model.py
index 54b8d4a..79f7449 100644
--- a/pes_to_spec/model.py
+++ b/pes_to_spec/model.py
@@ -531,7 +531,7 @@ class Model(TransformerMixin, BaseEstimator):
 
         return high_res
 
-    def check_compatibility(self, low_res_data: Dict[str, np.ndarray]) -> float:
+    def check_compatibility(self, low_res_data: Dict[str, np.ndarray]) -> np.ndarray:
         """
         Check if a new low-resolution data source is compatible with the one used in training, by
         comparing the effect of the trained PCA model on it.
@@ -561,8 +561,8 @@ class Model(TransformerMixin, BaseEstimator):
         #plt.savefig("check.png")
         #plt.close(fig)
 
-        low_pca_unc =  np.sqrt(np.mean((low_res - low_pca_rec)**2, axis=1, keepdims=True))
-        return low_pca_unc/low_pca_unc
+        low_pca_dev =  np.sqrt(np.mean((low_res - low_pca_rec)**2, axis=1, keepdims=True))
+        return low_pca_dev/low_pca_unc
 
 
     def predict(self, low_res_data: Dict[str, np.ndarray]) -> Dict[str, np.ndarray]:
-- 
GitLab