Commit 83a33a6f authored by Andreas Schmidt's avatar Andreas Schmidt

Refactor. correlation now using durations from xlap.yml.

parent cdb8a8c6
This source diff could not be displayed because it is too large. You can view the blob instead.
import math
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (16, 9)
plt.rcParams.update({'figure.autolayout': True})
# TODO: Refactor.
def box(data_frame, export=False, file_name=None):
"""
Display a boxplot for the durations contained in data_frame.
:param data_frame:
:param export:
:param file_name:
:return:
"""
ax = data_frame.plot.box(vert=False, grid=True)
fig = ax.get_figure()
ax.set_yticklabels(list(map(lambda x: x.get_text().replace("_D", ""), ax.get_yticklabels())))
plt.xlabel("Time [us]")
fig.set_size_inches(8, 4.5, forward=True)
if export and file_name is not None:
fig.savefig(file_name)
def describe_table(df):
stats = df.describe()
stats.drop(["count"], inplace=True)
stats.columns = list(map(lambda x: x.replace("_D", ""), stats.columns))
table = stats.to_latex(float_format=lambda x: "%.3f" % x)
print(table)
return stats
def correlation(df_data, title="Correlation.pdf"):
columns = list(["Sender_D",
"SendTime",
"SenderIPCTime",
"LinkTransmitTime",
"Receiver_D",
"ReceiverIPCTime",
"HandlePacketTime",
"FeedbackTime",
])
cols = 4
rows = int(math.ceil(len(columns) / cols))
fig, axes = plt.subplots(nrows=rows, ncols=cols)
fig.set_size_inches(4 * cols, 3.5 * rows, forward=True)
i = 0
for column in columns:
ax = df_data.plot.scatter(ax=axes[i // cols, i % cols], y="EndToEnd_D", x=column, grid=True, marker="+",
color="black")
ax.set_ylabel("EndToEnd [us]")
ax.margins(0.1, 0.1)
ax.set_xlabel("{} [us]".format(column.replace("_D", "")))
i += 1
fig.savefig(title)
import math
import matplotlib.pyplot as plt
from xlap.analyse.util import extract_durations
def correlation(data_frame, config, export=False, file_name="Correlation.pdf"):
durations = [x + "_D" for x in extract_durations(config)]
durations.remove("EndToEnd_D")
cols = 4
rows = int(math.ceil(len(durations) / cols))
fig, axes = plt.subplots(nrows=rows, ncols=cols)
fig.set_size_inches(4 * cols, 3.5 * rows, forward=True)
i = 0
for duration in durations:
ax = data_frame.plot.scatter(ax=axes[i // cols, i % cols], y="EndToEnd_D", x=duration, grid=True, marker="+",
color="black")
ax.set_ylabel("EndToEnd [us]")
ax.margins(0.1, 0.1)
ax.set_xlabel("{} [us]".format(duration.replace("_D", "")))
i += 1
if export and file_name is not None:
fig.savefig(file_name)
plt.tight_layout()
plt.show()
\ No newline at end of file
import pandas as pd
import matplotlib.pyplot as plt
from xlap.analyse.util import get_outlier_threshold, extract_durations
from xlap.analyse import box
from xlap.analyse.util import get_outlier_threshold, extract_durations, box
def jitter_causes(df, durations, export=False, file_name=None):
......@@ -43,6 +42,4 @@ def trace_jitter(data_frame, export=False, file_name=None):
def prep(df, config):
plt.rcParams["figure.figsize"] = (16, 9)
plt.rcParams.update({'figure.autolayout': True})
return df[[x + "_D" for x in extract_durations(config)]]
......@@ -65,10 +65,12 @@ def trace(data_frame, config, export=False, file_name="TraceJitter.pdf"):
plt.savefig(file_name)
plt.show()
def traces(df, config):
"""
Display a slider to select sequence numbers and the respective trace.
"""
@interact(seq_no=widgets.IntSlider(min=1,max=len(df),step=1,value=47))
@interact(seq_no=widgets.IntSlider(min=1, max=len(df), step=1, value=47))
def _f(seq_no):
trace(df.ix[seq_no],config)
trace(df.ix[seq_no], config)
import matplotlib.pyplot as plt
from matplotlib import pyplot as plt
def hist(df):
......@@ -21,4 +22,30 @@ def extract_durations(config):
durations_send = [x for x in durations if durations[x]["Source"] == "sender"]
durations_recv = [x for x in durations if durations[x]["Source"] == "receiver"]
return ["EndToEnd", "Sender"] + durations_send + ["Receiver"] + durations_recv
\ No newline at end of file
return ["EndToEnd", "Sender"] + durations_send + ["Receiver"] + durations_recv
def box(data_frame, export=False, file_name=None):
"""
Display a boxplot for the durations contained in data_frame.
:param data_frame:
:param export:
:param file_name:
:return:
"""
ax = data_frame.plot.box(vert=False, grid=True)
fig = ax.get_figure()
ax.set_yticklabels(list(map(lambda x: x.get_text().replace("_D", ""), ax.get_yticklabels())))
plt.xlabel("Time [us]")
fig.set_size_inches(8, 4.5, forward=True)
if export and file_name is not None:
fig.savefig(file_name)
def describe_table(df):
stats = df.describe()
stats.drop(["count"], inplace=True)
stats.columns = list(map(lambda x: x.replace("_D", ""), stats.columns))
table = stats.to_latex(float_format=lambda x: "%.3f" % x)
print(table)
return stats
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment