From 1f1b248b630ea8e84d23c6bc0f343bed70f0105c Mon Sep 17 00:00:00 2001
From: mashatarasevich <44651630+mashatarasevich@users.noreply.github.com>
Date: Thu, 5 Nov 2020 00:33:15 +0300
Subject: [PATCH] Added minimal Python example

---
 compute_mca.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 compute_mca.py

diff --git a/compute_mca.py b/compute_mca.py
new file mode 100644
index 0000000..4807c07
--- /dev/null
+++ b/compute_mca.py
@@ -0,0 +1,24 @@
+import numpy as np
+from supersvd import supersvd
+import matplotlib.pyplot as plt
+
+ts = np.fromfile('ts.std', dtype=np.float32).reshape(1147, 28, 31)
+ps = np.fromfile('ps.std', dtype=np.float32).reshape(1147, 28, 31)
+
+svd = supersvd(ts, ps, 4)
+
+first_mode_ts = svd.x_vect[0]
+
+plt.matshow(first_mode_ts)
+plt.savefig('first_mode_ts.png')
+
+first_ps_timeseries = svd.x_coeff[0]
+
+plt.figure()
+plt.plot(first_ps_timeseries)
+plt.savefig('first_ps_timeseries.png')
+
+print('Correlation coefficient between first_ts_timeseries. and first_ps_timeseries:', svd.corrcoeff[0])
+
+
+
-- 
GitLab