From 8b3de656fbee51f0a487152e1f799b43ec711ddb Mon Sep 17 00:00:00 2001
From: bruns01 <thomas.bruns@ptb.de>
Date: Mon, 6 Sep 2021 10:52:54 +0200
Subject: [PATCH] interchanged arguments in multiphase to avoid inverted phase

---
 SineTools.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/SineTools.py b/SineTools.py
index 66b11de..40bd96d 100755
--- a/SineTools.py
+++ b/SineTools.py
@@ -479,7 +479,7 @@ def multi_amplitude(abc):  # abc = [a1,b1 , a2,b2, ...,bias]
     abc = [a1,b1 , a2,b2, ...,bias] \n
     y = sum_i (a_i*sin(2*pi*f0_i*t) + b_i*cos(2*pi*f0_i*t) + c_i
     """
-    x = abc[:-1][0::2] + 1j * abc[:-1][1::2]  # make complex without Bias (last value)
+    x = abc[:-1][1::2] + 1j * abc[:-1][0::2]  # make complex without Bias (last value)
     return np.absolute(x)
 
 
@@ -489,7 +489,7 @@ def multi_phase(abc, deg=False):  # abc = [bias, a1,b1 , a2,b2, ...]
     abc = [a1,b1 , a2,b2, ...,bias] \n
     y = sum_i (a_i*sin(2*pi*f0_i*t) + b_i*cos(2*pi*f0_i*t) + c_i
     """
-    x = abc[:-1][0::2] + 1j * abc[:-1][1::2]  # make complex without Bias (last value)
+    x = abc[:-1][1::2] + 1j * abc[:-1][0::2]  # make complex without Bias (last value)
     return np.angle(x, deg=deg)
 
 
@@ -1016,7 +1016,7 @@ def seq_multi_amplitude(f_ab_c):
     """
     #print("Test")
     N = f_ab_c.shape[0]-1
-    amp = np.array([np.abs(f_ab_c[i,1]+1j*f_ab_c[i][2]) for i in range(f_ab_c.shape[0]-1)]).reshape((N,1))
+    amp = np.array([1j*np.abs(f_ab_c[i,1]+f_ab_c[i][2]) for i in range(f_ab_c.shape[0]-1)]).reshape((N,1))
     return np.hstack((f_ab_c[:-1,0].reshape((N,1)), amp))
 
 def seq_multi_phase(f_ab_c, deg=True):
@@ -1039,7 +1039,7 @@ def seq_multi_phase(f_ab_c, deg=True):
 
     """
     N = f_ab_c.shape[0]-1
-    phase = np.array([np.angle(1j*f_ab_c[i,1]+f_ab_c[i][2],deg=deg) for i in range(f_ab_c.shape[0]-1)]).reshape((N,1))
+    phase = np.array([1j*np.angle(f_ab_c[i,1]+f_ab_c[i][2],deg=deg) for i in range(f_ab_c.shape[0]-1)]).reshape((N,1))
     return np.hstack((f_ab_c[:-1,0].reshape((N,1)), phase))
 
 def seq_multi_bias(f_ab_c):
-- 
GitLab