Changeset 783 in ETALON
- Timestamp:
- Jul 17, 2018, 4:02:19 PM (6 years ago)
- Location:
- BPM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
BPM/initialise_motors.py
r779 r783 209 209 def move_motor_relative(motor, speed, steps): 210 210 motor_move_relative(motor, speed, steps) 211 while motor_get(motor, 'status') != 'READY': 212 time.sleep(1) 211 213 212 214 def motor_move_absolute(motor, speed, steps): … … 221 223 "Moves a motor with the given parameters" 222 224 motor_move_absolute(motor, speed, steps) 223 225 while motor_get(motor, 'status') != 'READY': 226 time.sleep(1) 224 227 225 228 def motor_wait_for_ready(motor,verbose=VERBOSE_DEFAULT): -
BPM/motor_control.py
r782 r783 1 import time2 import urllib3 import os1 #import time 2 #import urllib 3 #import os 4 4 from initialise_motors import * 5 5 from scope_function import * 6 import numpy as np7 import matplotlib.pyplot as plt6 #import numpy as np 7 #import matplotlib.pyplot as plt 8 8 9 9 # moteur 1 -> horizontal … … 16 16 motor_enable(1) 17 17 move_motor_absolute(1,5000,-5000) 18 #while motor_get(1, 'status') != 'READY': 19 # time.sleep(1) 18 20 move_motor_absolute(1,5000,0) 21 #while motor_get(1, 'status') != 'READY': 22 # time.sleep(1) 19 23 motor_disable(1) 20 24 -
BPM/print_datas.py
r782 r783 2 2 import matplotlib.pyplot as plt 3 3 from scipy import stats 4 5 6 global_index_figure = 0 4 7 5 8 def float_list(l): # convert a list of char in a list of float … … 57 60 def print_graph(L): # program to print graph of data set in a list with [[position][Va][Vb][Vc][Vd]], also do a linear regretion and print the equation 58 61 # a = np.array([L[0][i],L[1][i]] for i in range(len(L[0]))) 59 fig = plt.figure(1) 62 global global_index_figure 63 fig1 = plt.figure(global_index_figure) 64 global_index_figure += 1 60 65 plt.clf() 61 66 lr1 = stats.linregress(L[0],L[1]) # return tuple (pente,ordonnee a l'origine, coef de correlation, p-value, erreur standard de l'estimation) 62 67 plt.plot(L[0],L[1], "r", label = "BMP_ref") 63 68 plt.plot(L[0],[lr1.slope*i + lr1.intercept for i in L[0]], "r--", label = "BMP_ref regression line, \nerror = "+str(round(lr1.stderr,3))+",\ncorrelation coefficient = "+str(round(lr1.rvalue,3))) 64 69 65 70 lr2 = stats.linregress(L[0],L[2]) 66 71 plt.plot(L[0],L[2], "b", label = "BMP_impr") … … 76 81 77 82 plt.legend() 78 plt.xlabel("length in million motor step") 83 plt.xlabel("length in million motor step") #, fontsize=20) 79 84 plt.ylabel("tension in mV") 80 plt.show() 85 plt.gca().yaxis.set_tick_params(labelsize = 8) 86 # plt.show() 81 87 82 88 def residu(L): # program to do graph of residu of data give in a list with [[position][Va][Vb][Vc][Vd]] 83 fig = plt.figure(1) 89 global global_index_figure 90 fig1 = plt.figure(global_index_figure) 91 global_index_figure += 1 84 92 plt.clf() 85 93 plt.title("Residu") … … 88 96 L[1][i] = L[1][i] - lr1.slope*L[0][i] - lr1.intercept 89 97 plt.plot(L[0],L[1], "r", label = "BMP_ref") 90 98 91 99 lr2 = stats.linregress(L[0],L[2]) 92 100 for i in range(len(L[2])): … … 98 106 L[3][i] = L[3][i] - lr3.slope*L[0][i] - lr3.intercept 99 107 plt.plot(L[0],L[3], "g", label = "BMP_ref") 100 108 101 109 lr4 = stats.linregress(L[0],L[4]) 102 110 for i in range(len(L[4])): … … 106 114 plt.xlabel("length in million motor step") 107 115 plt.ylabel("tension in mV") 108 plt.show()116 # plt.show() 109 117 110 118 """ … … 127 135 if L[0][i] >= mini and L[0][i] <= maxi : 128 136 index_list.append(i) 129 print(index_list)130 137 return([[L[0][i] for i in index_list],[L[1][i] for i in index_list],[L[2][i] for i in index_list],[L[3][i] for i in index_list],[L[4][i] for i in index_list]]) 131 138 … … 162 169 #print_data("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition_20180612_0.txt") 163 170 #print_data("data/position_vs_tension_ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition_20180612_0.txt") 171 plt.show() 172
Note: See TracChangeset
for help on using the changeset viewer.