def plot(dt_start, dt_end, metric): dt_dir = utils.get_dt_dir(dt_start, dt_end) str_dt = utils.get_str_dt(dt_start, dt_end) utils.create_dirs([ "{}/{}".format(script_dir, str_dt), "{}/{}/{}".format(script_dir, str_dt, metric) ]) for server, mac, in_path in utils.iter_server_mac(dt_dir, True): out_file_name = utils.get_out_file_name(server, mac, dt_start, dt_end) out_path = "{}/{}/{}/{}.png".format(script_dir, str_dt, metric, out_file_name) # comparison between not filtered and filtered ts = TimeSeries(in_path, metric, dt_start, dt_end) ts_filter = TimeSeries(in_path, metric, dt_start, dt_end) ts_filter.percentile_filter(win_len=5, p=0.5) # if len(ts_filter.y) > 100: # plot_procedures.plot_stl_decomposition(ts_filter, # "median_filtered", # out_path) # comparison between with cross traffic and without # ts = TimeSeries(in_path, metric, dt_start, dt_end) # ts.percentile_filter(win_len=13, p=0.5) # ts_filter = TimeSeries(in_path, metric, dt_start, dt_end, # cross_traffic_thresh=0) # ts_filter.percentile_filter(win_len=13, p=0.5) # plot_procedures.plot_ts_share_x(ts, ts_filter, out_path, # compress=True, # plot_type2="scatter", # title1="raw", # title2="median filtered", # default_ylabel=True, # xlabel="$i$") ylabel = plot_procedures.get_default_ylabel(ts) plot_procedures.plot_ts(ts_filter, out_path, ylabel=ylabel, compress=False, title="median filtered")
def plot_per_node(dt_start, dt_end, metric, only_unique_traceroute): dt_dir = utils.get_dt_dir(dt_start, dt_end) str_dt = utils.get_str_dt(dt_start, dt_end) utils.create_dirs([ "{}/plots/".format(script_dir), "{}/plots/nodes".format(script_dir), "{}/plots/nodes/{}".format(script_dir, str_dt), "{}/plots/nodes/{}/{}".format(script_dir, str_dt, metric) ]) valid_nodes = read_input.get_valid_nodes() mac_node = read_input.get_mac_node() macs_unique_traceroute = read_input.get_macs_traceroute_filter( dt_start, dt_end, "filtered") for server, mac, in_path in utils.iter_server_mac(dt_dir, True): if only_unique_traceroute and (mac not in macs_unique_traceroute): continue if mac_node[mac] in valid_nodes: utils.create_dirs([ "{}/plots/nodes/{}/{}/{}".format(script_dir, str_dt, metric, mac_node[mac]) ]) out_file_name = utils.get_out_file_name(server, mac, dt_start, dt_end) out_path = ("{}/plots/nodes/{}/{}/{}/{}.png".format( script_dir, str_dt, metric, mac_node[mac], out_file_name)) ts = TimeSeries(in_path, metric, dt_start, dt_end) ts_filter = TimeSeries(in_path, metric, dt_start, dt_end) ts_filter.percentile_filter(win_len=13, p=0.5) plot_procedures.plot_ts_share_x(ts, ts_filter, out_path, compress=False, plot_type2="scatter")