Skip to content

Commit

Permalink
chore: refined loss rate ylim
Browse files Browse the repository at this point in the history
  • Loading branch information
penglei0 committed Nov 4, 2024
1 parent 6376718 commit 8bfab89
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/data_analyzer/iperf3_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def plot_udp_data(self):
fig, axs = plt.subplots(2, 1, figsize=(10, 8))
fig.suptitle("Iperf3 UDP statistics \n" +
self.config.subtitle, fontsize=12, fontweight="bold")
max_loss_rate = 50 # %
for input_log in self.config.input:
logging.info(f"Visualize iperf3 log: %s", input_log)
log_base_name = os.path.basename(input_log)
Expand All @@ -112,7 +113,9 @@ def plot_udp_data(self):
continue
log_label = log_base_name.split("_")[0]
loss_rate_array = visualize_data.get("loss_rate", [])
max_loss_rate = max(loss_rate_array)
cur_max = max(loss_rate_array)
max_loss_rate = max(max_loss_rate, cur_max)
logging.debug(f"loss_rate array: %s", loss_rate_array)
jitter_array = visualize_data.get("jitter", [])
x = np.arange(1, len(loss_rate_array))
# Plot loss rate
Expand All @@ -123,10 +126,7 @@ def plot_udp_data(self):
axs[0].set_ylabel('Loss Rate (%)', fontsize=9)
axs[0].legend(loc="upper right", fontsize=8)
axs[0].grid(True) # Add grid lines for better readability
if max_loss_rate < 0.5:
axs[0].set_ylim(-0.5, 0.5)
else:
axs[0].set_ylim(-0.5, 1)
axs[0].set_ylim(-10, max_loss_rate + 10)
axs[1].plot(x, jitter_array[0: len(x)], 'o-',
markersize=4, label=f"{log_label}")
axs[1].set_title('Jitter', fontsize=10)
Expand Down

0 comments on commit 8bfab89

Please sign in to comment.