Commit a42b07f4 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Drop jitter.prep. Add xlim to box.

parent 42530eef
...@@ -28,21 +28,17 @@ def jitter_causes(df, durations, export=False, file_name=None): ...@@ -28,21 +28,17 @@ def jitter_causes(df, durations, export=False, file_name=None):
print("Outliers:", len(outliers), ";", "Threshold[us]:", threshold) print("Outliers:", len(outliers), ";", "Threshold[us]:", threshold)
def trace_jitter(data_frame, threshold=None, export=False, file_name=None): def trace_jitter(data_frame, config=None, threshold=None, export=False, file_name=None):
""" """
Displays (and saves) a stacked boxplot of durations. Displays (and saves) a stacked boxplot of durations.
""" """
data_frame = data_frame[[x + "_D" for x in extract_durations(config)]]
if threshold is None: if threshold is None:
threshold = get_outlier_threshold(data_frame["EndToEnd_D"].describe()) threshold = get_outlier_threshold(data_frame["EndToEnd_D"].describe())
df_no_outliers = data_frame[data_frame["EndToEnd_D"] <= threshold] df_no_outliers = data_frame[data_frame["EndToEnd_D"] <= threshold]
box(df_no_outliers, export, file_name) box(df_no_outliers, (0, threshold), export, file_name)
print("{} / {} are no outliers.".format(len(df_no_outliers), len(data_frame))) print("{} / {} are no outliers.".format(len(df_no_outliers), len(data_frame)))
fig = plt.gcf() fig = plt.gcf()
fig.canvas.set_window_title('Jitter Analysis') fig.canvas.set_window_title('Jitter Analysis')
plt.show() plt.show()
def prep(df, config):
res = df[[x + "_D" for x in extract_durations(config)]]
res.name = df.name
return res
...@@ -40,7 +40,7 @@ def extract_durations(config): ...@@ -40,7 +40,7 @@ def extract_durations(config):
return ["EndToEnd", "Sender"] + durations_send + ["Receiver"] + durations_recv return ["EndToEnd", "Sender"] + durations_send + ["Receiver"] + durations_recv
def box(data_frame, export=False, file_name=None): def box(data_frame, xlim=None, export=False, file_name=None):
""" """
Display a boxplot for the durations contained in data_frame. Display a boxplot for the durations contained in data_frame.
:param data_frame: :param data_frame:
...@@ -52,6 +52,8 @@ def box(data_frame, export=False, file_name=None): ...@@ -52,6 +52,8 @@ def box(data_frame, export=False, file_name=None):
fig = ax.get_figure() fig = ax.get_figure()
ax.set_yticklabels(list(map(lambda x: x.get_text().replace("_D", ""), ax.get_yticklabels()))) ax.set_yticklabels(list(map(lambda x: x.get_text().replace("_D", ""), ax.get_yticklabels())))
plt.xlabel("Time [us]") plt.xlabel("Time [us]")
if xlim is not None:
plt.xlim(xlim)
fig.set_size_inches(8, 4.5, forward=True) fig.set_size_inches(8, 4.5, forward=True)
if export and file_name is not None: if export and file_name is not None:
fig.savefig(file_name) fig.savefig(file_name)
......
Supports Markdown
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