Added ability to plot current outputs if specified.

这个提交包含在:
Craig Warren
2017-01-30 16:54:25 +00:00
父节点 a43cdf7a70
当前提交 543ca1ba3b

查看文件

@@ -121,12 +121,12 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False):
plt.setp(ax1, ylabel=outputtext + ' field strength [A/m]')
plt.setp(stemlines, 'color', 'g')
plt.setp(markerline, 'markerfacecolor', 'g', 'markeredgecolor', 'g')
# elif 'I' in outputs[0]:
# plt.setp(line1, color='b')
# plt.setp(line2, color='b')
# plt.setp(ax1, ylabel=outputtext + ' current [A]')
# plt.setp(stemlines, 'color', 'b')
# plt.setp(markerline, 'markerfacecolor', 'b', 'markeredgecolor', 'b')
elif 'I' in outputs[0]:
plt.setp(line1, color='b')
plt.setp(line2, color='b')
plt.setp(ax1, ylabel=outputtext + ' current [A]')
plt.setp(stemlines, 'color', 'b')
plt.setp(markerline, 'markerfacecolor', 'b', 'markeredgecolor', 'b')
plt.show()
@@ -141,16 +141,19 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False):
if 'H' in output:
plt.setp(line, color='g')
plt.setp(ax, ylabel=outputtext + ', field strength [A/m]')
# elif 'I' in output:
# plt.setp(line, color='b')
# plt.setp(ax, ylabel=outputtext + ', current [A]')
elif 'I' in output:
plt.setp(line, color='b')
plt.setp(ax, ylabel=outputtext + ', current [A]')
# If multiple outputs required, create all nine subplots and populate only the specified ones
else:
fig, ax = plt.subplots(subplot_kw=dict(xlabel='Time [s]'), num='rx' + str(rx), figsize=(20, 10), facecolor='w', edgecolor='w')
gs = gridspec.GridSpec(3, 2, hspace=0.3, wspace=0.3)
if len(outputs) == 9:
gs = gridspec.GridSpec(3, 3, hspace=0.3, wspace=0.3)
else:
gs = gridspec.GridSpec(3, 2, hspace=0.3, wspace=0.3)
for output in outputs:
# Check for polarity of output and if requested output is in file
if output[-1] == 'm':
polarity = -1
@@ -196,18 +199,18 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False):
ax.plot(time, outputdata, 'g', lw=2, label=outputtext)
ax.set_ylabel(outputtext + ', field strength [A/m]')
#ax.set_ylim([-0.03, 0.03])
# elif output == 'Ix':
# ax = plt.subplot(gs[0, 2])
# ax.plot(time, outputdata,'b', lw=2, label=outputtext)
# ax.set_ylabel(outputtext + ', current [A]')
# elif output == 'Iy':
# ax = plt.subplot(gs[1, 2])
# ax.plot(time, outputdata,'b', lw=2, label=outputtext)
# ax.set_ylabel(outputtext + ', current [A]')
# elif output == 'Iz':
# ax = plt.subplot(gs[2, 2])
# ax.plot(time, outputdata,'b', lw=2, label=outputtext)
# ax.set_ylabel(outputtext + ', current [A]')
elif output == 'Ix':
ax = plt.subplot(gs[0, 2])
ax.plot(time, outputdata,'b', lw=2, label=outputtext)
ax.set_ylabel(outputtext + ', current [A]')
elif output == 'Iy':
ax = plt.subplot(gs[1, 2])
ax.plot(time, outputdata,'b', lw=2, label=outputtext)
ax.set_ylabel(outputtext + ', current [A]')
elif output == 'Iz':
ax = plt.subplot(gs[2, 2])
ax.plot(time, outputdata,'b', lw=2, label=outputtext)
ax.set_ylabel(outputtext + ', current [A]')
for ax in fig.axes:
ax.set_xlim([0, np.amax(time)])
ax.grid()