diff --git a/plot_gps_new.py b/plot_gps_new.py index f516920..e9e5719 100755 --- a/plot_gps_new.py +++ b/plot_gps_new.py @@ -14,7 +14,6 @@ if __name__ == "__main__": parser.add_argument("-l", "--label", help="Label above the plot.") parser.add_argument("--no_legend", action="store_false", default=True, help="Do not show legend.") parser.add_argument("--save", default=None, help="Location to save pdf file.") - parser.add_argument("--time_offset", default=None, type=int, help="Minutes added to GPS datetime.") parser.add_argument( "--show_providerinfo", diff --git a/plot_single_transmission_timeline.py b/plot_single_transmission_timeline.py index 72a0ac9..dfdbe84 100755 --- a/plot_single_transmission_timeline.py +++ b/plot_single_transmission_timeline.py @@ -53,9 +53,8 @@ if __name__ == "__main__": transmission_df.index = pd.to_datetime(transmission_df.index) transmission_df = transmission_df.sort_index() - #print("Calculate goodput...") - - #print(transmission_df) + # srtt to [s] + transmission_df["srtt"] = transmission_df["srtt"].apply(lambda x: x / 10**6) # key for columns and level for index transmission_df["goodput"] = transmission_df["payload_size"].groupby(pd.Grouper(level="datetime", freq="{}s".format(args.interval))).transform("sum") @@ -131,8 +130,8 @@ if __name__ == "__main__": ax.axvspan(bounds.min(), bounds.max(), alpha=0.3, color=color_list[c]) p4, = twin3.plot(transmission_df["snd_cwnd"].dropna(), color="lime", linestyle="dashed", label="cwnd") - p3, = twin2.plot(transmission_df["ack_rtt"].dropna(), color="red", linestyle="dashdot", label="ACK RTT") - p1, = ax.plot(transmission_df["goodput_rolling"], color="blue", linestyle="solid", label="goodput") + p3, = twin2.plot(transmission_df["srtt"].dropna(), color="red", linestyle="dashdot", label="sRTT") + p1, = ax.plot(transmission_df["arrival_time"], transmission_df["goodput_rolling"], color="blue", linestyle="solid", label="goodput") p2, = twin1.plot(transmission_df["downlink_cqi"].dropna(), color="magenta", linestyle="dotted", label="CQI") ax.set_xlim(transmission_df["index"].min(), transmission_df["index"].max()) @@ -144,7 +143,7 @@ if __name__ == "__main__": ax.set_xlabel("arrival time") ax.set_ylabel("Goodput [mbps]") twin1.set_ylabel("CQI") - twin2.set_ylabel("ACK RTT [s]") + twin2.set_ylabel("sRTT [s]") twin3.set_ylabel("cwnd") ax.yaxis.label.set_color(p1.get_color()) @@ -163,6 +162,30 @@ if __name__ == "__main__": if args.save: plt.savefig("{}{}_plot.pdf".format(args.save, csv.replace(".csv", ""))) + + + # plot correlations + corr_pairs = [ + ["goodput_rolling", "RSRQ"], + ["goodput_rolling", "RSRP"], + ["goodput_rolling", "RSSI"], + ["goodput_rolling", "SINR"], + ["goodput_rolling", "downlink_cqi"], + ] + + for pair in corr_pairs: + # spearman and pearson + sp = transmission_df[pair[0]].corr(transmission_df[pair[1]], method="spearman") + pe = transmission_df[pair[0]].corr(transmission_df[pair[1]], method="pearson") + title = "{}/{} spearman: {} pearson: {}".format(pair[0], pair[1], round(sp, 4), round(pe, 4)) + transmission_df.plot.scatter(x=pair[0], y=pair[1], c="DarkBlue", title=title) + + if args.save: + plt.savefig("{}{}_corr_{}_and_{}.pdf".format(args.save, csv.replace(".csv", ""), pair[0], pair[1])) + + plt.clf() + + counter += 1 plt.clf() \ No newline at end of file