| import matplotlib.pyplot as plt | import matplotlib.pyplot as plt | ||||
| import seaborn as sns | import seaborn as sns | ||||
| sns.set() | sns.set() | ||||
| tex_fonts = { | tex_fonts = { | ||||
| "mathtext.fontset": "dejavusans", | "mathtext.fontset": "dejavusans", | ||||
| } | } | ||||
| # plt.rcParams.update(tex_fonts) | # plt.rcParams.update(tex_fonts) | ||||
| transmission_df = transmission_df.sort_index() | transmission_df = transmission_df.sort_index() | ||||
| # srtt to [s] | # srtt to [s] | ||||
| transmission_df["srtt"] = transmission_df["srtt"].apply(lambda x: x / 10**6) | |||||
| transmission_df["srtt"] = transmission_df["srtt"].apply(lambda x: x / 10 ** 6) | |||||
| # key for columns and level for index | # key for columns and level for index | ||||
| transmission_df["goodput"] = ( | transmission_df["goodput"] = ( | ||||
| .transform("sum") | .transform("sum") | ||||
| ) | ) | ||||
| transmission_df["goodput"] = transmission_df["goodput"].apply( | transmission_df["goodput"] = transmission_df["goodput"].apply( | ||||
| lambda x: ((x * 8) / args.interval) / 10**6 | |||||
| lambda x: ((x * 8) / args.interval) / 10 ** 6 | |||||
| ) | ) | ||||
| transmission_df["goodput_rolling"] = ( | transmission_df["goodput_rolling"] = ( | ||||
| transmission_df["payload_size"].rolling("{}s".format(args.interval)).sum() | transmission_df["payload_size"].rolling("{}s".format(args.interval)).sum() | ||||
| ) | ) | ||||
| transmission_df["goodput_rolling"] = transmission_df["goodput_rolling"].apply( | transmission_df["goodput_rolling"] = transmission_df["goodput_rolling"].apply( | ||||
| lambda x: ((x * 8) / args.interval) / 10**6 | |||||
| lambda x: ((x * 8) / args.interval) / 10 ** 6 | |||||
| ) | ) | ||||
| # set meta values and remove all not needed columns | # set meta values and remove all not needed columns | ||||
| ].fillna(0) | ].fillna(0) | ||||
| transmission_df["lte_effective_bw_sum"] = ( | transmission_df["lte_effective_bw_sum"] = ( | ||||
| transmission_df["LTE_SCC1_effective_bw"].fillna(0) | |||||
| + transmission_df["LTE_SCC2_effective_bw"].fillna(0) | |||||
| + transmission_df["LTE_SCC3_effective_bw"].fillna(0) | |||||
| + transmission_df["LTE_SCC4_effective_bw"].fillna(0) | |||||
| + transmission_df["LTE_bw"].fillna(0)) | |||||
| transmission_df["LTE_SCC1_effective_bw"].fillna(0) | |||||
| + transmission_df["LTE_SCC2_effective_bw"].fillna(0) | |||||
| + transmission_df["LTE_SCC3_effective_bw"].fillna(0) | |||||
| + transmission_df["LTE_SCC4_effective_bw"].fillna(0) | |||||
| + transmission_df["LTE_bw"].fillna(0)) | |||||
| transmission_df["nr_effective_bw_sum"] = transmission_df["SCC1_NR5G_effective_bw"] | transmission_df["nr_effective_bw_sum"] = transmission_df["SCC1_NR5G_effective_bw"] | ||||
| transmission_df["effective_bw_sum"] = transmission_df["nr_effective_bw_sum"] + transmission_df["lte_effective_bw_sum"] | |||||
| transmission_df["effective_bw_sum"] = transmission_df["nr_effective_bw_sum"] + transmission_df[ | |||||
| "lte_effective_bw_sum"] | |||||
| # transmission timeline | # transmission timeline | ||||
| scaley = 1.5 | scaley = 1.5 | ||||
| ax01.set_ylabel("Bandwidth [MHz]") | ax01.set_ylabel("Bandwidth [MHz]") | ||||
| if args.fancy: | if args.fancy: | ||||
| ax0.set_xlim([0, transmission_df.index[-1]]) | |||||
| ax00.set_xlim([0, transmission_df.index[-1]]) | |||||
| # added these three lines | # added these three lines | ||||
| lns_ax0 = snd_plot + srtt_plot + goodput_plot | lns_ax0 = snd_plot + srtt_plot + goodput_plot | ||||
| labs_ax0 = [l.get_label() for l in lns_ax0] | labs_ax0 = [l.get_label() for l in lns_ax0] | ||||
| ax0.legend(lns_ax0, labs_ax0, ncols=4, fontsize=12, loc="upper center") | ax0.legend(lns_ax0, labs_ax0, ncols=4, fontsize=12, loc="upper center") | ||||
| lns_ax00 = eff_bw_plot + lte_eff_bw_plot + nr_eff_bw_plot + lte_rsrq_plot + nr_rsrq_plot | lns_ax00 = eff_bw_plot + lte_eff_bw_plot + nr_eff_bw_plot + lte_rsrq_plot + nr_rsrq_plot | ||||
| if lte_hanover_plot: | if lte_hanover_plot: | ||||
| lns_ax00.append(lte_hanover_plot) | lns_ax00.append(lte_hanover_plot) | ||||
| if nr_hanover_plot: | if nr_hanover_plot: | ||||
| lns_ax00.append(nr_hanover_plot) | lns_ax00.append(nr_hanover_plot) | ||||
| labs_ax00 = [l.get_label() for l in lns_ax0] | |||||
| labs_ax00 = [l.get_label() for l in labs_ax00] | |||||
| ax00.legend(lns_ax00, labs_ax00, ncols=4, fontsize=12, loc="upper center") | ax00.legend(lns_ax00, labs_ax00, ncols=4, fontsize=12, loc="upper center") | ||||
| plt.savefig("{}{}_plot.eps".format(args.save, csv.replace(".csv", "")), bbox_inches="tight") | plt.savefig("{}{}_plot.eps".format(args.save, csv.replace(".csv", "")), bbox_inches="tight") | ||||
| else: | else: | ||||
| fig.legend(loc="lower right") | fig.legend(loc="lower right") | ||||
| plt.savefig("{}{}_plot.pdf".format(args.save, csv.replace(".csv", "")), bbox_inches="tight") | |||||
| plt.savefig("{}{}_plot.pdf".format(args.save, csv.replace(".csv", "")), bbox_inches="tight") | |||||
| # except Exception as e: | # except Exception as e: | ||||
| # print("Error processing file: {}".format(csv)) | # print("Error processing file: {}".format(csv)) | ||||
| # print(str(e)) | # print(str(e)) |