Changeset 771 in ETALON
- Timestamp:
- May 25, 2018, 3:17:53 PM (6 years ago)
- Location:
- BPM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
BPM/initialise_motors.py
r766 r771 8 8 from bpm_constants import * 9 9 from scope_function import * 10 import numpy as np 11 import matplotlib.pyplot as plt 12 10 13 11 14 VERBOSE_DEFAULT=0 … … 243 246 244 247 def horizontal_aquisition(begin,end,pas,fichier): 245 for i in range(begin, end+1,pas): 246 move_motor_absolute(1,5000,i) 247 while motor_get(1, 'status') != 'READY': 248 time.sleep(1) 249 time.sleep(1) 250 read_scope_and_write(i, fichier) 251 time.sleep(1) 252 move_motor_absolute(1,5000,begin) 248 L = [[],[],[],[],[]] 249 for i in range(begin, end+1,pas): 250 move_motor_absolute(1,5000,i) 253 251 while motor_get(1, 'status') != 'READY': 254 252 time.sleep(1) 255 253 time.sleep(1) 256 motor_disable(1) 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 254 l = read_scope_and_write(i, fichier) 255 for i in range(5): 256 L[i].append(l[i]) 257 time.sleep(1) 258 move_motor_absolute(1,5000,begin) 259 while motor_get(1, 'status') != 'READY': 260 time.sleep(1) 261 time.sleep(1) 262 motor_disable(1) 263 for i in range(4): 264 plt.plot(L[0],L[i+1]) 265 plt.show() 276 266 277 267 -
BPM/motor_control.py
r770 r771 4 4 from initialise_motors import * 5 5 from scope_function import * 6 import numpy as np 6 7 import matplotlib.pyplot as plt 7 8 … … 9 10 # moteur 2 -> verticale 10 11 11 #motor_enable(1)12 motor_enable(1) 12 13 13 14 #controller_hello() … … 15 16 #time.sleep(1) 16 17 #move_motor_relative(1,1000,1000) 17 18 18 #urllib.urlretrieve('http://10.0.1.112/crt_print.png','../oscillo_17-05-2018_voltage5V_freq1MHz_signal_carre/test2.png') 19 20 19 #if not os.path.exists(repertoire): 21 20 #os.makedirs('./test') cree repertoir … … 24 23 25 24 26 # creation graphique25 # creation graphique 27 26 28 A = loadtxt('donnees.dat') 27 28 turn_on() 29 fichier = open("test.txt", "w") 30 horizontal_aquisition(0,2,1,fichier) 31 fichier.close() 32 #turn_off() 33 34 """ 35 fichier = open("24-05-2018_aquisition_from_0_to_400000_step_of_1000.txt", "r") 36 A = fichier.read() 37 29 38 X = [] 30 39 Y1 = [] … … 32 41 Y3 = [] 33 42 Y4 = [] 43 a = "" 44 l = 0 34 45 35 for i in range(A): 36 if (i%5) == 0: 37 X.append(A[i]) 38 elif (i%5) == 1: 39 Y1.append(A[i]) 40 elif (i%5) == 2: 41 Y2.append(A[i]) 42 elif (i%5) == 3: 43 Y3.append(A[i]) 46 47 for i in A: 48 if (i == "\n") : 49 if l == 0: 50 X.append(a) 51 52 l += 1 53 elif l == 1: 54 Y1.append(a) 55 #print(a) 56 l += 1 57 elif l == 2: 58 Y2.append(a) 59 l += 1 60 elif l == 3: 61 Y3.append(a) 62 l += 1 63 else: 64 Y4.append(a) 65 l = 0 66 a = "" 44 67 else: 45 Y4.append(A[i]) 68 a += i 69 70 def float_list(l): 71 L = [] 72 for i in l: 73 L.append(float(i)) 74 return(L) 75 76 X = float_list(X) 77 Y1 = float_list(Y1) 78 Y2 = float_list(Y2) 79 Y3 = float_list(Y3) 80 Y4 = float_list(Y4) 46 81 47 82 plt.plot(X,Y1) 83 plt.plot(X,Y2) 84 plt.plot(X,Y3) 85 plt.plot(X,Y4) 48 86 plt.show() 49 87 50 51 """ 52 turn_on() 53 fichier = open("24-05-2018_aquisition_from_0_to_400000_step_of_1000.txt", "w") 54 horizontal_aquisition(0,400000,1000,fichier) 55 fichier.close() 56 turn_off() 88 #fichier.close() 57 89 """ 58 90 -
BPM/scope_function.py
r766 r771 48 48 49 49 def turn_on(): 50 51 52 53 54 50 scpi_command('CHAN1:STAT ON \nCHAN1:STAT?') 51 scpi_command('CHAN2:STAT ON \nCHAN2:STAT?') 52 scpi_command('CHAN3:STAT ON \nCHAN1:STAT?') 53 scpi_command('CHAN4:STAT ON \nCHAN2:STAT?') 54 scpi_command('CURS1:STAT ON \nCURS1:STAT?') 55 55 56 56 def turn_off(): 57 58 59 60 61 57 scpi_command('CURS1:STAT OFF \nCURS1:STAT?') 58 scpi_command('CHAN1:STAT OFF \nCHAN1:STAT?') 59 scpi_command('CHAN2:STAT OFF \nCHAN2:STAT?') 60 scpi_command('CHAN3:STAT OFF \nCHAN2:STAT?') 61 scpi_command('CHAN4:STAT OFF \nCHAN2:STAT?') 62 62 63 63 def suppress_alignea(l): 64 L = '' 65 for i in l: 66 if not(i == '\n'): 67 L += i 68 return(L) 69 64 70 def read_scope_and_write(position, fichier): 65 fichier.write(str(position)+'\n') 66 for i in range(4): 67 scpi_command('CURS1:SOUR CH'+str(i+1)+' \n CURS1:SOUR?') 68 valeur = scpi_query('CURS1:FUNC UPE \n CURS:RES?') 69 fichier.write(valeur) 71 fichier.write(str(position)+' ') 72 L = [position] 73 for i in range(4): 74 scpi_command('CURS1:SOUR CH'+str(i+1)+' \n CURS1:SOUR?') 75 valeur = scpi_query('CURS1:FUNC UPE \n CURS:RES?') 76 valeur = suppress_alignea(valeur) 77 L.append(float(valeur)) 78 fichier.write(valeur+' ') 79 fichier.write('\n') 80 return(L) 81 70 82 71 83 72 84 73 85 74
Note: See TracChangeset
for help on using the changeset viewer.