In [3]:
# import com library
import win32com.client
Once this is done, we can connect to AWRDE. If it is already running it will connect to that instance, otherwise it will be started up. If you have multiple instances running and want to connect to a specific instance, see this link
In [4]:
# connect to awrde
mwo = win32com.client.Dispatch("MWOApp.MWOffice")
In [8]:
import os
example_directory = mwo.Directories(8).ValueAsString
example_filename = os.path.join(example_directory, 'LPF_lumped.emp')
mwo.Open(example_filename)
Out[8]:
Next we will simulate and bring some results back.
In [10]:
mwo.Project.Simulate()
In [49]:
graph = mwo.Project.Graphs('Passband and Stopband')
m1 = graph.Measurements(1)
m2 = graph.Measurements(2)
frequencies = m1.XValues
S11_dB = m1.YValues(0) # in this case we have to specify a dimension
S21_dB = m2.YValues(0)
In [50]:
%matplotlib inline
import matplotlib.pyplot as plt
import pylab
pylab.rcParams['figure.figsize'] = (10,6) # set default plot size
plt.plot(frequencies, S11_dB)
plt.plot(frequencies, S21_dB)
plt.show()
In [54]:
import pandas as pd
S11db = pd.Series(S11_dB, index=frequencies)
S21db = pd.Series(S21_dB, index=frequencies)
df = pd.concat([S11db, S21db], axis=1)
df.columns=['S21', 'S11']
df.head()
Out[54]:
This is a little ugly with the frequencies in Hertz so let's convert them to GHz
In [55]:
df.index=df.index/1e9
df.head()
Out[55]:
In [ ]: