Compare commits

...

2 Commits

Author SHA1 Message Date
Lukas Prause
29b5e02469 Merge branch 'master' of ssh://git.black-mesa.xyz:434/langspielplatte/measurement-scripts 2023-07-05 15:15:58 +02:00
Lukas Prause
f7abcf1fdf Adds script to plot the usage of bandwidth. 2023-07-05 15:15:45 +02:00

58
plot_stacked_bandwidth.py Executable file
View File

@@ -0,0 +1,58 @@
#!/usr/bin/env python3
from argparse import ArgumentParser
import pandas as pd
import matplotlib.pyplot as plt
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument("-f", "--file", required=True, help="Serial CSV")
parser.add_argument("--save", default=None, help="Location to save pdf file.")
args = parser.parse_args()
df = pd.read_csv(args.file)
df["time_rel"] = df["time"] - df["time"].iloc[0]
df.index = df["time_rel"] / 60
for i in range(1, 5):
df["LTE_SCC{}_effective_bw".format(i)] = df["LTE_SCC{}_bw".format(i)]
mask = df["LTE_SCC{}_state".format(i)].isin(["ACTIVE"])
df["LTE_SCC{}_effective_bw".format(i)] = df[
"LTE_SCC{}_effective_bw".format(i)
].where(mask, other=0)
df["SCC1_NR5G_effective_bw"] = df["SCC1_NR5G_bw"].fillna(0)
df["effective_bw_sum"] = (
df["SCC1_NR5G_effective_bw"]
+ df["LTE_SCC1_effective_bw"]
+ df["LTE_SCC2_effective_bw"]
+ df["LTE_SCC3_effective_bw"]
+ df["LTE_SCC4_effective_bw"]
+ df["LTE_bw"]
)
bw_cols = [
"SCC1_NR5G_effective_bw",
"LTE_bw",
"LTE_SCC1_effective_bw",
"LTE_SCC2_effective_bw",
"LTE_SCC3_effective_bw",
"LTE_SCC4_effective_bw",
]
ax = df[bw_cols].plot.area(stacked=True)
ax.set_ylabel("bandwidth [MHz]")
ax.set_xlabel("time [minutes]")
L = plt.legend()
L.get_texts()[0].set_text("5G main")
L.get_texts()[1].set_text("4G main")
L.get_texts()[2].set_text("4G SCC 1")
L.get_texts()[3].set_text("4G SCC 2")
L.get_texts()[4].set_text("4G SCC 3")
L.get_texts()[5].set_text("4G SCC 4")
plt.show()