Demo entry 6345473

myPi

   

Submitted by anonymous on Jan 31, 2017 at 20:43
Language: Python 3. Code size: 2.1 kB.

import sys



def read_data(path):
    data_t = []
    data_x = []
    data_y = []
    
    f = open(path, "r")
    data = f.read()
    f.close()
    row = data.split('\n')
    for data in row:
        data = data.split(',')
        if len(data) == 3:
            data_t.append(data[0])
            data_x.append(data[1])
            data_y.append(data[2])
    return [data_t,data_x, data_y]

if __name__ == "__main__":
    data_patron_t = []
    data_patron_x = []
    data_patron_y = []
    data_capturada_t = []
    data_capturada_x = []
    data_capturada_y = []

    #Argumento 1 = Path del file
    #Argumento 2 = path de los datos de la onda patron
    #Argumento 3 = path de los datos de la onda capturada
    argumentos = sys.argv

    #Datos de onda patron
    data = read_data(argumentos[2])
    data_patron_t = data[0]
    data_patron_x = data[1]
    data_patron_y = data[2]

    #Datos de onda capturada
    data = read_data(argumentos[2])
    data_capturada_t = data[0]
    data_capturada_x = data[1]
    data_capturada_y = data[2]

  # El codigo de aca hacia arriba es fijo en el Script
    #Analizar
    #for i in range(0,len(data_capturada_x),1):
        #suma=sum((sum(abs((float(data_capturada_y[i])))/sum(abs((float(data_capturada_y))))-(sum(abs(float(data_capturada_x[i])))/sum(abs(float(data_capturada_x)))));

    s=0.0
    sC=0.0
    sP=0.0
    
    s0=0.0
    sCp=0.0
    sPp=0.0
    
    for j in range(0,len(data_capturada_x)):            
       sumaC= abs(float(data_capturada_y[j]))
       sumaP= abs(float(data_capturada_x[j]))
       sC=sumaC+sC
       sP=sumaP+sP
       sumaCp= abs(float(data_patron_y[j]))
       sumaPp= abs(float(data_patron_x[j]))      
       sCp=sumaC+sCp
       sPp=sumaP+sPp


    for i in range(0,len(data_capturada_x)):
        suma= (abs(float(data_patron_y[i]))/sPp)-(abs(float(data_patron_x[i]))/sCp)
        s=suma+s
        sumap= (abs(float(data_patron_y[i]))/sPp)-(abs(float(data_patron_x[i]))/sCp)
        s0=sumap+s0        
        print(s)
        print(s0)

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).