Fixed the CSV file output/generation.

This commit is contained in:
klaute 2016-10-07 19:55:22 +02:00
parent 59b82fbb30
commit 5c71cc6606

View file

@ -498,10 +498,10 @@ def update_graph():
if config_read == True and config_lines == False: if config_read == True and config_lines == False:
x = arange(start_freq, end_freq, step_freq) x = arange(start_freq, end_freq, step_freq)
lvswr, = axarr[0].plot(x[0], meas_vswr[-1], label='VSWR', markevery=[vswr_marker[0]], markersize=4, marker="o", markerfacecolor="r") lvswr, = axarr[0].plot(x[0], [1], label='VSWR', markevery=[vswr_marker[0]], markersize=4, marker="o", markerfacecolor="r")
limp, = axarr[1].plot(x[0], meas_imp[-1], label='impedance', markevery=[vswr_marker[0]], markersize=4, marker="o", markerfacecolor="r") limp, = axarr[1].plot(x[0], [50], label='impedance', markevery=[vswr_marker[0]], markersize=4, marker="o", markerfacecolor="r")
la0, = axarr[2].plot(x[0], meas_a0[-1], label='a0')#, markersize=4, marker="o", markerfacecolor="r") la0, = axarr[2].plot(x[0], [512], label='a0')
la1, = axarr[2].plot(x[0], meas_a1[-1], label='a1')#, markersize=4, marker="o", markerfacecolor="r") la1, = axarr[2].plot(x[0], [512], label='a1')
axarr[0].legend(handles=[lvswr]) axarr[0].legend(handles=[lvswr])
axarr[0].set_xlim([start_freq, end_freq]) axarr[0].set_xlim([start_freq, end_freq])
@ -710,14 +710,21 @@ if __name__ == "__main__":
sys.stdout.write("\r100.00 % done \n") sys.stdout.write("\r100.00 % done \n")
print "" print ""
if (args.output_file != None or args.show_graph == True) and args.start_meas == True: #if (args.output_file != None or args.show_graph == True) and args.start_meas == True:
calc_data() #calc_data()
##### generate the output CSV file ##### generate the output CSV file
if args.output_file != None and args.start_meas == True: if args.output_file != None and args.start_meas == True:
FILE = open(args.output_file, "w") FILE = open(args.output_file, "w")
FILE.write("freqency;ratio;impedance;drive;a0;a1\n") FILE.write("freqency;ratio;impedance;drive;a0;a1\n")
j = 0 j = 0
i = ((drive_str + 1) * 2.0) / 1000.0
print meas_vswr
print meas_freq
print meas_imp
print meas_data
print meas_data[j]
print meas_data[j]
for m in meas_vswr: for m in meas_vswr:
FILE.write("%f;%f;%f;%f;%d;%d\n" % (meas_freq[j], m, meas_imp[j], i, meas_data[j][1], meas_data[j][2])) FILE.write("%f;%f;%f;%f;%d;%d\n" % (meas_freq[j], m, meas_imp[j], i, meas_data[j][1], meas_data[j][2]))
j = j + 1 j = j + 1