|
1 | NO CONTENT: new file 10644 |
|
1 | NO CONTENT: new file 10644 |
@@ -1,94 +1,97 | |||
|
1 | 1 |
import library3 |
|
2 | import os.path No newline at end of file | |
|
2 | 3 | |
|
4 | No newline at end of file | |
|
3 | class ABSClient: No newline at end of file | |
|
4 | 5 | No newline at end of file |
|
5 | 6 | def __init__(self,ipSource="192.168.1.117", iDSource="Clnt_01", ipDestino="192.168.1.117", iDDestino = "CeCnMod", portDestino=7000): No newline at end of file |
|
6 | 7 | No newline at end of file |
|
7 | 8 | self.ipSource = ipSource No newline at end of file |
|
8 | 9 | self.iDSource = iDSource No newline at end of file |
|
9 | 10 | self.ipDestino = ipDestino No newline at end of file |
|
10 | 11 | self.iDDestino = iDDestino No newline at end of file |
|
11 | 12 | self.portDestino = portDestino No newline at end of file |
|
12 | 13 | No newline at end of file |
|
13 | 14 | self.createObjects() No newline at end of file |
|
14 | 15 | No newline at end of file |
|
15 | 16 | def createObjects(self): No newline at end of file |
|
16 | 17 | No newline at end of file |
|
17 | 18 | self.commObj = library3.TCPComm(self.ipSource, self.iDSource, self.ipDestino, self.iDDestino, self.portDestino) |
|
19 | No newline at end of file | |
|
18 | # self.wFiles = library3.FilesStuff() No newline at end of file | |
|
19 | 20 | No newline at end of file |
|
20 | 21 | def __ConnectionWithCentralControl(self, cmd, data): No newline at end of file |
|
21 | 22 | No newline at end of file |
|
22 | 23 | self.commObj.open_socket() No newline at end of file |
|
23 | 24 | self.commObj.sendData(cmd = cmd, data = data, ipDestino = self.ipDestino) No newline at end of file |
|
24 | 25 | ipSource, ipDestino, cmd, output = self.commObj.waitData() No newline at end of file |
|
25 | 26 | self.commObj.close_socket() No newline at end of file |
|
26 | 27 | No newline at end of file |
|
27 | 28 | return output No newline at end of file |
|
28 | 29 | No newline at end of file |
|
29 | 30 | # def abs2ControlModuleFormatFile(self, filename): No newline at end of file |
|
30 | 31 | # No newline at end of file |
|
31 | 32 | # #From matriz to control module format No newline at end of file |
|
32 | 33 | # self.wFiles.toCentralControlFormat(filename) No newline at end of file |
|
33 | 34 | # FileName = "CentralControlFormat.txt" No newline at end of file |
|
34 | 35 | # F_Obj = open(FileName,"r") No newline at end of file |
|
35 | 36 | # FileList = F_Obj.readlines() No newline at end of file |
|
36 | 37 | # F_Obj.close() No newline at end of file |
|
37 | 38 | # FileStr = "".join(FileList) No newline at end of file |
|
38 | 39 | # No newline at end of file |
|
39 | 40 | # return FileStr No newline at end of file |
|
40 | 41 | No newline at end of file |
|
41 | 42 | def sendFile(self, filename): No newline at end of file |
|
42 | 43 | No newline at end of file |
|
43 | 44 | data = self.__readFile(filename) No newline at end of file |
|
44 | 45 | self.__ConnectionWithCentralControl(cmd = "SNDF", data = data) No newline at end of file |
|
45 | 46 | No newline at end of file |
|
46 | 47 | def changeBeam(self, newBeam): No newline at end of file |
|
47 | 48 | No newline at end of file |
|
48 | 49 | self.__ConnectionWithCentralControl(cmd = "CHGB", data = newBeam) No newline at end of file |
|
49 | 50 | No newline at end of file |
|
50 | 51 | def __writeFile(self, filename, data): No newline at end of file |
|
51 | 52 | No newline at end of file |
|
52 | 53 | fobj = open(filename,"w") No newline at end of file |
|
53 | 54 | fobj.writelines(data) No newline at end of file |
|
54 | 55 | fobj.close() No newline at end of file |
|
55 | 56 | No newline at end of file |
|
56 | 57 | def __readFile(self, filename): No newline at end of file |
|
57 | 58 | No newline at end of file |
|
58 | 59 | fobj = open(filename,"r") No newline at end of file |
|
59 | 60 | listData = fobj.readlines() No newline at end of file |
|
60 | 61 | fobj.close() No newline at end of file |
|
61 | 62 | tmp = "".join(listData) No newline at end of file |
|
62 | 63 | #Adding filename to the begining of the data |
|
64 | No newline at end of file | |
|
63 | data = filename + '\n' + tmp No newline at end of file | |
|
No newline at end of file | ||
|
65 | #data = filename + '\n' + tmp | |
|
No newline at end of file | ||
|
66 | data = newfilename + '\n' + tmp No newline at end of file | |
|
64 | 67 | return data No newline at end of file |
|
65 | 68 | No newline at end of file |
|
66 | 69 | No newline at end of file |
|
67 | 70 | def getControlModuleStatus(self, data): No newline at end of file |
|
68 | 71 | No newline at end of file |
|
69 | 72 | data = self.__ConnectionWithCentralControl(cmd = "ANST", data = data) No newline at end of file |
|
70 | 73 | self.__writeFile("report.txt", data) No newline at end of file |
|
71 | 74 | No newline at end of file |
|
72 | 75 | def getControlModulePhase(self, opt, u = "50", pw = "10"): No newline at end of file |
|
73 | 76 | No newline at end of file |
|
74 | 77 | if opt == '0': No newline at end of file |
|
75 | 78 | data = self.__ConnectionWithCentralControl(cmd = "LWPH", data = u + '/' + pw + '/') No newline at end of file |
|
76 | 79 | elif opt == '1': No newline at end of file |
|
77 | 80 | data = self.__ConnectionWithCentralControl(cmd = "BGPH", data = u + '/' + pw + '/') No newline at end of file |
|
78 | 81 | elif opt == '2': No newline at end of file |
|
79 | 82 | data = self.__ConnectionWithCentralControl(cmd = "cBPH", data = u + '/' + pw + '/') No newline at end of file |
|
80 | 83 | else: No newline at end of file |
|
81 | 84 | data = self.__ConnectionWithCentralControl(cmd = "cLPH", data = u + '/' + pw + '/') No newline at end of file |
|
82 | 85 | # self.__writeFile("report.txt", data) No newline at end of file |
|
83 | 86 | No newline at end of file |
|
84 | 87 | def getConnectionStatus(self): No newline at end of file |
|
85 | 88 | No newline at end of file |
|
86 | 89 | data = self.__ConnectionWithCentralControl(cmd = "NTST", data = "none") No newline at end of file |
|
87 | 90 | self.__writeFile("connection_status.txt", data) No newline at end of file |
|
88 | 91 | No newline at end of file |
|
89 | 92 | if __name__ == '__main__': No newline at end of file |
|
90 | 93 | No newline at end of file |
|
91 | 94 | filename = "experimento1.abs" No newline at end of file |
|
92 | 95 | No newline at end of file |
|
93 | 96 | absObj = ABSClient() No newline at end of file |
|
94 | 97 | absObj.sendFile(filename) No newline at end of file |
@@ -1,537 +1,537 | |||
|
1 | 1 | # Needed for the FilesStuff class No newline at end of file |
|
2 | 2 | import os No newline at end of file |
|
3 | 3 | import numpy as np No newline at end of file |
|
4 | 4 | # Needed for the TCPComm class No newline at end of file |
|
5 | 5 | import socket No newline at end of file |
|
6 | 6 | No newline at end of file |
|
7 | 7 | class TCPComm: No newline at end of file |
|
8 | 8 | No newline at end of file |
|
9 | 9 | __HEADER = "JRO" No newline at end of file |
|
10 | 10 | __TYPE = "ABS" No newline at end of file |
|
11 | 11 | No newline at end of file |
|
12 | 12 | def __init__(self, ipSource, iDSource, ipDestino, iDDestino, portDestino, asServer=False): No newline at end of file |
|
13 | 13 | No newline at end of file |
|
14 | 14 | self.ipSource = ipSource No newline at end of file |
|
15 | 15 | self.iDSource = iDSource No newline at end of file |
|
16 | 16 | self.ipDestino = ipDestino No newline at end of file |
|
17 | 17 | self.iDDestino = iDDestino No newline at end of file |
|
18 | 18 | self.portDestino = portDestino No newline at end of file |
|
19 | 19 | self.addr = (ipDestino,portDestino) No newline at end of file |
|
20 | 20 | No newline at end of file |
|
21 | 21 | self.sc = "none" No newline at end of file |
|
22 | 22 | self.answer = "none" #test No newline at end of file |
|
23 | 23 | self.asServer = False No newline at end of file |
|
24 | 24 | self.len = "000000" No newline at end of file |
|
25 | 25 | self.crc = "0" No newline at end of file |
|
26 | 26 | No newline at end of file |
|
27 | 27 | self.openSocket(asServer) No newline at end of file |
|
28 | 28 | No newline at end of file |
|
29 | 29 | def openSocket(self, asServer): No newline at end of file |
|
30 | 30 | No newline at end of file |
|
31 | 31 | #self.socket_c = socket.socket(AF_INET,SOCK_DGRAM) No newline at end of file |
|
32 | 32 | # self.socket_c = socket.socket() No newline at end of file |
|
33 | 33 | # self.socket_c.connect((self.ipDestino, self.portDestino)) No newline at end of file |
|
34 | 34 | No newline at end of file |
|
35 | 35 | if asServer: No newline at end of file |
|
36 | 36 | self.socket_c = socket.socket() No newline at end of file |
|
37 | 37 | # self.configAsServer() No newline at end of file |
|
38 | 38 | self.socket_c.bind(self.addr) No newline at end of file |
|
39 | 39 | self.asServer = True No newline at end of file |
|
40 | 40 | else: No newline at end of file |
|
41 | 41 | # self.configAsClient() No newline at end of file |
|
42 | 42 | self.asServer = False #Socket is opened at the sendData function No newline at end of file |
|
43 | 43 | No newline at end of file |
|
44 | 44 | # def configAsClient(self): No newline at end of file |
|
45 | 45 | #Buscar broadcast TCP No newline at end of file |
|
46 | 46 | # self.socket_c.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) No newline at end of file |
|
47 | 47 | # self.socket_c.connect(self.addr) No newline at end of file |
|
48 | 48 | # pass No newline at end of file |
|
49 | 49 | No newline at end of file |
|
50 | 50 | # def configAsServer(self): No newline at end of file |
|
51 | 51 | # No newline at end of file |
|
52 | 52 | # self.socket_c.bind(self.addr) No newline at end of file |
|
53 | 53 | No newline at end of file |
|
54 | 54 | def waitData(self): No newline at end of file |
|
55 | 55 | if self.asServer == True: No newline at end of file |
|
56 | 56 | trama_rx, l = self.waitAsServer() No newline at end of file |
|
57 | 57 | else: No newline at end of file |
|
58 | 58 | trama_rx, l = self.waitAsClient() No newline at end of file |
|
59 | 59 | No newline at end of file |
|
60 | 60 | ipSource, ipDestino, cmd, data = self.__getTrama(trama_rx, l) No newline at end of file |
|
61 | 61 | No newline at end of file |
|
62 | 62 | return ipSource, ipDestino, cmd, data No newline at end of file |
|
63 | 63 | No newline at end of file |
|
64 | 64 | def waitAsClient2(self, nbytes = 1024): No newline at end of file |
|
65 | 65 | print "\nWaiting the server." No newline at end of file |
|
66 | 66 | # Short data through ethernet No newline at end of file |
|
67 | 67 | trama_rx = self.socket_c.recv(nbytes) No newline at end of file |
|
68 | 68 | print "\nThis socket has received this data: " + str(trama_rx) No newline at end of file |
|
69 | 69 | No newline at end of file |
|
70 | 70 | return trama_rx No newline at end of file |
|
71 | 71 | No newline at end of file |
|
72 | 72 | def waitAsServer2(self, nbytes = 1024): No newline at end of file |
|
73 | 73 | print "\nWaiting some client." No newline at end of file |
|
74 | 74 | self.socket_c.listen(1) No newline at end of file |
|
75 | 75 | sc, addr = self.socket_c.accept() No newline at end of file |
|
76 | 76 | self.sc = sc No newline at end of file |
|
77 | 77 | self.answer = addr No newline at end of file |
|
78 | 78 | # Big data through ethernet No newline at end of file |
|
79 | 79 | trama_rx = "" No newline at end of file |
|
80 | 80 | while True: No newline at end of file |
|
81 | 81 | tmp = self.sc.recv(nbytes) No newline at end of file |
|
82 | 82 | trama_rx = trama_rx + tmp No newline at end of file |
|
83 | 83 | if trama_rx[-4:] == "quit": No newline at end of file |
|
84 | 84 | break No newline at end of file |
|
85 | 85 | No newline at end of file |
|
86 | 86 | print "\nThis socket has received some data from: " + str(self.answer) No newline at end of file |
|
87 | 87 | No newline at end of file |
|
88 | 88 | return trama_rx No newline at end of file |
|
89 | 89 | No newline at end of file |
|
90 | 90 | def waitAsServer(self, nbytes = 1024): No newline at end of file |
|
91 | 91 | print "\nWaiting some client." No newline at end of file |
|
92 | 92 | self.socket_c.listen(1) No newline at end of file |
|
93 | 93 | sc, addr = self.socket_c.accept() No newline at end of file |
|
94 | 94 | self.sc = sc No newline at end of file |
|
95 | 95 | self.answer = addr No newline at end of file |
|
96 | 96 | # Big data through ethernet No newline at end of file |
|
97 | 97 | cnt = 0; No newline at end of file |
|
98 | 98 | first = 0; No newline at end of file |
|
99 | 99 | trama_rx = "" No newline at end of file |
|
100 | 100 | while True: No newline at end of file |
|
101 | 101 | tmp = self.sc.recv(nbytes) No newline at end of file |
|
102 | 102 | trama_rx = trama_rx + tmp No newline at end of file |
|
103 | 103 | cnt = len(trama_rx) No newline at end of file |
|
104 | 104 | if first == 0: No newline at end of file |
|
105 | 105 | first = 1 No newline at end of file |
|
106 | 106 | lng = int(trama_rx[20:26]) No newline at end of file |
|
107 | 107 | frm_lng= lng + 31 # 31 bytes are fixed and added to the data size to get the frame size No newline at end of file |
|
108 | 108 | if cnt == frm_lng: No newline at end of file |
|
109 | 109 | break No newline at end of file |
|
110 | 110 | No newline at end of file |
|
111 | 111 | print "\nThis socket has received some data from: " + str(self.answer) No newline at end of file |
|
112 | 112 | No newline at end of file |
|
113 | 113 | return trama_rx, lng No newline at end of file |
|
114 | 114 | No newline at end of file |
|
115 | 115 | def waitAsClient(self, nbytes = 1024): No newline at end of file |
|
116 | 116 | print "\nWaiting the server." No newline at end of file |
|
117 | 117 | # Short data through ethernet No newline at end of file |
|
118 | 118 | try: No newline at end of file |
|
119 | 119 | trama_rx = self.socket_c.recv(nbytes) No newline at end of file |
|
120 | 120 | lng = int(trama_rx[20:26]) No newline at end of file |
|
121 | 121 | except: No newline at end of file |
|
122 | 122 | print "Waiting error" No newline at end of file |
|
123 | 123 | trama_rx = "Error" No newline at end of file |
|
124 | 124 | lng = 0 No newline at end of file |
|
125 | 125 | else: No newline at end of file |
|
126 | 126 | print "\nThis socket has received this data: " + str(trama_rx) No newline at end of file |
|
127 | 127 | No newline at end of file |
|
128 | 128 | return trama_rx, lng No newline at end of file |
|
129 | 129 | No newline at end of file |
|
130 | 130 | def sendData2(self, cmd, data, ipDestino): No newline at end of file |
|
131 | 131 | No newline at end of file |
|
132 | 132 | trama_tx = self.__HEADER + ":" + self.__TYPE + ":" + str(self.ipSource) + ":" + str(ipDestino) + \ No newline at end of file |
|
133 | 133 | ":" + str(self.len) + ":" + str(cmd) + ":" + str(data) + ":" + str(self.crc) + ":" + "quit" No newline at end of file |
|
134 | 134 | No newline at end of file |
|
135 | 135 | if self.asServer == True: No newline at end of file |
|
136 | 136 | self.SendAsServer(trama_tx) No newline at end of file |
|
137 | 137 | else: No newline at end of file |
|
138 | 138 | self.SendAsClient(ipDestino, trama_tx) No newline at end of file |
|
139 | 139 | No newline at end of file |
|
140 | 140 | def sendData(self, cmd, data, ipDestino): No newline at end of file |
|
141 | 141 | No newline at end of file |
|
142 | 142 | trama_tx = self.__HEADER + self.__TYPE + self.iDSource + \ No newline at end of file |
|
143 | 143 | self.iDDestino + self.len + str(cmd) + str(data) + self.crc No newline at end of file |
|
144 | 144 | No newline at end of file |
|
145 | 145 | self.len = self.int2str(len(data)) No newline at end of file |
|
146 | 146 | No newline at end of file |
|
147 | 147 | trama_tx = self.__HEADER + self.__TYPE + self.iDSource + \ No newline at end of file |
|
148 | 148 | self.iDDestino + self.len + str(cmd) + str(data) + self.crc No newline at end of file |
|
149 | 149 | No newline at end of file |
|
150 | 150 | if self.asServer == True: No newline at end of file |
|
151 | 151 | self.SendAsServer(trama_tx) No newline at end of file |
|
152 | 152 | else: No newline at end of file |
|
153 | 153 | self.SendAsClient(ipDestino, trama_tx) No newline at end of file |
|
154 | 154 | No newline at end of file |
|
155 | 155 | def SendAsServer(self, trama_tx): No newline at end of file |
|
156 | 156 | No newline at end of file |
|
157 | 157 | self.sc.send(trama_tx) No newline at end of file |
|
158 | 158 | print "Sending message:[" + trama_tx + "] to: " + str(self.answer) No newline at end of file |
|
159 | 159 | No newline at end of file |
|
160 | 160 | No newline at end of file |
|
161 | 161 | def SendAsClient(self, ipDestino, trama_tx): No newline at end of file |
|
162 | 162 | No newline at end of file |
|
163 | 163 | try: No newline at end of file |
|
164 | 164 | self.socket_c.connect((ipDestino, self.portDestino)) No newline at end of file |
|
165 | 165 | except: No newline at end of file |
|
166 | 166 | print "Connection error with:" + ipDestino No newline at end of file |
|
167 | 167 | else: No newline at end of file |
|
168 | 168 | self.socket_c.send(trama_tx) No newline at end of file |
|
169 | 169 | print "Sending message:[" + trama_tx + "] to: " + ipDestino No newline at end of file |
|
170 | 170 | No newline at end of file |
|
171 | 171 | def __getTrama2(self, trama): No newline at end of file |
|
172 | 172 | No newline at end of file |
|
173 | 173 | FrameList = trama.split(':') No newline at end of file |
|
174 | 174 | No newline at end of file |
|
175 | 175 | header = FrameList[0] No newline at end of file |
|
176 | 176 | TypeOfInstrument = FrameList[1] No newline at end of file |
|
177 | 177 | ipSource = FrameList[2] No newline at end of file |
|
178 | 178 | ipDestino = FrameList[3] No newline at end of file |
|
179 | 179 | len = FrameList[4] No newline at end of file |
|
180 | 180 | cmd = FrameList[5] No newline at end of file |
|
181 | 181 | data = FrameList[6] No newline at end of file |
|
182 | 182 | crc = FrameList[7] No newline at end of file |
|
183 | 183 | trash = FrameList[8] No newline at end of file |
|
184 | 184 | No newline at end of file |
|
185 | 185 | return ipSource, ipDestino, cmd, data No newline at end of file |
|
186 | 186 | No newline at end of file |
|
187 | 187 | def __getTrama(self, trama, l): No newline at end of file |
|
188 | 188 | No newline at end of file |
|
189 | 189 | header = trama[0:3] No newline at end of file |
|
190 | 190 | TypeOfInstrument = trama[3:6] No newline at end of file |
|
191 | 191 | ipSource = trama[6:13] No newline at end of file |
|
192 | 192 | ipDestino = trama[13:20] No newline at end of file |
|
193 | 193 | len = trama[20:26] No newline at end of file |
|
194 | 194 | cmd = trama[26:30] No newline at end of file |
|
195 | 195 | data = trama[30:30+int(l)] No newline at end of file |
|
196 | 196 | crc = trama[30+ int(l):] No newline at end of file |
|
197 | 197 | No newline at end of file |
|
198 | 198 | return ipSource, ipDestino, cmd, data No newline at end of file |
|
199 | 199 | No newline at end of file |
|
200 | 200 | def close_socket(self): No newline at end of file |
|
201 | 201 | self.socket_c.close() No newline at end of file |
|
202 | 202 | No newline at end of file |
|
203 | 203 | def open_socket(self): No newline at end of file |
|
204 | 204 | self.socket_c = socket.socket() No newline at end of file |
|
205 | 205 | No newline at end of file |
|
206 | 206 | def int2str(self, n): No newline at end of file |
|
207 | 207 | No newline at end of file |
|
208 | 208 | str_n = str(n) No newline at end of file |
|
209 | 209 | l_n = len(str_n) No newline at end of file |
|
210 | 210 | if l_n == 1: No newline at end of file |
|
211 | 211 | str_n = "00000" + str_n No newline at end of file |
|
212 | 212 | elif l_n == 2: No newline at end of file |
|
213 | 213 | str_n = "0000" + str_n No newline at end of file |
|
214 | 214 | elif l_n == 3: No newline at end of file |
|
215 | 215 | str_n = "000" + str_n No newline at end of file |
|
216 | 216 | elif l_n == 4: No newline at end of file |
|
217 | 217 | str_n = "00" + str_n No newline at end of file |
|
218 | 218 | elif l_n == 5: No newline at end of file |
|
219 | 219 | str_n = "0" + str_n No newline at end of file |
|
220 | 220 | return str_n No newline at end of file |
|
221 | 221 | No newline at end of file |
|
222 | 222 | class FilesStuff(): No newline at end of file |
|
223 | 223 | No newline at end of file |
|
224 | 224 | def lst2string(self, lst): No newline at end of file |
|
225 | 225 | string='' No newline at end of file |
|
226 | 226 | for i in lst: No newline at end of file |
|
227 | 227 | string=string+i No newline at end of file |
|
228 | 228 | return string No newline at end of file |
|
229 | 229 | No newline at end of file |
|
230 | 230 | def string2lst(self, string): No newline at end of file |
|
231 | 231 | lst = [] No newline at end of file |
|
232 | 232 | for i in string: No newline at end of file |
|
233 | 233 | lst.append(i) No newline at end of file |
|
234 | 234 | return lst No newline at end of file |
|
235 | 235 | No newline at end of file |
|
236 | 236 | No newline at end of file |
|
237 | 237 | def file1(self, filename, type): No newline at end of file |
|
238 | 238 | lst = self.string2lst(filename) No newline at end of file |
|
239 | 239 | fin = -1 No newline at end of file |
|
240 | 240 | t = len(lst) No newline at end of file |
|
241 | 241 | for i in np.arange(-1,-t,-1): No newline at end of file |
|
242 | 242 | if lst[i]=='/': No newline at end of file |
|
243 | 243 | fin=i No newline at end of file |
|
244 | 244 | break No newline at end of file |
|
245 | 245 | if type == '1': No newline at end of file |
|
246 | 246 | nombre2 = lst[fin+1:] No newline at end of file |
|
247 | 247 | nombre2[-1]='s' No newline at end of file |
|
248 | 248 | nombre2 = self.lst2string(nombre2) No newline at end of file |
|
249 | 249 | return nombre2 No newline at end of file |
|
250 | 250 | if type == '2': No newline at end of file |
|
251 | 251 | nombre2 = lst[fin+1:] No newline at end of file |
|
252 | 252 | nombre2[-1]='1' No newline at end of file |
|
253 | 253 | nombre2 = self.lst2string(nombre2) No newline at end of file |
|
254 | 254 | return nombre2 No newline at end of file |
|
255 | 255 | No newline at end of file |
|
256 | 256 | No newline at end of file |
|
257 | 257 | def EliminaSaltoDeLinea(self,cadena): No newline at end of file |
|
258 | 258 | i = 0 No newline at end of file |
|
259 | 259 | for elemento in cadena: No newline at end of file |
|
260 | 260 | if elemento =='\n' or elemento =='\r': No newline at end of file |
|
261 | 261 | pass No newline at end of file |
|
262 | 262 | else: No newline at end of file |
|
263 | 263 | i=i+1 No newline at end of file |
|
264 | 264 | return cadena [:i] No newline at end of file |
|
265 | 265 | No newline at end of file |
|
266 | 266 | def NumeroDeExperimentos(self, path): No newline at end of file |
|
267 | 267 | fichero1=open(path,'r') No newline at end of file |
|
268 | 268 | cont=0 No newline at end of file |
|
269 | 269 | for cadena in fichero1: No newline at end of file |
|
270 | 270 | cont=cont+1 No newline at end of file |
|
271 | 271 | if cont==3: No newline at end of file |
|
272 | 272 | nexp='' No newline at end of file |
|
273 | 273 | pos=0 No newline at end of file |
|
274 | 274 | for elemento in cadena: No newline at end of file |
|
275 | 275 | pos=pos+1 No newline at end of file |
|
276 | 276 | if elemento=='=': No newline at end of file |
|
277 | 277 | nexp=int(cadena[pos:]) No newline at end of file |
|
278 | 278 | return nexp No newline at end of file |
|
279 | 279 | fichero1.close() No newline at end of file |
|
280 | 280 | |
|
281 | No newline at end of file | |
|
281 | def Paridad(numero): No newline at end of file | |
|
282 | 282 | if numero%2==0: return 'par' No newline at end of file |
|
283 | 283 | elif numero%2==1: return 'impar' No newline at end of file |
|
284 | 284 | No newline at end of file |
|
285 | 285 | def EvaluaCadena(self,cadena): No newline at end of file |
|
286 | 286 | if len(cadena)>35: No newline at end of file |
|
287 | 287 | if cadena[-1]=='$': No newline at end of file |
|
288 | 288 | return cadena[-35:-2] No newline at end of file |
|
289 | 289 | elif cadena[-1]==']': No newline at end of file |
|
290 | 290 | return cadena[-34:-1] No newline at end of file |
|
291 | 291 | else: No newline at end of file |
|
292 | 292 | return None No newline at end of file |
|
293 | 293 | No newline at end of file |
|
294 | 294 | def GuardaEnLista(self,path): No newline at end of file |
|
295 | 295 | fichero=open(path,'r') No newline at end of file |
|
296 | 296 | lista=[] No newline at end of file |
|
297 | 297 | for cadena in fichero: No newline at end of file |
|
298 | 298 | cadena = self.EliminaSaltoDeLinea(cadena) No newline at end of file |
|
299 | 299 | cadena = self.EvaluaCadena(cadena) No newline at end of file |
|
300 | 300 | if cadena != None: No newline at end of file |
|
301 | 301 | lista.append(cadena) No newline at end of file |
|
302 | 302 | fichero.close() No newline at end of file |
|
303 | 303 | return lista No newline at end of file |
|
304 | 304 | No newline at end of file |
|
305 | 305 | def CreaFicherosPrevios(self, path, archivo): No newline at end of file |
|
306 | 306 | vector = self.GuardaEnLista(archivo) No newline at end of file |
|
307 | 307 | for i in range(1,self.NumeroDeExperimentos(archivo)+1): No newline at end of file |
|
308 | 308 | fichero =open(path + str(i)+ '.txt','w') No newline at end of file |
|
309 | 309 | for j in range(0,16): No newline at end of file |
|
310 | 310 | fichero.write(vector[j+16*(i-1)]+'\n') No newline at end of file |
|
311 | 311 | fichero.close() No newline at end of file |
|
312 | 312 | No newline at end of file |
|
313 | 313 | def CapturaValoresEnArchivo(self, path, polarizacion='up'): No newline at end of file |
|
314 | 314 | fichero =open(path,'r') No newline at end of file |
|
315 | 315 | cnt=0 No newline at end of file |
|
316 | 316 | lstup=[] No newline at end of file |
|
317 | 317 | lstdw=[] No newline at end of file |
|
318 | 318 | for cadena in fichero: No newline at end of file |
|
319 | 319 | cnt=cnt+1 No newline at end of file |
|
320 | 320 | if cnt==1: No newline at end of file |
|
321 | 321 | nu01=cadena[1:4] No newline at end of file |
|
322 | 322 | nu02=cadena[5:8] No newline at end of file |
|
323 | 323 | nu03=cadena[9:12] No newline at end of file |
|
324 | 324 | nu04=cadena[13:16] No newline at end of file |
|
325 | 325 | eu01=cadena[17:20] No newline at end of file |
|
326 | 326 | eu02=cadena[21:24] No newline at end of file |
|
327 | 327 | eu03=cadena[25:28] No newline at end of file |
|
328 | 328 | eu04=cadena[29:32] No newline at end of file |
|
329 | 329 | if cnt==2: No newline at end of file |
|
330 | 330 | nu05=cadena[1:4] No newline at end of file |
|
331 | 331 | nu06=cadena[5:8] No newline at end of file |
|
332 | 332 | nu07=cadena[9:12] No newline at end of file |
|
333 | 333 | nu08=cadena[13:16] No newline at end of file |
|
334 | 334 | eu05=cadena[17:20] No newline at end of file |
|
335 | 335 | eu06=cadena[21:24] No newline at end of file |
|
336 | 336 | eu07=cadena[25:28] No newline at end of file |
|
337 | 337 | eu08=cadena[29:32] No newline at end of file |
|
338 | 338 | if cnt==3: No newline at end of file |
|
339 | 339 | nu09=cadena[1:4] No newline at end of file |
|
340 | 340 | nu10=cadena[5:8] No newline at end of file |
|
341 | 341 | nu11=cadena[9:12] No newline at end of file |
|
342 | 342 | nu12=cadena[13:16] No newline at end of file |
|
343 | 343 | eu09=cadena[17:20] No newline at end of file |
|
344 | 344 | eu10=cadena[21:24] No newline at end of file |
|
345 | 345 | eu11=cadena[25:28] No newline at end of file |
|
346 | 346 | eu12=cadena[29:32] No newline at end of file |
|
347 | 347 | if cnt==4: No newline at end of file |
|
348 | 348 | nu13=cadena[1:4] No newline at end of file |
|
349 | 349 | nu14=cadena[5:8] No newline at end of file |
|
350 | 350 | nu15=cadena[9:12] No newline at end of file |
|
351 | 351 | nu16=cadena[13:16] No newline at end of file |
|
352 | 352 | eu13=cadena[17:20] No newline at end of file |
|
353 | 353 | eu14=cadena[21:24] No newline at end of file |
|
354 | 354 | eu15=cadena[25:28] No newline at end of file |
|
355 | 355 | eu16=cadena[29:32] No newline at end of file |
|
356 | 356 | if cnt==5: No newline at end of file |
|
357 | 357 | wu01=cadena[1:4] No newline at end of file |
|
358 | 358 | wu02=cadena[5:8] No newline at end of file |
|
359 | 359 | wu03=cadena[9:12] No newline at end of file |
|
360 | 360 | wu04=cadena[13:16] No newline at end of file |
|
361 | 361 | su01=cadena[17:20] No newline at end of file |
|
362 | 362 | su02=cadena[21:24] No newline at end of file |
|
363 | 363 | su03=cadena[25:28] No newline at end of file |
|
364 | 364 | su04=cadena[29:32] No newline at end of file |
|
365 | 365 | if cnt==6: No newline at end of file |
|
366 | 366 | wu05=cadena[1:4] No newline at end of file |
|
367 | 367 | wu06=cadena[5:8] No newline at end of file |
|
368 | 368 | wu07=cadena[9:12] No newline at end of file |
|
369 | 369 | wu08=cadena[13:16] No newline at end of file |
|
370 | 370 | su05=cadena[17:20] No newline at end of file |
|
371 | 371 | su06=cadena[21:24] No newline at end of file |
|
372 | 372 | su07=cadena[25:28] No newline at end of file |
|
373 | 373 | su08=cadena[29:32] No newline at end of file |
|
374 | 374 | if cnt==7: No newline at end of file |
|
375 | 375 | wu09=cadena[1:4] No newline at end of file |
|
376 | 376 | wu10=cadena[5:8] No newline at end of file |
|
377 | 377 | wu11=cadena[9:12] No newline at end of file |
|
378 | 378 | wu12=cadena[13:16] No newline at end of file |
|
379 | 379 | su09=cadena[17:20] No newline at end of file |
|
380 | 380 | su10=cadena[21:24] No newline at end of file |
|
381 | 381 | su11=cadena[25:28] No newline at end of file |
|
382 | 382 | su12=cadena[29:32] No newline at end of file |
|
383 | 383 | if cnt==8: No newline at end of file |
|
384 | 384 | wu13=cadena[1:4] No newline at end of file |
|
385 | 385 | wu14=cadena[5:8] No newline at end of file |
|
386 | 386 | wu15=cadena[9:12] No newline at end of file |
|
387 | 387 | wu16=cadena[13:16] No newline at end of file |
|
388 | 388 | su13=cadena[17:20] No newline at end of file |
|
389 | 389 | su14=cadena[21:24] No newline at end of file |
|
390 | 390 | su15=cadena[25:28] No newline at end of file |
|
391 | 391 | su16=cadena[29:32] No newline at end of file |
|
392 | 392 | if cnt==9: No newline at end of file |
|
393 | 393 | nd01=cadena[1:4] No newline at end of file |
|
394 | 394 | nd02=cadena[5:8] No newline at end of file |
|
395 | 395 | nd03=cadena[9:12] No newline at end of file |
|
396 | 396 | nd04=cadena[13:16] No newline at end of file |
|
397 | 397 | ed01=cadena[17:20] No newline at end of file |
|
398 | 398 | ed02=cadena[21:24] No newline at end of file |
|
399 | 399 | ed03=cadena[25:28] No newline at end of file |
|
400 | 400 | ed04=cadena[29:32] No newline at end of file |
|
401 | 401 | if cnt==10: No newline at end of file |
|
402 | 402 | nd05=cadena[1:4] No newline at end of file |
|
403 | 403 | nd06=cadena[5:8] No newline at end of file |
|
404 | 404 | nd07=cadena[9:12] No newline at end of file |
|
405 | 405 | nd08=cadena[13:16] No newline at end of file |
|
406 | 406 | ed05=cadena[17:20] No newline at end of file |
|
407 | 407 | ed06=cadena[21:24] No newline at end of file |
|
408 | 408 | ed07=cadena[25:28] No newline at end of file |
|
409 | 409 | ed08=cadena[29:32] No newline at end of file |
|
410 | 410 | if cnt==11: No newline at end of file |
|
411 | 411 | nd09=cadena[1:4] No newline at end of file |
|
412 | 412 | nd10=cadena[5:8] No newline at end of file |
|
413 | 413 | nd11=cadena[9:12] No newline at end of file |
|
414 | 414 | nd12=cadena[13:16] No newline at end of file |
|
415 | 415 | ed09=cadena[17:20] No newline at end of file |
|
416 | 416 | ed10=cadena[21:24] No newline at end of file |
|
417 | 417 | ed11=cadena[25:28] No newline at end of file |
|
418 | 418 | ed12=cadena[29:32] No newline at end of file |
|
419 | 419 | if cnt==12: No newline at end of file |
|
420 | 420 | nd13=cadena[1:4] No newline at end of file |
|
421 | 421 | nd14=cadena[5:8] No newline at end of file |
|
422 | 422 | nd15=cadena[9:12] No newline at end of file |
|
423 | 423 | nd16=cadena[13:16] No newline at end of file |
|
424 | 424 | ed13=cadena[17:20] No newline at end of file |
|
425 | 425 | ed14=cadena[21:24] No newline at end of file |
|
426 | 426 | ed15=cadena[25:28] No newline at end of file |
|
427 | 427 | ed16=cadena[29:32] No newline at end of file |
|
428 | 428 | if cnt==13: No newline at end of file |
|
429 | 429 | wd01=cadena[1:4] No newline at end of file |
|
430 | 430 | wd02=cadena[5:8] No newline at end of file |
|
431 | 431 | wd03=cadena[9:12] No newline at end of file |
|
432 | 432 | wd04=cadena[13:16] No newline at end of file |
|
433 | 433 | sd01=cadena[17:20] No newline at end of file |
|
434 | 434 | sd02=cadena[21:24] No newline at end of file |
|
435 | 435 | sd03=cadena[25:28] No newline at end of file |
|
436 | 436 | sd04=cadena[29:32] No newline at end of file |
|
437 | 437 | if cnt==14: No newline at end of file |
|
438 | 438 | wd05=cadena[1:4] No newline at end of file |
|
439 | 439 | wd06=cadena[5:8] No newline at end of file |
|
440 | 440 | wd07=cadena[9:12] No newline at end of file |
|
441 | 441 | wd08=cadena[13:16] No newline at end of file |
|
442 | 442 | sd05=cadena[17:20] No newline at end of file |
|
443 | 443 | sd06=cadena[21:24] No newline at end of file |
|
444 | 444 | sd07=cadena[25:28] No newline at end of file |
|
445 | 445 | sd08=cadena[29:32] No newline at end of file |
|
446 | 446 | if cnt==15: No newline at end of file |
|
447 | 447 | wd09=cadena[1:4] No newline at end of file |
|
448 | 448 | wd10=cadena[5:8] No newline at end of file |
|
449 | 449 | wd11=cadena[9:12] No newline at end of file |
|
450 | 450 | wd12=cadena[13:16] No newline at end of file |
|
451 | 451 | sd09=cadena[17:20] No newline at end of file |
|
452 | 452 | sd10=cadena[21:24] No newline at end of file |
|
453 | 453 | sd11=cadena[25:28] No newline at end of file |
|
454 | 454 | sd12=cadena[29:32] No newline at end of file |
|
455 | 455 | if cnt==16: No newline at end of file |
|
456 | 456 | wd13=cadena[1:4] No newline at end of file |
|
457 | 457 | wd14=cadena[5:8] No newline at end of file |
|
458 | 458 | wd15=cadena[9:12] No newline at end of file |
|
459 | 459 | wd16=cadena[13:16] No newline at end of file |
|
460 | 460 | sd13=cadena[17:20] No newline at end of file |
|
461 | 461 | sd14=cadena[21:24] No newline at end of file |
|
462 | 462 | sd15=cadena[25:28] No newline at end of file |
|
463 | 463 | sd16=cadena[29:32] No newline at end of file |
|
464 | 464 | blck_1_up = [nu01,nu02,nu03,nu04,eu01,eu02,eu03,eu04,nu05,nu06,nu07,nu08,eu05,eu06,eu07,eu08] No newline at end of file |
|
465 | 465 | blck_1_dw = [nd01,nd02,nd03,nd04,ed01,ed02,ed03,ed04,nd05,nd06,nd07,nd08,ed05,ed06,ed07,ed08] No newline at end of file |
|
466 | 466 | blck_2_up = [nu09,nu10,nu11,nu12,eu09,eu10,eu11,eu12,nu13,nu14,nu15,nu16,eu13,eu14,eu15,eu16] No newline at end of file |
|
467 | 467 | blck_2_dw = [nd09,nd10,nd11,nd12,ed09,ed10,ed11,ed12,nd13,nd14,nd15,nd16,ed13,ed14,ed15,ed16] No newline at end of file |
|
468 | 468 | blck_3_up = [wu01,wu02,wu03,wu04,su01,su02,su03,su04,wu05,wu06,wu07,wu08,su05,su06,su07,su08] No newline at end of file |
|
469 | 469 | blck_3_dw = [wd01,wd02,wd03,wd04,sd01,sd02,sd03,sd04,wd05,wd06,wd07,wd08,sd05,sd06,sd07,sd08] No newline at end of file |
|
470 | 470 | blck_4_up = [wu09,wu10,wu11,wu12,su09,su10,su11,su12,wu13,wu14,wu15,wu16,su13,su14,su15,su16] No newline at end of file |
|
471 | 471 | blck_4_dw = [wd09,wd10,wd11,wd12,sd09,sd10,sd11,sd12,wd13,wd14,wd15,wd16,sd13,sd14,sd15,sd16] No newline at end of file |
|
472 | 472 | No newline at end of file |
|
473 | 473 | lstup = blck_1_up + blck_2_up + blck_3_up + blck_4_up No newline at end of file |
|
474 | 474 | lstdw = blck_1_dw + blck_2_dw + blck_3_dw + blck_4_dw No newline at end of file |
|
475 | 475 | No newline at end of file |
|
476 | 476 | if polarizacion=='up': No newline at end of file |
|
477 | 477 | return lstup No newline at end of file |
|
478 | 478 | elif polarizacion=='dw': No newline at end of file |
|
479 | 479 | return lstdw No newline at end of file |
|
480 | 480 | fichero.close() No newline at end of file |
|
481 | 481 | No newline at end of file |
|
482 | 482 | def CreaFormatoFinal(self, path, filename): No newline at end of file |
|
483 | 483 | ne=self.NumeroDeExperimentos(filename) No newline at end of file |
|
484 | 484 | No newline at end of file |
|
485 | 485 | #nombre01 = file1(archivo,'1') No newline at end of file |
|
486 | 486 | nombre02 = self.file1(filename,'2') No newline at end of file |
|
487 | 487 | fichero=open(path + 'CentralControlFormat.txt','w') No newline at end of file |
|
488 | 488 | fichero.write(nombre02+'\n') No newline at end of file |
|
489 | 489 | fichero.write(str(ne)+'\n') No newline at end of file |
|
490 | 490 | No newline at end of file |
|
491 | 491 | for i in range(1,65): No newline at end of file |
|
492 | 492 | No newline at end of file |
|
493 | 493 | if i<10: No newline at end of file |
|
494 | 494 | nmod = '0'+str(i) No newline at end of file |
|
495 | 495 | else: nmod = str(i) No newline at end of file |
|
496 | 496 | No newline at end of file |
|
497 | 497 | fichero.write("ABS_" + nmod+'\n') No newline at end of file |
|
498 | 498 | No newline at end of file |
|
499 | 499 | for j in range(1,ne+1): No newline at end of file |
|
500 | 500 | ruta=path+str(j)+'.txt' No newline at end of file |
|
501 | 501 | lu=self.CapturaValoresEnArchivo(ruta,polarizacion='up') No newline at end of file |
|
502 | 502 | ld=self.CapturaValoresEnArchivo(ruta,polarizacion='dw') No newline at end of file |
|
503 | 503 | part1='' No newline at end of file |
|
504 | 504 | part2='' No newline at end of file |
|
505 | 505 | if lu[i-1]=='1.0': part1='000' No newline at end of file |
|
506 | 506 | if lu[i-1]=='2.0': part1='001' No newline at end of file |
|
507 | 507 | if lu[i-1]=='3.0': part1='010' No newline at end of file |
|
508 | 508 | if lu[i-1]=='0.0': part1='011' No newline at end of file |
|
509 | 509 | if lu[i-1]=='0.5': part1='100' No newline at end of file |
|
510 | 510 | if lu[i-1]=='1.5': part1='101' No newline at end of file |
|
511 | 511 | if lu[i-1]=='2.5': part1='110' No newline at end of file |
|
512 | 512 | if lu[i-1]=='3.5': part1='111' No newline at end of file |
|
513 | 513 | if ld[i-1]=='1.0': part2='000' No newline at end of file |
|
514 | 514 | if ld[i-1]=='2.0': part2='001' No newline at end of file |
|
515 | 515 | if ld[i-1]=='3.0': part2='010' No newline at end of file |
|
516 | 516 | if ld[i-1]=='0.0': part2='011' No newline at end of file |
|
517 | 517 | if ld[i-1]=='0.5': part2='100' No newline at end of file |
|
518 | 518 | if ld[i-1]=='1.5': part2='101' No newline at end of file |
|
519 | 519 | if ld[i-1]=='2.5': part2='110' No newline at end of file |
|
520 | 520 | if ld[i-1]=='3.5': part2='111' No newline at end of file |
|
521 | 521 | fichero.write(part1+part2+'\n') No newline at end of file |
|
522 | 522 | fichero.write('------'+'\n') No newline at end of file |
|
523 | 523 | fichero.close() No newline at end of file |
|
524 | 524 | No newline at end of file |
|
525 | 525 | def EliminaArchivosEnLaCarpeta(self, path, filename): No newline at end of file |
|
526 | 526 | ne=self.NumeroDeExperimentos(filename) No newline at end of file |
|
527 | 527 | for i in range(1,ne+1): No newline at end of file |
|
528 | 528 | os.remove(path + str(i)+'.txt') No newline at end of file |
|
529 | 529 | No newline at end of file |
|
530 | 530 | No newline at end of file |
|
531 | 531 | def toCentralControlFormat(self, filename): No newline at end of file |
|
532 | 532 | """ Funcion que genera un archivo para el control central""" No newline at end of file |
|
533 | 533 | No newline at end of file |
|
534 | 534 | path = os.getcwd() + '/' No newline at end of file |
|
535 | 535 | self.CreaFicherosPrevios(path, filename) No newline at end of file |
|
536 | 536 | self.CreaFormatoFinal(path, filename) No newline at end of file |
|
537 | 537 | self.EliminaArchivosEnLaCarpeta(path, filename) No newline at end of file |
@@ -1,13 +1,32 | |||
|
1 | import file | |
|
1 | import optparse, os, sys No newline at end of file | |
|
No newline at end of file | ||
|
2 | from client3 import * | |
|
No newline at end of file | ||
|
3 | import sys No newline at end of file | |
|
4 | 2 | No newline at end of file |
|
3 | pathFile = os.getcwd() | |
|
No newline at end of file | ||
|
4 | sys.path.append(os.path.split(pathFile)[0]) | |
|
No newline at end of file | ||
|
5 | ||
|
No newline at end of file | ||
|
6 | from abscontrol.client3 import ABSClient | |
|
No newline at end of file | ||
|
7 | ||
|
No newline at end of file | ||
|
8 | class changeBeam(object): | |
|
No newline at end of file | ||
|
9 | ||
|
No newline at end of file | ||
|
10 | def __init__(self): | |
|
No newline at end of file | ||
|
11 | pass | |
|
No newline at end of file | ||
|
12 | ||
|
No newline at end of file | ||
|
13 | def execute(self, beam="0"): No newline at end of file | |
|
5 | 14 | absObj = ABSClient(ipDestino="10.10.10.97") |
|
15 | No newline at end of file | |
|
6 | #absObj = ABSClient() No newline at end of file | |
|
7 | 16 | |
|
17 | No newline at end of file | |
|
8 | if len(sys.argv) == 2: | |
|
No newline at end of file | ||
|
18 | No newline at end of file | |
|
9 | #beam = "2" | |
|
No newline at end of file | ||
|
19 | No newline at end of file | |
|
10 | beam = sys.argv[1] | |
|
No newline at end of file | ||
|
20 | No newline at end of file | |
|
11 | absObj.changeBeam(beam) | |
|
No newline at end of file | ||
|
21 | No newline at end of file | |
|
12 | else: | |
|
No newline at end of file | ||
|
22 | No newline at end of file | |
|
13 | print "Only one argument needed" No newline at end of file | |
|
No newline at end of file | ||
|
23 | parser = optparse.OptionParser(usage=usage) | |
|
No newline at end of file | ||
|
24 | ||
|
No newline at end of file | ||
|
25 | parser.add_option("-n", "--beam", dest="pattern", type="string", default="0", help="Number of Pattern") | |
|
No newline at end of file | ||
|
26 | ||
|
No newline at end of file | ||
|
27 | (options, args) = parser.parse_args() | |
|
No newline at end of file | ||
|
28 | ||
|
No newline at end of file | ||
|
29 | beam = options.pattern | |
|
No newline at end of file | ||
|
30 | ||
|
No newline at end of file | ||
|
31 | app = changeBeam() | |
|
No newline at end of file | ||
|
32 | app.execute(beam) No newline at end of file |
@@ -1,12 +1,36 | |||
|
1 | import file | |
|
No newline at end of file | ||
|
2 | from client3 import * | |
|
No newline at end of file | ||
|
3 | import sys No newline at end of file | |
|
4 | 1 |
|
|
2 | import optparse, os, sys | |
|
No newline at end of file | ||
|
3 | ||
|
No newline at end of file | ||
|
4 | pathFile = os.getcwd() | |
|
No newline at end of file | ||
|
5 | sys.path.append(os.path.split(pathFile)[0]) | |
|
No newline at end of file | ||
|
6 | ||
|
No newline at end of file | ||
|
7 | from abscontrol.client3 import ABSClient | |
|
No newline at end of file | ||
|
8 | ||
|
No newline at end of file | ||
|
9 | class sendFile(object): | |
|
No newline at end of file | ||
|
10 | ||
|
No newline at end of file | ||
|
11 | def __init__(self): | |
|
No newline at end of file | ||
|
12 | pass | |
|
No newline at end of file | ||
|
13 | ||
|
No newline at end of file | ||
|
14 | def execute(self, filename): | |
|
No newline at end of file | ||
|
15 | if os.path.exists(filename): No newline at end of file | |
|
5 | 16 | absObj = ABSClient(ipDestino="10.10.10.97") |
|
No newline at end of file | ||
|
6 | #absObj = ABSClient() | |
|
No newline at end of file | ||
|
7 | if len(sys.argv) == 2: | |
|
No newline at end of file | ||
|
8 | #filename = "experimento1.abs" | |
|
No newline at end of file | ||
|
9 | filename = sys.argv[1] No newline at end of file | |
|
10 | 17 | absObj.sendFile(filename) No newline at end of file |
|
18 | pass No newline at end of file | |
|
11 | 19 | else: |
|
20 | No newline at end of file | |
|
12 | print "Only one argument needed" No newline at end of file | |
|
No newline at end of file | ||
|
21 | ||
|
No newline at end of file | ||
|
22 | usage = "::::::::::::\n" | |
|
No newline at end of file | ||
|
23 | ||
|
No newline at end of file | ||
|
24 | ||
|
No newline at end of file | ||
|
25 | if __name__ == '__main__': | |
|
No newline at end of file | ||
|
26 | ||
|
No newline at end of file | ||
|
27 | parser = optparse.OptionParser(usage=usage) | |
|
No newline at end of file | ||
|
28 | ||
|
No newline at end of file | ||
|
29 | parser.add_option("-f", "--filename", dest="filename", type="string", default="", help="Filename") | |
|
No newline at end of file | ||
|
30 | ||
|
No newline at end of file | ||
|
31 | (options, args) = parser.parse_args() | |
|
No newline at end of file | ||
|
32 | ||
|
No newline at end of file | ||
|
33 | filename = options.filename | |
|
No newline at end of file | ||
|
34 | ||
|
No newline at end of file | ||
|
35 | app = sendFile() | |
|
No newline at end of file | ||
|
36 | app.execute(filename) No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now