Adds DL_bandwidth to plot.
This commit is contained in:
@@ -10,6 +10,23 @@ import pandas as pd
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
|
||||||
|
def convert_bandwidth(value):
|
||||||
|
if value == 0:
|
||||||
|
return 1.4
|
||||||
|
elif value == 1:
|
||||||
|
return 3
|
||||||
|
elif value == 2:
|
||||||
|
return 5
|
||||||
|
elif value == 3:
|
||||||
|
return 10
|
||||||
|
elif value == 4:
|
||||||
|
return 15
|
||||||
|
elif value == 5:
|
||||||
|
return 20
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = ArgumentParser()
|
parser = ArgumentParser()
|
||||||
parser.add_argument("-s", "--serial_file", required=True, help="Serial csv file.")
|
parser.add_argument("-s", "--serial_file", required=True, help="Serial csv file.")
|
||||||
@@ -49,7 +66,9 @@ if __name__ == "__main__":
|
|||||||
transmission_df = pd.read_csv(
|
transmission_df = pd.read_csv(
|
||||||
"{}{}".format(args.pcap_csv_folder, csv),
|
"{}{}".format(args.pcap_csv_folder, csv),
|
||||||
dtype=dict(is_retranmission=bool, is_dup_ack=bool),
|
dtype=dict(is_retranmission=bool, is_dup_ack=bool),
|
||||||
|
converters={"UL_bandwidth": convert_bandwidth, "DL_bandwidth": convert_bandwidth},
|
||||||
)
|
)
|
||||||
|
|
||||||
transmission_df["datetime"] = pd.to_datetime(transmission_df["datetime"]) - pd.Timedelta(hours=1)
|
transmission_df["datetime"] = pd.to_datetime(transmission_df["datetime"]) - pd.Timedelta(hours=1)
|
||||||
transmission_df = transmission_df.set_index("datetime")
|
transmission_df = transmission_df.set_index("datetime")
|
||||||
transmission_df.index = pd.to_datetime(transmission_df.index)
|
transmission_df.index = pd.to_datetime(transmission_df.index)
|
||||||
@@ -102,10 +121,12 @@ if __name__ == "__main__":
|
|||||||
twin1 = ax.twinx()
|
twin1 = ax.twinx()
|
||||||
twin2 = ax.twinx()
|
twin2 = ax.twinx()
|
||||||
twin3 = ax.twinx()
|
twin3 = ax.twinx()
|
||||||
|
twin4 = ax.twinx()
|
||||||
# Offset the right spine of twin2. The ticks and label have already been
|
# Offset the right spine of twin2. The ticks and label have already been
|
||||||
# placed on the right by twinx above.
|
# placed on the right by twinx above.
|
||||||
twin2.spines.right.set_position(("axes", 1.1))
|
twin2.spines.right.set_position(("axes", 1.1))
|
||||||
twin3.spines.right.set_position(("axes", 1.2))
|
twin3.spines.right.set_position(("axes", 1.2))
|
||||||
|
twin4.spines.right.set_position(("axes", 1.3))
|
||||||
|
|
||||||
|
|
||||||
# create list fo color indices
|
# create list fo color indices
|
||||||
@@ -135,18 +156,21 @@ if __name__ == "__main__":
|
|||||||
p3, = twin2.plot(transmission_df["srtt"].dropna(), color="red", linestyle="dashdot", label="sRTT")
|
p3, = twin2.plot(transmission_df["srtt"].dropna(), color="red", linestyle="dashdot", label="sRTT")
|
||||||
p1, = ax.plot(transmission_df["goodput_rolling"], color="blue", linestyle="solid", label="goodput")
|
p1, = ax.plot(transmission_df["goodput_rolling"], color="blue", linestyle="solid", label="goodput")
|
||||||
p2, = twin1.plot(transmission_df["downlink_cqi"].dropna(), color="magenta", linestyle="dotted", label="CQI")
|
p2, = twin1.plot(transmission_df["downlink_cqi"].dropna(), color="magenta", linestyle="dotted", label="CQI")
|
||||||
|
p5, = twin4.plot(transmission_df["DL_bandwidth"].dropna(), color="peru", linestyle="dotted", label="DL_bandwidth")
|
||||||
|
|
||||||
ax.set_xlim(transmission_df["index"].min(), transmission_df["index"].max())
|
ax.set_xlim(transmission_df["index"].min(), transmission_df["index"].max())
|
||||||
ax.set_ylim(0, 500)
|
ax.set_ylim(0, 500)
|
||||||
twin1.set_ylim(0, 15)
|
twin1.set_ylim(0, 15)
|
||||||
twin2.set_ylim(0, 0.2) #twin2.set_ylim(0, transmission_df["ack_rtt"].max())
|
twin2.set_ylim(0, 0.2) #twin2.set_ylim(0, transmission_df["ack_rtt"].max())
|
||||||
twin3.set_ylim(0, transmission_df["snd_cwnd"].max() + 10)
|
twin3.set_ylim(0, transmission_df["snd_cwnd"].max() + 10)
|
||||||
|
twin4.set_ylim(0, 21)
|
||||||
|
|
||||||
ax.set_xlabel("arrival time")
|
ax.set_xlabel("arrival time")
|
||||||
ax.set_ylabel("Goodput [mbps]")
|
ax.set_ylabel("Goodput [mbps]")
|
||||||
twin1.set_ylabel("CQI")
|
twin1.set_ylabel("CQI")
|
||||||
twin2.set_ylabel("sRTT [s]")
|
twin2.set_ylabel("sRTT [s]")
|
||||||
twin3.set_ylabel("cwnd")
|
twin3.set_ylabel("cwnd")
|
||||||
|
twin4.set_ylabel("DL_bandwidth")
|
||||||
|
|
||||||
ax.yaxis.label.set_color(p1.get_color())
|
ax.yaxis.label.set_color(p1.get_color())
|
||||||
twin1.yaxis.label.set_color(p2.get_color())
|
twin1.yaxis.label.set_color(p2.get_color())
|
||||||
|
|||||||
Reference in New Issue
Block a user