你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-06 12:36:51 +08:00
autopep8 code cleanups.
这个提交包含在:
@@ -67,10 +67,10 @@ if args.otherresults is not None:
|
||||
for i, result in enumerate(otherresults):
|
||||
ax.plot(result['threads'], result['benchtimes'], color=colors[1], marker='.', ms=10, lw=2, ls=lines[i], label=otherplotlabels[i] + ' (v' + version + ')')
|
||||
|
||||
#ax.plot(results['threads'], results['bench1'], color=colors[1], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v3.0.0b21)')
|
||||
#ax.plot(results['threads'], results['bench1c'], color=colors[0], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v2)')
|
||||
#ax.plot(results['threads'], results['bench2'], color=colors[1], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v3.0.0b21)')
|
||||
#ax.plot(results['threads'], results['bench2c'], color=colors[0], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v2)')
|
||||
# ax.plot(results['threads'], results['bench1'], color=colors[1], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v3.0.0b21)')
|
||||
# ax.plot(results['threads'], results['bench1c'], color=colors[0], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v2)')
|
||||
# ax.plot(results['threads'], results['bench2'], color=colors[1], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v3.0.0b21)')
|
||||
# ax.plot(results['threads'], results['bench2c'], color=colors[0], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v2)')
|
||||
|
||||
ax.set_xlabel('Number of threads')
|
||||
ax.set_ylabel('Time [s]')
|
||||
@@ -91,10 +91,10 @@ if args.otherresults is not None:
|
||||
for i, result in enumerate(otherresults):
|
||||
ax.plot(result['threads'], result['benchtimes'][-1] / result['benchtimes'], color=colors[1], marker='.', ms=10, lw=2, ls=lines[i], label=otherplotlabels[i] + ' (v' + version + ')')
|
||||
|
||||
#ax.plot(results['threads'], results['bench1'][0] / results['bench1'], color=colors[1], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v3.0.0b21)')
|
||||
#ax.plot(results['threads'], results['bench1c'][1] / results['bench1c'], color=colors[0], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v2)')
|
||||
#ax.plot(results['threads'], results['bench2'][0] / results['bench2'], color=colors[1], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v3.0.0b21)')
|
||||
#ax.plot(results['threads'], results['bench2c'][1] / results['bench2c'], color=colors[0], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v2)')
|
||||
# ax.plot(results['threads'], results['bench1'][0] / results['bench1'], color=colors[1], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v3.0.0b21)')
|
||||
# ax.plot(results['threads'], results['bench1c'][1] / results['bench1c'], color=colors[0], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v2)')
|
||||
# ax.plot(results['threads'], results['bench2'][0] / results['bench2'], color=colors[1], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v3.0.0b21)')
|
||||
# ax.plot(results['threads'], results['bench2c'][1] / results['bench2c'], color=colors[0], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v2)')
|
||||
|
||||
ax.set_xlabel('Number of threads')
|
||||
ax.set_ylabel('Speed-up factor')
|
||||
|
@@ -84,7 +84,7 @@ ax.grid()
|
||||
|
||||
# Save a PDF/PNG of the figure
|
||||
savename = os.path.abspath(os.path.dirname(args.modelfile)) + os.sep + os.path.splitext(os.path.split(args.modelfile)[1])[0] + '_vs_' + os.path.splitext(os.path.split(args.realfile)[1])[0]
|
||||
#fig.savefig(savename + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
|
||||
# fig.savefig(savename + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
|
||||
# fig.savefig((savename + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
|
||||
|
||||
plt.show()
|
||||
|
@@ -47,11 +47,6 @@ class My_input_cmd_funcs_test(unittest.TestCase):
|
||||
rx(2, 1, 0, 'id', ['Ex', 'Ez'])
|
||||
self.assert_output(out, '#rx: 2 1 0 id Ex Ez')
|
||||
|
||||
def test_rx4(self):
|
||||
with captured_output() as (out, err):
|
||||
rx(2, 1, 0, 'id', ['Ex', 'Ez'])
|
||||
self.assert_output(out, '#rx: 2 1 0 id Ex Ez')
|
||||
|
||||
def test_rx_rotate_exception(self):
|
||||
with self.assertRaises(ValueError):
|
||||
rx(2, 1, 0, 'id', ['Ex', 'Ez'], polarisation='x', rotate90origin=(1, 1)) # no dxdy given
|
||||
|
@@ -41,17 +41,17 @@ from tests.analytical_solutions import hertzian_dipole_fs
|
||||
|
||||
basepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'models_')
|
||||
basepath += 'basic'
|
||||
#basepath += 'advanced'
|
||||
# basepath += 'advanced'
|
||||
|
||||
# List of available basic test models
|
||||
testmodels = ['hertzian_dipole_fs_analytical', '2D_ExHyHz', '2D_EyHxHz', '2D_EzHxHy', 'cylinder_Ascan_2D', 'hertzian_dipole_fs', 'hertzian_dipole_hs', 'hertzian_dipole_dispersive', 'magnetic_dipole_fs']
|
||||
|
||||
# List of available advanced test models
|
||||
#testmodels = ['antenna_GSSI_1500_fs', 'antenna_MALA_1200_fs']
|
||||
# testmodels = ['antenna_GSSI_1500_fs', 'antenna_MALA_1200_fs']
|
||||
|
||||
# Select a specific model if desired
|
||||
#testmodels = [testmodels[0], testmodels[5], testmodels[7]]
|
||||
#testmodels = [testmodels[5]]
|
||||
# testmodels = [testmodels[0], testmodels[5], testmodels[7]]
|
||||
# testmodels = [testmodels[5]]
|
||||
testresults = dict.fromkeys(testmodels)
|
||||
path = '/rxs/rx1/'
|
||||
|
||||
@@ -138,9 +138,9 @@ for i, model in enumerate(testmodels):
|
||||
datadiffs = np.zeros(datatest.shape, dtype=np.float64)
|
||||
for i in range(len(outputstest)):
|
||||
max = np.amax(np.abs(dataref[:, i]))
|
||||
datadiffs[:, i] = np.divide(np.abs(dataref[:, i] - datatest[:, i]), max, out=np.zeros_like(dataref[:, i]), where=max!=0) # Replace any division by zero with zero
|
||||
datadiffs[:, i] = np.divide(np.abs(dataref[:, i] - datatest[:, i]), max, out=np.zeros_like(dataref[:, i]), where=max != 0) # Replace any division by zero with zero
|
||||
with np.errstate(divide='ignore'):
|
||||
datadiffs[:, i] = 20 * np.log10(datadiffs[:, i]) # Ignore any zero division in log10
|
||||
datadiffs[:, i] = 20 * np.log10(datadiffs[:, i]) # Ignore any zero division in log10
|
||||
|
||||
# Store max difference
|
||||
maxdiff = np.amax(np.amax(datadiffs))
|
||||
@@ -184,8 +184,8 @@ for i, model in enumerate(testmodels):
|
||||
|
||||
# Save a PDF/PNG of the figure
|
||||
savename = os.path.join(basepath, model + os.path.sep + model)
|
||||
#fig1.savefig(savename + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
|
||||
#fig2.savefig(savename + '_diffs.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
|
||||
# fig1.savefig(savename + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
|
||||
# fig2.savefig(savename + '_diffs.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
|
||||
fig1.savefig(savename + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
|
||||
fig2.savefig(savename + '_diffs.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
|
||||
|
||||
|
在新工单中引用
屏蔽一个用户