Changeset 779 in ETALON


Ignore:
Timestamp:
Jun 15, 2018, 2:13:45 PM (6 years ago)
Author:
moutardier
Message:

add fonction to print residu

Location:
BPM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • BPM/initialise_motors.py

    r778 r779  
    406406        motor_enable(1)
    407407        motor_enable(2)
     408        move_motor_absolute(1,10000,begin1)
     409        move_motor_absolute(2,10000,begin2)
     410        while (motor_get(1, 'status') != 'READY') or (motor_get(2, 'status') != 'READY'):
     411            time.sleep(1)
     412        print("bagin position ok ?")
     413        time.sleep(15)
    408414#        L = [[],[],[],[],[],[]]
    409415        for i in range(begin1, end1, pas1):           
     
    417423            time.sleep(1)
    418424        time.sleep(1)
    419 
    420425        acqui_column(begin2, end2, pas2, data_name_and_path, end1)
    421        
     426        print("end position ok ?")
     427        time.sleep(15)
    422428        motor_disable(1)
    423429        motor_disable(2)
  • BPM/motor_control.py

    r778 r779  
    3737#horizontal_acquisition(4000,0,-4000,"test")   
    3838
    39 acquisition(-10000,10000,10000,-50000,0,25000,"test")
     39acquisition(-15000,15000,10000,-50000,50000,25000,"test")
    4040
    4141#acquisition(-10000,10000,1000,-50000,0,5000,"test")
  • BPM/print_datas.py

    r777 r779  
    1616
    1717
    18 def print_data(fichier):
     18def read_data(fichier):
    1919    fichier = open(fichier, "r")
    2020    A = fichier.read()
     
    5252    for i in range(1,5):
    5353        L[i] = product_list(L[i],1000)
    54     print_graph(L)
     54    return(L)
     55
     56
    5557
    5658def print_graph(L):
    57     a = np.array([L[0][i],L[1][i]] for i in range(len(L[0])))
     59#    a = np.array([L[0][i],L[1][i]] for i in range(len(L[0])))
    5860    fig = plt.figure(1)
    5961    plt.clf()
    60    
    6162    lr1 = stats.linregress(L[0],L[1]) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
    6263    plt.plot(L[0],L[1], "r", label = "BMP_ref")
     
    8081    plt.show()
    8182
     83def residu(L):
     84    fig = plt.figure(1)
     85    plt.clf()
     86    plt.title("Residu")
     87    lr1 = stats.linregress(L[0],L[1]) # return tuple (pente (.slope),ordonnee a l'origine (.intercept), coef de correlation (.rvalue), p-value (.pvalue ?), erreur standard de l'estimation (.stderr))
     88    for i in range(len(L[1])):
     89        L[1][i] = L[1][i] -  lr1.slope*L[0][i] - lr1.intercept
     90    plt.plot(L[0],L[1], "r", label = "BMP_ref")
     91   
     92    lr2 = stats.linregress(L[0],L[2])
     93    for i in range(len(L[2])):
     94        L[2][i] = L[2][i] -  lr1.slope*L[0][i] - lr1.intercept
     95    plt.plot(L[0],L[2], "b", label = "BMP_impr")
     96
     97    lr3 = stats.linregress(L[0],L[3])
     98    for i in range(len(L[3])):
     99        L[3][i] = L[3][i] -  lr1.slope*L[0][i] - lr1.intercept
     100    plt.plot(L[0],L[3], "g", label = "BMP_ref")
     101 
     102    lr4 = stats.linregress(L[0],L[4])
     103    for i in range(len(L[4])):
     104        L[4][i] = L[4][i] -  lr1.slope*L[0][i] - lr1.intercept
     105    plt.plot(L[0],L[4], "m", label = "BMP_impr")
     106    plt.legend()
     107    plt.xlabel("length in million motor step")
     108    plt.ylabel("tension in mV")
     109    plt.show()
    82110   
    83111"""   
     
    88116    plt.show()
    89117"""
     118def print_data(fichier):
     119    L = read_data(fichier)
     120    print_graph(L)
    90121
     122def print_residu(fichier):
     123    L = read_data(fichier)
     124    residu(L)
    91125
    92 #print_data("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_20180611_160153_0.txt")
     126print_data("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_20180611_160153_0.txt")
     127print_residu("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_20180611_160153_0.txt")
     128
    93129#print_data("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_20180611_163036_0.txt")
    94130
    95131#print_data("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition_20180612_0.txt")
    96 print_data("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition_20180612_0.txt")
     132#print_data("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition_20180612_0.txt")
Note: See TracChangeset for help on using the changeset viewer.