Changeset 775 in ETALON
- Timestamp:
- Jun 6, 2018, 10:43:32 AM (6 years ago)
- Location:
- BPM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
BPM/initialise_motors.py
r774 r775 50 50 def motor_disable(motor, verbose=0): 51 51 "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() 52 61 msg = str(motor) + 'CD' 53 62 motor_send(msg, verbose) … … 356 365 357 366 367 358 368 359 369 #controller_hello() -
BPM/print_datas.py
r774 r775 1 import numpy as np 1 2 import matplotlib.pyplot as plt 3 from scipy import stats 2 4 3 5 def float_list(l): … … 40 42 for i in range(5): 41 43 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 46 def 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 46 67 plt.legend() 47 plt. ylabel("length in motor step")68 plt.xlabel("length in motor step") 48 69 plt.ylabel("tension in V") 49 70 plt.show() 50 71 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 """ 51 80 52 81
Note: See TracChangeset
for help on using the changeset viewer.