Added filename argument to assist with saving figures from module.

这个提交包含在:
Craig Warren
2016-05-27 15:15:24 +01:00
父节点 98556e5dea
当前提交 438669959b
共有 3 个文件被更改,包括 6 次插入5 次删除

查看文件

@@ -74,7 +74,7 @@
"\n", "\n",
"filename = os.path.join(os.pardir, os.pardir, 'user_models', 'antenna_wire_dipole_fs.out')\n", "filename = os.path.join(os.pardir, os.pardir, 'user_models', 'antenna_wire_dipole_fs.out')\n",
"antennaparams = calculate_antenna_params(filename)\n", "antennaparams = calculate_antenna_params(filename)\n",
"plt = mpl_plot(**antennaparams)" "plt = mpl_plot(filename, **antennaparams)"
] ]
} }
], ],

查看文件

@@ -210,8 +210,8 @@ def mpl_plot(filename, outputs=Rx.availableoutputs, fft=False):
ax.grid() ax.grid()
# Save a PDF/PNG of the figure # Save a PDF/PNG of the figure
#fig.savefig(os.path.splitext(os.path.abspath(file))[0] + '_rx' + str(rx) + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1) #fig.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_rx' + str(rx) + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
#fig.savefig(os.path.splitext(os.path.abspath(file))[0] + '_rx' + str(rx) + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1) #fig.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_rx' + str(rx) + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
return plt return plt

查看文件

@@ -130,10 +130,11 @@ def calculate_antenna_params(filename, tltxnumber=1, tlrxnumber=None, rxnumber=N
return antennaparams return antennaparams
def mpl_plot(time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, Irefp, Vtotal, Vtotalp, Itotal, Itotalp, s11, zin, yin, s21=None): def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, Irefp, Vtotal, Vtotalp, Itotal, Itotalp, s11, zin, yin, s21=None):
"""Plots antenna parameters - incident, reflected and total volatges and currents; s11, (s21) and input impedance. """Plots antenna parameters - incident, reflected and total volatges and currents; s11, (s21) and input impedance.
Args: Args:
filename (string): Filename (including path) of output file.
time (array): Simulation time. time (array): Simulation time.
freq (array): Frequencies for FFTs. freq (array): Frequencies for FFTs.
Vinc, Vincp, Iinc, Iincp (array): Time and frequency domain representations of incident voltage and current. Vinc, Vincp, Iinc, Iincp (array): Time and frequency domain representations of incident voltage and current.
@@ -401,6 +402,6 @@ if __name__ == "__main__":
args = parser.parse_args() args = parser.parse_args()
antennaparams = calculate_antenna_params(args.outputfile, args.tltx_num, args.tlrx_num, args.rx_num, args.rx_component) antennaparams = calculate_antenna_params(args.outputfile, args.tltx_num, args.tlrx_num, args.rx_num, args.rx_component)
plt = mpl_plot(**antennaparams) plt = mpl_plot(args.outputfile, **antennaparams)
plt.show() plt.show()