def plot_epochs(): if len(sys.argv) > 1: filename = sys.argv[1] csv = readcsv.parse_to_dir_list(filename) lines = group(csv) plt.figure() plt.title(x_axis_colname.replace('_', ' ') + " vs. " + y_axis_colname.replace('_', ' ')) i = 0 for line_name, line_xy in lines.items(): # hex_color = "#%06X" % random.randint(0,256**3-1) plt.plot(line_xy["x"], line_xy["y"], linestyle=line_styles[i % len(line_styles)], marker=marker_types[i % len(marker_types)], alpha=0.7, linewidth=3, label=line_name, markeredgecolor=None) i+=1 plt.legend(prop=fontP, loc='upper center') plt.draw() plt.xlabel(x_axis_colname.replace('_', ' ')) plt.ylabel(y_axis_colname.replace('_', ' ')) plt.show(block=False) raw_input("press enter to close") plt.close("all")
import readcsv import sys if len(sys.argv) > 1: filename = sys.argv[1] pos = filename.rfind('.') newfilename = filename[:pos] + '_parsed' + filename[pos:] csv = readcsv.parse_to_dir_list(filename) with open(newfilename, "w") as f: keys = csv.keys() f.write(','.join(keys) + '\n') for idx in range(len(csv[keys[0]])): row = [] for k in keys: row.append(csv[k][idx]) f.write(','.join(row) + '\n')
import readcsv import sys if len(sys.argv) > 1: filename = sys.argv[1] pos = filename.rfind('.') newfilename = filename[:pos] + '_parsed' + filename[pos:] csv = readcsv.parse_to_dir_list(filename) with open(newfilename,"w") as f: keys = csv.keys() f.write(','.join(keys) + '\n') for idx in range(len(csv[keys[0]])): row = [] for k in keys: row.append(csv[k][idx]) f.write(','.join(row) + '\n')