コード例 #1
0
ファイル: plotter.py プロジェクト: bcdev/opec-tools
 def setup_axes(self):
     ax = SubplotZero(self.fig, 1, 1, 1)
     self.fig.add_subplot(ax)
     ax.set_xlabel('%s %s' % (self.ref_name, self.unit_string))
     ax.set_ylabel('%s %s' % (self.model_name, self.unit_string))
     ax.grid()
     self.ax = ax
コード例 #2
0
 def setup_axes(self):
     ax = SubplotZero(self.fig, 1, 1, 1)
     self.fig.add_subplot(ax)
     ax.set_xlabel('%s %s' % (self.ref_name, self.unit_string))
     ax.set_ylabel('%s %s' % (self.model_name, self.unit_string))
     ax.grid()
     self.ax = ax
コード例 #3
0
print(f"Success:\n{success}")
print(f"Failed reassembly:\n{failed_reassembly}")
print(f"Sender aborted:\n{sender_aborted}")
print(f"Receiver aborted:\n{receiver_aborted}")

fig = plt.figure()
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
ax.grid(True, ls='dotted')
x_axis = [l / 100 for l in loss_rates]
ax.plot(x_axis, [x / 100 for x in sender_aborted])
ax.plot(x_axis, [x / 100 for x in receiver_aborted])
ax.plot(x_axis, [x / 100 for x in failed_reassembly], color='r', linewidth=4)
ax.set_xlabel("Fragment loss rate")
ax.set_ylabel("Occurrences / Total experiments")
ax.set_xlim((0, 1))
ax.set_ylim((0, 1))
plt.legend(["Sender-Aborted", "Receiver-Aborted", "Failed reassembly"])
plt.show()
fig.savefig("failed_total.png")

fail_rate = [None] * len(loss_rates)
completion_rate = [None] * len(loss_rates)
for i in range(len(loss_rates)):
    try:
        fail_rate[i] = failed_reassembly[i] / (success[i] + failed_reassembly[i])
        completion_rate[i] = (success[i] + failed_reassembly[i]) / 100
    except ZeroDivisionError:
        fail_rate[i] = None