From 14441988544c4d7448c9b36cad8814cadd7c7e0d Mon Sep 17 00:00:00 2001
From: "110646@TRI.LAN" <amaia.abanda@tecnalia.com>
Date: Tue, 9 Apr 2024 17:02:52 +0200
Subject: [PATCH] plots

---
 src/functions.py                    |  3 +--
 src/main.py                         |  2 +-
 src/main_experimentation_kerasae.py | 20 +++++++++-----------
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/src/functions.py b/src/functions.py
index ff75b77..a83cdbf 100644
--- a/src/functions.py
+++ b/src/functions.py
@@ -216,7 +216,7 @@ def majority_vote_for_instances(labels_list):
     return majority_votes
 
 
-def plot_reconstructions(test_x, reconstruction, ind= 0):
+def plot_reconstructions(test_x, test_y, reconstruction, ind= 0):
         plt.rcParams["font.size"] = 24
 
         # plt.figure()
@@ -243,7 +243,6 @@ def plot_reconstructions(test_x, reconstruction, ind= 0):
         # plt.ylabel("Wind Speed")
         # plt.tight_layout()
 
-        ind=27
 
         plt.figure()
         plt.plot(test_x[ind, :, 0].numpy()-reconstruction[0, :, 0])
diff --git a/src/main.py b/src/main.py
index e1e7cc1..07c7a73 100644
--- a/src/main.py
+++ b/src/main.py
@@ -198,7 +198,7 @@ if __name__ == "__main__":
         )
 
 
-        plot_reconstructions(test_x=  testD, reconstruction=reconstruction)
+        plot_reconstructions(test_x=  testD, test_y= test_y, reconstruction=reconstruction)
 
         if model_name == "basic_autoencoder":
             loss_test = loss_test.reshape(
diff --git a/src/main_experimentation_kerasae.py b/src/main_experimentation_kerasae.py
index fd76b41..3ad742a 100644
--- a/src/main_experimentation_kerasae.py
+++ b/src/main_experimentation_kerasae.py
@@ -136,7 +136,8 @@ if __name__ == "__main__":
         recons_train = model.predict(trainD)
         reconstruction = model.predict(testD)
 
-        ind = 27
+        ind = 0
+        # ind = 27
 
         plt.rcParams["font.size"] = 24
 
@@ -159,38 +160,35 @@ if __name__ == "__main__":
         # plt.plot(testD[ind, :, 2], label="Original")
         # plt.plot(reconstruction[0, :, 2], label="Reconstructed")
         # plt.xlabel("Time")
-        # plt.ylabel("Wind Speed")    
+        # plt.ylabel("Wind Speed")
         # plt.plot(test_y[ind*120:(ind+1)*120])
         # plt.tight_layout()
 
-
-
         plt.figure()
-        plt.plot(testD[ind, :, 0]-reconstruction[0, :, 0], label="Reconstrucion")
+        plt.plot(testD[ind, :, 0] - reconstruction[0, :, 0], label="Reconstrucion")
         plt.xlabel("Time")
         plt.ylabel("Torque Average")
-        plt.plot(test_y[ind*120:(ind+1)*120])
+        plt.plot(test_y[ind * 120 : (ind + 1) * 120])
 
         plt.ylim(-0.4, 0.5)
         plt.tight_layout()
 
         plt.figure()
-        plt.plot(testD[ind, :, 1]-reconstruction[0, :, 1], label="Original")
+        plt.plot(testD[ind, :, 1] - reconstruction[0, :, 1], label="Original")
         plt.xlabel("Time")
         plt.ylabel("Nacelle Temp")
-        plt.plot(test_y[ind*120:(ind+1)*120])
+        plt.plot(test_y[ind * 120 : (ind + 1) * 120])
         plt.ylim(-0.4, 0.5)
         plt.tight_layout()
 
         plt.figure()
-        plt.plot(testD[ind, :, 2]-reconstruction[0, :, 2], label="Original")
+        plt.plot(testD[ind, :, 2] - reconstruction[0, :, 2], label="Original")
         plt.xlabel("Time")
         plt.ylabel("Wind Speed")
-        plt.plot(test_y[ind*120:(ind+1)*120])
+        plt.plot(test_y[ind * 120 : (ind + 1) * 120])
         plt.ylim(-0.4, 0.5)
         plt.tight_layout()
 
-
         loss_test = np.mean(np.abs(reconstruction - testD), axis=2).ravel()
 
         # plt.style.use("seaborn-v0_8")
-- 
GitLab