Skip to content

Commit

Permalink
changed to run on linux with keysight io drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
kbandura committed May 28, 2024
1 parent e2d2d22 commit 17f0a75
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Measure_S11.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def measure_s_parameter(measurement, output_power,serial_num, start_freq, stop_f
plt.ylabel("dBm")
plt.title(f"{measurement}_{serial_num}")
print(f"DONE measuring {measurement}")
plt.savefig(f"C:\\Users\\RadioLab\\Enigma_Testing_2022\\Antenna_Test_Files\\Results\\S11_Plots\\{measurement}_{serial_num}.png")
#plt.savefig(f"C:\\Users\\RadioLab\\Enigma_Testing_2022\\Antenna_Test_Files\\Results\\S11_Plots\\{measurement}_{serial_num}.png")
plt.savefig(f"Results/S11_Plots/{measurement}_{serial_num}.png")
VNA.write(':CALCulate:SELected:FORMat REAL')
time.sleep(1)
data_real = VNA.query('CALCulate:DATA:FDaTa?')
Expand All @@ -87,7 +88,8 @@ def measure_s_parameter(measurement, output_power,serial_num, start_freq, stop_f
if con == 'y':
##############################################################################
# load visa library
rm=visa.ResourceManager('C:\\Windows\\System32\\visa64.dll') # windows
#rm=visa.ResourceManager('C:\\Windows\\System32\\visa64.dll') # windows
rm=visa.ResourceManager('/opt/keysight/iolibs/libktvisa32.so') #linux
# TODO linux
# https://edadocs.software.keysight.com/kkbopen/linux-io-libraries-faq-589309025.html
# https://www.keysight.com/us/en/lib/software-detail/computer-software/io-libraries-suite-downloads-2175637.html click linux
Expand Down Expand Up @@ -166,12 +168,12 @@ def measure_s_parameter(measurement, output_power,serial_num, start_freq, stop_f
f = np.linspace(start_freq,stop_freq,S11_raw.shape[-1])
nw2 = rf.Network(name=f"{serial_num_1}",s=S11_raw,frequency=f, z0=50)
print(nw2)
nw2.write_touchstone(filename = f"{serial_num_1}",dir= 'C:\\Users\\RadioLab\\Enigma_Testing_2022\\Antenna_Test_Files\\Results\\Touchstone_Files')
nw2.write_touchstone(filename = f"{serial_num_1}",dir= 'Results/Touchstone_Files')

#plot a smith chart of s11
nw2.plot_s_smith()
plt.title(f"{serial_num_1} Smith Chart")
plt.savefig(f"C:\\Users\\RadioLab\\Enigma_Testing_2022\\Antenna_Test_Files\\Results\\Smith_Charts\\{serial_num_1}.jpg")
plt.savefig(f"Results/Smith_Charts/{serial_num_1}.jpg")

print("Please Connect VNA to P2!")
z= input("Please Connect VNA to P2!Press enter when Finished: ")
Expand All @@ -183,12 +185,12 @@ def measure_s_parameter(measurement, output_power,serial_num, start_freq, stop_f
f = np.linspace(start_freq,stop_freq,S11_raw.shape[-1])
nw2 = rf.Network(name=f"{serial_num_2}",s=S11_raw,frequency=f, z0=50)
print(nw2)
nw2.write_touchstone(filename = f"{serial_num_2}",dir= 'C:\\Users\\RadioLab\\Enigma_Testing_2022\\Antenna_Test_Files\\Results\\Touchstone_Files')
nw2.write_touchstone(filename = f"{serial_num_2}",dir= 'Results/Touchstone_Files')

#plot a smith chart of s11
nw2.plot_s_smith()
plt.title(f"{serial_num_2} Smith Chart")
plt.savefig(f"C:\\Users\\RadioLab\\Enigma_Testing_2022\\Antenna_Test_Files\\Results\\Smith_Charts\\{serial_num_2}.jpg")
plt.savefig(f"Results/Smith_Charts/{serial_num_2}.jpg")



Expand Down

0 comments on commit 17f0a75

Please sign in to comment.