Changeset 775 in ETALON for BPM/print_datas.py


Ignore:
Timestamp:
Jun 6, 2018, 10:43:32 AM (6 years ago)
Author:
moutardier
Message:

add a security on disable the vertical motor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BPM/print_datas.py

    r774 r775  
     1import numpy as np
    12import matplotlib.pyplot as plt
     3from scipy import stats
    24
    35def float_list(l):
     
    4042    for i in range(5):
    4143        L[i] = float_list(L[i])
    42     plt.plot(L[0],L[1], label = "BMP_ref")
    43     plt.plot(L[0],L[2], label = "BMP_impr")
    44     plt.plot(L[0],L[3], label = "BMP_ref")
    45     plt.plot(L[0],L[4], label = "BMP_impr")
     44    print_graph(L)
     45
     46def print_graph(L):
     47    a = np.array([L[0][i],L[1][i]] for i in range(len(L[0])))
     48    fig = plt.figure(1)
     49    plt.clf()
     50   
     51    lr1 = stats.linregress(L[0],L[1]) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation)
     52    plt.plot(L[0],L[1], "r", label = "BMP_ref")
     53    plt.plot(L[0],[lr1.slope*i + lr1.intercept for i in L[0]], "r--", label = "BMP_ref regression line, \nerror = "+str(lr1.stderr)+",\ncorrelation coefficient = "+str(lr1.rvalue))
     54   
     55    lr2 = stats.linregress(L[0],L[2])
     56    plt.plot(L[0],L[2], "b", label = "BMP_impr")
     57    plt.plot(L[0],[lr2.slope*i + lr2.intercept for i in L[0]], "b--", label = "BMP_impr regression line, \nerror = "+str(lr2.stderr)+",\ncorrelation coefficient = "+str(lr2.rvalue))
     58
     59    lr3 = stats.linregress(L[0],L[3])
     60    plt.plot(L[0],L[3], "g", label = "BMP_ref")
     61    plt.plot(L[0],[lr3.slope*i + lr3.intercept for i in L[0]], "g--", label = "BMP_ref regression line, \nerror = "+str(lr3.stderr)+",\ncorrelation coefficient = "+str(lr3.rvalue))
     62
     63    lr4 = stats.linregress(L[0],L[4])
     64    plt.plot(L[0],L[4], "m", label = "BMP_impr")
     65    plt.plot(L[0],[lr4.slope*i + lr4.intercept for i in L[0]], "m--", label = "BMP_impr regression line, \nerror = "+str(lr4.stderr)+",\ncorrelation coefficient = "+str(lr4.rvalue))
     66   
    4667    plt.legend()
    47     plt.ylabel("length in motor step")
     68    plt.xlabel("length in motor step")
    4869    plt.ylabel("tension in V")
    4970    plt.show()
    5071
     72   
     73"""   
     74    ax2 = fig.add_axes((0.1,0.1,0.8,0.0))
     75    ax2.yaxis.set_visible(False) # hide the yaxis
     76    ax2.set_xticklabels(10*L[0])
     77    ax2.set_xlabel("lenght in mm")
     78    plt.show()
     79"""
    5180
    5281
Note: See TracChangeset for help on using the changeset viewer.