def deviation_generation(fname, groups_list): """ Print deviation by groups for data from fname """ CONC_POS = key_pos['concurence'] int_list = [int(i) for i in groups_list] data = list(io_test.load_io_py_file(fname)) item = io_test.Data("hdr") for key, vals in io_test.groupby_globally(data, io_test.key_func).items(): item.series[key] = [val['iops'] * key[CONC_POS] for val in vals] print deviation_on_deviation(int_list, item.series[key])
def plot_generation(fname, group_by): """ plots for value group_by in imgs by actions""" data = list(io_test.load_io_py_file(fname)) item = io_test.Data("hdr") for key, vals in io_test.groupby_globally(data, io_test.key_func).items(): item.series[key] = [val['iops'] for val in vals] io_test.process_inplace(item) pr_data = generate_groups(item.processed_series, group_by) print pr_data #fig = plt.figure() plot = plt.subplot(111) for action in actions: for tp in types: color = 0 hasPlot = False for key, val in pr_data.items(): if action in key and tp in key: ok = gen_app_plot(key, val, plot, colors[color]) hasPlot = hasPlot or ok color += 1 # use it for just connect dots #save_plot(key, val) if hasPlot: # Shrink current axis by 10% box = plot.get_position() plot.set_position([ box.x0, box.y0 + box.height * 0.1, box.width, box.height * 0.9 ]) # Put a legend to the bottom plot.legend(loc='lower center', bbox_to_anchor=(0.5, -0.25), fancybox=True, shadow=True, ncol=4, fontsize='xx-small') plt.title("Plot for %s on %s" % (group_by, action)) plt.ylabel("time") plt.xlabel(group_by) plt.grid() # use it if want scale plot somehow # plt.axis([0.0, 5000.0, 0.0, 64.0]) name = "%s__%s_%s.png" % (group_by, action, tp) plt.savefig(name, format='png', dpi=100) plt.clf() plot = plt.subplot(111) color = 0
def plot_generation(fname, group_by): """ plots for value group_by in imgs by actions""" data = list(io_test.load_io_py_file(fname)) item = io_test.Data("hdr") for key, vals in io_test.groupby_globally(data, io_test.key_func).items(): item.series[key] = [val['iops'] for val in vals] io_test.process_inplace(item) pr_data = generate_groups(item.processed_series, group_by) print pr_data #fig = plt.figure() plot = plt.subplot(111) for action in actions: for tp in types: color = 0 hasPlot = False for key, val in pr_data.items(): if action in key and tp in key: ok = gen_app_plot(key, val, plot, colors[color]) hasPlot = hasPlot or ok color += 1 # use it for just connect dots #save_plot(key, val) if hasPlot: # Shrink current axis by 10% box = plot.get_position() plot.set_position([box.x0, box.y0 + box.height * 0.1, box.width, box.height * 0.9]) # Put a legend to the bottom plot.legend(loc='lower center', bbox_to_anchor=(0.5, -0.25), fancybox=True, shadow=True, ncol=4, fontsize='xx-small') plt.title("Plot for %s on %s" % (group_by, action)) plt.ylabel("time") plt.xlabel(group_by) plt.grid() # use it if want scale plot somehow # plt.axis([0.0, 5000.0, 0.0, 64.0]) name = "%s__%s_%s.png" % (group_by, action, tp) plt.savefig(name, format='png', dpi=100) plt.clf() plot = plt.subplot(111) color = 0