Changeset 775 in ETALON


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

add a security on disable the vertical motor

Location:
BPM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • BPM/initialise_motors.py

    r774 r775  
    5050def motor_disable(motor, verbose=0):
    5151    "Enables a motor"
     52    if motor == 2: # security to avoid issue with vertical motor
     53        print('are you sure to wanted to disable vertical motor ? \n yes or no')
     54    x = raw_input()
     55    while not (x == 'yes' or x == 'no' or x == 'y' or x == 'n' or x == 'YES' or x == 'NO' or x == 'Y' or x == 'N'):
     56        print('Do you want to disable vertical motor ?')
     57        x = raw_input()
     58    if (x == 'no' or x == 'n' or  x == 'NO' or x == 'N'):
     59        print('Be carful with disable vertical motor')
     60        exit()
    5261    msg = str(motor) + 'CD'
    5362    motor_send(msg, verbose)
     
    356365
    357366
     367
    358368   
    359369#controller_hello()
  • 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.