import matplotlib.pyplot as plt
import numpy as np
import math
import cmath
import os
# Create target Directory if don't exist
if not os.path.exists('Sparameters images'):
os.mkdir('Sparameters images')
## UPLOAD DATA ##############################
#############################################
HB1 = np.loadtxt('S11_Magnitude\S11_Magnitude.txt',skiprows=7)
HB2 = np.loadtxt('S11_Phase\S11_Phase.txt',skiprows=7)
HB3 = np.loadtxt('S21_Magnitude\S12_Magnitude.txt',skiprows=7)
HB4 = np.loadtxt('S21_Phase\S12_Phase.txt',skiprows=7)
## CONVERT DATA TO LINEAR MAGNITUDE AND RADS
###############################################################
W1=HB1[:,0]
A_mag=np.power(10,HB1[:,1]/10)*100
W2=HB2[:,0]
A_Phase=HB2[:,1]
W3=HB3[:,0]
B_mag=np.power(10,HB3[:,1]/10)*100
W4=HB4[:,0]
B_Phase=HB4[:,1]
## CONVERTING INTO COMPLEX NUMBERS ##############################
S11 = np.vectorize(complex)(A_mag * math.cos(A_Phase), A_mag * math.sin(A_Phase))
S21 = np.vectorize(complex)(B_mag * math.cos(B_Phase), B_mag * math.sin(B_Phase))
But still It doesn't work. Can I do something else to solve this problem?