Commit 0feb1cbc authored by Andreas Schmidt's avatar Andreas Schmidt

Refactor config parsing out. Use ruamel.yaml.

parent 7e068b69
......@@ -3,4 +3,4 @@ scipy==0.19.0
pandas==0.20.1
matplotlib==2.0.1
sklearn==0.0
pyyaml==3.12
ruamel.yaml==3.12
......@@ -9,14 +9,6 @@ plt.rcParams.update({'figure.autolayout': True})
# TODO: Refactor.
def hist(df):
return df.hist(cumulative=True, normed=1, bins=200)
def scatter(df, column):
plt.scatter(df.index, df[column], grid=True)
def regress(df, column):
x = df.index.values.reshape(-1, 1)
y = df[column].values
......
......@@ -29,11 +29,14 @@ def jitter_causes(df, durations, export=False, file_name=None):
print("Outliers:", len(outliers), ";", "Threshold[us]:", threshold)
def trace_jitter(df_filtered, export=False, file_name=None):
thresh = get_outlier_threshold(df_filtered["EndToEndTime"].describe())
df_no_outliers = df_filtered[df_filtered["EndToEndTime"] <= thresh]
def trace_jitter(data_frame, export=False, file_name=None):
"""
Displays (and saves) a stacked boxplot of durations.
"""
thresh = get_outlier_threshold(data_frame["EndToEndTime"].describe())
df_no_outliers = data_frame[data_frame["EndToEndTime"] <= thresh]
box(df_no_outliers, export, file_name)
print("{} / {} are no outliers.".format(len(df_no_outliers), len(df_filtered)))
print("{} / {} are no outliers.".format(len(df_no_outliers), len(data_frame)))
fig = plt.gcf()
fig.canvas.set_window_title('Jitter Analysis')
plt.show()
......
import matplotlib.pyplot as plt
def hist(df):
return df.hist(cumulative=True, normed=1, bins=200)
def scatter(df, column):
plt.scatter(df.index, df[column], grid=True)
import argparse
import yaml
from xlap.parse import evaluate
from xlap.parse import evaluate, parse_config
import xlap.analyse.jitter as jitter
tasks = {
......@@ -9,12 +8,6 @@ tasks = {
}
def parse_config():
with open("xlap.yml") as f:
contents = f.read()
return yaml.load(contents)
def main():
config = parse_config()
data_files = config["data_files"]
......
import pandas as pd
import ruamel.yaml
import ruamel.yaml as yaml
def _stamp_name_by_src_and_type(all_stamps, src, kind=None):
......@@ -77,3 +79,9 @@ def evaluate(sender_file, receiver_file, config, kind=0):
df["EndToEndTime"] = df["Sender_D"] + df["Receiver_D"]
return df
def parse_config(file_name="xlap.yml"):
with open(file_name) as f:
contents = f.read()
return yaml.load(contents, Loader=ruamel.yaml.Loader)
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