Ejemplo n.º 1

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description="""For getting and dumping data
                                                  into the db""")
    parser.add_argument("--get", dest="get", help="""This option is used to
    obtain data of the db, you have to pass the filename""")
    parser.add_argument("--get-lineal-r", dest="get_lineal", help="""This
    option is used to obtain the values of lineal regression of the db,
    you have to pass the filename""")
    parser.add_argument("--put", dest="put", help="""This is for dump values
    into the db, you have to pass the filename or a path""")
    args = parser.parse_args()

    myDB = Repositorio(MYDB)
    if args.get:
        if path.isfile(args.get):
            #its a file not just a part of the name
            values = myDB.get_original_data(args.get)
            x_processed_values, y_processed_values = myDB.get_processed_data(args.get)
            print x_values, y_values
            #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]
Ejemplo n.º 2
    """Plot chart of x_values vs. y_values using color and label."""
    data, = pylab.plot(y_values)
    pylab.text(400, -0.0002, about, {'color': 'g', 'fontsize': 15})
    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):