1 | import time |
---|
2 | import urllib |
---|
3 | import os |
---|
4 | from initialise_motors import * |
---|
5 | from scope_function import * |
---|
6 | import numpy as np |
---|
7 | import matplotlib.pyplot as plt |
---|
8 | |
---|
9 | # moteur 1 -> horizontal |
---|
10 | # moteur 2 -> verticale |
---|
11 | |
---|
12 | """ |
---|
13 | motor_enable(2) |
---|
14 | move_motor_absolute(2,5000,-50000) |
---|
15 | while motor_get(1, 'status') != 'READY': |
---|
16 | time.sleep(1) |
---|
17 | time.sleep(5) |
---|
18 | """ |
---|
19 | """ |
---|
20 | move_motor_absolute(2,5000,0) |
---|
21 | while motor_get(1, 'status') != 'READY': |
---|
22 | time.sleep(1) |
---|
23 | """ |
---|
24 | #controller_hello() |
---|
25 | #move_motor_relative(1,1000,-1000) |
---|
26 | #time.sleep(1) |
---|
27 | #move_motor_relative(1,1000,1000) |
---|
28 | #urllib.urlretrieve('http://10.0.1.112/crt_print.png','../oscillo_17-05-2018_voltage5V_freq1MHz_signal_carre/test2.png') |
---|
29 | #if not os.path.exists(repertoire): |
---|
30 | #os.makedirs('./test') cree repertoir |
---|
31 | |
---|
32 | #position_test_horizontal() |
---|
33 | |
---|
34 | |
---|
35 | # creation graphique |
---|
36 | |
---|
37 | #horizontal_acquisition(4000,0,-4000,"test") |
---|
38 | |
---|
39 | acquisition(-10000,10000,10000,-50000,0,25000,"test") |
---|
40 | |
---|
41 | #acquisition(-10000,10000,1000,-50000,0,5000,"test") |
---|
42 | |
---|
43 | #turn_on() |
---|
44 | |
---|
45 | #vertical_acquisition(-110000,90000,4000,"ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition") |
---|
46 | |
---|
47 | #vertical_acquisition(90000,-110000,4000,"ch1-3_bpm_ref_ch2-4_bpm_impr_vertical_acquisition") |
---|
48 | |
---|
49 | #vertical_acquisition(0,-4000,2000,"test") |
---|
50 | #vertical_acquisition(4000,0,2000,"test2") |
---|
51 | |
---|
52 | #horizontal_acquisition(400000,0,-4000,"ch1-3_bpm_ref_ch2-4_bpm_impr") |
---|
53 | |
---|
54 | #turn_off() |
---|
55 | |
---|
56 | #fichier = open("24-05-2018_acquisition_from_0_to_400000_step_of_1000.txt", "r") |
---|
57 | """ |
---|
58 | A = fichier.read() |
---|
59 | |
---|
60 | X = [] |
---|
61 | Y1 = [] |
---|
62 | Y2 = [] |
---|
63 | Y3 = [] |
---|
64 | Y4 = [] |
---|
65 | a = "" |
---|
66 | l = 0 |
---|
67 | |
---|
68 | |
---|
69 | for i in A: |
---|
70 | if (i == "\n") : |
---|
71 | if l == 0: |
---|
72 | X.append(a) |
---|
73 | |
---|
74 | l += 1 |
---|
75 | elif l == 1: |
---|
76 | Y1.append(a) |
---|
77 | #print(a) |
---|
78 | l += 1 |
---|
79 | elif l == 2: |
---|
80 | Y2.append(a) |
---|
81 | l += 1 |
---|
82 | elif l == 3: |
---|
83 | Y3.append(a) |
---|
84 | l += 1 |
---|
85 | else: |
---|
86 | Y4.append(a) |
---|
87 | l = 0 |
---|
88 | a = "" |
---|
89 | else: |
---|
90 | a += i |
---|
91 | |
---|
92 | def float_list(l): |
---|
93 | L = [] |
---|
94 | for i in l: |
---|
95 | L.append(float(i)) |
---|
96 | return(L) |
---|
97 | |
---|
98 | X = float_list(X) |
---|
99 | Y1 = float_list(Y1) |
---|
100 | Y2 = float_list(Y2) |
---|
101 | Y3 = float_list(Y3) |
---|
102 | Y4 = float_list(Y4) |
---|
103 | |
---|
104 | plt.plot(X,Y1) |
---|
105 | plt.plot(X,Y2) |
---|
106 | plt.plot(X,Y3) |
---|
107 | plt.plot(X,Y4) |
---|
108 | plt.show() |
---|
109 | """ |
---|
110 | |
---|
111 | #fichier.close() |
---|
112 | |
---|
113 | |
---|
114 | |
---|
115 | """ |
---|
116 | for i in range(3): |
---|
117 | move_motor_absolute(1,5000,i*10000) |
---|
118 | while motor_get(1, 'status') != 'READY': |
---|
119 | time.sleep(1) |
---|
120 | time.sleep(1) |
---|
121 | urllib.urlretrieve('http://10.0.1.112/crt_print.png','../oscillo_17-05-2018_voltage5V_freq1MHz_signal_carre/position_'+str(i*10000)+'.png') |
---|
122 | time.sleep(1) |
---|
123 | |
---|
124 | |
---|
125 | move_motor_absolute(1,5000,0) |
---|
126 | while motor_get(1, 'status') != 'READY': |
---|
127 | time.sleep(1) |
---|
128 | time.sleep(1) |
---|
129 | motor_disable(1) |
---|
130 | |
---|
131 | |
---|
132 | """ |
---|
133 | #motor_enable(2) |
---|
134 | |
---|
135 | #motor_disable(2) #commande dangeureuse |
---|