Commit 52c938e1 authored by Sven Liefgen's avatar Sven Liefgen
Browse files

Fix and improve

parent 4382ba9c
......@@ -33,7 +33,10 @@ def trace_jitter(data_frame, config=None, threshold=None, export=False, file_nam
"""
Displays (and saves) a stacked boxplot of durations.
"""
print(data_frame)
data_frame = data_frame[[x + "_D" for x in extract_durations(config)]]
print(data_frame)
data_frame.to_csv("durations.csv")
if threshold is None:
threshold = get_outlier_threshold(data_frame["EndToEnd_D"].describe())
......@@ -42,7 +45,7 @@ def trace_jitter(data_frame, config=None, threshold=None, export=False, file_nam
fig.set_size_inches(figsize[0], figsize[1])
print("{} / {} are no outliers.".format(len(df_no_outliers), len(data_frame)))
fig.canvas.set_window_title('Jitter Analysis')
plt.show()
# plt.show()
plt.close()
return None
......
......@@ -12,19 +12,26 @@ tasks = {
def main():
config = parse_config()
data_files = config["data_files"]
parser = argparse.ArgumentParser()
parser.add_argument("tasks", metavar="T", type=str, nargs="+", help="Analysis tasks to execute")
parser.add_argument("-e", "--export", dest="export", action="store_true", default=False, help="Output pdf files.")
parser.add_argument("-f", "--files", dest="files", nargs=2, help="Sender and Receiver CSV")
parser.add_argument("-s", "--suffix", dest="suffix", help="Suffix for exported file")
parser.add_argument("-x", "--xlap", dest="xlap", default="xlap.yml", help="xlap.yml config file")
args = parser.parse_args()
config = parse_config(args.xlap)
data_files = config["data_files"]
for command in args.tasks:
if command not in tasks.keys():
print("{} is not a known analysis task.".format(command))
continue
if args.files:
data_files["sender"] = args.files[0]
data_files["receiver"] = args.files[1]
if command == "capture":
types = ",\n".join([" ts_{}_packet = {}".format(k.lower(),v) for k,v in config["packet_types"].items()])
......@@ -52,13 +59,16 @@ def main():
if command == "jitter":
params1 = dict(params)
params1.update({"file_name": "TraceJitter.pdf"})
params2 = dict(params)
params1.update({"file_name": "TraceJitter.pdf"})
params2.update({"file_name": "JitterCauses.pdf"})
if args.suffix:
params1.update({"file_name": "TraceJitter_{}.pdf".format(args.suffix)})
params2.update({"file_name": "JitterCauses_{}.pdf".format(args.suffix)})
df = jitter.prep(df_data, config)
jitter.trace_jitter(df, **params1)
jitter.jitter_causes(df, config["durations"], **params2)
# df = jitter.prep(df_data, config)
jitter.trace_jitter(df_data, config=config, **params1)
jitter.jitter_causes(df_data, config, **params2)
if __name__ == "__main__":
main()
......@@ -21,7 +21,7 @@ def _extract_stamps_by_src_and_kind(all_stamps, src, kind=None):
def _evaluate_file(file_name, stamps, kind, measured_column, sender=False):
df = pd.read_csv(file_name)
df = pd.read_csv(file_name, skipinitialspace=True)
df = df[df["Kind"] == kind].drop(["Kind"], axis=1).set_index("SeqNo")
......
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