From 438669959bf8916e72b003d9f8078592e7a1407f Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Fri, 27 May 2016 15:15:24 +0100 Subject: [PATCH] Added filename argument to assist with saving figures from module. --- tools/Jupyter notebooks/plot_antenna_params.ipynb | 2 +- tools/plot_Ascan.py | 4 ++-- tools/plot_antenna_params.py | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/Jupyter notebooks/plot_antenna_params.ipynb b/tools/Jupyter notebooks/plot_antenna_params.ipynb index ba4ceb8c..c6b62785 100644 --- a/tools/Jupyter notebooks/plot_antenna_params.ipynb +++ b/tools/Jupyter notebooks/plot_antenna_params.ipynb @@ -74,7 +74,7 @@ "\n", "filename = os.path.join(os.pardir, os.pardir, 'user_models', 'antenna_wire_dipole_fs.out')\n", "antennaparams = calculate_antenna_params(filename)\n", - "plt = mpl_plot(**antennaparams)" + "plt = mpl_plot(filename, **antennaparams)" ] } ], diff --git a/tools/plot_Ascan.py b/tools/plot_Ascan.py index 6ab393ea..9324c839 100644 --- a/tools/plot_Ascan.py +++ b/tools/plot_Ascan.py @@ -210,8 +210,8 @@ def mpl_plot(filename, outputs=Rx.availableoutputs, fft=False): ax.grid() # 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(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) + '.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) + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1) return plt diff --git a/tools/plot_antenna_params.py b/tools/plot_antenna_params.py index 431c66ef..3868f80f 100644 --- a/tools/plot_antenna_params.py +++ b/tools/plot_antenna_params.py @@ -130,10 +130,11 @@ def calculate_antenna_params(filename, tltxnumber=1, tlrxnumber=None, rxnumber=N 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. Args: + filename (string): Filename (including path) of output file. time (array): Simulation time. freq (array): Frequencies for FFTs. 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() 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()