From faaf9741ec311a80cf5e448c6f584e1882b2f239 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Wed, 13 Jan 2016 13:35:51 +0000 Subject: [PATCH] Added PNG plotting option. --- tools/plot_Ascan.py | 3 ++- tools/plot_Bscan.py | 6 +++++- tools/plot_antenna_params.py | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/plot_Ascan.py b/tools/plot_Ascan.py index 0d91e0c8..8a9f870a 100644 --- a/tools/plot_Ascan.py +++ b/tools/plot_Ascan.py @@ -165,8 +165,9 @@ for rx in range(1, nrx + 1): ax.set_xlim([0, np.amax(time)]) ax.grid() - # Save a PDF of the figure + # Save a PDF/PNG of the figure #fig.savefig(os.path.splitext(os.path.abspath(file))[0] + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1) + #fig.savefig(os.path.splitext(os.path.abspath(file))[0] + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1) plt.show() f.close() \ No newline at end of file diff --git a/tools/plot_Bscan.py b/tools/plot_Bscan.py index 080aca92..1d35e8be 100644 --- a/tools/plot_Bscan.py +++ b/tools/plot_Bscan.py @@ -42,6 +42,7 @@ if args.output not in outputslist: f = h5py.File(args.outputfile, 'r') path = '/rxs/rx1' outputdata = f[path + '/' + args.output] +f.close() # Check that there is more than one A-scan present if outputdata.shape[1] == 1: @@ -62,5 +63,8 @@ elif 'I' in args.output: cb.set_label('Current [A]') plt.show() + +# Save a PDF/PNG of the figure #fig.savefig(os.path.splitext(os.path.abspath(file))[0] + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1) -f.close() +#fig.savefig(os.path.splitext(os.path.abspath(file))[0] + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1) + diff --git a/tools/plot_antenna_params.py b/tools/plot_antenna_params.py index 6747f89c..d8f87314 100644 --- a/tools/plot_antenna_params.py +++ b/tools/plot_antenna_params.py @@ -46,6 +46,7 @@ Vinc = f[path + 'Vinc'][:] Iinc = f[path + 'Iinc'][:] Vtotal = f[path +'Vtotal'][:] Itotal = f[path +'Itotal'][:] +f.close() Vref = Vtotal - Vinc Iref = Itotal - Iinc @@ -290,8 +291,9 @@ ax.set_ylabel('Phase [degrees]') ax.grid() plt.show() + +# Save a PDF/PNG of the figure #fig1.savefig(os.path.splitext(os.path.abspath(file))[0] + '_tl_params.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1) #fig2.savefig(os.path.splitext(os.path.abspath(file))[0] + '_ant_params.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1) #fig1.savefig(os.path.splitext(os.path.abspath(file))[0] + '_tl_params.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1) #fig2.savefig(os.path.splitext(os.path.abspath(file))[0] + '_ant_params.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1) -f.close() \ No newline at end of file