Last change
on this file since 771 was
771,
checked in by moutardier, 6 years ago
|
modification des programmes afin de faire les graphiques
|
File size:
2.0 KB
|
Line | |
---|
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 | motor_enable(1) |
---|
13 | |
---|
14 | #controller_hello() |
---|
15 | #move_motor_relative(1,1000,-1000) |
---|
16 | #time.sleep(1) |
---|
17 | #move_motor_relative(1,1000,1000) |
---|
18 | #urllib.urlretrieve('http://10.0.1.112/crt_print.png','../oscillo_17-05-2018_voltage5V_freq1MHz_signal_carre/test2.png') |
---|
19 | #if not os.path.exists(repertoire): |
---|
20 | #os.makedirs('./test') cree repertoir |
---|
21 | |
---|
22 | #position_test_horizontal() |
---|
23 | |
---|
24 | |
---|
25 | # creation graphique |
---|
26 | |
---|
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 | |
---|
38 | X = [] |
---|
39 | Y1 = [] |
---|
40 | Y2 = [] |
---|
41 | Y3 = [] |
---|
42 | Y4 = [] |
---|
43 | a = "" |
---|
44 | l = 0 |
---|
45 | |
---|
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 = "" |
---|
67 | else: |
---|
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) |
---|
81 | |
---|
82 | plt.plot(X,Y1) |
---|
83 | plt.plot(X,Y2) |
---|
84 | plt.plot(X,Y3) |
---|
85 | plt.plot(X,Y4) |
---|
86 | plt.show() |
---|
87 | |
---|
88 | #fichier.close() |
---|
89 | """ |
---|
90 | |
---|
91 | |
---|
92 | """ |
---|
93 | for i in range(3): |
---|
94 | move_motor_absolute(1,5000,i*10000) |
---|
95 | while motor_get(1, 'status') != 'READY': |
---|
96 | time.sleep(1) |
---|
97 | time.sleep(1) |
---|
98 | urllib.urlretrieve('http://10.0.1.112/crt_print.png','../oscillo_17-05-2018_voltage5V_freq1MHz_signal_carre/position_'+str(i*10000)+'.png') |
---|
99 | time.sleep(1) |
---|
100 | |
---|
101 | |
---|
102 | move_motor_absolute(1,5000,0) |
---|
103 | while motor_get(1, 'status') != 'READY': |
---|
104 | time.sleep(1) |
---|
105 | time.sleep(1) |
---|
106 | motor_disable(1) |
---|
107 | |
---|
108 | |
---|
109 | """ |
---|
110 | #motor_enable(2) |
---|
111 | |
---|
112 | #motor_disable(2) #commande dangeureuse |
---|
113 | |
---|
114 | |
---|
115 | |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | |
---|
120 | |
---|
121 | |
---|
122 | |
---|
123 | |
---|
124 | |
---|
125 | |
---|
126 | |
---|
127 | |
---|
128 | |
---|
Note: See
TracBrowser
for help on using the repository browser.