#its a RE descriptions = myDB.get_filenames_with_re(args.get) x_values = []; y_values = [] x_total_proc_values = []; y_total_proc_values = [] for d in descriptions: values = myDB.get_original_data(d) x_values += values[0] y_values += values[1] xps, yps = myDB.get_processed_data(d) x_total_proc_values += xps y_total_proc_values += yps print x_values, y_values #Now we can do something with this values... if args.put: if path.isfile(args.put): myDB.insert_data(args.put) else: insert_multiple_files(args.put) if args.get_lineal: std, slope, intercept, r_value, p_value = myDB.get_lineal_regression(args.get_lineal) #do something with this values print """ std : %1.8f slope : %1.8f intercept : %1.8f r_value : %1.8f p_value : %1.8f """ % (std, slope, intercept, r_value, p_value)
pylab.title(title) pylab.text(400, -0.0002, about, {'color': 'g', 'fontsize': 15}) pylab.xlabel('x') pylab.ylabel('y') pylab.savefig("../plots/matplot2std.png", dpi = 100) if __name__ == '__main__': parser = argparse.ArgumentParser(description='For test linealregression and standar desviation') parser.add_argument("-f", "--file", dest="file", help='This option is used to pass the data file') args = parser.parse_args() myDB = Repositorio(MYDB) #nos aseguramos de guardar en la db el archivo values = myDB.insert_data(args.file) #obtain de std of y values desviation_y = do_std(values[1]) #dump into the db myDB.dump_data(args.file, [None], [desviation_y], "std") plot_data(values[1], r'$\sigma = %.18f $' %(desviation_y), "y_values and std") #do the same with lineal regression results_lineal = do_linealregression(values[0], values[1]) labels = ['slope', 'intercept', 'r_value', 'p_value'] for value, about in zip(results_lineal, labels): myDB.dump_data(args.file, [None], [value], about) filename = "../fileTest/liear_fit" + path.basename(args.file) save_ascii(filename, labels, results_lineal)