autopep8 code cleanups.

这个提交包含在:
Craig Warren
2017-02-22 10:37:30 +00:00
父节点 40576db389
当前提交 db4fdb167c
共有 14 个文件被更改,包括 228 次插入232 次删除

查看文件

@@ -25,7 +25,7 @@ outputfile = args.outputfile
########################################
# User configurable parameters
# Pattern type (E or H)
# Pattern type (E or H)
type = 'H'
# Antenna (true if using full antenna model; false for a theoretical Hertzian dipole
@@ -116,21 +116,21 @@ for rx in range(0, nrx):
f.close()
# Plot traces for sanity checking
#fig, ((ax1, ax2), (ax3, ax4), (ax5, ax6)) = plt.subplots(num=outputfile, nrows=3, ncols=2, sharex=False, sharey='col', subplot_kw=dict(xlabel='Time [ns]'), figsize=(20, 10), facecolor='w', edgecolor='w')
#ax1.plot(time, Ex[:, traceno],'r', lw=2)
#ax1.set_ylabel('$E_x$, field strength [V/m]')
#ax3.plot(time, Ey[:, traceno],'r', lw=2)
#ax3.set_ylabel('$E_y$, field strength [V/m]')
#ax5.plot(time, Ez[:, traceno],'r', lw=2)
#ax5.set_ylabel('$E_z$, field strength [V/m]')
#ax2.plot(time, Hx[:, traceno],'b', lw=2)
#ax2.set_ylabel('$H_x$, field strength [A/m]')
#ax4.plot(time, Hy[:, traceno],'b', lw=2)
#ax4.set_ylabel('$H_y$, field strength [A/m]')
#ax6.plot(time, Hz[:, traceno],'b', lw=2)
#ax6.set_ylabel('$H_z$, field strength [A/m]')
# fig, ((ax1, ax2), (ax3, ax4), (ax5, ax6)) = plt.subplots(num=outputfile, nrows=3, ncols=2, sharex=False, sharey='col', subplot_kw=dict(xlabel='Time [ns]'), figsize=(20, 10), facecolor='w', edgecolor='w')
# ax1.plot(time, Ex[:, traceno],'r', lw=2)
# ax1.set_ylabel('$E_x$, field strength [V/m]')
# ax3.plot(time, Ey[:, traceno],'r', lw=2)
# ax3.set_ylabel('$E_y$, field strength [V/m]')
# ax5.plot(time, Ez[:, traceno],'r', lw=2)
# ax5.set_ylabel('$E_z$, field strength [V/m]')
# ax2.plot(time, Hx[:, traceno],'b', lw=2)
# ax2.set_ylabel('$H_x$, field strength [A/m]')
# ax4.plot(time, Hy[:, traceno],'b', lw=2)
# ax4.set_ylabel('$H_y$, field strength [A/m]')
# ax6.plot(time, Hz[:, traceno],'b', lw=2)
# ax6.set_ylabel('$H_z$, field strength [A/m]')
# Turn on grid
#[ax.grid() for ax in fig.axes]
# [ax.grid() for ax in fig.axes]
# plt.show()
# Calculate fields for patterns

查看文件

@@ -18,15 +18,15 @@ from gprMax.constants import c, z0
# Parse command line arguments
parser = argparse.ArgumentParser(description='Plot field patterns from a simulation with receivers positioned in circles around an antenna. This module should be used after the field pattern data has been processed and stored using the initial_save.py module.', usage='cd gprMax; python -m user_libs.antenna_patterns.plot_fields numpyfile')
parser.add_argument('numpyfile', help='name of numpy file including path')
#parser.add_argument('hertzian', help='name of numpy file including path')
# parser.add_argument('hertzian', help='name of numpy file including path')
args = parser.parse_args()
patterns = np.load(args.numpyfile)
#hertzian = np.load(args.hertzian)
# hertzian = np.load(args.hertzian)
########################################
# User configurable parameters
# Pattern type (E or H)
# Pattern type (E or H)
type = 'H'
# Relative permittivity of half-space for homogeneous materials (set to None for inhomogeneous)
@@ -87,11 +87,11 @@ for patt in range(0, len(radii)):
# Add Hertzian dipole plot
# hertzplot1 = np.append(hertzian[0, :], hertzian[0, 0]) # Append start value to close circle
#hertzplot1 = hertzplot1 / np.max(np.max(hertzian))
#ax.plot(theta, 10 * np.log10(hertzplot1), label='Inf. dipole, 0.1m', color='black', ls='-.', lw=3)
# hertzplot1 = hertzplot1 / np.max(np.max(hertzian))
# ax.plot(theta, 10 * np.log10(hertzplot1), label='Inf. dipole, 0.1m', color='black', ls='-.', lw=3)
# hertzplot2 = np.append(hertzian[-1, :], hertzian[-1, 0]) # Append start value to close circle
#hertzplot2 = hertzplot2 / np.max(np.max(hertzian))
#ax.plot(theta, 10 * np.log10(hertzplot2), label='Inf. dipole, 0.58m', color='black', ls='--', lw=3)
# hertzplot2 = hertzplot2 / np.max(np.max(hertzian))
# ax.plot(theta, 10 * np.log10(hertzplot2), label='Inf. dipole, 0.58m', color='black', ls='--', lw=3)
# Theta axis options
ax.set_theta_zero_location('N')
@@ -110,13 +110,13 @@ ax.set_yticklabels(yticks)
ax.grid(True)
handles, existlabels = ax.get_legend_handles_labels()
leg = ax.legend([handles[0], handles[-1]], [existlabels[0], existlabels[-1]], ncol=2, loc=(0.27, -0.12), frameon=False) # Plot just first and last legend entries
#leg = ax.legend([handles[0], handles[-3], handles[-2], handles[-1]], [existlabels[0], existlabels[-3], existlabels[-2], existlabels[-1]], ncol=4, loc=(-0.13,-0.12), frameon=False)
# leg = ax.legend([handles[0], handles[-3], handles[-2], handles[-1]], [existlabels[0], existlabels[-3], existlabels[-2], existlabels[-1]], ncol=4, loc=(-0.13,-0.12), frameon=False)
[legobj.set_linewidth(2) for legobj in leg.legendHandles]
# Save a pdf of the plot
savename = os.path.splitext(args.numpyfile)[0] + '.pdf'
fig.savefig(savename, dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
#savename = os.path.splitext(args.numpyfile)[0] + '.png'
#fig.savefig(savename, dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
# savename = os.path.splitext(args.numpyfile)[0] + '.png'
# fig.savefig(savename, dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
plt.show()