@@ -1,1209 +1,1209 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on September , 2012 |
|
2 | Created on September , 2012 | |
3 | @author: |
|
3 | @author: | |
4 | ''' |
|
4 | ''' | |
5 | from xml.etree.ElementTree import Element, SubElement |
|
5 | from xml.etree.ElementTree import Element, SubElement | |
6 | from xml.etree import ElementTree as ET |
|
6 | from xml.etree import ElementTree as ET | |
7 | from xml.dom import minidom |
|
7 | from xml.dom import minidom | |
8 |
|
8 | |||
9 | #import datetime |
|
9 | #import datetime | |
10 | from model import * |
|
10 | from model import * | |
11 |
|
11 | |||
12 | try: |
|
12 | try: | |
13 | from gevent import sleep |
|
13 | from gevent import sleep | |
14 | except: |
|
14 | except: | |
15 | from time import sleep |
|
15 | from time import sleep | |
16 |
|
16 | |||
17 | import ast |
|
17 | import ast | |
18 |
|
18 | |||
19 | def prettify(elem): |
|
19 | def prettify(elem): | |
20 | """Return a pretty-printed XML string for the Element. |
|
20 | """Return a pretty-printed XML string for the Element. | |
21 | """ |
|
21 | """ | |
22 | rough_string = ET.tostring(elem, 'utf-8') |
|
22 | rough_string = ET.tostring(elem, 'utf-8') | |
23 | reparsed = minidom.parseString(rough_string) |
|
23 | reparsed = minidom.parseString(rough_string) | |
24 | return reparsed.toprettyxml(indent=" ") |
|
24 | return reparsed.toprettyxml(indent=" ") | |
25 |
|
25 | |||
26 | class ParameterConf(): |
|
26 | class ParameterConf(): | |
27 |
|
27 | |||
28 | id = None |
|
28 | id = None | |
29 | name = None |
|
29 | name = None | |
30 | value = None |
|
30 | value = None | |
31 | format = None |
|
31 | format = None | |
32 |
|
32 | |||
33 | __formated_value = None |
|
33 | __formated_value = None | |
34 |
|
34 | |||
35 | ELEMENTNAME = 'Parameter' |
|
35 | ELEMENTNAME = 'Parameter' | |
36 |
|
36 | |||
37 | def __init__(self): |
|
37 | def __init__(self): | |
38 |
|
38 | |||
39 | self.format = 'str' |
|
39 | self.format = 'str' | |
40 |
|
40 | |||
41 | def getElementName(self): |
|
41 | def getElementName(self): | |
42 |
|
42 | |||
43 | return self.ELEMENTNAME |
|
43 | return self.ELEMENTNAME | |
44 |
|
44 | |||
45 | def getValue(self): |
|
45 | def getValue(self): | |
46 |
|
46 | |||
47 | value = self.value |
|
47 | value = self.value | |
48 | format = self.format |
|
48 | format = self.format | |
49 |
|
49 | |||
50 | if self.__formated_value != None: |
|
50 | if self.__formated_value != None: | |
51 |
|
51 | |||
52 | return self.__formated_value |
|
52 | return self.__formated_value | |
53 |
|
53 | |||
54 | if format == 'str': |
|
54 | if format == 'str': | |
55 | self.__formated_value = str(value) |
|
55 | self.__formated_value = str(value) | |
56 | return self.__formated_value |
|
56 | return self.__formated_value | |
57 |
|
57 | |||
58 | if value == '': |
|
58 | if value == '': | |
59 | raise ValueError, "%s: This parameter value is empty" %self.name |
|
59 | raise ValueError, "%s: This parameter value is empty" %self.name | |
60 |
|
60 | |||
61 | if format == 'bool': |
|
61 | if format == 'bool': | |
62 | value = int(value) |
|
62 | value = int(value) | |
63 |
|
63 | |||
64 | if format == 'list': |
|
64 | if format == 'list': | |
65 | strList = value.split(',') |
|
65 | strList = value.split(',') | |
66 |
|
66 | |||
67 | self.__formated_value = strList |
|
67 | self.__formated_value = strList | |
68 |
|
68 | |||
69 | return self.__formated_value |
|
69 | return self.__formated_value | |
70 |
|
70 | |||
71 | if format == 'intlist': |
|
71 | if format == 'intlist': | |
72 | """ |
|
72 | """ | |
73 | Example: |
|
73 | Example: | |
74 | value = (0,1,2) |
|
74 | value = (0,1,2) | |
75 | """ |
|
75 | """ | |
76 | value = value.replace('(', '') |
|
76 | value = value.replace('(', '') | |
77 | value = value.replace(')', '') |
|
77 | value = value.replace(')', '') | |
78 |
|
78 | |||
79 | value = value.replace('[', '') |
|
79 | value = value.replace('[', '') | |
80 | value = value.replace(']', '') |
|
80 | value = value.replace(']', '') | |
81 |
|
81 | |||
82 | strList = value.split(',') |
|
82 | strList = value.split(',') | |
83 | intList = [int(x) for x in strList] |
|
83 | intList = [int(x) for x in strList] | |
84 |
|
84 | |||
85 | self.__formated_value = intList |
|
85 | self.__formated_value = intList | |
86 |
|
86 | |||
87 | return self.__formated_value |
|
87 | return self.__formated_value | |
88 |
|
88 | |||
89 | if format == 'floatlist': |
|
89 | if format == 'floatlist': | |
90 | """ |
|
90 | """ | |
91 | Example: |
|
91 | Example: | |
92 | value = (0.5, 1.4, 2.7) |
|
92 | value = (0.5, 1.4, 2.7) | |
93 | """ |
|
93 | """ | |
94 |
|
94 | |||
95 | value = value.replace('(', '') |
|
95 | value = value.replace('(', '') | |
96 | value = value.replace(')', '') |
|
96 | value = value.replace(')', '') | |
97 |
|
97 | |||
98 | value = value.replace('[', '') |
|
98 | value = value.replace('[', '') | |
99 | value = value.replace(']', '') |
|
99 | value = value.replace(']', '') | |
100 |
|
100 | |||
101 | strList = value.split(',') |
|
101 | strList = value.split(',') | |
102 | floatList = [float(x) for x in strList] |
|
102 | floatList = [float(x) for x in strList] | |
103 |
|
103 | |||
104 | self.__formated_value = floatList |
|
104 | self.__formated_value = floatList | |
105 |
|
105 | |||
106 | return self.__formated_value |
|
106 | return self.__formated_value | |
107 |
|
107 | |||
108 | if format == 'date': |
|
108 | if format == 'date': | |
109 | strList = value.split('/') |
|
109 | strList = value.split('/') | |
110 | intList = [int(x) for x in strList] |
|
110 | intList = [int(x) for x in strList] | |
111 | date = datetime.date(intList[0], intList[1], intList[2]) |
|
111 | date = datetime.date(intList[0], intList[1], intList[2]) | |
112 |
|
112 | |||
113 | self.__formated_value = date |
|
113 | self.__formated_value = date | |
114 |
|
114 | |||
115 | return self.__formated_value |
|
115 | return self.__formated_value | |
116 |
|
116 | |||
117 | if format == 'time': |
|
117 | if format == 'time': | |
118 | strList = value.split(':') |
|
118 | strList = value.split(':') | |
119 | intList = [int(x) for x in strList] |
|
119 | intList = [int(x) for x in strList] | |
120 | time = datetime.time(intList[0], intList[1], intList[2]) |
|
120 | time = datetime.time(intList[0], intList[1], intList[2]) | |
121 |
|
121 | |||
122 | self.__formated_value = time |
|
122 | self.__formated_value = time | |
123 |
|
123 | |||
124 | return self.__formated_value |
|
124 | return self.__formated_value | |
125 |
|
125 | |||
126 | if format == 'pairslist': |
|
126 | if format == 'pairslist': | |
127 | """ |
|
127 | """ | |
128 | Example: |
|
128 | Example: | |
129 | value = (0,1),(1,2) |
|
129 | value = (0,1),(1,2) | |
130 | """ |
|
130 | """ | |
131 |
|
131 | |||
132 | value = value.replace('(', '') |
|
132 | value = value.replace('(', '') | |
133 | value = value.replace(')', '') |
|
133 | value = value.replace(')', '') | |
134 |
|
134 | |||
135 | value = value.replace('[', '') |
|
135 | value = value.replace('[', '') | |
136 | value = value.replace(']', '') |
|
136 | value = value.replace(']', '') | |
137 |
|
137 | |||
138 | strList = value.split(',') |
|
138 | strList = value.split(',') | |
139 | intList = [int(item) for item in strList] |
|
139 | intList = [int(item) for item in strList] | |
140 | pairList = [] |
|
140 | pairList = [] | |
141 | for i in range(len(intList)/2): |
|
141 | for i in range(len(intList)/2): | |
142 | pairList.append((intList[i*2], intList[i*2 + 1])) |
|
142 | pairList.append((intList[i*2], intList[i*2 + 1])) | |
143 |
|
143 | |||
144 | self.__formated_value = pairList |
|
144 | self.__formated_value = pairList | |
145 |
|
145 | |||
146 | return self.__formated_value |
|
146 | return self.__formated_value | |
147 |
|
147 | |||
148 | if format == 'multilist': |
|
148 | if format == 'multilist': | |
149 | """ |
|
149 | """ | |
150 | Example: |
|
150 | Example: | |
151 | value = (0,1,2),(3,4,5) |
|
151 | value = (0,1,2),(3,4,5) | |
152 | """ |
|
152 | """ | |
153 | multiList = ast.literal_eval(value) |
|
153 | multiList = ast.literal_eval(value) | |
154 |
|
154 | |||
155 | if type(multiList[0]) == int: |
|
155 | if type(multiList[0]) == int: | |
156 | multiList = ast.literal_eval("(" + value + ")") |
|
156 | multiList = ast.literal_eval("(" + value + ")") | |
157 |
|
157 | |||
158 | self.__formated_value = multiList |
|
158 | self.__formated_value = multiList | |
159 |
|
159 | |||
160 | return self.__formated_value |
|
160 | return self.__formated_value | |
161 |
|
161 | |||
162 | format_func = eval(format) |
|
162 | format_func = eval(format) | |
163 |
|
163 | |||
164 | self.__formated_value = format_func(value) |
|
164 | self.__formated_value = format_func(value) | |
165 |
|
165 | |||
166 | return self.__formated_value |
|
166 | return self.__formated_value | |
167 |
|
167 | |||
168 | def updateId(self, new_id): |
|
168 | def updateId(self, new_id): | |
169 |
|
169 | |||
170 | self.id = str(new_id) |
|
170 | self.id = str(new_id) | |
171 |
|
171 | |||
172 | def setup(self, id, name, value, format='str'): |
|
172 | def setup(self, id, name, value, format='str'): | |
173 |
|
173 | |||
174 | self.id = str(id) |
|
174 | self.id = str(id) | |
175 | self.name = name |
|
175 | self.name = name | |
176 | self.value = str(value) |
|
176 | self.value = str(value) | |
177 | self.format = str.lower(format) |
|
177 | self.format = str.lower(format) | |
178 |
|
178 | |||
179 | def update(self, name, value, format='str'): |
|
179 | def update(self, name, value, format='str'): | |
180 |
|
180 | |||
181 | self.name = name |
|
181 | self.name = name | |
182 | self.value = str(value) |
|
182 | self.value = str(value) | |
183 | self.format = format |
|
183 | self.format = format | |
184 |
|
184 | |||
185 | def makeXml(self, opElement): |
|
185 | def makeXml(self, opElement): | |
186 |
|
186 | |||
187 | parmElement = SubElement(opElement, self.ELEMENTNAME) |
|
187 | parmElement = SubElement(opElement, self.ELEMENTNAME) | |
188 | parmElement.set('id', str(self.id)) |
|
188 | parmElement.set('id', str(self.id)) | |
189 | parmElement.set('name', self.name) |
|
189 | parmElement.set('name', self.name) | |
190 | parmElement.set('value', self.value) |
|
190 | parmElement.set('value', self.value) | |
191 | parmElement.set('format', self.format) |
|
191 | parmElement.set('format', self.format) | |
192 |
|
192 | |||
193 | def readXml(self, parmElement): |
|
193 | def readXml(self, parmElement): | |
194 |
|
194 | |||
195 | self.id = parmElement.get('id') |
|
195 | self.id = parmElement.get('id') | |
196 | self.name = parmElement.get('name') |
|
196 | self.name = parmElement.get('name') | |
197 | self.value = parmElement.get('value') |
|
197 | self.value = parmElement.get('value') | |
198 | self.format = str.lower(parmElement.get('format')) |
|
198 | self.format = str.lower(parmElement.get('format')) | |
199 |
|
199 | |||
200 | #Compatible with old signal chain version |
|
200 | #Compatible with old signal chain version | |
201 | if self.format == 'int' and self.name == 'idfigure': |
|
201 | if self.format == 'int' and self.name == 'idfigure': | |
202 | self.name = 'id' |
|
202 | self.name = 'id' | |
203 |
|
203 | |||
204 | def printattr(self): |
|
204 | def printattr(self): | |
205 |
|
205 | |||
206 | print "Parameter[%s]: name = %s, value = %s, format = %s" %(self.id, self.name, self.value, self.format) |
|
206 | print "Parameter[%s]: name = %s, value = %s, format = %s" %(self.id, self.name, self.value, self.format) | |
207 |
|
207 | |||
208 | class OperationConf(): |
|
208 | class OperationConf(): | |
209 |
|
209 | |||
210 | id = None |
|
210 | id = None | |
211 | name = None |
|
211 | name = None | |
212 | priority = None |
|
212 | priority = None | |
213 | type = None |
|
213 | type = None | |
214 |
|
214 | |||
215 | parmConfObjList = [] |
|
215 | parmConfObjList = [] | |
216 |
|
216 | |||
217 | ELEMENTNAME = 'Operation' |
|
217 | ELEMENTNAME = 'Operation' | |
218 |
|
218 | |||
219 | def __init__(self): |
|
219 | def __init__(self): | |
220 |
|
220 | |||
221 | self.id = '0' |
|
221 | self.id = '0' | |
222 | self.name = None |
|
222 | self.name = None | |
223 | self.priority = None |
|
223 | self.priority = None | |
224 | self.type = 'self' |
|
224 | self.type = 'self' | |
225 |
|
225 | |||
226 |
|
226 | |||
227 | def __getNewId(self): |
|
227 | def __getNewId(self): | |
228 |
|
228 | |||
229 | return int(self.id)*10 + len(self.parmConfObjList) + 1 |
|
229 | return int(self.id)*10 + len(self.parmConfObjList) + 1 | |
230 |
|
230 | |||
231 | def updateId(self, new_id): |
|
231 | def updateId(self, new_id): | |
232 |
|
232 | |||
233 | self.id = str(new_id) |
|
233 | self.id = str(new_id) | |
234 |
|
234 | |||
235 | n = 1 |
|
235 | n = 1 | |
236 | for parmObj in self.parmConfObjList: |
|
236 | for parmObj in self.parmConfObjList: | |
237 |
|
237 | |||
238 | idParm = str(int(new_id)*10 + n) |
|
238 | idParm = str(int(new_id)*10 + n) | |
239 | parmObj.updateId(idParm) |
|
239 | parmObj.updateId(idParm) | |
240 |
|
240 | |||
241 | n += 1 |
|
241 | n += 1 | |
242 |
|
242 | |||
243 | def getElementName(self): |
|
243 | def getElementName(self): | |
244 |
|
244 | |||
245 | return self.ELEMENTNAME |
|
245 | return self.ELEMENTNAME | |
246 |
|
246 | |||
247 | def getParameterObjList(self): |
|
247 | def getParameterObjList(self): | |
248 |
|
248 | |||
249 | return self.parmConfObjList |
|
249 | return self.parmConfObjList | |
250 |
|
250 | |||
251 | def getParameterObj(self, parameterName): |
|
251 | def getParameterObj(self, parameterName): | |
252 |
|
252 | |||
253 | for parmConfObj in self.parmConfObjList: |
|
253 | for parmConfObj in self.parmConfObjList: | |
254 |
|
254 | |||
255 | if parmConfObj.name != parameterName: |
|
255 | if parmConfObj.name != parameterName: | |
256 | continue |
|
256 | continue | |
257 |
|
257 | |||
258 | return parmConfObj |
|
258 | return parmConfObj | |
259 |
|
259 | |||
260 | return None |
|
260 | return None | |
261 |
|
261 | |||
262 | def getParameterObjfromValue(self, parameterValue): |
|
262 | def getParameterObjfromValue(self, parameterValue): | |
263 |
|
263 | |||
264 | for parmConfObj in self.parmConfObjList: |
|
264 | for parmConfObj in self.parmConfObjList: | |
265 |
|
265 | |||
266 | if parmConfObj.getValue() != parameterValue: |
|
266 | if parmConfObj.getValue() != parameterValue: | |
267 | continue |
|
267 | continue | |
268 |
|
268 | |||
269 | return parmConfObj.getValue() |
|
269 | return parmConfObj.getValue() | |
270 |
|
270 | |||
271 | return None |
|
271 | return None | |
272 |
|
272 | |||
273 | def getParameterValue(self, parameterName): |
|
273 | def getParameterValue(self, parameterName): | |
274 |
|
274 | |||
275 | parameterObj = self.getParameterObj(parameterName) |
|
275 | parameterObj = self.getParameterObj(parameterName) | |
276 |
|
276 | |||
277 | if not parameterObj: |
|
277 | # if not parameterObj: | |
278 | return None |
|
278 | # return None | |
279 |
|
279 | |||
280 | value = parameterObj.getValue() |
|
280 | value = parameterObj.getValue() | |
281 |
|
281 | |||
282 | return value |
|
282 | return value | |
283 |
|
283 | |||
284 | def setup(self, id, name, priority, type): |
|
284 | def setup(self, id, name, priority, type): | |
285 |
|
285 | |||
286 | self.id = str(id) |
|
286 | self.id = str(id) | |
287 | self.name = name |
|
287 | self.name = name | |
288 | self.type = type |
|
288 | self.type = type | |
289 | self.priority = priority |
|
289 | self.priority = priority | |
290 |
|
290 | |||
291 | self.parmConfObjList = [] |
|
291 | self.parmConfObjList = [] | |
292 |
|
292 | |||
293 | def removeParameters(self): |
|
293 | def removeParameters(self): | |
294 |
|
294 | |||
295 | for obj in self.parmConfObjList: |
|
295 | for obj in self.parmConfObjList: | |
296 | del obj |
|
296 | del obj | |
297 |
|
297 | |||
298 | self.parmConfObjList = [] |
|
298 | self.parmConfObjList = [] | |
299 |
|
299 | |||
300 | def addParameter(self, name, value, format='str'): |
|
300 | def addParameter(self, name, value, format='str'): | |
301 |
|
301 | |||
302 | id = self.__getNewId() |
|
302 | id = self.__getNewId() | |
303 |
|
303 | |||
304 | parmConfObj = ParameterConf() |
|
304 | parmConfObj = ParameterConf() | |
305 | parmConfObj.setup(id, name, value, format) |
|
305 | parmConfObj.setup(id, name, value, format) | |
306 |
|
306 | |||
307 | self.parmConfObjList.append(parmConfObj) |
|
307 | self.parmConfObjList.append(parmConfObj) | |
308 |
|
308 | |||
309 | return parmConfObj |
|
309 | return parmConfObj | |
310 |
|
310 | |||
311 | def changeParameter(self, name, value, format='str'): |
|
311 | def changeParameter(self, name, value, format='str'): | |
312 |
|
312 | |||
313 | parmConfObj = self.getParameterObj(name) |
|
313 | parmConfObj = self.getParameterObj(name) | |
314 | parmConfObj.update(name, value, format) |
|
314 | parmConfObj.update(name, value, format) | |
315 |
|
315 | |||
316 | return parmConfObj |
|
316 | return parmConfObj | |
317 |
|
317 | |||
318 | def makeXml(self, upElement): |
|
318 | def makeXml(self, upElement): | |
319 |
|
319 | |||
320 | opElement = SubElement(upElement, self.ELEMENTNAME) |
|
320 | opElement = SubElement(upElement, self.ELEMENTNAME) | |
321 | opElement.set('id', str(self.id)) |
|
321 | opElement.set('id', str(self.id)) | |
322 | opElement.set('name', self.name) |
|
322 | opElement.set('name', self.name) | |
323 | opElement.set('type', self.type) |
|
323 | opElement.set('type', self.type) | |
324 | opElement.set('priority', str(self.priority)) |
|
324 | opElement.set('priority', str(self.priority)) | |
325 |
|
325 | |||
326 | for parmConfObj in self.parmConfObjList: |
|
326 | for parmConfObj in self.parmConfObjList: | |
327 | parmConfObj.makeXml(opElement) |
|
327 | parmConfObj.makeXml(opElement) | |
328 |
|
328 | |||
329 | def readXml(self, opElement): |
|
329 | def readXml(self, opElement): | |
330 |
|
330 | |||
331 | self.id = opElement.get('id') |
|
331 | self.id = opElement.get('id') | |
332 | self.name = opElement.get('name') |
|
332 | self.name = opElement.get('name') | |
333 | self.type = opElement.get('type') |
|
333 | self.type = opElement.get('type') | |
334 | self.priority = opElement.get('priority') |
|
334 | self.priority = opElement.get('priority') | |
335 |
|
335 | |||
336 | #Compatible with old signal chain version |
|
336 | #Compatible with old signal chain version | |
337 | #Use of 'run' method instead 'init' |
|
337 | #Use of 'run' method instead 'init' | |
338 | if self.type == 'self' and self.name == 'init': |
|
338 | if self.type == 'self' and self.name == 'init': | |
339 | self.name = 'run' |
|
339 | self.name = 'run' | |
340 |
|
340 | |||
341 | self.parmConfObjList = [] |
|
341 | self.parmConfObjList = [] | |
342 |
|
342 | |||
343 | parmElementList = opElement.getiterator(ParameterConf().getElementName()) |
|
343 | parmElementList = opElement.getiterator(ParameterConf().getElementName()) | |
344 |
|
344 | |||
345 | for parmElement in parmElementList: |
|
345 | for parmElement in parmElementList: | |
346 | parmConfObj = ParameterConf() |
|
346 | parmConfObj = ParameterConf() | |
347 | parmConfObj.readXml(parmElement) |
|
347 | parmConfObj.readXml(parmElement) | |
348 |
|
348 | |||
349 | #Compatible with old signal chain version |
|
349 | #Compatible with old signal chain version | |
350 | #If an 'plot' OPERATION is found, changes name operation by the value of its type PARAMETER |
|
350 | #If an 'plot' OPERATION is found, changes name operation by the value of its type PARAMETER | |
351 | if self.type != 'self' and self.name == 'Plot': |
|
351 | if self.type != 'self' and self.name == 'Plot': | |
352 | if parmConfObj.format == 'str' and parmConfObj.name == 'type': |
|
352 | if parmConfObj.format == 'str' and parmConfObj.name == 'type': | |
353 | self.name = parmConfObj.value |
|
353 | self.name = parmConfObj.value | |
354 | continue |
|
354 | continue | |
355 |
|
355 | |||
356 | self.parmConfObjList.append(parmConfObj) |
|
356 | self.parmConfObjList.append(parmConfObj) | |
357 |
|
357 | |||
358 | def printattr(self): |
|
358 | def printattr(self): | |
359 |
|
359 | |||
360 | print "%s[%s]: name = %s, type = %s, priority = %s" %(self.ELEMENTNAME, |
|
360 | print "%s[%s]: name = %s, type = %s, priority = %s" %(self.ELEMENTNAME, | |
361 | self.id, |
|
361 | self.id, | |
362 | self.name, |
|
362 | self.name, | |
363 | self.type, |
|
363 | self.type, | |
364 | self.priority) |
|
364 | self.priority) | |
365 |
|
365 | |||
366 | for parmConfObj in self.parmConfObjList: |
|
366 | for parmConfObj in self.parmConfObjList: | |
367 | parmConfObj.printattr() |
|
367 | parmConfObj.printattr() | |
368 |
|
368 | |||
369 | def createObject(self): |
|
369 | def createObject(self): | |
370 |
|
370 | |||
371 | if self.type == 'self': |
|
371 | if self.type == 'self': | |
372 | raise ValueError, "This operation type cannot be created" |
|
372 | raise ValueError, "This operation type cannot be created" | |
373 |
|
373 | |||
374 | if self.type == 'external' or self.type == 'other': |
|
374 | if self.type == 'external' or self.type == 'other': | |
375 | className = eval(self.name) |
|
375 | className = eval(self.name) | |
376 | opObj = className() |
|
376 | opObj = className() | |
377 |
|
377 | |||
378 | return opObj |
|
378 | return opObj | |
379 |
|
379 | |||
380 | class ProcUnitConf(): |
|
380 | class ProcUnitConf(): | |
381 |
|
381 | |||
382 | id = None |
|
382 | id = None | |
383 | name = None |
|
383 | name = None | |
384 | datatype = None |
|
384 | datatype = None | |
385 | inputId = None |
|
385 | inputId = None | |
386 | parentId = None |
|
386 | parentId = None | |
387 |
|
387 | |||
388 | opConfObjList = [] |
|
388 | opConfObjList = [] | |
389 |
|
389 | |||
390 | procUnitObj = None |
|
390 | procUnitObj = None | |
391 | opObjList = [] |
|
391 | opObjList = [] | |
392 |
|
392 | |||
393 | ELEMENTNAME = 'ProcUnit' |
|
393 | ELEMENTNAME = 'ProcUnit' | |
394 |
|
394 | |||
395 | def __init__(self): |
|
395 | def __init__(self): | |
396 |
|
396 | |||
397 | self.id = None |
|
397 | self.id = None | |
398 | self.datatype = None |
|
398 | self.datatype = None | |
399 | self.name = None |
|
399 | self.name = None | |
400 | self.inputId = None |
|
400 | self.inputId = None | |
401 |
|
401 | |||
402 | self.opConfObjList = [] |
|
402 | self.opConfObjList = [] | |
403 |
|
403 | |||
404 | self.procUnitObj = None |
|
404 | self.procUnitObj = None | |
405 | self.opObjDict = {} |
|
405 | self.opObjDict = {} | |
406 |
|
406 | |||
407 | def __getPriority(self): |
|
407 | def __getPriority(self): | |
408 |
|
408 | |||
409 | return len(self.opConfObjList)+1 |
|
409 | return len(self.opConfObjList)+1 | |
410 |
|
410 | |||
411 | def __getNewId(self): |
|
411 | def __getNewId(self): | |
412 |
|
412 | |||
413 | return int(self.id)*10 + len(self.opConfObjList) + 1 |
|
413 | return int(self.id)*10 + len(self.opConfObjList) + 1 | |
414 |
|
414 | |||
415 | def getElementName(self): |
|
415 | def getElementName(self): | |
416 |
|
416 | |||
417 | return self.ELEMENTNAME |
|
417 | return self.ELEMENTNAME | |
418 |
|
418 | |||
419 | def getId(self): |
|
419 | def getId(self): | |
420 |
|
420 | |||
421 | return self.id |
|
421 | return self.id | |
422 |
|
422 | |||
423 | def updateId(self, new_id, parentId=parentId): |
|
423 | def updateId(self, new_id, parentId=parentId): | |
424 |
|
424 | |||
425 |
|
425 | |||
426 | new_id = int(parentId)*10 + (int(self.id) % 10) |
|
426 | new_id = int(parentId)*10 + (int(self.id) % 10) | |
427 | new_inputId = int(parentId)*10 + (int(self.inputId) % 10) |
|
427 | new_inputId = int(parentId)*10 + (int(self.inputId) % 10) | |
428 |
|
428 | |||
429 | #If this proc unit has not inputs |
|
429 | #If this proc unit has not inputs | |
430 | if self.inputId == '0': |
|
430 | if self.inputId == '0': | |
431 | new_inputId = 0 |
|
431 | new_inputId = 0 | |
432 |
|
432 | |||
433 | n = 1 |
|
433 | n = 1 | |
434 | for opConfObj in self.opConfObjList: |
|
434 | for opConfObj in self.opConfObjList: | |
435 |
|
435 | |||
436 | idOp = str(int(new_id)*10 + n) |
|
436 | idOp = str(int(new_id)*10 + n) | |
437 | opConfObj.updateId(idOp) |
|
437 | opConfObj.updateId(idOp) | |
438 |
|
438 | |||
439 | n += 1 |
|
439 | n += 1 | |
440 |
|
440 | |||
441 | self.parentId = str(parentId) |
|
441 | self.parentId = str(parentId) | |
442 | self.id = str(new_id) |
|
442 | self.id = str(new_id) | |
443 | self.inputId = str(new_inputId) |
|
443 | self.inputId = str(new_inputId) | |
444 |
|
444 | |||
445 |
|
445 | |||
446 | def getInputId(self): |
|
446 | def getInputId(self): | |
447 |
|
447 | |||
448 | return self.inputId |
|
448 | return self.inputId | |
449 |
|
449 | |||
450 | def getOperationObjList(self): |
|
450 | def getOperationObjList(self): | |
451 |
|
451 | |||
452 | return self.opConfObjList |
|
452 | return self.opConfObjList | |
453 |
|
453 | |||
454 | def getOperationObj(self, name=None): |
|
454 | def getOperationObj(self, name=None): | |
455 |
|
455 | |||
456 | for opConfObj in self.opConfObjList: |
|
456 | for opConfObj in self.opConfObjList: | |
457 |
|
457 | |||
458 | if opConfObj.name != name: |
|
458 | if opConfObj.name != name: | |
459 | continue |
|
459 | continue | |
460 |
|
460 | |||
461 | return opConfObj |
|
461 | return opConfObj | |
462 |
|
462 | |||
463 | return None |
|
463 | return None | |
464 |
|
464 | |||
465 | def getOpObjfromParamValue(self, value=None): |
|
465 | def getOpObjfromParamValue(self, value=None): | |
466 |
|
466 | |||
467 | for opConfObj in self.opConfObjList: |
|
467 | for opConfObj in self.opConfObjList: | |
468 | if opConfObj.getParameterObjfromValue(parameterValue=value) != value: |
|
468 | if opConfObj.getParameterObjfromValue(parameterValue=value) != value: | |
469 | continue |
|
469 | continue | |
470 | return opConfObj |
|
470 | return opConfObj | |
471 | return None |
|
471 | return None | |
472 |
|
472 | |||
473 | def getProcUnitObj(self): |
|
473 | def getProcUnitObj(self): | |
474 |
|
474 | |||
475 | return self.procUnitObj |
|
475 | return self.procUnitObj | |
476 |
|
476 | |||
477 | def setup(self, id, name, datatype, inputId, parentId=None): |
|
477 | def setup(self, id, name, datatype, inputId, parentId=None): | |
478 |
|
478 | |||
479 | #Compatible with old signal chain version |
|
479 | #Compatible with old signal chain version | |
480 | if datatype==None and name==None: |
|
480 | if datatype==None and name==None: | |
481 | raise ValueError, "datatype or name should be defined" |
|
481 | raise ValueError, "datatype or name should be defined" | |
482 |
|
482 | |||
483 | if name==None: |
|
483 | if name==None: | |
484 | if 'Proc' in datatype: |
|
484 | if 'Proc' in datatype: | |
485 | name = datatype |
|
485 | name = datatype | |
486 | else: |
|
486 | else: | |
487 | name = '%sProc' %(datatype) |
|
487 | name = '%sProc' %(datatype) | |
488 |
|
488 | |||
489 | if datatype==None: |
|
489 | if datatype==None: | |
490 | datatype = name.replace('Proc','') |
|
490 | datatype = name.replace('Proc','') | |
491 |
|
491 | |||
492 | self.id = str(id) |
|
492 | self.id = str(id) | |
493 | self.name = name |
|
493 | self.name = name | |
494 | self.datatype = datatype |
|
494 | self.datatype = datatype | |
495 | self.inputId = inputId |
|
495 | self.inputId = inputId | |
496 | self.parentId = parentId |
|
496 | self.parentId = parentId | |
497 |
|
497 | |||
498 | self.opConfObjList = [] |
|
498 | self.opConfObjList = [] | |
499 |
|
499 | |||
500 | self.addOperation(name='run', optype='self') |
|
500 | self.addOperation(name='run', optype='self') | |
501 |
|
501 | |||
502 | def removeOperations(self): |
|
502 | def removeOperations(self): | |
503 |
|
503 | |||
504 | for obj in self.opConfObjList: |
|
504 | for obj in self.opConfObjList: | |
505 | del obj |
|
505 | del obj | |
506 |
|
506 | |||
507 | self.opConfObjList = [] |
|
507 | self.opConfObjList = [] | |
508 | self.addOperation(name='run') |
|
508 | self.addOperation(name='run') | |
509 |
|
509 | |||
510 | def addParameter(self, **kwargs): |
|
510 | def addParameter(self, **kwargs): | |
511 | ''' |
|
511 | ''' | |
512 | Add parameters to "run" operation |
|
512 | Add parameters to "run" operation | |
513 | ''' |
|
513 | ''' | |
514 | opObj = self.opConfObjList[0] |
|
514 | opObj = self.opConfObjList[0] | |
515 |
|
515 | |||
516 | opObj.addParameter(**kwargs) |
|
516 | opObj.addParameter(**kwargs) | |
517 |
|
517 | |||
518 | return opObj |
|
518 | return opObj | |
519 |
|
519 | |||
520 | def addOperation(self, name, optype='self'): |
|
520 | def addOperation(self, name, optype='self'): | |
521 |
|
521 | |||
522 | id = self.__getNewId() |
|
522 | id = self.__getNewId() | |
523 | priority = self.__getPriority() |
|
523 | priority = self.__getPriority() | |
524 |
|
524 | |||
525 | opConfObj = OperationConf() |
|
525 | opConfObj = OperationConf() | |
526 | opConfObj.setup(id, name=name, priority=priority, type=optype) |
|
526 | opConfObj.setup(id, name=name, priority=priority, type=optype) | |
527 |
|
527 | |||
528 | self.opConfObjList.append(opConfObj) |
|
528 | self.opConfObjList.append(opConfObj) | |
529 |
|
529 | |||
530 | return opConfObj |
|
530 | return opConfObj | |
531 |
|
531 | |||
532 | def makeXml(self, procUnitElement): |
|
532 | def makeXml(self, procUnitElement): | |
533 |
|
533 | |||
534 | upElement = SubElement(procUnitElement, self.ELEMENTNAME) |
|
534 | upElement = SubElement(procUnitElement, self.ELEMENTNAME) | |
535 | upElement.set('id', str(self.id)) |
|
535 | upElement.set('id', str(self.id)) | |
536 | upElement.set('name', self.name) |
|
536 | upElement.set('name', self.name) | |
537 | upElement.set('datatype', self.datatype) |
|
537 | upElement.set('datatype', self.datatype) | |
538 | upElement.set('inputId', str(self.inputId)) |
|
538 | upElement.set('inputId', str(self.inputId)) | |
539 |
|
539 | |||
540 | for opConfObj in self.opConfObjList: |
|
540 | for opConfObj in self.opConfObjList: | |
541 | opConfObj.makeXml(upElement) |
|
541 | opConfObj.makeXml(upElement) | |
542 |
|
542 | |||
543 | def readXml(self, upElement): |
|
543 | def readXml(self, upElement): | |
544 |
|
544 | |||
545 | self.id = upElement.get('id') |
|
545 | self.id = upElement.get('id') | |
546 | self.name = upElement.get('name') |
|
546 | self.name = upElement.get('name') | |
547 | self.datatype = upElement.get('datatype') |
|
547 | self.datatype = upElement.get('datatype') | |
548 | self.inputId = upElement.get('inputId') |
|
548 | self.inputId = upElement.get('inputId') | |
549 |
|
549 | |||
550 | if self.ELEMENTNAME == "ReadUnit": |
|
550 | if self.ELEMENTNAME == "ReadUnit": | |
551 | self.datatype = self.datatype.replace("Reader", "") |
|
551 | self.datatype = self.datatype.replace("Reader", "") | |
552 |
|
552 | |||
553 | if self.ELEMENTNAME == "ProcUnit": |
|
553 | if self.ELEMENTNAME == "ProcUnit": | |
554 | self.datatype = self.datatype.replace("Proc", "") |
|
554 | self.datatype = self.datatype.replace("Proc", "") | |
555 |
|
555 | |||
556 | if self.inputId == 'None': |
|
556 | if self.inputId == 'None': | |
557 | self.inputId = '0' |
|
557 | self.inputId = '0' | |
558 |
|
558 | |||
559 | self.opConfObjList = [] |
|
559 | self.opConfObjList = [] | |
560 |
|
560 | |||
561 | opElementList = upElement.getiterator(OperationConf().getElementName()) |
|
561 | opElementList = upElement.getiterator(OperationConf().getElementName()) | |
562 |
|
562 | |||
563 | for opElement in opElementList: |
|
563 | for opElement in opElementList: | |
564 | opConfObj = OperationConf() |
|
564 | opConfObj = OperationConf() | |
565 | opConfObj.readXml(opElement) |
|
565 | opConfObj.readXml(opElement) | |
566 | self.opConfObjList.append(opConfObj) |
|
566 | self.opConfObjList.append(opConfObj) | |
567 |
|
567 | |||
568 | def printattr(self): |
|
568 | def printattr(self): | |
569 |
|
569 | |||
570 | print "%s[%s]: name = %s, datatype = %s, inputId = %s" %(self.ELEMENTNAME, |
|
570 | print "%s[%s]: name = %s, datatype = %s, inputId = %s" %(self.ELEMENTNAME, | |
571 | self.id, |
|
571 | self.id, | |
572 | self.name, |
|
572 | self.name, | |
573 | self.datatype, |
|
573 | self.datatype, | |
574 | self.inputId) |
|
574 | self.inputId) | |
575 |
|
575 | |||
576 | for opConfObj in self.opConfObjList: |
|
576 | for opConfObj in self.opConfObjList: | |
577 | opConfObj.printattr() |
|
577 | opConfObj.printattr() | |
578 |
|
578 | |||
579 | def createObjects(self): |
|
579 | def createObjects(self): | |
580 |
|
580 | |||
581 | className = eval(self.name) |
|
581 | className = eval(self.name) | |
582 | procUnitObj = className() |
|
582 | procUnitObj = className() | |
583 |
|
583 | |||
584 | for opConfObj in self.opConfObjList: |
|
584 | for opConfObj in self.opConfObjList: | |
585 |
|
585 | |||
586 | if opConfObj.type == 'self': |
|
586 | if opConfObj.type == 'self': | |
587 | continue |
|
587 | continue | |
588 |
|
588 | |||
589 | opObj = opConfObj.createObject() |
|
589 | opObj = opConfObj.createObject() | |
590 |
|
590 | |||
591 | self.opObjDict[opConfObj.id] = opObj |
|
591 | self.opObjDict[opConfObj.id] = opObj | |
592 | procUnitObj.addOperation(opObj, opConfObj.id) |
|
592 | procUnitObj.addOperation(opObj, opConfObj.id) | |
593 |
|
593 | |||
594 | self.procUnitObj = procUnitObj |
|
594 | self.procUnitObj = procUnitObj | |
595 |
|
595 | |||
596 | return procUnitObj |
|
596 | return procUnitObj | |
597 |
|
597 | |||
598 | def run(self): |
|
598 | def run(self): | |
599 |
|
599 | |||
600 | finalSts = False |
|
600 | finalSts = False | |
601 |
|
601 | |||
602 | for opConfObj in self.opConfObjList: |
|
602 | for opConfObj in self.opConfObjList: | |
603 |
|
603 | |||
604 | kwargs = {} |
|
604 | kwargs = {} | |
605 | for parmConfObj in opConfObj.getParameterObjList(): |
|
605 | for parmConfObj in opConfObj.getParameterObjList(): | |
606 | if opConfObj.name == 'run' and parmConfObj.name == 'datatype': |
|
606 | if opConfObj.name == 'run' and parmConfObj.name == 'datatype': | |
607 | continue |
|
607 | continue | |
608 |
|
608 | |||
609 | kwargs[parmConfObj.name] = parmConfObj.getValue() |
|
609 | kwargs[parmConfObj.name] = parmConfObj.getValue() | |
610 |
|
610 | |||
611 | #print "\tRunning the '%s' operation with %s" %(opConfObj.name, opConfObj.id) |
|
611 | #print "\tRunning the '%s' operation with %s" %(opConfObj.name, opConfObj.id) | |
612 | sts = self.procUnitObj.call(opType = opConfObj.type, |
|
612 | sts = self.procUnitObj.call(opType = opConfObj.type, | |
613 | opName = opConfObj.name, |
|
613 | opName = opConfObj.name, | |
614 | opId = opConfObj.id, |
|
614 | opId = opConfObj.id, | |
615 | **kwargs) |
|
615 | **kwargs) | |
616 | finalSts = finalSts or sts |
|
616 | finalSts = finalSts or sts | |
617 |
|
617 | |||
618 | return finalSts |
|
618 | return finalSts | |
619 |
|
619 | |||
620 | def close(self): |
|
620 | def close(self): | |
621 |
|
621 | |||
622 | for opConfObj in self.opConfObjList: |
|
622 | for opConfObj in self.opConfObjList: | |
623 | if opConfObj.type == 'self': |
|
623 | if opConfObj.type == 'self': | |
624 | continue |
|
624 | continue | |
625 |
|
625 | |||
626 | opObj = self.procUnitObj.getOperationObj(opConfObj.id) |
|
626 | opObj = self.procUnitObj.getOperationObj(opConfObj.id) | |
627 | opObj.close() |
|
627 | opObj.close() | |
628 |
|
628 | |||
629 | self.procUnitObj.close() |
|
629 | self.procUnitObj.close() | |
630 |
|
630 | |||
631 | return |
|
631 | return | |
632 |
|
632 | |||
633 | class ReadUnitConf(ProcUnitConf): |
|
633 | class ReadUnitConf(ProcUnitConf): | |
634 |
|
634 | |||
635 | path = None |
|
635 | path = None | |
636 | startDate = None |
|
636 | startDate = None | |
637 | endDate = None |
|
637 | endDate = None | |
638 | startTime = None |
|
638 | startTime = None | |
639 | endTime = None |
|
639 | endTime = None | |
640 |
|
640 | |||
641 | ELEMENTNAME = 'ReadUnit' |
|
641 | ELEMENTNAME = 'ReadUnit' | |
642 |
|
642 | |||
643 | def __init__(self): |
|
643 | def __init__(self): | |
644 |
|
644 | |||
645 | self.id = None |
|
645 | self.id = None | |
646 | self.datatype = None |
|
646 | self.datatype = None | |
647 | self.name = None |
|
647 | self.name = None | |
648 | self.inputId = None |
|
648 | self.inputId = None | |
649 |
|
649 | |||
650 | self.parentId = None |
|
650 | self.parentId = None | |
651 |
|
651 | |||
652 | self.opConfObjList = [] |
|
652 | self.opConfObjList = [] | |
653 | self.opObjList = [] |
|
653 | self.opObjList = [] | |
654 |
|
654 | |||
655 | def getElementName(self): |
|
655 | def getElementName(self): | |
656 |
|
656 | |||
657 | return self.ELEMENTNAME |
|
657 | return self.ELEMENTNAME | |
658 |
|
658 | |||
659 | def setup(self, id, name, datatype, path, startDate="", endDate="", startTime="", endTime="", parentId=None, **kwargs): |
|
659 | def setup(self, id, name, datatype, path, startDate="", endDate="", startTime="", endTime="", parentId=None, **kwargs): | |
660 |
|
660 | |||
661 | #Compatible with old signal chain version |
|
661 | #Compatible with old signal chain version | |
662 | if datatype==None and name==None: |
|
662 | if datatype==None and name==None: | |
663 | raise ValueError, "datatype or name should be defined" |
|
663 | raise ValueError, "datatype or name should be defined" | |
664 |
|
664 | |||
665 | if name==None: |
|
665 | if name==None: | |
666 | if 'Reader' in datatype: |
|
666 | if 'Reader' in datatype: | |
667 | name = datatype |
|
667 | name = datatype | |
668 | else: |
|
668 | else: | |
669 | name = '%sReader' %(datatype) |
|
669 | name = '%sReader' %(datatype) | |
670 |
|
670 | |||
671 | if datatype==None: |
|
671 | if datatype==None: | |
672 | datatype = name.replace('Reader','') |
|
672 | datatype = name.replace('Reader','') | |
673 |
|
673 | |||
674 | self.id = id |
|
674 | self.id = id | |
675 | self.name = name |
|
675 | self.name = name | |
676 | self.datatype = datatype |
|
676 | self.datatype = datatype | |
677 |
|
677 | |||
678 | self.path = path |
|
678 | self.path = path | |
679 | self.startDate = startDate |
|
679 | self.startDate = startDate | |
680 | self.endDate = endDate |
|
680 | self.endDate = endDate | |
681 | self.startTime = startTime |
|
681 | self.startTime = startTime | |
682 | self.endTime = endTime |
|
682 | self.endTime = endTime | |
683 |
|
683 | |||
684 | self.inputId = '0' |
|
684 | self.inputId = '0' | |
685 | self.parentId = parentId |
|
685 | self.parentId = parentId | |
686 |
|
686 | |||
687 | self.addRunOperation(**kwargs) |
|
687 | self.addRunOperation(**kwargs) | |
688 |
|
688 | |||
689 | def update(self, datatype, path, startDate, endDate, startTime, endTime, parentId=None, name=None, **kwargs): |
|
689 | def update(self, datatype, path, startDate, endDate, startTime, endTime, parentId=None, name=None, **kwargs): | |
690 |
|
690 | |||
691 | #Compatible with old signal chain version |
|
691 | #Compatible with old signal chain version | |
692 | if datatype==None and name==None: |
|
692 | if datatype==None and name==None: | |
693 | raise ValueError, "datatype or name should be defined" |
|
693 | raise ValueError, "datatype or name should be defined" | |
694 |
|
694 | |||
695 | if name==None: |
|
695 | if name==None: | |
696 | if 'Reader' in datatype: |
|
696 | if 'Reader' in datatype: | |
697 | name = datatype |
|
697 | name = datatype | |
698 | else: |
|
698 | else: | |
699 | name = '%sReader' %(datatype) |
|
699 | name = '%sReader' %(datatype) | |
700 |
|
700 | |||
701 | if datatype==None: |
|
701 | if datatype==None: | |
702 | datatype = name.replace('Reader','') |
|
702 | datatype = name.replace('Reader','') | |
703 |
|
703 | |||
704 | self.datatype = datatype |
|
704 | self.datatype = datatype | |
705 | self.name = name |
|
705 | self.name = name | |
706 | self.path = path |
|
706 | self.path = path | |
707 | self.startDate = startDate |
|
707 | self.startDate = startDate | |
708 | self.endDate = endDate |
|
708 | self.endDate = endDate | |
709 | self.startTime = startTime |
|
709 | self.startTime = startTime | |
710 | self.endTime = endTime |
|
710 | self.endTime = endTime | |
711 |
|
711 | |||
712 | self.inputId = '0' |
|
712 | self.inputId = '0' | |
713 | self.parentId = parentId |
|
713 | self.parentId = parentId | |
714 |
|
714 | |||
715 | self.updateRunOperation(**kwargs) |
|
715 | self.updateRunOperation(**kwargs) | |
716 |
|
716 | |||
717 | def addRunOperation(self, **kwargs): |
|
717 | def addRunOperation(self, **kwargs): | |
718 |
|
718 | |||
719 | opObj = self.addOperation(name = 'run', optype = 'self') |
|
719 | opObj = self.addOperation(name = 'run', optype = 'self') | |
720 |
|
720 | |||
721 | opObj.addParameter(name='datatype' , value=self.datatype, format='str') |
|
721 | opObj.addParameter(name='datatype' , value=self.datatype, format='str') | |
722 | opObj.addParameter(name='path' , value=self.path, format='str') |
|
722 | opObj.addParameter(name='path' , value=self.path, format='str') | |
723 | opObj.addParameter(name='startDate' , value=self.startDate, format='date') |
|
723 | opObj.addParameter(name='startDate' , value=self.startDate, format='date') | |
724 | opObj.addParameter(name='endDate' , value=self.endDate, format='date') |
|
724 | opObj.addParameter(name='endDate' , value=self.endDate, format='date') | |
725 | opObj.addParameter(name='startTime' , value=self.startTime, format='time') |
|
725 | opObj.addParameter(name='startTime' , value=self.startTime, format='time') | |
726 | opObj.addParameter(name='endTime' , value=self.endTime, format='time') |
|
726 | opObj.addParameter(name='endTime' , value=self.endTime, format='time') | |
727 |
|
727 | |||
728 | for key, value in kwargs.items(): |
|
728 | for key, value in kwargs.items(): | |
729 | opObj.addParameter(name=key, value=value, format=type(value).__name__) |
|
729 | opObj.addParameter(name=key, value=value, format=type(value).__name__) | |
730 |
|
730 | |||
731 | return opObj |
|
731 | return opObj | |
732 |
|
732 | |||
733 | def updateRunOperation(self, **kwargs): |
|
733 | def updateRunOperation(self, **kwargs): | |
734 |
|
734 | |||
735 | opObj = self.getOperationObj(name = 'run') |
|
735 | opObj = self.getOperationObj(name = 'run') | |
736 | opObj.removeParameters() |
|
736 | opObj.removeParameters() | |
737 |
|
737 | |||
738 | opObj.addParameter(name='datatype' , value=self.datatype, format='str') |
|
738 | opObj.addParameter(name='datatype' , value=self.datatype, format='str') | |
739 | opObj.addParameter(name='path' , value=self.path, format='str') |
|
739 | opObj.addParameter(name='path' , value=self.path, format='str') | |
740 | opObj.addParameter(name='startDate' , value=self.startDate, format='date') |
|
740 | opObj.addParameter(name='startDate' , value=self.startDate, format='date') | |
741 | opObj.addParameter(name='endDate' , value=self.endDate, format='date') |
|
741 | opObj.addParameter(name='endDate' , value=self.endDate, format='date') | |
742 | opObj.addParameter(name='startTime' , value=self.startTime, format='time') |
|
742 | opObj.addParameter(name='startTime' , value=self.startTime, format='time') | |
743 | opObj.addParameter(name='endTime' , value=self.endTime, format='time') |
|
743 | opObj.addParameter(name='endTime' , value=self.endTime, format='time') | |
744 |
|
744 | |||
745 | for key, value in kwargs.items(): |
|
745 | for key, value in kwargs.items(): | |
746 | opObj.addParameter(name=key, value=value, format=type(value).__name__) |
|
746 | opObj.addParameter(name=key, value=value, format=type(value).__name__) | |
747 |
|
747 | |||
748 | return opObj |
|
748 | return opObj | |
749 |
|
749 | |||
750 | class Project(): |
|
750 | class Project(): | |
751 |
|
751 | |||
752 | id = None |
|
752 | id = None | |
753 | name = None |
|
753 | name = None | |
754 | description = None |
|
754 | description = None | |
755 | # readUnitConfObjList = None |
|
755 | # readUnitConfObjList = None | |
756 | procUnitConfObjDict = None |
|
756 | procUnitConfObjDict = None | |
757 |
|
757 | |||
758 | ELEMENTNAME = 'Project' |
|
758 | ELEMENTNAME = 'Project' | |
759 |
|
759 | |||
760 | def __init__(self, control=None, dataq=None): |
|
760 | def __init__(self, control=None, dataq=None): | |
761 |
|
761 | |||
762 | self.id = None |
|
762 | self.id = None | |
763 | self.name = None |
|
763 | self.name = None | |
764 | self.description = None |
|
764 | self.description = None | |
765 |
|
765 | |||
766 | self.procUnitConfObjDict = {} |
|
766 | self.procUnitConfObjDict = {} | |
767 |
|
767 | |||
768 | #global data_q |
|
768 | #global data_q | |
769 | #data_q = dataq |
|
769 | #data_q = dataq | |
770 |
|
770 | |||
771 | if control==None: |
|
771 | if control==None: | |
772 | control = {'stop':False,'pause':False} |
|
772 | control = {'stop':False,'pause':False} | |
773 |
|
773 | |||
774 | self.control = control |
|
774 | self.control = control | |
775 |
|
775 | |||
776 | def __getNewId(self): |
|
776 | def __getNewId(self): | |
777 |
|
777 | |||
778 | id = int(self.id)*10 + len(self.procUnitConfObjDict) + 1 |
|
778 | id = int(self.id)*10 + len(self.procUnitConfObjDict) + 1 | |
779 |
|
779 | |||
780 | return str(id) |
|
780 | return str(id) | |
781 |
|
781 | |||
782 | def getElementName(self): |
|
782 | def getElementName(self): | |
783 |
|
783 | |||
784 | return self.ELEMENTNAME |
|
784 | return self.ELEMENTNAME | |
785 |
|
785 | |||
786 | def getId(self): |
|
786 | def getId(self): | |
787 |
|
787 | |||
788 | return self.id |
|
788 | return self.id | |
789 |
|
789 | |||
790 | def updateId(self, new_id): |
|
790 | def updateId(self, new_id): | |
791 |
|
791 | |||
792 | self.id = str(new_id) |
|
792 | self.id = str(new_id) | |
793 |
|
793 | |||
794 | keyList = self.procUnitConfObjDict.keys() |
|
794 | keyList = self.procUnitConfObjDict.keys() | |
795 | keyList.sort() |
|
795 | keyList.sort() | |
796 |
|
796 | |||
797 | n = 1 |
|
797 | n = 1 | |
798 | newProcUnitConfObjDict = {} |
|
798 | newProcUnitConfObjDict = {} | |
799 |
|
799 | |||
800 | for procKey in keyList: |
|
800 | for procKey in keyList: | |
801 |
|
801 | |||
802 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
802 | procUnitConfObj = self.procUnitConfObjDict[procKey] | |
803 | idProcUnit = str(int(self.id)*10 + n) |
|
803 | idProcUnit = str(int(self.id)*10 + n) | |
804 | procUnitConfObj.updateId(idProcUnit, parentId = self.id) |
|
804 | procUnitConfObj.updateId(idProcUnit, parentId = self.id) | |
805 |
|
805 | |||
806 | newProcUnitConfObjDict[idProcUnit] = procUnitConfObj |
|
806 | newProcUnitConfObjDict[idProcUnit] = procUnitConfObj | |
807 | n += 1 |
|
807 | n += 1 | |
808 |
|
808 | |||
809 | self.procUnitConfObjDict = newProcUnitConfObjDict |
|
809 | self.procUnitConfObjDict = newProcUnitConfObjDict | |
810 |
|
810 | |||
811 | def setup(self, id, name, description): |
|
811 | def setup(self, id, name, description): | |
812 |
|
812 | |||
813 | self.id = str(id) |
|
813 | self.id = str(id) | |
814 | self.name = name |
|
814 | self.name = name | |
815 | self.description = description |
|
815 | self.description = description | |
816 |
|
816 | |||
817 | def update(self, name, description): |
|
817 | def update(self, name, description): | |
818 |
|
818 | |||
819 | self.name = name |
|
819 | self.name = name | |
820 | self.description = description |
|
820 | self.description = description | |
821 |
|
821 | |||
822 | def addReadUnit(self, datatype=None, name=None, **kwargs): |
|
822 | def addReadUnit(self, datatype=None, name=None, **kwargs): | |
823 |
|
823 | |||
824 | idReadUnit = self.__getNewId() |
|
824 | idReadUnit = self.__getNewId() | |
825 |
|
825 | |||
826 | readUnitConfObj = ReadUnitConf() |
|
826 | readUnitConfObj = ReadUnitConf() | |
827 | readUnitConfObj.setup(idReadUnit, name, datatype, parentId=self.id, **kwargs) |
|
827 | readUnitConfObj.setup(idReadUnit, name, datatype, parentId=self.id, **kwargs) | |
828 |
|
828 | |||
829 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
829 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj | |
830 |
|
830 | |||
831 | return readUnitConfObj |
|
831 | return readUnitConfObj | |
832 |
|
832 | |||
833 | def addProcUnit(self, inputId='0', datatype=None, name=None): |
|
833 | def addProcUnit(self, inputId='0', datatype=None, name=None): | |
834 |
|
834 | |||
835 | idProcUnit = self.__getNewId() |
|
835 | idProcUnit = self.__getNewId() | |
836 |
|
836 | |||
837 | procUnitConfObj = ProcUnitConf() |
|
837 | procUnitConfObj = ProcUnitConf() | |
838 | procUnitConfObj.setup(idProcUnit, name, datatype, inputId, parentId=self.id) |
|
838 | procUnitConfObj.setup(idProcUnit, name, datatype, inputId, parentId=self.id) | |
839 |
|
839 | |||
840 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
840 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj | |
841 |
|
841 | |||
842 | return procUnitConfObj |
|
842 | return procUnitConfObj | |
843 |
|
843 | |||
844 | def removeProcUnit(self, id): |
|
844 | def removeProcUnit(self, id): | |
845 |
|
845 | |||
846 | if id in self.procUnitConfObjDict.keys(): |
|
846 | if id in self.procUnitConfObjDict.keys(): | |
847 | self.procUnitConfObjDict.pop(id) |
|
847 | self.procUnitConfObjDict.pop(id) | |
848 |
|
848 | |||
849 | def getReadUnitId(self): |
|
849 | def getReadUnitId(self): | |
850 |
|
850 | |||
851 | readUnitConfObj = self.getReadUnitObj() |
|
851 | readUnitConfObj = self.getReadUnitObj() | |
852 |
|
852 | |||
853 | return readUnitConfObj.id |
|
853 | return readUnitConfObj.id | |
854 |
|
854 | |||
855 | def getReadUnitObj(self): |
|
855 | def getReadUnitObj(self): | |
856 |
|
856 | |||
857 | for obj in self.procUnitConfObjDict.values(): |
|
857 | for obj in self.procUnitConfObjDict.values(): | |
858 | if obj.getElementName() == "ReadUnit": |
|
858 | if obj.getElementName() == "ReadUnit": | |
859 | return obj |
|
859 | return obj | |
860 |
|
860 | |||
861 | return None |
|
861 | return None | |
862 |
|
862 | |||
863 | def getProcUnitObj(self, id=None, name=None): |
|
863 | def getProcUnitObj(self, id=None, name=None): | |
864 |
|
864 | |||
865 | if id != None: |
|
865 | if id != None: | |
866 | return self.procUnitConfObjDict[id] |
|
866 | return self.procUnitConfObjDict[id] | |
867 |
|
867 | |||
868 | if name != None: |
|
868 | if name != None: | |
869 | return self.getProcUnitObjByName(name) |
|
869 | return self.getProcUnitObjByName(name) | |
870 |
|
870 | |||
871 | return None |
|
871 | return None | |
872 |
|
872 | |||
873 | def getProcUnitObjByName(self, name): |
|
873 | def getProcUnitObjByName(self, name): | |
874 |
|
874 | |||
875 | for obj in self.procUnitConfObjDict.values(): |
|
875 | for obj in self.procUnitConfObjDict.values(): | |
876 | if obj.name == name: |
|
876 | if obj.name == name: | |
877 | return obj |
|
877 | return obj | |
878 |
|
878 | |||
879 | return None |
|
879 | return None | |
880 |
|
880 | |||
881 | def procUnitItems(self): |
|
881 | def procUnitItems(self): | |
882 |
|
882 | |||
883 | return self.procUnitConfObjDict.items() |
|
883 | return self.procUnitConfObjDict.items() | |
884 |
|
884 | |||
885 | def makeXml(self): |
|
885 | def makeXml(self): | |
886 |
|
886 | |||
887 | projectElement = Element('Project') |
|
887 | projectElement = Element('Project') | |
888 | projectElement.set('id', str(self.id)) |
|
888 | projectElement.set('id', str(self.id)) | |
889 | projectElement.set('name', self.name) |
|
889 | projectElement.set('name', self.name) | |
890 | projectElement.set('description', self.description) |
|
890 | projectElement.set('description', self.description) | |
891 |
|
891 | |||
892 | # for readUnitConfObj in self.readUnitConfObjList: |
|
892 | # for readUnitConfObj in self.readUnitConfObjList: | |
893 | # readUnitConfObj.makeXml(projectElement) |
|
893 | # readUnitConfObj.makeXml(projectElement) | |
894 |
|
894 | |||
895 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
895 | for procUnitConfObj in self.procUnitConfObjDict.values(): | |
896 | procUnitConfObj.makeXml(projectElement) |
|
896 | procUnitConfObj.makeXml(projectElement) | |
897 |
|
897 | |||
898 | self.projectElement = projectElement |
|
898 | self.projectElement = projectElement | |
899 |
|
899 | |||
900 | def writeXml(self, filename): |
|
900 | def writeXml(self, filename): | |
901 |
|
901 | |||
902 | self.makeXml() |
|
902 | self.makeXml() | |
903 |
|
903 | |||
904 | #print prettify(self.projectElement) |
|
904 | #print prettify(self.projectElement) | |
905 |
|
905 | |||
906 | ElementTree(self.projectElement).write(filename, method='xml') |
|
906 | ElementTree(self.projectElement).write(filename, method='xml') | |
907 |
|
907 | |||
908 | def readXml(self, filename): |
|
908 | def readXml(self, filename): | |
909 |
|
909 | |||
910 | #tree = ET.parse(filename) |
|
910 | #tree = ET.parse(filename) | |
911 | self.projectElement = None |
|
911 | self.projectElement = None | |
912 | # self.readUnitConfObjList = [] |
|
912 | # self.readUnitConfObjList = [] | |
913 | self.procUnitConfObjDict = {} |
|
913 | self.procUnitConfObjDict = {} | |
914 |
|
914 | |||
915 | self.projectElement = ElementTree().parse(filename) |
|
915 | self.projectElement = ElementTree().parse(filename) | |
916 |
|
916 | |||
917 | self.project = self.projectElement.tag |
|
917 | self.project = self.projectElement.tag | |
918 |
|
918 | |||
919 | self.id = self.projectElement.get('id') |
|
919 | self.id = self.projectElement.get('id') | |
920 | self.name = self.projectElement.get('name') |
|
920 | self.name = self.projectElement.get('name') | |
921 | self.description = self.projectElement.get('description') |
|
921 | self.description = self.projectElement.get('description') | |
922 |
|
922 | |||
923 | readUnitElementList = self.projectElement.getiterator(ReadUnitConf().getElementName()) |
|
923 | readUnitElementList = self.projectElement.getiterator(ReadUnitConf().getElementName()) | |
924 |
|
924 | |||
925 | for readUnitElement in readUnitElementList: |
|
925 | for readUnitElement in readUnitElementList: | |
926 | readUnitConfObj = ReadUnitConf() |
|
926 | readUnitConfObj = ReadUnitConf() | |
927 | readUnitConfObj.readXml(readUnitElement) |
|
927 | readUnitConfObj.readXml(readUnitElement) | |
928 |
|
928 | |||
929 | if readUnitConfObj.parentId == None: |
|
929 | if readUnitConfObj.parentId == None: | |
930 | readUnitConfObj.parentId = self.id |
|
930 | readUnitConfObj.parentId = self.id | |
931 |
|
931 | |||
932 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
932 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj | |
933 |
|
933 | |||
934 | procUnitElementList = self.projectElement.getiterator(ProcUnitConf().getElementName()) |
|
934 | procUnitElementList = self.projectElement.getiterator(ProcUnitConf().getElementName()) | |
935 |
|
935 | |||
936 | for procUnitElement in procUnitElementList: |
|
936 | for procUnitElement in procUnitElementList: | |
937 | procUnitConfObj = ProcUnitConf() |
|
937 | procUnitConfObj = ProcUnitConf() | |
938 | procUnitConfObj.readXml(procUnitElement) |
|
938 | procUnitConfObj.readXml(procUnitElement) | |
939 |
|
939 | |||
940 | if procUnitConfObj.parentId == None: |
|
940 | if procUnitConfObj.parentId == None: | |
941 | procUnitConfObj.parentId = self.id |
|
941 | procUnitConfObj.parentId = self.id | |
942 |
|
942 | |||
943 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
943 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj | |
944 |
|
944 | |||
945 | def printattr(self): |
|
945 | def printattr(self): | |
946 |
|
946 | |||
947 | print "Project[%s]: name = %s, description = %s" %(self.id, |
|
947 | print "Project[%s]: name = %s, description = %s" %(self.id, | |
948 | self.name, |
|
948 | self.name, | |
949 | self.description) |
|
949 | self.description) | |
950 |
|
950 | |||
951 | # for readUnitConfObj in self.readUnitConfObjList: |
|
951 | # for readUnitConfObj in self.readUnitConfObjList: | |
952 | # readUnitConfObj.printattr() |
|
952 | # readUnitConfObj.printattr() | |
953 |
|
953 | |||
954 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
954 | for procUnitConfObj in self.procUnitConfObjDict.values(): | |
955 | procUnitConfObj.printattr() |
|
955 | procUnitConfObj.printattr() | |
956 |
|
956 | |||
957 | def createObjects(self): |
|
957 | def createObjects(self): | |
958 |
|
958 | |||
959 | # for readUnitConfObj in self.readUnitConfObjList: |
|
959 | # for readUnitConfObj in self.readUnitConfObjList: | |
960 | # readUnitConfObj.createObjects() |
|
960 | # readUnitConfObj.createObjects() | |
961 |
|
961 | |||
962 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
962 | for procUnitConfObj in self.procUnitConfObjDict.values(): | |
963 | procUnitConfObj.createObjects() |
|
963 | procUnitConfObj.createObjects() | |
964 |
|
964 | |||
965 | def __connect(self, objIN, thisObj): |
|
965 | def __connect(self, objIN, thisObj): | |
966 |
|
966 | |||
967 | thisObj.setInput(objIN.getOutputObj()) |
|
967 | thisObj.setInput(objIN.getOutputObj()) | |
968 |
|
968 | |||
969 | def connectObjects(self): |
|
969 | def connectObjects(self): | |
970 |
|
970 | |||
971 | for thisPUConfObj in self.procUnitConfObjDict.values(): |
|
971 | for thisPUConfObj in self.procUnitConfObjDict.values(): | |
972 |
|
972 | |||
973 | inputId = thisPUConfObj.getInputId() |
|
973 | inputId = thisPUConfObj.getInputId() | |
974 |
|
974 | |||
975 | if int(inputId) == 0: |
|
975 | if int(inputId) == 0: | |
976 | continue |
|
976 | continue | |
977 |
|
977 | |||
978 | #Get input object |
|
978 | #Get input object | |
979 | puConfINObj = self.procUnitConfObjDict[inputId] |
|
979 | puConfINObj = self.procUnitConfObjDict[inputId] | |
980 | puObjIN = puConfINObj.getProcUnitObj() |
|
980 | puObjIN = puConfINObj.getProcUnitObj() | |
981 |
|
981 | |||
982 | #Get current object |
|
982 | #Get current object | |
983 | thisPUObj = thisPUConfObj.getProcUnitObj() |
|
983 | thisPUObj = thisPUConfObj.getProcUnitObj() | |
984 |
|
984 | |||
985 | self.__connect(puObjIN, thisPUObj) |
|
985 | self.__connect(puObjIN, thisPUObj) | |
986 |
|
986 | |||
987 | def run(self): |
|
987 | def run(self): | |
988 |
|
988 | |||
989 | # for readUnitConfObj in self.readUnitConfObjList: |
|
989 | # for readUnitConfObj in self.readUnitConfObjList: | |
990 | # readUnitConfObj.run() |
|
990 | # readUnitConfObj.run() | |
991 |
|
991 | |||
992 | print "*"*40 |
|
992 | print "*"*40 | |
993 | print " Starting SIGNAL CHAIN PROCESSING " |
|
993 | print " Starting SIGNAL CHAIN PROCESSING " | |
994 | print "*"*40 |
|
994 | print "*"*40 | |
995 |
|
995 | |||
996 |
|
996 | |||
997 | keyList = self.procUnitConfObjDict.keys() |
|
997 | keyList = self.procUnitConfObjDict.keys() | |
998 | keyList.sort() |
|
998 | keyList.sort() | |
999 |
|
999 | |||
1000 | while(True): |
|
1000 | while(True): | |
1001 |
|
1001 | |||
1002 | finalSts = False |
|
1002 | finalSts = False | |
1003 |
|
1003 | |||
1004 | for procKey in keyList: |
|
1004 | for procKey in keyList: | |
1005 | # print "Running the '%s' process with %s" %(procUnitConfObj.name, procUnitConfObj.id) |
|
1005 | # print "Running the '%s' process with %s" %(procUnitConfObj.name, procUnitConfObj.id) | |
1006 |
|
1006 | |||
1007 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
1007 | procUnitConfObj = self.procUnitConfObjDict[procKey] | |
1008 | sts = procUnitConfObj.run() |
|
1008 | sts = procUnitConfObj.run() | |
1009 | finalSts = finalSts or sts |
|
1009 | finalSts = finalSts or sts | |
1010 |
|
1010 | |||
1011 | #If every process unit finished so end process |
|
1011 | #If every process unit finished so end process | |
1012 | if not(finalSts): |
|
1012 | if not(finalSts): | |
1013 | print "Every process unit have finished" |
|
1013 | print "Every process unit have finished" | |
1014 | break |
|
1014 | break | |
1015 |
|
1015 | |||
1016 | if self.control['pause']: |
|
1016 | if self.control['pause']: | |
1017 | print "Process suspended" |
|
1017 | print "Process suspended" | |
1018 |
|
1018 | |||
1019 | while True: |
|
1019 | while True: | |
1020 | sleep(0.1) |
|
1020 | sleep(0.1) | |
1021 |
|
1021 | |||
1022 | if not self.control['pause']: |
|
1022 | if not self.control['pause']: | |
1023 | break |
|
1023 | break | |
1024 |
|
1024 | |||
1025 | if self.control['stop']: |
|
1025 | if self.control['stop']: | |
1026 | break |
|
1026 | break | |
1027 | print "Process reinitialized" |
|
1027 | print "Process reinitialized" | |
1028 |
|
1028 | |||
1029 | if self.control['stop']: |
|
1029 | if self.control['stop']: | |
1030 | print "Process stopped" |
|
1030 | print "Process stopped" | |
1031 | break |
|
1031 | break | |
1032 |
|
1032 | |||
1033 | #Closing every process |
|
1033 | #Closing every process | |
1034 | for procKey in keyList: |
|
1034 | for procKey in keyList: | |
1035 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
1035 | procUnitConfObj = self.procUnitConfObjDict[procKey] | |
1036 | procUnitConfObj.close() |
|
1036 | procUnitConfObj.close() | |
1037 |
|
1037 | |||
1038 | print "Process finished" |
|
1038 | print "Process finished" | |
1039 |
|
1039 | |||
1040 | def start(self, filename): |
|
1040 | def start(self, filename): | |
1041 |
|
1041 | |||
1042 | self.writeXml(filename) |
|
1042 | self.writeXml(filename) | |
1043 | self.readXml(filename) |
|
1043 | self.readXml(filename) | |
1044 |
|
1044 | |||
1045 | self.createObjects() |
|
1045 | self.createObjects() | |
1046 | self.connectObjects() |
|
1046 | self.connectObjects() | |
1047 | self.run() |
|
1047 | self.run() | |
1048 |
|
1048 | |||
1049 | class ControllerThread(threading.Thread, Project): |
|
1049 | class ControllerThread(threading.Thread, Project): | |
1050 |
|
1050 | |||
1051 | def __init__(self, filename): |
|
1051 | def __init__(self, filename): | |
1052 |
|
1052 | |||
1053 | threading.Thread.__init__(self) |
|
1053 | threading.Thread.__init__(self) | |
1054 | Project.__init__(self) |
|
1054 | Project.__init__(self) | |
1055 |
|
1055 | |||
1056 | self.setDaemon(True) |
|
1056 | self.setDaemon(True) | |
1057 |
|
1057 | |||
1058 | self.filename = filename |
|
1058 | self.filename = filename | |
1059 | self.control = {'stop':False, 'pause':False} |
|
1059 | self.control = {'stop':False, 'pause':False} | |
1060 |
|
1060 | |||
1061 | def stop(self): |
|
1061 | def stop(self): | |
1062 | self.control['stop'] = True |
|
1062 | self.control['stop'] = True | |
1063 |
|
1063 | |||
1064 | def pause(self): |
|
1064 | def pause(self): | |
1065 | self.control['pause'] = not(self.control['pause']) |
|
1065 | self.control['pause'] = not(self.control['pause']) | |
1066 |
|
1066 | |||
1067 | def run(self): |
|
1067 | def run(self): | |
1068 | self.control['stop'] = False |
|
1068 | self.control['stop'] = False | |
1069 | self.control['pause'] = False |
|
1069 | self.control['pause'] = False | |
1070 |
|
1070 | |||
1071 | self.readXml(self.filename) |
|
1071 | self.readXml(self.filename) | |
1072 | self.createObjects() |
|
1072 | self.createObjects() | |
1073 | self.connectObjects() |
|
1073 | self.connectObjects() | |
1074 | Project.run(self) |
|
1074 | Project.run(self) | |
1075 |
|
1075 | |||
1076 | if __name__ == '__main__': |
|
1076 | if __name__ == '__main__': | |
1077 |
|
1077 | |||
1078 | desc = "Segundo Test" |
|
1078 | desc = "Segundo Test" | |
1079 | filename = "schain.xml" |
|
1079 | filename = "schain.xml" | |
1080 |
|
1080 | |||
1081 | controllerObj = Project() |
|
1081 | controllerObj = Project() | |
1082 |
|
1082 | |||
1083 | controllerObj.setup(id = '191', name='test01', description=desc) |
|
1083 | controllerObj.setup(id = '191', name='test01', description=desc) | |
1084 |
|
1084 | |||
1085 | readUnitConfObj = controllerObj.addReadUnit(datatype='Voltage', |
|
1085 | readUnitConfObj = controllerObj.addReadUnit(datatype='Voltage', | |
1086 | path='data/rawdata/', |
|
1086 | path='data/rawdata/', | |
1087 | startDate='2011/01/01', |
|
1087 | startDate='2011/01/01', | |
1088 | endDate='2012/12/31', |
|
1088 | endDate='2012/12/31', | |
1089 | startTime='00:00:00', |
|
1089 | startTime='00:00:00', | |
1090 | endTime='23:59:59', |
|
1090 | endTime='23:59:59', | |
1091 | online=1, |
|
1091 | online=1, | |
1092 | walk=1) |
|
1092 | walk=1) | |
1093 |
|
1093 | |||
1094 | # opObj00 = readUnitConfObj.addOperation(name='printInfo') |
|
1094 | # opObj00 = readUnitConfObj.addOperation(name='printInfo') | |
1095 |
|
1095 | |||
1096 | procUnitConfObj0 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) |
|
1096 | procUnitConfObj0 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) | |
1097 |
|
1097 | |||
1098 | opObj10 = procUnitConfObj0.addOperation(name='selectChannels') |
|
1098 | opObj10 = procUnitConfObj0.addOperation(name='selectChannels') | |
1099 | opObj10.addParameter(name='channelList', value='3,4,5', format='intlist') |
|
1099 | opObj10.addParameter(name='channelList', value='3,4,5', format='intlist') | |
1100 |
|
1100 | |||
1101 | opObj10 = procUnitConfObj0.addOperation(name='selectHeights') |
|
1101 | opObj10 = procUnitConfObj0.addOperation(name='selectHeights') | |
1102 | opObj10.addParameter(name='minHei', value='90', format='float') |
|
1102 | opObj10.addParameter(name='minHei', value='90', format='float') | |
1103 | opObj10.addParameter(name='maxHei', value='180', format='float') |
|
1103 | opObj10.addParameter(name='maxHei', value='180', format='float') | |
1104 |
|
1104 | |||
1105 | opObj12 = procUnitConfObj0.addOperation(name='CohInt', optype='external') |
|
1105 | opObj12 = procUnitConfObj0.addOperation(name='CohInt', optype='external') | |
1106 | opObj12.addParameter(name='n', value='10', format='int') |
|
1106 | opObj12.addParameter(name='n', value='10', format='int') | |
1107 |
|
1107 | |||
1108 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj0.getId()) |
|
1108 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj0.getId()) | |
1109 | procUnitConfObj1.addParameter(name='nFFTPoints', value='32', format='int') |
|
1109 | procUnitConfObj1.addParameter(name='nFFTPoints', value='32', format='int') | |
1110 | # procUnitConfObj1.addParameter(name='pairList', value='(0,1),(0,2),(1,2)', format='') |
|
1110 | # procUnitConfObj1.addParameter(name='pairList', value='(0,1),(0,2),(1,2)', format='') | |
1111 |
|
1111 | |||
1112 |
|
1112 | |||
1113 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external') |
|
1113 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external') | |
1114 | opObj11.addParameter(name='idfigure', value='1', format='int') |
|
1114 | opObj11.addParameter(name='idfigure', value='1', format='int') | |
1115 | opObj11.addParameter(name='wintitle', value='SpectraPlot0', format='str') |
|
1115 | opObj11.addParameter(name='wintitle', value='SpectraPlot0', format='str') | |
1116 | opObj11.addParameter(name='zmin', value='40', format='int') |
|
1116 | opObj11.addParameter(name='zmin', value='40', format='int') | |
1117 | opObj11.addParameter(name='zmax', value='90', format='int') |
|
1117 | opObj11.addParameter(name='zmax', value='90', format='int') | |
1118 | opObj11.addParameter(name='showprofile', value='1', format='int') |
|
1118 | opObj11.addParameter(name='showprofile', value='1', format='int') | |
1119 |
|
1119 | |||
1120 | # opObj11 = procUnitConfObj1.addOperation(name='CrossSpectraPlot', optype='external') |
|
1120 | # opObj11 = procUnitConfObj1.addOperation(name='CrossSpectraPlot', optype='external') | |
1121 | # opObj11.addParameter(name='idfigure', value='2', format='int') |
|
1121 | # opObj11.addParameter(name='idfigure', value='2', format='int') | |
1122 | # opObj11.addParameter(name='wintitle', value='CrossSpectraPlot', format='str') |
|
1122 | # opObj11.addParameter(name='wintitle', value='CrossSpectraPlot', format='str') | |
1123 | # opObj11.addParameter(name='zmin', value='40', format='int') |
|
1123 | # opObj11.addParameter(name='zmin', value='40', format='int') | |
1124 | # opObj11.addParameter(name='zmax', value='90', format='int') |
|
1124 | # opObj11.addParameter(name='zmax', value='90', format='int') | |
1125 |
|
1125 | |||
1126 |
|
1126 | |||
1127 | # procUnitConfObj2 = controllerObj.addProcUnit(datatype='Voltage', inputId=procUnitConfObj0.getId()) |
|
1127 | # procUnitConfObj2 = controllerObj.addProcUnit(datatype='Voltage', inputId=procUnitConfObj0.getId()) | |
1128 | # |
|
1128 | # | |
1129 | # opObj12 = procUnitConfObj2.addOperation(name='CohInt', optype='external') |
|
1129 | # opObj12 = procUnitConfObj2.addOperation(name='CohInt', optype='external') | |
1130 | # opObj12.addParameter(name='n', value='2', format='int') |
|
1130 | # opObj12.addParameter(name='n', value='2', format='int') | |
1131 | # opObj12.addParameter(name='overlapping', value='1', format='int') |
|
1131 | # opObj12.addParameter(name='overlapping', value='1', format='int') | |
1132 | # |
|
1132 | # | |
1133 | # procUnitConfObj3 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj2.getId()) |
|
1133 | # procUnitConfObj3 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj2.getId()) | |
1134 | # procUnitConfObj3.addParameter(name='nFFTPoints', value='32', format='int') |
|
1134 | # procUnitConfObj3.addParameter(name='nFFTPoints', value='32', format='int') | |
1135 | # |
|
1135 | # | |
1136 | # opObj11 = procUnitConfObj3.addOperation(name='SpectraPlot', optype='external') |
|
1136 | # opObj11 = procUnitConfObj3.addOperation(name='SpectraPlot', optype='external') | |
1137 | # opObj11.addParameter(name='idfigure', value='2', format='int') |
|
1137 | # opObj11.addParameter(name='idfigure', value='2', format='int') | |
1138 | # opObj11.addParameter(name='wintitle', value='SpectraPlot1', format='str') |
|
1138 | # opObj11.addParameter(name='wintitle', value='SpectraPlot1', format='str') | |
1139 | # opObj11.addParameter(name='zmin', value='40', format='int') |
|
1139 | # opObj11.addParameter(name='zmin', value='40', format='int') | |
1140 | # opObj11.addParameter(name='zmax', value='90', format='int') |
|
1140 | # opObj11.addParameter(name='zmax', value='90', format='int') | |
1141 | # opObj11.addParameter(name='showprofile', value='1', format='int') |
|
1141 | # opObj11.addParameter(name='showprofile', value='1', format='int') | |
1142 |
|
1142 | |||
1143 | # opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='external') |
|
1143 | # opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='external') | |
1144 | # opObj11.addParameter(name='idfigure', value='10', format='int') |
|
1144 | # opObj11.addParameter(name='idfigure', value='10', format='int') | |
1145 | # opObj11.addParameter(name='wintitle', value='RTI', format='str') |
|
1145 | # opObj11.addParameter(name='wintitle', value='RTI', format='str') | |
1146 | ## opObj11.addParameter(name='xmin', value='21', format='float') |
|
1146 | ## opObj11.addParameter(name='xmin', value='21', format='float') | |
1147 | ## opObj11.addParameter(name='xmax', value='22', format='float') |
|
1147 | ## opObj11.addParameter(name='xmax', value='22', format='float') | |
1148 | # opObj11.addParameter(name='zmin', value='40', format='int') |
|
1148 | # opObj11.addParameter(name='zmin', value='40', format='int') | |
1149 | # opObj11.addParameter(name='zmax', value='90', format='int') |
|
1149 | # opObj11.addParameter(name='zmax', value='90', format='int') | |
1150 | # opObj11.addParameter(name='showprofile', value='1', format='int') |
|
1150 | # opObj11.addParameter(name='showprofile', value='1', format='int') | |
1151 | # opObj11.addParameter(name='timerange', value=str(60), format='int') |
|
1151 | # opObj11.addParameter(name='timerange', value=str(60), format='int') | |
1152 |
|
1152 | |||
1153 | # opObj10 = procUnitConfObj1.addOperation(name='selectChannels') |
|
1153 | # opObj10 = procUnitConfObj1.addOperation(name='selectChannels') | |
1154 | # opObj10.addParameter(name='channelList', value='0,2,4,6', format='intlist') |
|
1154 | # opObj10.addParameter(name='channelList', value='0,2,4,6', format='intlist') | |
1155 | # |
|
1155 | # | |
1156 | # opObj12 = procUnitConfObj1.addOperation(name='IncohInt', optype='external') |
|
1156 | # opObj12 = procUnitConfObj1.addOperation(name='IncohInt', optype='external') | |
1157 | # opObj12.addParameter(name='n', value='2', format='int') |
|
1157 | # opObj12.addParameter(name='n', value='2', format='int') | |
1158 | # |
|
1158 | # | |
1159 | # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external') |
|
1159 | # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external') | |
1160 | # opObj11.addParameter(name='idfigure', value='2', format='int') |
|
1160 | # opObj11.addParameter(name='idfigure', value='2', format='int') | |
1161 | # opObj11.addParameter(name='wintitle', value='SpectraPlot10', format='str') |
|
1161 | # opObj11.addParameter(name='wintitle', value='SpectraPlot10', format='str') | |
1162 | # opObj11.addParameter(name='zmin', value='70', format='int') |
|
1162 | # opObj11.addParameter(name='zmin', value='70', format='int') | |
1163 | # opObj11.addParameter(name='zmax', value='90', format='int') |
|
1163 | # opObj11.addParameter(name='zmax', value='90', format='int') | |
1164 | # |
|
1164 | # | |
1165 | # opObj10 = procUnitConfObj1.addOperation(name='selectChannels') |
|
1165 | # opObj10 = procUnitConfObj1.addOperation(name='selectChannels') | |
1166 | # opObj10.addParameter(name='channelList', value='2,6', format='intlist') |
|
1166 | # opObj10.addParameter(name='channelList', value='2,6', format='intlist') | |
1167 | # |
|
1167 | # | |
1168 | # opObj12 = procUnitConfObj1.addOperation(name='IncohInt', optype='external') |
|
1168 | # opObj12 = procUnitConfObj1.addOperation(name='IncohInt', optype='external') | |
1169 | # opObj12.addParameter(name='n', value='2', format='int') |
|
1169 | # opObj12.addParameter(name='n', value='2', format='int') | |
1170 | # |
|
1170 | # | |
1171 | # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external') |
|
1171 | # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external') | |
1172 | # opObj11.addParameter(name='idfigure', value='3', format='int') |
|
1172 | # opObj11.addParameter(name='idfigure', value='3', format='int') | |
1173 | # opObj11.addParameter(name='wintitle', value='SpectraPlot10', format='str') |
|
1173 | # opObj11.addParameter(name='wintitle', value='SpectraPlot10', format='str') | |
1174 | # opObj11.addParameter(name='zmin', value='70', format='int') |
|
1174 | # opObj11.addParameter(name='zmin', value='70', format='int') | |
1175 | # opObj11.addParameter(name='zmax', value='90', format='int') |
|
1175 | # opObj11.addParameter(name='zmax', value='90', format='int') | |
1176 |
|
1176 | |||
1177 |
|
1177 | |||
1178 | # opObj12 = procUnitConfObj1.addOperation(name='decoder') |
|
1178 | # opObj12 = procUnitConfObj1.addOperation(name='decoder') | |
1179 | # opObj12.addParameter(name='ncode', value='2', format='int') |
|
1179 | # opObj12.addParameter(name='ncode', value='2', format='int') | |
1180 | # opObj12.addParameter(name='nbauds', value='8', format='int') |
|
1180 | # opObj12.addParameter(name='nbauds', value='8', format='int') | |
1181 | # opObj12.addParameter(name='code0', value='001110011', format='int') |
|
1181 | # opObj12.addParameter(name='code0', value='001110011', format='int') | |
1182 | # opObj12.addParameter(name='code1', value='001110011', format='int') |
|
1182 | # opObj12.addParameter(name='code1', value='001110011', format='int') | |
1183 |
|
1183 | |||
1184 |
|
1184 | |||
1185 |
|
1185 | |||
1186 | # procUnitConfObj2 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj1.getId()) |
|
1186 | # procUnitConfObj2 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj1.getId()) | |
1187 | # |
|
1187 | # | |
1188 | # opObj21 = procUnitConfObj2.addOperation(name='IncohInt', optype='external') |
|
1188 | # opObj21 = procUnitConfObj2.addOperation(name='IncohInt', optype='external') | |
1189 | # opObj21.addParameter(name='n', value='2', format='int') |
|
1189 | # opObj21.addParameter(name='n', value='2', format='int') | |
1190 | # |
|
1190 | # | |
1191 | # opObj11 = procUnitConfObj2.addOperation(name='SpectraPlot', optype='external') |
|
1191 | # opObj11 = procUnitConfObj2.addOperation(name='SpectraPlot', optype='external') | |
1192 | # opObj11.addParameter(name='idfigure', value='4', format='int') |
|
1192 | # opObj11.addParameter(name='idfigure', value='4', format='int') | |
1193 | # opObj11.addParameter(name='wintitle', value='SpectraPlot OBJ 2', format='str') |
|
1193 | # opObj11.addParameter(name='wintitle', value='SpectraPlot OBJ 2', format='str') | |
1194 | # opObj11.addParameter(name='zmin', value='70', format='int') |
|
1194 | # opObj11.addParameter(name='zmin', value='70', format='int') | |
1195 | # opObj11.addParameter(name='zmax', value='90', format='int') |
|
1195 | # opObj11.addParameter(name='zmax', value='90', format='int') | |
1196 |
|
1196 | |||
1197 | print "Escribiendo el archivo XML" |
|
1197 | print "Escribiendo el archivo XML" | |
1198 |
|
1198 | |||
1199 | controllerObj.writeXml(filename) |
|
1199 | controllerObj.writeXml(filename) | |
1200 |
|
1200 | |||
1201 | print "Leyendo el archivo XML" |
|
1201 | print "Leyendo el archivo XML" | |
1202 | controllerObj.readXml(filename) |
|
1202 | controllerObj.readXml(filename) | |
1203 | #controllerObj.printattr() |
|
1203 | #controllerObj.printattr() | |
1204 |
|
1204 | |||
1205 | controllerObj.createObjects() |
|
1205 | controllerObj.createObjects() | |
1206 | controllerObj.connectObjects() |
|
1206 | controllerObj.connectObjects() | |
1207 | controllerObj.run() |
|
1207 | controllerObj.run() | |
1208 |
|
1208 | |||
1209 | No newline at end of file |
|
1209 |
@@ -1,5840 +1,5684 | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """ |
|
2 | """ | |
3 | Module implementing MainWindow. |
|
3 | Module implementing MainWindow. | |
4 | #+++++++++++++GUI V1++++++++++++++# |
|
4 | #+++++++++++++GUI V1++++++++++++++# | |
5 | @author: AlexanderValdezPortocarrero Γ±_Γ± |
|
5 | @author: AlexanderValdezPortocarrero Γ±_Γ± | |
6 | """ |
|
6 | """ | |
7 | import os, sys, time |
|
7 | import os, sys, time | |
8 | import datetime |
|
8 | import datetime | |
9 | import numpy |
|
9 | import numpy | |
10 | import Queue |
|
10 | import Queue | |
11 |
|
11 | |||
12 | from collections import OrderedDict |
|
12 | from collections import OrderedDict | |
13 | from os.path import expanduser |
|
13 | from os.path import expanduser | |
14 | from time import sleep |
|
14 | from time import sleep | |
15 | import ast |
|
15 | import ast | |
16 |
|
16 | |||
17 | from PyQt4.QtGui import QMainWindow |
|
17 | from PyQt4.QtGui import QMainWindow | |
18 | from PyQt4.QtCore import pyqtSignature |
|
18 | from PyQt4.QtCore import pyqtSignature | |
19 | from PyQt4.QtCore import pyqtSignal |
|
19 | from PyQt4.QtCore import pyqtSignal | |
20 | from PyQt4 import QtCore |
|
20 | from PyQt4 import QtCore | |
21 | from PyQt4 import QtGui |
|
21 | from PyQt4 import QtGui | |
22 |
|
22 | |||
23 | from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess |
|
23 | from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess | |
24 | from schainpy.gui.viewer.ui_ftp import Ui_Ftp |
|
24 | from schainpy.gui.viewer.ui_ftp import Ui_Ftp | |
25 | from schainpy.gui.viewer.ui_mainwindow import Ui_BasicWindow |
|
25 | from schainpy.gui.viewer.ui_mainwindow import Ui_BasicWindow | |
26 | from schainpy.controller import Project, ControllerThread |
|
26 | from schainpy.controller import Project, ControllerThread | |
27 |
|
27 | |||
28 | from propertiesViewModel import TreeModel, PropertyBuffer |
|
28 | from propertiesViewModel import TreeModel, PropertyBuffer | |
29 | from parametersModel import ProjectParms |
|
29 | from parametersModel import ProjectParms | |
30 |
|
30 | |||
31 | from schainpy.gui.figures import tools |
|
31 | from schainpy.gui.figures import tools | |
32 |
|
32 | |||
33 | FIGURES_PATH = tools.get_path() |
|
33 | FIGURES_PATH = tools.get_path() | |
34 | TEMPORAL_FILE = ".temp.xml" |
|
34 | TEMPORAL_FILE = ".temp.xml" | |
35 |
|
35 | |||
36 | def isRadarFile(file): |
|
36 | def isRadarFile(file): | |
37 | try: |
|
37 | try: | |
38 | year = int(file[1:5]) |
|
38 | year = int(file[1:5]) | |
39 | doy = int(file[5:8]) |
|
39 | doy = int(file[5:8]) | |
40 | set = int(file[8:11]) |
|
40 | set = int(file[8:11]) | |
41 | except: |
|
41 | except: | |
42 | return 0 |
|
42 | return 0 | |
43 |
|
43 | |||
44 | return 1 |
|
44 | return 1 | |
45 |
|
45 | |||
46 | def isRadarPath(path): |
|
46 | def isRadarPath(path): | |
47 | try: |
|
47 | try: | |
48 | year = int(path[1:5]) |
|
48 | year = int(path[1:5]) | |
49 | doy = int(path[5:8]) |
|
49 | doy = int(path[5:8]) | |
50 | except: |
|
50 | except: | |
51 | return 0 |
|
51 | return 0 | |
52 |
|
52 | |||
53 | return 1 |
|
53 | return 1 | |
54 |
|
54 | |||
55 | class BasicWindow(QMainWindow, Ui_BasicWindow): |
|
55 | class BasicWindow(QMainWindow, Ui_BasicWindow): | |
56 | """ |
|
56 | """ | |
57 | """ |
|
57 | """ | |
58 | def __init__(self, parent=None): |
|
58 | def __init__(self, parent=None): | |
59 | """ |
|
59 | """ | |
60 |
|
60 | |||
61 | """ |
|
61 | """ | |
62 | QMainWindow.__init__(self, parent) |
|
62 | QMainWindow.__init__(self, parent) | |
63 | self.setupUi(self) |
|
63 | self.setupUi(self) | |
64 | self.__puObjDict = {} |
|
64 | self.__puObjDict = {} | |
65 | self.__itemTreeDict = {} |
|
65 | self.__itemTreeDict = {} | |
66 | self.readUnitConfObjList = [] |
|
66 | self.readUnitConfObjList = [] | |
67 | self.operObjList = [] |
|
67 | self.operObjList = [] | |
68 | self.projecObjView = None |
|
68 | self.projecObjView = None | |
69 | self.idProject = 0 |
|
69 | self.idProject = 0 | |
70 | # self.idImag = 0 |
|
70 | # self.idImag = 0 | |
71 |
|
71 | |||
72 | self.idImagscope = 0 |
|
72 | self.idImagscope = 0 | |
73 | self.idImagspectra = 0 |
|
73 | self.idImagspectra = 0 | |
74 | self.idImagcross = 0 |
|
74 | self.idImagcross = 0 | |
75 | self.idImagrti = 0 |
|
75 | self.idImagrti = 0 | |
76 | self.idImagcoherence = 0 |
|
76 | self.idImagcoherence = 0 | |
77 | self.idImagpower = 0 |
|
77 | self.idImagpower = 0 | |
78 | self.idImagrtinoise = 0 |
|
78 | self.idImagrtinoise = 0 | |
79 | self.idImagspectraHeis = 0 |
|
79 | self.idImagspectraHeis = 0 | |
80 | self.idImagrtiHeis = 0 |
|
80 | self.idImagrtiHeis = 0 | |
81 |
|
81 | |||
82 | self.dataPath = None |
|
82 | self.dataPath = None | |
83 | self.online = 0 |
|
83 | self.online = 0 | |
84 | self.walk = 0 |
|
84 | self.walk = 0 | |
85 | self.create = False |
|
85 | self.create = False | |
86 | self.selectedItemTree = None |
|
86 | self.selectedItemTree = None | |
87 | self.controllerObj = None |
|
87 | self.controllerObj = None | |
88 | # self.commCtrlPThread = None |
|
88 | # self.commCtrlPThread = None | |
89 | # self.create_figure() |
|
89 | # self.create_figure() | |
90 | self.temporalFTP = ftpBuffer() |
|
90 | self.temporalFTP = ftpBuffer() | |
91 | self.projectProperCaracteristica = [] |
|
91 | self.projectProperCaracteristica = [] | |
92 | self.projectProperPrincipal = [] |
|
92 | self.projectProperPrincipal = [] | |
93 | self.projectProperDescripcion = [] |
|
93 | self.projectProperDescripcion = [] | |
94 | self.volProperCaracteristica = [] |
|
94 | self.volProperCaracteristica = [] | |
95 | self.volProperPrincipal = [] |
|
95 | self.volProperPrincipal = [] | |
96 | self.volProperDescripcion = [] |
|
96 | self.volProperDescripcion = [] | |
97 | self.specProperCaracteristica = [] |
|
97 | self.specProperCaracteristica = [] | |
98 | self.specProperPrincipal = [] |
|
98 | self.specProperPrincipal = [] | |
99 | self.specProperDescripcion = [] |
|
99 | self.specProperDescripcion = [] | |
100 |
|
100 | |||
101 | self.specHeisProperCaracteristica = [] |
|
101 | self.specHeisProperCaracteristica = [] | |
102 | self.specHeisProperPrincipal = [] |
|
102 | self.specHeisProperPrincipal = [] | |
103 | self.specHeisProperDescripcion = [] |
|
103 | self.specHeisProperDescripcion = [] | |
104 |
|
104 | |||
105 | # self.pathWorkSpace = './' |
|
105 | # self.pathWorkSpace = './' | |
106 |
|
106 | |||
107 | self.__projectObjDict = {} |
|
107 | self.__projectObjDict = {} | |
108 | self.__operationObjDict = {} |
|
108 | self.__operationObjDict = {} | |
109 |
|
109 | |||
110 | self.__puLocalFolder2FTP = {} |
|
110 | self.__puLocalFolder2FTP = {} | |
111 | self.__initialized = False |
|
111 | self.__initialized = False | |
112 |
|
112 | |||
113 | # self.create_comm() |
|
113 | # self.create_comm() | |
114 | self.create_updating_timer() |
|
114 | self.create_updating_timer() | |
115 | self.setParameter() |
|
115 | self.setParameter() | |
116 |
|
116 | |||
117 | @pyqtSignature("") |
|
117 | @pyqtSignature("") | |
118 | def on_actionOpen_triggered(self): |
|
118 | def on_actionOpen_triggered(self): | |
119 | """ |
|
119 | """ | |
120 | Slot documentation goes here. |
|
120 | Slot documentation goes here. | |
121 | """ |
|
121 | """ | |
122 | self.openProject() |
|
122 | self.openProject() | |
123 |
|
123 | |||
124 | @pyqtSignature("") |
|
124 | @pyqtSignature("") | |
125 | def on_actionCreate_triggered(self): |
|
125 | def on_actionCreate_triggered(self): | |
126 | """ |
|
126 | """ | |
127 | Slot documentation goes here. |
|
127 | Slot documentation goes here. | |
128 | """ |
|
128 | """ | |
129 | self.setInputsProject_View() |
|
129 | self.setInputsProject_View() | |
130 | self.create = True |
|
130 | self.create = True | |
131 |
|
131 | |||
132 | @pyqtSignature("") |
|
132 | @pyqtSignature("") | |
133 | def on_actionSave_triggered(self): |
|
133 | def on_actionSave_triggered(self): | |
134 | """ |
|
134 | """ | |
135 | Slot documentation goes here. |
|
135 | Slot documentation goes here. | |
136 | """ |
|
136 | """ | |
137 | self.saveProject() |
|
137 | self.saveProject() | |
138 |
|
138 | |||
139 | @pyqtSignature("") |
|
139 | @pyqtSignature("") | |
140 | def on_actionClose_triggered(self): |
|
140 | def on_actionClose_triggered(self): | |
141 | """ |
|
141 | """ | |
142 | Slot documentation goes here. |
|
142 | Slot documentation goes here. | |
143 | """ |
|
143 | """ | |
144 | self.close() |
|
144 | self.close() | |
145 |
|
145 | |||
146 | @pyqtSignature("") |
|
146 | @pyqtSignature("") | |
147 | def on_actionStart_triggered(self): |
|
147 | def on_actionStart_triggered(self): | |
148 | """ |
|
148 | """ | |
149 | """ |
|
149 | """ | |
150 | self.playProject() |
|
150 | self.playProject() | |
151 |
|
151 | |||
152 | @pyqtSignature("") |
|
152 | @pyqtSignature("") | |
153 | def on_actionPause_triggered(self): |
|
153 | def on_actionPause_triggered(self): | |
154 | """ |
|
154 | """ | |
155 | """ |
|
155 | """ | |
156 | self.pauseProject() |
|
156 | self.pauseProject() | |
157 |
|
157 | |||
158 | @pyqtSignature("") |
|
158 | @pyqtSignature("") | |
159 | def on_actionStop_triggered(self): |
|
159 | def on_actionStop_triggered(self): | |
160 | """ |
|
160 | """ | |
161 | """ |
|
161 | """ | |
162 | self.stopProject() |
|
162 | self.stopProject() | |
163 |
|
163 | |||
164 | @pyqtSignature("") |
|
164 | @pyqtSignature("") | |
165 | def on_actionFTP_triggered(self): |
|
165 | def on_actionFTP_triggered(self): | |
166 | """ |
|
166 | """ | |
167 | """ |
|
167 | """ | |
168 | self.configFTPWindowObj = Ftp(self) |
|
168 | self.configFTPWindowObj = Ftp(self) | |
169 |
|
169 | |||
170 | if not self.temporalFTP.create: |
|
170 | if not self.temporalFTP.create: | |
171 | self.temporalFTP.setwithoutconfiguration() |
|
171 | self.temporalFTP.setwithoutconfiguration() | |
172 |
|
172 | |||
173 | self.configFTPWindowObj.setParmsfromTemporal(self.temporalFTP.server, |
|
173 | self.configFTPWindowObj.setParmsfromTemporal(self.temporalFTP.server, | |
174 | self.temporalFTP.remotefolder, |
|
174 | self.temporalFTP.remotefolder, | |
175 | self.temporalFTP.username, |
|
175 | self.temporalFTP.username, | |
176 | self.temporalFTP.password, |
|
176 | self.temporalFTP.password, | |
177 | self.temporalFTP.ftp_wei, |
|
177 | self.temporalFTP.ftp_wei, | |
178 | self.temporalFTP.exp_code, |
|
178 | self.temporalFTP.exp_code, | |
179 | self.temporalFTP.sub_exp_code, |
|
179 | self.temporalFTP.sub_exp_code, | |
180 | self.temporalFTP.plot_pos) |
|
180 | self.temporalFTP.plot_pos) | |
181 |
|
181 | |||
182 | self.configFTPWindowObj.show() |
|
182 | self.configFTPWindowObj.show() | |
183 | self.configFTPWindowObj.closed.connect(self.createFTPConfig) |
|
183 | self.configFTPWindowObj.closed.connect(self.createFTPConfig) | |
184 |
|
184 | |||
185 | def createFTPConfig(self): |
|
185 | def createFTPConfig(self): | |
186 |
|
186 | |||
187 | if not self.configFTPWindowObj.create: |
|
187 | if not self.configFTPWindowObj.create: | |
188 | self.console.clear() |
|
188 | self.console.clear() | |
189 | self.console.append("There is no FTP configuration") |
|
189 | self.console.append("There is no FTP configuration") | |
190 | return |
|
190 | return | |
191 |
|
191 | |||
192 | self.console.append("Push Ok in Spectra view to Add FTP Configuration") |
|
192 | self.console.append("Push Ok in Spectra view to Add FTP Configuration") | |
193 |
|
193 | |||
194 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.configFTPWindowObj.getParmsFromFtpWindow() |
|
194 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.configFTPWindowObj.getParmsFromFtpWindow() | |
195 | self.temporalFTP.save(server=server, |
|
195 | self.temporalFTP.save(server=server, | |
196 | remotefolder=remotefolder, |
|
196 | remotefolder=remotefolder, | |
197 | username=username, |
|
197 | username=username, | |
198 | password=password, |
|
198 | password=password, | |
199 | ftp_wei=ftp_wei, |
|
199 | ftp_wei=ftp_wei, | |
200 | exp_code=exp_code, |
|
200 | exp_code=exp_code, | |
201 | sub_exp_code=sub_exp_code, |
|
201 | sub_exp_code=sub_exp_code, | |
202 | plot_pos=plot_pos) |
|
202 | plot_pos=plot_pos) | |
203 |
|
203 | |||
204 | @pyqtSignature("") |
|
204 | @pyqtSignature("") | |
205 | def on_actionOpenToolbar_triggered(self): |
|
205 | def on_actionOpenToolbar_triggered(self): | |
206 | """ |
|
206 | """ | |
207 | Slot documentation goes here. |
|
207 | Slot documentation goes here. | |
208 | """ |
|
208 | """ | |
209 | self.openProject() |
|
209 | self.openProject() | |
210 |
|
210 | |||
211 | @pyqtSignature("") |
|
211 | @pyqtSignature("") | |
212 | def on_actionCreateToolbar_triggered(self): |
|
212 | def on_actionCreateToolbar_triggered(self): | |
213 | """ |
|
213 | """ | |
214 | Slot documentation goes here. |
|
214 | Slot documentation goes here. | |
215 | """ |
|
215 | """ | |
216 | self.setInputsProject_View() |
|
216 | self.setInputsProject_View() | |
217 | self.create = True |
|
217 | self.create = True | |
218 |
|
218 | |||
219 | @pyqtSignature("") |
|
219 | @pyqtSignature("") | |
220 | def on_actionAddPU_triggered(self): |
|
220 | def on_actionAddPU_triggered(self): | |
221 | if len(self.__projectObjDict) == 0: |
|
221 | if len(self.__projectObjDict) == 0: | |
222 | outputstr = "First Create a Project then add Processing Unit" |
|
222 | outputstr = "First Create a Project then add Processing Unit" | |
223 | self.console.clear() |
|
223 | self.console.clear() | |
224 | self.console.append(outputstr) |
|
224 | self.console.append(outputstr) | |
225 | return 0 |
|
225 | return 0 | |
226 | else: |
|
226 | else: | |
227 | self.addPUWindow() |
|
227 | self.addPUWindow() | |
228 | self.console.clear() |
|
228 | self.console.clear() | |
229 | self.console.append("Please, Choose the type of Processing Unit") |
|
229 | self.console.append("Please, Choose the type of Processing Unit") | |
230 | self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") |
|
230 | self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") | |
231 | self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") |
|
231 | self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") | |
232 | self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") |
|
232 | self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") | |
233 |
|
233 | |||
234 |
|
234 | |||
235 | @pyqtSignature("") |
|
235 | @pyqtSignature("") | |
236 | def on_actionSaveToolbar_triggered(self): |
|
236 | def on_actionSaveToolbar_triggered(self): | |
237 | """ |
|
237 | """ | |
238 | Slot documentation goes here. |
|
238 | Slot documentation goes here. | |
239 | """ |
|
239 | """ | |
240 | self.saveProject() |
|
240 | self.saveProject() | |
241 |
|
241 | |||
242 | @pyqtSignature("") |
|
242 | @pyqtSignature("") | |
243 | def on_actionStarToolbar_triggered(self): |
|
243 | def on_actionStarToolbar_triggered(self): | |
244 | """ |
|
244 | """ | |
245 | Slot documentation goes here. |
|
245 | Slot documentation goes here. | |
246 | """ |
|
246 | """ | |
247 | self.playProject() |
|
247 | self.playProject() | |
248 |
|
248 | |||
249 | @pyqtSignature("") |
|
249 | @pyqtSignature("") | |
250 | def on_actionPauseToolbar_triggered(self): |
|
250 | def on_actionPauseToolbar_triggered(self): | |
251 |
|
251 | |||
252 | self.pauseProject() |
|
252 | self.pauseProject() | |
253 |
|
253 | |||
254 | @pyqtSignature("") |
|
254 | @pyqtSignature("") | |
255 | def on_actionStopToolbar_triggered(self): |
|
255 | def on_actionStopToolbar_triggered(self): | |
256 | """ |
|
256 | """ | |
257 | Slot documentation goes here. |
|
257 | Slot documentation goes here. | |
258 | """ |
|
258 | """ | |
259 | self.stopProject() |
|
259 | self.stopProject() | |
260 |
|
260 | |||
261 | @pyqtSignature("int") |
|
261 | @pyqtSignature("int") | |
262 | def on_proComReadMode_activated(self, index): |
|
262 | def on_proComReadMode_activated(self, index): | |
263 | """ |
|
263 | """ | |
264 | SELECCION DEL MODO DE LECTURA ON=1, OFF=0 |
|
264 | SELECCION DEL MODO DE LECTURA ON=1, OFF=0 | |
265 | """ |
|
265 | """ | |
266 | if index == 0: |
|
266 | if index == 0: | |
267 | self.online = 0 |
|
267 | self.online = 0 | |
268 | self.proDelay.setText("0") |
|
268 | self.proDelay.setText("0") | |
269 | self.proSet.setText("") |
|
269 | self.proSet.setText("") | |
270 | self.proSet.setEnabled(False) |
|
270 | self.proSet.setEnabled(False) | |
271 | self.proDelay.setEnabled(False) |
|
271 | self.proDelay.setEnabled(False) | |
272 | elif index == 1: |
|
272 | elif index == 1: | |
273 | self.online = 1 |
|
273 | self.online = 1 | |
274 | self.proSet.setText(" ") |
|
274 | self.proSet.setText(" ") | |
275 | self.proDelay.setText("5") |
|
275 | self.proDelay.setText("5") | |
276 | self.proSet.setEnabled(True) |
|
276 | self.proSet.setEnabled(True) | |
277 | self.proDelay.setEnabled(True) |
|
277 | self.proDelay.setEnabled(True) | |
278 |
|
278 | |||
279 | @pyqtSignature("int") |
|
279 | @pyqtSignature("int") | |
280 | def on_proComDataType_activated(self, index): |
|
280 | def on_proComDataType_activated(self, index): | |
281 | """ |
|
281 | """ | |
282 | Voltage or Spectra |
|
282 | Voltage or Spectra | |
283 | """ |
|
283 | """ | |
284 | self.labelSet.show() |
|
284 | self.labelSet.show() | |
285 | self.proSet.show() |
|
285 | self.proSet.show() | |
286 |
|
286 | |||
287 | self.labelIPPKm.hide() |
|
287 | self.labelIPPKm.hide() | |
288 | self.proIPPKm.hide() |
|
288 | self.proIPPKm.hide() | |
289 |
|
289 | |||
290 | if index == 0: |
|
290 | if index == 0: | |
291 | extension = '.r' |
|
291 | extension = '.r' | |
292 | elif index == 1: |
|
292 | elif index == 1: | |
293 | extension = '.pdata' |
|
293 | extension = '.pdata' | |
294 | elif index == 2: |
|
294 | elif index == 2: | |
295 | extension = '.fits' |
|
295 | extension = '.fits' | |
296 | elif index == 3: |
|
296 | elif index == 3: | |
297 | extension = '.hdf5' |
|
297 | extension = '.hdf5' | |
298 |
|
298 | |||
299 | self.labelSet.hide() |
|
299 | self.labelSet.hide() | |
300 | self.proSet.hide() |
|
300 | self.proSet.hide() | |
301 | self.labelIPPKm.show() |
|
301 | self.labelIPPKm.show() | |
302 | self.proIPPKm.show() |
|
302 | self.proIPPKm.show() | |
303 |
|
303 | |||
304 | self.proDataType.setText(extension) |
|
304 | self.proDataType.setText(extension) | |
305 |
|
305 | |||
306 | @pyqtSignature("int") |
|
306 | @pyqtSignature("int") | |
307 | def on_proComWalk_activated(self, index): |
|
307 | def on_proComWalk_activated(self, index): | |
308 | """ |
|
308 | """ | |
309 |
|
309 | |||
310 | """ |
|
310 | """ | |
311 | if index == 0: |
|
311 | if index == 0: | |
312 | self.walk = 0 |
|
312 | self.walk = 0 | |
313 | elif index == 1: |
|
313 | elif index == 1: | |
314 | self.walk = 1 |
|
314 | self.walk = 1 | |
315 |
|
315 | |||
316 | @pyqtSignature("") |
|
316 | @pyqtSignature("") | |
317 | def on_proToolPath_clicked(self): |
|
317 | def on_proToolPath_clicked(self): | |
318 | """ |
|
318 | """ | |
319 | Choose your path |
|
319 | Choose your path | |
320 | """ |
|
320 | """ | |
321 |
|
321 | |||
322 | current_dpath = './' |
|
322 | current_dpath = './' | |
323 | if self.dataPath: |
|
323 | if self.dataPath: | |
324 | current_dpath = self.dataPath |
|
324 | current_dpath = self.dataPath | |
325 |
|
325 | |||
326 | datapath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', current_dpath, QtGui.QFileDialog.ShowDirsOnly)) |
|
326 | datapath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', current_dpath, QtGui.QFileDialog.ShowDirsOnly)) | |
327 |
|
327 | |||
328 | #If it was canceled |
|
328 | #If it was canceled | |
329 | if not datapath: |
|
329 | if not datapath: | |
330 | return |
|
330 | return | |
331 |
|
331 | |||
332 | #If any change was done |
|
332 | #If any change was done | |
333 | if datapath == self.dataPath: |
|
333 | if datapath == self.dataPath: | |
334 | return |
|
334 | return | |
335 |
|
335 | |||
336 | self.proDataPath.setText(datapath) |
|
336 | self.proDataPath.setText(datapath) | |
337 |
|
337 | |||
338 | self.actionStart.setEnabled(False) |
|
338 | self.actionStart.setEnabled(False) | |
339 | self.actionStarToolbar.setEnabled(False) |
|
339 | self.actionStarToolbar.setEnabled(False) | |
340 | self.proOk.setEnabled(False) |
|
340 | self.proOk.setEnabled(False) | |
341 |
|
341 | |||
342 | self.proComStartDate.clear() |
|
342 | self.proComStartDate.clear() | |
343 | self.proComEndDate.clear() |
|
343 | self.proComEndDate.clear() | |
344 |
|
344 | |||
345 | if not os.path.exists(datapath): |
|
345 | if not os.path.exists(datapath): | |
346 |
|
346 | |||
347 | self.console.clear() |
|
347 | self.console.clear() | |
348 | self.console.append("Write a correct a path") |
|
348 | self.console.append("Write a correct a path") | |
349 | return |
|
349 | return | |
350 |
|
350 | |||
351 | self.dataPath = datapath |
|
351 | self.dataPath = datapath | |
352 |
|
352 | |||
353 | self.console.clear() |
|
353 | self.console.clear() | |
354 | self.console.append("Select the read mode and press 'load button'") |
|
354 | self.console.append("Select the read mode and press 'load button'") | |
355 |
|
355 | |||
356 |
|
356 | |||
357 | @pyqtSignature("") |
|
357 | @pyqtSignature("") | |
358 | def on_proLoadButton_clicked(self): |
|
358 | def on_proLoadButton_clicked(self): | |
359 |
|
359 | |||
360 | self.console.clear() |
|
360 | self.console.clear() | |
361 |
|
361 | |||
362 | parameter_list = self.checkInputsProject() |
|
362 | parameter_list = self.checkInputsProject() | |
363 |
|
363 | |||
364 | if not parameter_list[0]: |
|
364 | if not parameter_list[0]: | |
365 | return |
|
365 | return | |
366 |
|
366 | |||
367 | parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set = parameter_list |
|
367 | parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set = parameter_list | |
368 |
|
368 | |||
369 | if read_mode == "Offline": |
|
369 | if read_mode == "Offline": | |
370 | self.proComStartDate.clear() |
|
370 | self.proComStartDate.clear() | |
371 | self.proComEndDate.clear() |
|
371 | self.proComEndDate.clear() | |
372 | self.proComStartDate.setEnabled(True) |
|
372 | self.proComStartDate.setEnabled(True) | |
373 | self.proComEndDate.setEnabled(True) |
|
373 | self.proComEndDate.setEnabled(True) | |
374 | self.proStartTime.setEnabled(True) |
|
374 | self.proStartTime.setEnabled(True) | |
375 | self.proEndTime.setEnabled(True) |
|
375 | self.proEndTime.setEnabled(True) | |
376 | self.frame_2.setEnabled(True) |
|
376 | self.frame_2.setEnabled(True) | |
377 |
|
377 | |||
378 | if read_mode == "Online": |
|
378 | if read_mode == "Online": | |
379 | self.proComStartDate.addItem("2000/01/30") |
|
379 | self.proComStartDate.addItem("2000/01/30") | |
380 | self.proComEndDate.addItem("2016/12/31") |
|
380 | self.proComEndDate.addItem("2016/12/31") | |
381 | self.proComStartDate.setEnabled(False) |
|
381 | self.proComStartDate.setEnabled(False) | |
382 | self.proComEndDate.setEnabled(False) |
|
382 | self.proComEndDate.setEnabled(False) | |
383 | self.proStartTime.setEnabled(False) |
|
383 | self.proStartTime.setEnabled(False) | |
384 | self.proEndTime.setEnabled(False) |
|
384 | self.proEndTime.setEnabled(False) | |
385 | self.frame_2.setEnabled(True) |
|
385 | self.frame_2.setEnabled(True) | |
386 |
|
386 | |||
387 | self.loadDays(data_path, ext, walk) |
|
387 | self.loadDays(data_path, ext, walk) | |
388 |
|
388 | |||
389 | @pyqtSignature("int") |
|
389 | @pyqtSignature("int") | |
390 | def on_proComStartDate_activated(self, index): |
|
390 | def on_proComStartDate_activated(self, index): | |
391 | """ |
|
391 | """ | |
392 | SELECCION DEL RANGO DE FECHAS -START DATE |
|
392 | SELECCION DEL RANGO DE FECHAS -START DATE | |
393 | """ |
|
393 | """ | |
394 | stopIndex = self.proComEndDate.count() - self.proComEndDate.currentIndex() |
|
394 | stopIndex = self.proComEndDate.count() - self.proComEndDate.currentIndex() | |
395 | self.proComEndDate.clear() |
|
395 | self.proComEndDate.clear() | |
396 | for i in self.dateList[index:]: |
|
396 | for i in self.dateList[index:]: | |
397 | self.proComEndDate.addItem(i) |
|
397 | self.proComEndDate.addItem(i) | |
398 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - stopIndex) |
|
398 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - stopIndex) | |
399 |
|
399 | |||
400 | @pyqtSignature("int") |
|
400 | @pyqtSignature("int") | |
401 | def on_proComEndDate_activated(self, index): |
|
401 | def on_proComEndDate_activated(self, index): | |
402 | """ |
|
402 | """ | |
403 | SELECCION DEL RANGO DE FECHAS-END DATE |
|
403 | SELECCION DEL RANGO DE FECHAS-END DATE | |
404 | """ |
|
404 | """ | |
405 | startIndex = self.proComStartDate.currentIndex() |
|
405 | startIndex = self.proComStartDate.currentIndex() | |
406 | stopIndex = self.proComEndDate.count() - index |
|
406 | stopIndex = self.proComEndDate.count() - index | |
407 | self.proComStartDate.clear() |
|
407 | self.proComStartDate.clear() | |
408 | for i in self.dateList[:len(self.dateList) - stopIndex + 1]: |
|
408 | for i in self.dateList[:len(self.dateList) - stopIndex + 1]: | |
409 | self.proComStartDate.addItem(i) |
|
409 | self.proComStartDate.addItem(i) | |
410 | self.proComStartDate.setCurrentIndex(startIndex) |
|
410 | self.proComStartDate.setCurrentIndex(startIndex) | |
411 |
|
411 | |||
412 | @pyqtSignature("") |
|
412 | @pyqtSignature("") | |
413 | def on_proOk_clicked(self): |
|
413 | def on_proOk_clicked(self): | |
414 | """ |
|
414 | """ | |
415 | AΓ±ade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml. |
|
415 | AΓ±ade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml. | |
416 | Prepara la configuraciΓ³n del diΓ‘grama del Arbol del treeView numero 2 |
|
416 | Prepara la configuraciΓ³n del diΓ‘grama del Arbol del treeView numero 2 | |
417 | """ |
|
417 | """ | |
418 |
|
418 | |||
419 | self.actionStart.setEnabled(False) |
|
419 | self.actionStart.setEnabled(False) | |
420 | self.actionStarToolbar.setEnabled(False) |
|
420 | self.actionStarToolbar.setEnabled(False) | |
421 |
|
421 | |||
422 | if self.create: |
|
422 | if self.create: | |
423 |
|
423 | |||
424 | projectId = self.__getNewProjectId() |
|
424 | projectId = self.__getNewProjectId() | |
425 |
|
425 | |||
426 | if not projectId: |
|
426 | if not projectId: | |
427 | return 0 |
|
427 | return 0 | |
428 |
|
428 | |||
429 | projectObjView = self.createProjectView(projectId) |
|
429 | projectObjView = self.createProjectView(projectId) | |
430 |
|
430 | |||
431 | if not projectObjView: |
|
431 | if not projectObjView: | |
432 | return 0 |
|
432 | return 0 | |
433 |
|
433 | |||
434 | readUnitObj = self.createReadUnitView(projectObjView) |
|
434 | readUnitObj = self.createReadUnitView(projectObjView) | |
435 |
|
435 | |||
436 | if not readUnitObj: |
|
436 | if not readUnitObj: | |
437 | return 0 |
|
437 | return 0 | |
438 |
|
438 | |||
439 | else: |
|
439 | else: | |
440 | projectObjView = self.updateProjectView() |
|
440 | projectObjView = self.updateProjectView() | |
441 |
|
441 | |||
442 | if not projectObjView: |
|
442 | if not projectObjView: | |
443 | return 0 |
|
443 | return 0 | |
444 |
|
444 | |||
445 | projectId = projectObjView.getId() |
|
445 | projectId = projectObjView.getId() | |
446 | idReadUnit = projectObjView.getReadUnitId() |
|
446 | idReadUnit = projectObjView.getReadUnitId() | |
447 | readUnitObj = self.updateReadUnitView(projectObjView, idReadUnit) |
|
447 | readUnitObj = self.updateReadUnitView(projectObjView, idReadUnit) | |
448 |
|
448 | |||
449 | if not readUnitObj: |
|
449 | if not readUnitObj: | |
450 | return 0 |
|
450 | return 0 | |
451 |
|
451 | |||
452 | self.__itemTreeDict[projectId].setText(projectObjView.name) |
|
452 | self.__itemTreeDict[projectId].setText(projectObjView.name) | |
453 | # Project Properties |
|
453 | # Project Properties | |
454 | self.refreshProjectProperties(projectObjView) |
|
454 | self.refreshProjectProperties(projectObjView) | |
455 | # Disable tabProject after finish the creation |
|
455 | # Disable tabProject after finish the creation | |
456 |
|
456 | |||
457 | self.actionStart.setEnabled(True) |
|
457 | self.actionStart.setEnabled(True) | |
458 | self.actionStarToolbar.setEnabled(True) |
|
458 | self.actionStarToolbar.setEnabled(True) | |
459 | self.console.clear() |
|
459 | self.console.clear() | |
460 | self.console.append("The project parameters were validated") |
|
460 | self.console.append("The project parameters were validated") | |
461 |
|
461 | |||
462 | return 1 |
|
462 | return 1 | |
463 |
|
463 | |||
464 | @pyqtSignature("") |
|
464 | @pyqtSignature("") | |
465 | def on_proClear_clicked(self): |
|
465 | def on_proClear_clicked(self): | |
466 |
|
466 | |||
467 | self.console.clear() |
|
467 | self.console.clear() | |
468 |
|
468 | |||
469 | @pyqtSignature("int") |
|
469 | @pyqtSignature("int") | |
470 | def on_volOpCebChannels_stateChanged(self, p0): |
|
470 | def on_volOpCebChannels_stateChanged(self, p0): | |
471 | """ |
|
471 | """ | |
472 | Check Box habilita operaciones de SelecciοΏ½n de Canales |
|
472 | Check Box habilita operaciones de SelecciοΏ½n de Canales | |
473 | """ |
|
473 | """ | |
474 | if p0 == 2: |
|
474 | if p0 == 2: | |
475 | self.volOpComChannels.setEnabled(True) |
|
475 | self.volOpComChannels.setEnabled(True) | |
476 | self.volOpChannel.setEnabled(True) |
|
476 | self.volOpChannel.setEnabled(True) | |
477 |
|
477 | |||
478 | if p0 == 0: |
|
478 | if p0 == 0: | |
479 | self.volOpComChannels.setEnabled(False) |
|
479 | self.volOpComChannels.setEnabled(False) | |
480 | self.volOpChannel.setEnabled(False) |
|
480 | self.volOpChannel.setEnabled(False) | |
481 | self.volOpChannel.clear() |
|
481 | self.volOpChannel.clear() | |
482 |
|
482 | |||
483 | @pyqtSignature("int") |
|
483 | @pyqtSignature("int") | |
484 | def on_volOpCebHeights_stateChanged(self, p0): |
|
484 | def on_volOpCebHeights_stateChanged(self, p0): | |
485 | """ |
|
485 | """ | |
486 | Check Box habilita operaciones de SelecciοΏ½n de Alturas |
|
486 | Check Box habilita operaciones de SelecciοΏ½n de Alturas | |
487 | """ |
|
487 | """ | |
488 | if p0 == 2: |
|
488 | if p0 == 2: | |
489 | self.volOpHeights.setEnabled(True) |
|
489 | self.volOpHeights.setEnabled(True) | |
490 | self.volOpComHeights.setEnabled(True) |
|
490 | self.volOpComHeights.setEnabled(True) | |
491 |
|
491 | |||
492 | if p0 == 0: |
|
492 | if p0 == 0: | |
493 | self.volOpHeights.setEnabled(False) |
|
493 | self.volOpHeights.setEnabled(False) | |
494 | self.volOpHeights.clear() |
|
494 | self.volOpHeights.clear() | |
495 | self.volOpComHeights.setEnabled(False) |
|
495 | self.volOpComHeights.setEnabled(False) | |
496 |
|
496 | |||
497 | @pyqtSignature("int") |
|
497 | @pyqtSignature("int") | |
498 | def on_volOpCebFilter_stateChanged(self, p0): |
|
498 | def on_volOpCebFilter_stateChanged(self, p0): | |
499 | """ |
|
499 | """ | |
500 | Name='Decoder', optype='other' |
|
500 | Name='Decoder', optype='other' | |
501 | """ |
|
501 | """ | |
502 | if p0 == 2: |
|
502 | if p0 == 2: | |
503 | self.volOpFilter.setEnabled(True) |
|
503 | self.volOpFilter.setEnabled(True) | |
504 |
|
504 | |||
505 | if p0 == 0: |
|
505 | if p0 == 0: | |
506 | self.volOpFilter.setEnabled(False) |
|
506 | self.volOpFilter.setEnabled(False) | |
507 | self.volOpFilter.clear() |
|
507 | self.volOpFilter.clear() | |
508 |
|
508 | |||
509 | @pyqtSignature("int") |
|
509 | @pyqtSignature("int") | |
510 | def on_volOpCebProfile_stateChanged(self, p0): |
|
510 | def on_volOpCebProfile_stateChanged(self, p0): | |
511 | """ |
|
511 | """ | |
512 | Check Box habilita ingreso del rango de Perfiles |
|
512 | Check Box habilita ingreso del rango de Perfiles | |
513 | """ |
|
513 | """ | |
514 | if p0 == 2: |
|
514 | if p0 == 2: | |
515 | self.volOpComProfile.setEnabled(True) |
|
515 | self.volOpComProfile.setEnabled(True) | |
516 | self.volOpProfile.setEnabled(True) |
|
516 | self.volOpProfile.setEnabled(True) | |
517 |
|
517 | |||
518 | if p0 == 0: |
|
518 | if p0 == 0: | |
519 | self.volOpComProfile.setEnabled(False) |
|
519 | self.volOpComProfile.setEnabled(False) | |
520 | self.volOpProfile.setEnabled(False) |
|
520 | self.volOpProfile.setEnabled(False) | |
521 | self.volOpProfile.clear() |
|
521 | self.volOpProfile.clear() | |
522 |
|
522 | |||
523 | @pyqtSignature("int") |
|
523 | @pyqtSignature("int") | |
524 | def on_volOpComProfile_activated(self, index): |
|
524 | def on_volOpComProfile_activated(self, index): | |
525 | """ |
|
525 | """ | |
526 | Check Box habilita ingreso del rango de Perfiles |
|
526 | Check Box habilita ingreso del rango de Perfiles | |
527 | """ |
|
527 | """ | |
528 | #Profile List |
|
528 | #Profile List | |
529 | if index == 0: |
|
529 | if index == 0: | |
530 | self.volOpProfile.setToolTip('List of selected profiles. Example: 0, 1, 2, 3, 4, 5, 6, 7') |
|
530 | self.volOpProfile.setToolTip('List of selected profiles. Example: 0, 1, 2, 3, 4, 5, 6, 7') | |
531 |
|
531 | |||
532 | #Profile Range |
|
532 | #Profile Range | |
533 | if index == 1: |
|
533 | if index == 1: | |
534 | self.volOpProfile.setToolTip('Minimum and maximum profile index. Example: 0, 7') |
|
534 | self.volOpProfile.setToolTip('Minimum and maximum profile index. Example: 0, 7') | |
535 |
|
535 | |||
536 | #Profile Range List |
|
536 | #Profile Range List | |
537 | if index == 2: |
|
537 | if index == 2: | |
538 | self.volOpProfile.setToolTip('List of profile ranges. Example: (0, 7), (12, 19), (100, 200)') |
|
538 | self.volOpProfile.setToolTip('List of profile ranges. Example: (0, 7), (12, 19), (100, 200)') | |
539 |
|
539 | |||
540 | @pyqtSignature("int") |
|
540 | @pyqtSignature("int") | |
541 | def on_volOpCebDecodification_stateChanged(self, p0): |
|
541 | def on_volOpCebDecodification_stateChanged(self, p0): | |
542 | """ |
|
542 | """ | |
543 | Check Box habilita |
|
543 | Check Box habilita | |
544 | """ |
|
544 | """ | |
545 | if p0 == 2: |
|
545 | if p0 == 2: | |
546 | self.volOpComCode.setEnabled(True) |
|
546 | self.volOpComCode.setEnabled(True) | |
547 | self.volOpComMode.setEnabled(True) |
|
547 | self.volOpComMode.setEnabled(True) | |
548 | if p0 == 0: |
|
548 | if p0 == 0: | |
549 | self.volOpComCode.setEnabled(False) |
|
549 | self.volOpComCode.setEnabled(False) | |
550 | self.volOpComMode.setEnabled(False) |
|
550 | self.volOpComMode.setEnabled(False) | |
551 |
|
551 | |||
552 | @pyqtSignature("int") |
|
552 | @pyqtSignature("int") | |
553 | def on_volOpComCode_activated(self, index): |
|
553 | def on_volOpComCode_activated(self, index): | |
554 | """ |
|
554 | """ | |
555 | Check Box habilita ingreso |
|
555 | Check Box habilita ingreso | |
556 | """ |
|
556 | """ | |
557 | if index == 13: |
|
557 | if index == 13: | |
558 | self.volOpCode.setEnabled(True) |
|
558 | self.volOpCode.setEnabled(True) | |
559 | else: |
|
559 | else: | |
560 | self.volOpCode.setEnabled(False) |
|
560 | self.volOpCode.setEnabled(False) | |
561 |
|
561 | |||
562 | if index == 0: |
|
562 | if index == 0: | |
563 | code = '' |
|
563 | code = '' | |
564 | self.volOpCode.setText(str(code)) |
|
564 | self.volOpCode.setText(str(code)) | |
565 | return |
|
565 | return | |
566 |
|
566 | |||
567 | if index == 1: |
|
567 | if index == 1: | |
568 | code = '(1,1,-1)' |
|
568 | code = '(1,1,-1)' | |
569 | nCode = '1' |
|
569 | nCode = '1' | |
570 | nBaud = '3' |
|
570 | nBaud = '3' | |
571 | if index == 2: |
|
571 | if index == 2: | |
572 | code = '(1,1,-1,1)' |
|
572 | code = '(1,1,-1,1)' | |
573 | nCode = '1' |
|
573 | nCode = '1' | |
574 | nBaud = '4' |
|
574 | nBaud = '4' | |
575 | if index == 3: |
|
575 | if index == 3: | |
576 | code = '(1,1,1,-1,1)' |
|
576 | code = '(1,1,1,-1,1)' | |
577 | nCode = '1' |
|
577 | nCode = '1' | |
578 | nBaud = '5' |
|
578 | nBaud = '5' | |
579 | if index == 4: |
|
579 | if index == 4: | |
580 | code = '(1,1,1,-1,-1,1,-1)' |
|
580 | code = '(1,1,1,-1,-1,1,-1)' | |
581 | nCode = '1' |
|
581 | nCode = '1' | |
582 | nBaud = '7' |
|
582 | nBaud = '7' | |
583 | if index == 5: |
|
583 | if index == 5: | |
584 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1)' |
|
584 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1)' | |
585 | nCode = '1' |
|
585 | nCode = '1' | |
586 | nBaud = '11' |
|
586 | nBaud = '11' | |
587 | if index == 6: |
|
587 | if index == 6: | |
588 | code = '(1,1,1,1,1,-1,-1,1,1,-1,1,-1,1)' |
|
588 | code = '(1,1,1,1,1,-1,-1,1,1,-1,1,-1,1)' | |
589 | nCode = '1' |
|
589 | nCode = '1' | |
590 | nBaud = '13' |
|
590 | nBaud = '13' | |
591 | if index == 7: |
|
591 | if index == 7: | |
592 | code = '(1,1,-1,-1,-1,1)' |
|
592 | code = '(1,1,-1,-1,-1,1)' | |
593 | nCode = '2' |
|
593 | nCode = '2' | |
594 | nBaud = '3' |
|
594 | nBaud = '3' | |
595 | if index == 8: |
|
595 | if index == 8: | |
596 | code = '(1,1,-1,1,-1,-1,1,-1)' |
|
596 | code = '(1,1,-1,1,-1,-1,1,-1)' | |
597 | nCode = '2' |
|
597 | nCode = '2' | |
598 | nBaud = '4' |
|
598 | nBaud = '4' | |
599 | if index == 9: |
|
599 | if index == 9: | |
600 | code = '(1,1,1,-1,1,-1,-1,-1,1,-1)' |
|
600 | code = '(1,1,1,-1,1,-1,-1,-1,1,-1)' | |
601 | nCode = '2' |
|
601 | nCode = '2' | |
602 | nBaud = '5' |
|
602 | nBaud = '5' | |
603 | if index == 10: |
|
603 | if index == 10: | |
604 | code = '(1,1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1)' |
|
604 | code = '(1,1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1)' | |
605 | nCode = '2' |
|
605 | nCode = '2' | |
606 | nBaud = '7' |
|
606 | nBaud = '7' | |
607 | if index == 11: |
|
607 | if index == 11: | |
608 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1 ,-1 ,-1 ,1 ,1,1,-1 ,1 ,1 ,-1 ,1)' |
|
608 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1 ,-1 ,-1 ,1 ,1,1,-1 ,1 ,1 ,-1 ,1)' | |
609 | nCode = '2' |
|
609 | nCode = '2' | |
610 | nBaud = '11' |
|
610 | nBaud = '11' | |
611 | if index == 12: |
|
611 | if index == 12: | |
612 | code = '(1,1,1,1,1,-1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1)' |
|
612 | code = '(1,1,1,1,1,-1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1)' | |
613 | nCode = '2' |
|
613 | nCode = '2' | |
614 | nBaud = '13' |
|
614 | nBaud = '13' | |
615 |
|
615 | |||
616 | code = ast.literal_eval(code) |
|
616 | code = ast.literal_eval(code) | |
617 | nCode = int(nCode) |
|
617 | nCode = int(nCode) | |
618 | nBaud = int(nBaud) |
|
618 | nBaud = int(nBaud) | |
619 |
|
619 | |||
620 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() |
|
620 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() | |
621 |
|
621 | |||
622 | self.volOpCode.setText(str(code)) |
|
622 | self.volOpCode.setText(str(code)) | |
623 |
|
623 | |||
624 | @pyqtSignature("int") |
|
624 | @pyqtSignature("int") | |
625 | def on_volOpCebFlip_stateChanged(self, p0): |
|
625 | def on_volOpCebFlip_stateChanged(self, p0): | |
626 | """ |
|
626 | """ | |
627 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
627 | Check Box habilita ingresode del numero de Integraciones a realizar | |
628 | """ |
|
628 | """ | |
629 | if p0 == 2: |
|
629 | if p0 == 2: | |
630 | self.volOpFlip.setEnabled(True) |
|
630 | self.volOpFlip.setEnabled(True) | |
631 | if p0 == 0: |
|
631 | if p0 == 0: | |
632 | self.volOpFlip.setEnabled(False) |
|
632 | self.volOpFlip.setEnabled(False) | |
633 | self.volOpFlip.clear() |
|
633 | self.volOpFlip.clear() | |
634 |
|
634 | |||
635 | @pyqtSignature("int") |
|
635 | @pyqtSignature("int") | |
636 | def on_volOpCebCohInt_stateChanged(self, p0): |
|
636 | def on_volOpCebCohInt_stateChanged(self, p0): | |
637 | """ |
|
637 | """ | |
638 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
638 | Check Box habilita ingresode del numero de Integraciones a realizar | |
639 | """ |
|
639 | """ | |
640 | if p0 == 2: |
|
640 | if p0 == 2: | |
641 | self.volOpCohInt.setEnabled(True) |
|
641 | self.volOpCohInt.setEnabled(True) | |
642 | if p0 == 0: |
|
642 | if p0 == 0: | |
643 | self.volOpCohInt.setEnabled(False) |
|
643 | self.volOpCohInt.setEnabled(False) | |
644 | self.volOpCohInt.clear() |
|
644 | self.volOpCohInt.clear() | |
645 |
|
645 | |||
646 | @pyqtSignature("int") |
|
646 | @pyqtSignature("int") | |
647 | def on_volOpCebRadarfrequency_stateChanged(self, p0): |
|
647 | def on_volOpCebRadarfrequency_stateChanged(self, p0): | |
648 | """ |
|
648 | """ | |
649 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
649 | Check Box habilita ingresode del numero de Integraciones a realizar | |
650 | """ |
|
650 | """ | |
651 | if p0 == 2: |
|
651 | if p0 == 2: | |
652 | self.volOpRadarfrequency.setEnabled(True) |
|
652 | self.volOpRadarfrequency.setEnabled(True) | |
653 | if p0 == 0: |
|
653 | if p0 == 0: | |
654 | self.volOpRadarfrequency.clear() |
|
654 | self.volOpRadarfrequency.clear() | |
655 | self.volOpRadarfrequency.setEnabled(False) |
|
655 | self.volOpRadarfrequency.setEnabled(False) | |
656 |
|
656 | |||
657 | @pyqtSignature("") |
|
657 | @pyqtSignature("") | |
658 | def on_volOutputToolPath_clicked(self): |
|
658 | def on_volOutputToolPath_clicked(self): | |
659 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
659 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
660 | self.volOutputPath.setText(dirOutPath) |
|
660 | self.volOutputPath.setText(dirOutPath) | |
661 |
|
661 | |||
662 | @pyqtSignature("") |
|
662 | @pyqtSignature("") | |
663 | def on_specOutputToolPath_clicked(self): |
|
663 | def on_specOutputToolPath_clicked(self): | |
664 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
664 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
665 | self.specOutputPath.setText(dirOutPath) |
|
665 | self.specOutputPath.setText(dirOutPath) | |
666 |
|
666 | |||
667 | @pyqtSignature("") |
|
667 | @pyqtSignature("") | |
668 | def on_specHeisOutputToolPath_clicked(self): |
|
668 | def on_specHeisOutputToolPath_clicked(self): | |
669 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
669 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
670 | self.specHeisOutputPath.setText(dirOutPath) |
|
670 | self.specHeisOutputPath.setText(dirOutPath) | |
671 |
|
671 | |||
672 | @pyqtSignature("") |
|
672 | @pyqtSignature("") | |
673 | def on_specHeisOutputMetadaToolPath_clicked(self): |
|
673 | def on_specHeisOutputMetadaToolPath_clicked(self): | |
674 |
|
674 | |||
675 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) |
|
675 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) | |
676 | self.specHeisOutputMetada.setText(filename) |
|
676 | self.specHeisOutputMetada.setText(filename) | |
677 |
|
677 | |||
678 | @pyqtSignature("") |
|
678 | @pyqtSignature("") | |
679 | def on_volOpOk_clicked(self): |
|
679 | def on_volOpOk_clicked(self): | |
680 | """ |
|
680 | """ | |
681 | BUSCA EN LA LISTA DE OPERACIONES DEL TIPO VOLTAJE Y LES AοΏ½ADE EL PARAMETRO ADECUADO ESPERANDO LA ACEPTACION DEL USUARIO |
|
681 | BUSCA EN LA LISTA DE OPERACIONES DEL TIPO VOLTAJE Y LES AοΏ½ADE EL PARAMETRO ADECUADO ESPERANDO LA ACEPTACION DEL USUARIO | |
682 | PARA AGREGARLO AL ARCHIVO DE CONFIGURACION XML |
|
682 | PARA AGREGARLO AL ARCHIVO DE CONFIGURACION XML | |
683 | """ |
|
683 | """ | |
684 |
|
684 | |||
685 | checkPath = False |
|
685 | checkPath = False | |
686 |
|
686 | |||
687 | self.actionSaveToolbar.setEnabled(False) |
|
687 | self.actionSaveToolbar.setEnabled(False) | |
688 | self.actionStarToolbar.setEnabled(False) |
|
688 | self.actionStarToolbar.setEnabled(False) | |
689 |
|
689 | |||
690 | puObj = self.getSelectedItemObj() |
|
690 | puObj = self.getSelectedItemObj() | |
691 | puObj.removeOperations() |
|
691 | puObj.removeOperations() | |
692 |
|
692 | |||
693 | if self.volOpCebRadarfrequency.isChecked(): |
|
693 | if self.volOpCebRadarfrequency.isChecked(): | |
694 | value = str(self.volOpRadarfrequency.text()) |
|
694 | value = str(self.volOpRadarfrequency.text()) | |
695 | format = 'float' |
|
695 | format = 'float' | |
696 | name_operation = 'setRadarFrequency' |
|
696 | name_operation = 'setRadarFrequency' | |
697 | name_parameter = 'frequency' |
|
697 | name_parameter = 'frequency' | |
698 | if not value == "": |
|
698 | if not value == "": | |
699 | try: |
|
699 | try: | |
700 | radarfreq = float(self.volOpRadarfrequency.text())*1e6 |
|
700 | radarfreq = float(self.volOpRadarfrequency.text())*1e6 | |
701 | except: |
|
701 | except: | |
702 | self.console.clear() |
|
702 | self.console.clear() | |
703 | self.console.append("Write the parameter Radar Frequency type float") |
|
703 | self.console.append("Write the parameter Radar Frequency type float") | |
704 | return 0 |
|
704 | return 0 | |
705 | opObj = puObj.addOperation(name=name_operation) |
|
705 | opObj = puObj.addOperation(name=name_operation) | |
706 | opObj.addParameter(name=name_parameter, value=radarfreq, format=format) |
|
706 | opObj.addParameter(name=name_parameter, value=radarfreq, format=format) | |
707 |
|
707 | |||
708 | if self.volOpCebChannels.isChecked(): |
|
708 | if self.volOpCebChannels.isChecked(): | |
709 | value = str(self.volOpChannel.text()) |
|
709 | value = str(self.volOpChannel.text()) | |
710 |
|
710 | |||
711 | if value == "": |
|
711 | if value == "": | |
712 | print "Please fill channel list" |
|
712 | print "Please fill channel list" | |
713 | return 0 |
|
713 | return 0 | |
714 |
|
714 | |||
715 | format = 'intlist' |
|
715 | format = 'intlist' | |
716 | if self.volOpComChannels.currentIndex() == 0: |
|
716 | if self.volOpComChannels.currentIndex() == 0: | |
717 | name_operation = "selectChannels" |
|
717 | name_operation = "selectChannels" | |
718 | name_parameter = 'channelList' |
|
718 | name_parameter = 'channelList' | |
719 | else: |
|
719 | else: | |
720 | name_operation = "selectChannelsByIndex" |
|
720 | name_operation = "selectChannelsByIndex" | |
721 | name_parameter = 'channelIndexList' |
|
721 | name_parameter = 'channelIndexList' | |
722 |
|
722 | |||
723 | opObj = puObj.addOperation(name=name_operation) |
|
723 | opObj = puObj.addOperation(name=name_operation) | |
724 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
724 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
725 |
|
725 | |||
726 | if self.volOpCebHeights.isChecked(): |
|
726 | if self.volOpCebHeights.isChecked(): | |
727 | value = str(self.volOpHeights.text()) |
|
727 | value = str(self.volOpHeights.text()) | |
728 |
|
728 | |||
729 | if value == "": |
|
729 | if value == "": | |
730 | print "Please fill height range" |
|
730 | print "Please fill height range" | |
731 | return 0 |
|
731 | return 0 | |
732 |
|
732 | |||
733 | valueList = value.split(',') |
|
733 | valueList = value.split(',') | |
734 | format = 'float' |
|
734 | format = 'float' | |
735 | if self.volOpComHeights.currentIndex() == 0: |
|
735 | if self.volOpComHeights.currentIndex() == 0: | |
736 | name_operation = 'selectHeights' |
|
736 | name_operation = 'selectHeights' | |
737 | name_parameter1 = 'minHei' |
|
737 | name_parameter1 = 'minHei' | |
738 | name_parameter2 = 'maxHei' |
|
738 | name_parameter2 = 'maxHei' | |
739 | else: |
|
739 | else: | |
740 | name_operation = 'selectHeightsByIndex' |
|
740 | name_operation = 'selectHeightsByIndex' | |
741 | name_parameter1 = 'minIndex' |
|
741 | name_parameter1 = 'minIndex' | |
742 | name_parameter2 = 'maxIndex' |
|
742 | name_parameter2 = 'maxIndex' | |
743 |
|
743 | |||
744 | opObj = puObj.addOperation(name=name_operation) |
|
744 | opObj = puObj.addOperation(name=name_operation) | |
745 | opObj.addParameter(name=name_parameter1, value=valueList[0], format=format) |
|
745 | opObj.addParameter(name=name_parameter1, value=valueList[0], format=format) | |
746 | opObj.addParameter(name=name_parameter2, value=valueList[1], format=format) |
|
746 | opObj.addParameter(name=name_parameter2, value=valueList[1], format=format) | |
747 |
|
747 | |||
748 | if self.volOpCebFilter.isChecked(): |
|
748 | if self.volOpCebFilter.isChecked(): | |
749 | value = str(self.volOpFilter.text()) |
|
749 | value = str(self.volOpFilter.text()) | |
750 | if value == "": |
|
750 | if value == "": | |
751 | print "Please fill filter value" |
|
751 | print "Please fill filter value" | |
752 | return 0 |
|
752 | return 0 | |
753 |
|
753 | |||
754 | format = 'int' |
|
754 | format = 'int' | |
755 | name_operation = 'filterByHeights' |
|
755 | name_operation = 'filterByHeights' | |
756 | name_parameter = 'window' |
|
756 | name_parameter = 'window' | |
757 | opObj = puObj.addOperation(name=name_operation) |
|
757 | opObj = puObj.addOperation(name=name_operation) | |
758 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
758 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
759 |
|
759 | |||
760 | if self.volOpCebProfile.isChecked(): |
|
760 | if self.volOpCebProfile.isChecked(): | |
761 | value = str(self.volOpProfile.text()) |
|
761 | value = str(self.volOpProfile.text()) | |
762 |
|
762 | |||
763 | if value == "": |
|
763 | if value == "": | |
764 | print "Please fill profile value" |
|
764 | print "Please fill profile value" | |
765 | return 0 |
|
765 | return 0 | |
766 |
|
766 | |||
767 | format = 'intlist' |
|
767 | format = 'intlist' | |
768 | optype = 'other' |
|
768 | optype = 'other' | |
769 | name_operation = 'ProfileSelector' |
|
769 | name_operation = 'ProfileSelector' | |
770 | if self.volOpComProfile.currentIndex() == 0: |
|
770 | if self.volOpComProfile.currentIndex() == 0: | |
771 | name_parameter = 'profileList' |
|
771 | name_parameter = 'profileList' | |
772 | if self.volOpComProfile.currentIndex() == 1: |
|
772 | if self.volOpComProfile.currentIndex() == 1: | |
773 | name_parameter = 'profileRangeList' |
|
773 | name_parameter = 'profileRangeList' | |
774 | if self.volOpComProfile.currentIndex() == 2: |
|
774 | if self.volOpComProfile.currentIndex() == 2: | |
775 | name_parameter = 'rangeList' |
|
775 | name_parameter = 'rangeList' | |
776 |
|
776 | |||
777 | opObj = puObj.addOperation(name='ProfileSelector', optype='other') |
|
777 | opObj = puObj.addOperation(name='ProfileSelector', optype='other') | |
778 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
778 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
779 |
|
779 | |||
780 | if self.volOpCebDecodification.isChecked(): |
|
780 | if self.volOpCebDecodification.isChecked(): | |
781 |
|
781 | |||
782 | if self.volOpComMode.currentIndex() == 0: |
|
782 | if self.volOpComMode.currentIndex() == 0: | |
783 | mode = '0' |
|
783 | mode = '0' | |
784 | if self.volOpComMode.currentIndex() == 1: |
|
784 | if self.volOpComMode.currentIndex() == 1: | |
785 | mode = '1' |
|
785 | mode = '1' | |
786 | if self.volOpComMode.currentIndex() == 2: |
|
786 | if self.volOpComMode.currentIndex() == 2: | |
787 | mode = '2' |
|
787 | mode = '2' | |
788 |
|
788 | |||
789 | if self.volOpComCode.currentIndex() == 0: |
|
789 | if self.volOpComCode.currentIndex() == 0: | |
790 | opObj = puObj.addOperation(name='Decoder', optype='other') |
|
790 | opObj = puObj.addOperation(name='Decoder', optype='other') | |
791 | opObj.addParameter(name='mode', value=mode, format='int') |
|
791 | opObj.addParameter(name='mode', value=mode, format='int') | |
792 | else: |
|
792 | else: | |
793 | #User defined |
|
793 | #User defined | |
794 | code = str(self.volOpCode.text()) |
|
794 | code = str(self.volOpCode.text()) | |
795 | try: |
|
795 | try: | |
796 | code_tmp = ast.literal_eval(code) |
|
796 | code_tmp = ast.literal_eval(code) | |
797 | except: |
|
797 | except: | |
798 | code_tmp = [] |
|
798 | code_tmp = [] | |
799 |
|
799 | |||
800 | if len(code_tmp) < 1: |
|
800 | if len(code_tmp) < 1: | |
801 | self.console.append("Please fill the code value") |
|
801 | self.console.append("Please fill the code value") | |
802 | return 0 |
|
802 | return 0 | |
803 |
|
803 | |||
804 | if len(code_tmp) == 1 or type(code_tmp[0]) != int: |
|
804 | if len(code_tmp) == 1 or type(code_tmp[0]) != int: | |
805 | nBaud = len(code_tmp[0]) |
|
805 | nBaud = len(code_tmp[0]) | |
806 | nCode = len(code_tmp) |
|
806 | nCode = len(code_tmp) | |
807 | else: |
|
807 | else: | |
808 | nBaud = len(code_tmp) |
|
808 | nBaud = len(code_tmp) | |
809 | nCode = 1 |
|
809 | nCode = 1 | |
810 |
|
810 | |||
811 | opObj = puObj.addOperation(name='Decoder', optype='other') |
|
811 | opObj = puObj.addOperation(name='Decoder', optype='other') | |
812 |
|
812 | |||
813 | code = code.replace("(", "") |
|
813 | code = code.replace("(", "") | |
814 | code = code.replace(")", "") |
|
814 | code = code.replace(")", "") | |
815 | code = code.replace("[", "") |
|
815 | code = code.replace("[", "") | |
816 | code = code.replace("]", "") |
|
816 | code = code.replace("]", "") | |
817 | opObj.addParameter(name='code', value=code, format='intlist') |
|
817 | opObj.addParameter(name='code', value=code, format='intlist') | |
818 | opObj.addParameter(name='nCode', value=nCode, format='int') |
|
818 | opObj.addParameter(name='nCode', value=nCode, format='int') | |
819 | opObj.addParameter(name='nBaud', value=nBaud, format='int') |
|
819 | opObj.addParameter(name='nBaud', value=nBaud, format='int') | |
820 | opObj.addParameter(name='mode', value=mode, format='int') |
|
820 | opObj.addParameter(name='mode', value=mode, format='int') | |
821 |
|
821 | |||
822 | if self.volOpCebFlip.isChecked(): |
|
822 | if self.volOpCebFlip.isChecked(): | |
823 | name_operation = 'deFlip' |
|
823 | name_operation = 'deFlip' | |
824 | optype = 'self' |
|
824 | optype = 'self' | |
825 | value = str(self.volOpFlip.text()) |
|
825 | value = str(self.volOpFlip.text()) | |
826 | name_parameter = 'channelList' |
|
826 | name_parameter = 'channelList' | |
827 | format = 'intlist' |
|
827 | format = 'intlist' | |
828 |
|
828 | |||
829 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
829 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
830 | if value: |
|
830 | if value: | |
831 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
831 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
832 |
|
832 | |||
833 | if self.volOpCebCohInt.isChecked(): |
|
833 | if self.volOpCebCohInt.isChecked(): | |
834 | name_operation = 'CohInt' |
|
834 | name_operation = 'CohInt' | |
835 | optype = 'other' |
|
835 | optype = 'other' | |
836 | value = str(self.volOpCohInt.text()) |
|
836 | value = str(self.volOpCohInt.text()) | |
837 |
|
837 | |||
838 | if value == "": |
|
838 | if value == "": | |
839 | print "Please fill number of coherent integrations" |
|
839 | print "Please fill number of coherent integrations" | |
840 | return 0 |
|
840 | return 0 | |
841 |
|
841 | |||
842 | name_parameter = 'n' |
|
842 | name_parameter = 'n' | |
843 | format = 'float' |
|
843 | format = 'float' | |
844 |
|
844 | |||
845 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
845 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
846 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
846 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
847 |
|
847 | |||
848 | if self.volGraphCebshow.isChecked(): |
|
848 | if self.volGraphCebshow.isChecked(): | |
849 | name_operation = 'Scope' |
|
849 | name_operation = 'Scope' | |
850 | optype = 'other' |
|
850 | optype = 'other' | |
851 | name_parameter = 'type' |
|
851 | name_parameter = 'type' | |
852 | value = 'Scope' |
|
852 | value = 'Scope' | |
853 | if self.idImagscope == 0: |
|
853 | if self.idImagscope == 0: | |
854 | self.idImagscope = 100 |
|
854 | self.idImagscope = 100 | |
855 | else: |
|
855 | else: | |
856 | self.idImagscope = self.idImagscope + 1 |
|
856 | self.idImagscope = self.idImagscope + 1 | |
857 |
|
857 | |||
858 | name_parameter1 = 'id' |
|
858 | name_parameter1 = 'id' | |
859 | value1 = int(self.idImagscope) |
|
859 | value1 = int(self.idImagscope) | |
860 | format1 = 'int' |
|
860 | format1 = 'int' | |
861 | format = 'str' |
|
861 | format = 'str' | |
862 |
|
862 | |||
863 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
863 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
864 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
864 | # opObj.addParameter(name=name_parameter, value=value, format=format) | |
865 | opObj.addParameter(name=name_parameter1, value=opObj.id, format=format1) |
|
865 | opObj.addParameter(name=name_parameter1, value=opObj.id, format=format1) | |
866 |
|
866 | |||
867 | channelList = str(self.volGraphChannelList.text()).replace(" ","") |
|
867 | channelList = str(self.volGraphChannelList.text()).replace(" ","") | |
868 | xvalue = str(self.volGraphfreqrange.text()).replace(" ","") |
|
868 | xvalue = str(self.volGraphfreqrange.text()).replace(" ","") | |
869 | yvalue = str(self.volGraphHeightrange.text()).replace(" ","") |
|
869 | yvalue = str(self.volGraphHeightrange.text()).replace(" ","") | |
870 |
|
870 | |||
871 | if channelList: |
|
871 | if channelList: | |
872 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
872 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
873 |
|
873 | |||
874 | if xvalue: |
|
874 | if xvalue: | |
875 | xvalueList = xvalue.split(',') |
|
875 | xvalueList = xvalue.split(',') | |
876 | try: |
|
876 | try: | |
877 | value0 = float(xvalueList[0]) |
|
877 | value0 = float(xvalueList[0]) | |
878 | value1 = float(xvalueList[1]) |
|
878 | value1 = float(xvalueList[1]) | |
879 | except: |
|
879 | except: | |
880 | return 0 |
|
880 | return 0 | |
881 | opObj.addParameter(name='xmin', value=value0, format='float') |
|
881 | opObj.addParameter(name='xmin', value=value0, format='float') | |
882 | opObj.addParameter(name='xmax', value=value1, format='float') |
|
882 | opObj.addParameter(name='xmax', value=value1, format='float') | |
883 |
|
883 | |||
884 |
|
884 | |||
885 | if not yvalue == "": |
|
885 | if not yvalue == "": | |
886 | yvalueList = yvalue.split(",") |
|
886 | yvalueList = yvalue.split(",") | |
887 | try: |
|
887 | try: | |
888 | value0 = int(yvalueList[0]) |
|
888 | value0 = int(yvalueList[0]) | |
889 | value1 = int(yvalueList[1]) |
|
889 | value1 = int(yvalueList[1]) | |
890 | except: |
|
890 | except: | |
891 | return 0 |
|
891 | return 0 | |
892 |
|
892 | |||
893 | opObj.addParameter(name='ymin', value=value0, format='int') |
|
893 | opObj.addParameter(name='ymin', value=value0, format='int') | |
894 | opObj.addParameter(name='ymax', value=value1, format='int') |
|
894 | opObj.addParameter(name='ymax', value=value1, format='int') | |
895 |
|
895 | |||
896 | if self.volGraphCebSave.isChecked(): |
|
896 | if self.volGraphCebSave.isChecked(): | |
897 | checkPath = True |
|
897 | checkPath = True | |
898 | opObj.addParameter(name='save', value='1', format='int') |
|
898 | opObj.addParameter(name='save', value='1', format='int') | |
899 | opObj.addParameter(name='figpath', value=self.volGraphPath.text(), format='str') |
|
899 | opObj.addParameter(name='figpath', value=self.volGraphPath.text(), format='str') | |
900 | value = str(self.volGraphPrefix.text()).replace(" ","") |
|
900 | value = str(self.volGraphPrefix.text()).replace(" ","") | |
901 | if value: |
|
901 | if value: | |
902 | opObj.addParameter(name='figfile', value=value, format='str') |
|
902 | opObj.addParameter(name='figfile', value=value, format='str') | |
903 |
|
903 | |||
904 | localfolder = None |
|
904 | localfolder = None | |
905 | if checkPath: |
|
905 | if checkPath: | |
906 | localfolder = str(self.volGraphPath.text()) |
|
906 | localfolder = str(self.volGraphPath.text()) | |
907 | if localfolder == '': |
|
907 | if localfolder == '': | |
908 | self.console.clear() |
|
908 | self.console.clear() | |
909 | self.console.append("Graphic path should be defined") |
|
909 | self.console.append("Graphic path should be defined") | |
910 | return 0 |
|
910 | return 0 | |
911 |
|
911 | |||
912 | # if something happend |
|
912 | # if something happend | |
913 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Voltage') |
|
913 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Voltage') | |
914 | if parms_ok: |
|
914 | if parms_ok: | |
915 | name_operation = 'VoltageWriter' |
|
915 | name_operation = 'VoltageWriter' | |
916 | optype = 'other' |
|
916 | optype = 'other' | |
917 | name_parameter1 = 'path' |
|
917 | name_parameter1 = 'path' | |
918 | name_parameter2 = 'blocksPerFile' |
|
918 | name_parameter2 = 'blocksPerFile' | |
919 | name_parameter3 = 'profilesPerBlock' |
|
919 | name_parameter3 = 'profilesPerBlock' | |
920 | value1 = output_path |
|
920 | value1 = output_path | |
921 | value2 = blocksperfile |
|
921 | value2 = blocksperfile | |
922 | value3 = profilesperblock |
|
922 | value3 = profilesperblock | |
923 | format = "int" |
|
923 | format = "int" | |
924 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
924 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
925 | opObj.addParameter(name=name_parameter1, value=value1) |
|
925 | opObj.addParameter(name=name_parameter1, value=value1) | |
926 | opObj.addParameter(name=name_parameter2, value=value2, format=format) |
|
926 | opObj.addParameter(name=name_parameter2, value=value2, format=format) | |
927 | opObj.addParameter(name=name_parameter3, value=value3, format=format) |
|
927 | opObj.addParameter(name=name_parameter3, value=value3, format=format) | |
928 |
|
928 | |||
929 | self.console.clear() |
|
929 | self.console.clear() | |
930 | try: |
|
930 | try: | |
931 | self.refreshPUProperties(puObj) |
|
931 | self.refreshPUProperties(puObj) | |
932 | except: |
|
932 | except: | |
933 | self.console.append("Check input parameters") |
|
933 | self.console.append("Check input parameters") | |
934 | return 0 |
|
934 | return 0 | |
935 |
|
935 | |||
936 | self.console.append("If you want to save your project") |
|
936 | self.console.append("If you want to save your project") | |
937 | self.console.append("click on your project name in the Tree Project Explorer") |
|
937 | self.console.append("click on your project name in the Tree Project Explorer") | |
938 |
|
938 | |||
939 | self.actionSaveToolbar.setEnabled(True) |
|
939 | self.actionSaveToolbar.setEnabled(True) | |
940 | self.actionStarToolbar.setEnabled(True) |
|
940 | self.actionStarToolbar.setEnabled(True) | |
941 |
|
941 | |||
942 | return 1 |
|
942 | return 1 | |
943 |
|
943 | |||
944 | """ |
|
944 | """ | |
945 | Voltage Graph |
|
945 | Voltage Graph | |
946 | """ |
|
946 | """ | |
947 | @pyqtSignature("int") |
|
947 | @pyqtSignature("int") | |
948 | def on_volGraphCebSave_stateChanged(self, p0): |
|
948 | def on_volGraphCebSave_stateChanged(self, p0): | |
949 | """ |
|
949 | """ | |
950 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
950 | Check Box habilita ingresode del numero de Integraciones a realizar | |
951 | """ |
|
951 | """ | |
952 | if p0 == 2: |
|
952 | if p0 == 2: | |
953 | self.volGraphPath.setEnabled(True) |
|
953 | self.volGraphPath.setEnabled(True) | |
954 | self.volGraphPrefix.setEnabled(True) |
|
954 | self.volGraphPrefix.setEnabled(True) | |
955 | self.volGraphToolPath.setEnabled(True) |
|
955 | self.volGraphToolPath.setEnabled(True) | |
956 |
|
956 | |||
957 | if p0 == 0: |
|
957 | if p0 == 0: | |
958 | self.volGraphPath.setEnabled(False) |
|
958 | self.volGraphPath.setEnabled(False) | |
959 | self.volGraphPrefix.setEnabled(False) |
|
959 | self.volGraphPrefix.setEnabled(False) | |
960 | self.volGraphToolPath.setEnabled(False) |
|
960 | self.volGraphToolPath.setEnabled(False) | |
961 |
|
961 | |||
962 | @pyqtSignature("") |
|
962 | @pyqtSignature("") | |
963 | def on_volGraphToolPath_clicked(self): |
|
963 | def on_volGraphToolPath_clicked(self): | |
964 | """ |
|
964 | """ | |
965 | Donde se guardan los DATOS |
|
965 | Donde se guardan los DATOS | |
966 | """ |
|
966 | """ | |
967 | self.dataPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
967 | self.dataPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
968 | self.volGraphPath.setText(self.dataPath) |
|
968 | self.volGraphPath.setText(self.dataPath) | |
969 |
|
969 | |||
970 | # if not os.path.exists(self.dataPath): |
|
970 | # if not os.path.exists(self.dataPath): | |
971 | # self.volGraphOk.setEnabled(False) |
|
971 | # self.volGraphOk.setEnabled(False) | |
972 | # return |
|
972 | # return | |
973 |
|
973 | |||
974 | @pyqtSignature("int") |
|
974 | @pyqtSignature("int") | |
975 | def on_volGraphCebshow_stateChanged(self, p0): |
|
975 | def on_volGraphCebshow_stateChanged(self, p0): | |
976 | """ |
|
976 | """ | |
977 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
977 | Check Box habilita ingresode del numero de Integraciones a realizar | |
978 | """ |
|
978 | """ | |
979 | if p0 == 0: |
|
979 | if p0 == 0: | |
980 |
|
980 | |||
981 | self.volGraphChannelList.setEnabled(False) |
|
981 | self.volGraphChannelList.setEnabled(False) | |
982 | self.volGraphfreqrange.setEnabled(False) |
|
982 | self.volGraphfreqrange.setEnabled(False) | |
983 | self.volGraphHeightrange.setEnabled(False) |
|
983 | self.volGraphHeightrange.setEnabled(False) | |
984 | if p0 == 2: |
|
984 | if p0 == 2: | |
985 |
|
985 | |||
986 | self.volGraphChannelList.setEnabled(True) |
|
986 | self.volGraphChannelList.setEnabled(True) | |
987 | self.volGraphfreqrange.setEnabled(True) |
|
987 | self.volGraphfreqrange.setEnabled(True) | |
988 | self.volGraphHeightrange.setEnabled(True) |
|
988 | self.volGraphHeightrange.setEnabled(True) | |
989 |
|
989 | |||
990 | """ |
|
990 | """ | |
991 | Spectra operation |
|
991 | Spectra operation | |
992 | """ |
|
992 | """ | |
993 | @pyqtSignature("int") |
|
993 | @pyqtSignature("int") | |
994 | def on_specOpCebRadarfrequency_stateChanged(self, p0): |
|
994 | def on_specOpCebRadarfrequency_stateChanged(self, p0): | |
995 | """ |
|
995 | """ | |
996 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
996 | Check Box habilita ingresode del numero de Integraciones a realizar | |
997 | """ |
|
997 | """ | |
998 | if p0 == 2: |
|
998 | if p0 == 2: | |
999 | self.specOpRadarfrequency.setEnabled(True) |
|
999 | self.specOpRadarfrequency.setEnabled(True) | |
1000 | if p0 == 0: |
|
1000 | if p0 == 0: | |
1001 | self.specOpRadarfrequency.clear() |
|
1001 | self.specOpRadarfrequency.clear() | |
1002 | self.specOpRadarfrequency.setEnabled(False) |
|
1002 | self.specOpRadarfrequency.setEnabled(False) | |
1003 |
|
1003 | |||
1004 |
|
1004 | |||
1005 | @pyqtSignature("int") |
|
1005 | @pyqtSignature("int") | |
1006 | def on_specOpCebCrossSpectra_stateChanged(self, p0): |
|
1006 | def on_specOpCebCrossSpectra_stateChanged(self, p0): | |
1007 | """ |
|
1007 | """ | |
1008 | Habilita la opcion de aοΏ½adir el parοΏ½metro CrossSpectra a la Unidad de Procesamiento . |
|
1008 | Habilita la opcion de aοΏ½adir el parοΏ½metro CrossSpectra a la Unidad de Procesamiento . | |
1009 | """ |
|
1009 | """ | |
1010 | if p0 == 2: |
|
1010 | if p0 == 2: | |
1011 | # self.specOpnFFTpoints.setEnabled(True) |
|
1011 | # self.specOpnFFTpoints.setEnabled(True) | |
1012 | self.specOppairsList.setEnabled(True) |
|
1012 | self.specOppairsList.setEnabled(True) | |
1013 | if p0 == 0: |
|
1013 | if p0 == 0: | |
1014 | # self.specOpnFFTpoints.setEnabled(False) |
|
1014 | # self.specOpnFFTpoints.setEnabled(False) | |
1015 | self.specOppairsList.setEnabled(False) |
|
1015 | self.specOppairsList.setEnabled(False) | |
1016 |
|
1016 | |||
1017 | @pyqtSignature("int") |
|
1017 | @pyqtSignature("int") | |
1018 | def on_specOpCebChannel_stateChanged(self, p0): |
|
1018 | def on_specOpCebChannel_stateChanged(self, p0): | |
1019 | """ |
|
1019 | """ | |
1020 | Habilita la opcion de aοΏ½adir el parοΏ½metro numero de Canales a la Unidad de Procesamiento . |
|
1020 | Habilita la opcion de aοΏ½adir el parοΏ½metro numero de Canales a la Unidad de Procesamiento . | |
1021 | """ |
|
1021 | """ | |
1022 | if p0 == 2: |
|
1022 | if p0 == 2: | |
1023 | self.specOpChannel.setEnabled(True) |
|
1023 | self.specOpChannel.setEnabled(True) | |
1024 | self.specOpComChannel.setEnabled(True) |
|
1024 | self.specOpComChannel.setEnabled(True) | |
1025 | if p0 == 0: |
|
1025 | if p0 == 0: | |
1026 | self.specOpChannel.setEnabled(False) |
|
1026 | self.specOpChannel.setEnabled(False) | |
1027 | self.specOpComChannel.setEnabled(False) |
|
1027 | self.specOpComChannel.setEnabled(False) | |
1028 |
|
1028 | |||
1029 | @pyqtSignature("int") |
|
1029 | @pyqtSignature("int") | |
1030 | def on_specOpCebHeights_stateChanged(self, p0): |
|
1030 | def on_specOpCebHeights_stateChanged(self, p0): | |
1031 | """ |
|
1031 | """ | |
1032 | Habilita la opcion de aοΏ½adir el parοΏ½metro de alturas a la Unidad de Procesamiento . |
|
1032 | Habilita la opcion de aοΏ½adir el parοΏ½metro de alturas a la Unidad de Procesamiento . | |
1033 | """ |
|
1033 | """ | |
1034 | if p0 == 2: |
|
1034 | if p0 == 2: | |
1035 | self.specOpComHeights.setEnabled(True) |
|
1035 | self.specOpComHeights.setEnabled(True) | |
1036 | self.specOpHeights.setEnabled(True) |
|
1036 | self.specOpHeights.setEnabled(True) | |
1037 | if p0 == 0: |
|
1037 | if p0 == 0: | |
1038 | self.specOpComHeights.setEnabled(False) |
|
1038 | self.specOpComHeights.setEnabled(False) | |
1039 | self.specOpHeights.setEnabled(False) |
|
1039 | self.specOpHeights.setEnabled(False) | |
1040 |
|
1040 | |||
1041 |
|
1041 | |||
1042 | @pyqtSignature("int") |
|
1042 | @pyqtSignature("int") | |
1043 | def on_specOpCebIncoherent_stateChanged(self, p0): |
|
1043 | def on_specOpCebIncoherent_stateChanged(self, p0): | |
1044 | """ |
|
1044 | """ | |
1045 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . |
|
1045 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . | |
1046 | """ |
|
1046 | """ | |
1047 | if p0 == 2: |
|
1047 | if p0 == 2: | |
1048 | self.specOpIncoherent.setEnabled(True) |
|
1048 | self.specOpIncoherent.setEnabled(True) | |
1049 | if p0 == 0: |
|
1049 | if p0 == 0: | |
1050 | self.specOpIncoherent.setEnabled(False) |
|
1050 | self.specOpIncoherent.setEnabled(False) | |
1051 |
|
1051 | |||
1052 | @pyqtSignature("int") |
|
1052 | @pyqtSignature("int") | |
1053 | def on_specOpCebRemoveDC_stateChanged(self, p0): |
|
1053 | def on_specOpCebRemoveDC_stateChanged(self, p0): | |
1054 | """ |
|
1054 | """ | |
1055 | Habilita la opcion de aοΏ½adir el parοΏ½metro remover DC a la Unidad de Procesamiento . |
|
1055 | Habilita la opcion de aοΏ½adir el parοΏ½metro remover DC a la Unidad de Procesamiento . | |
1056 | """ |
|
1056 | """ | |
1057 | if p0 == 2: |
|
1057 | if p0 == 2: | |
1058 | self.specOpComRemoveDC.setEnabled(True) |
|
1058 | self.specOpComRemoveDC.setEnabled(True) | |
1059 | if p0 == 0: |
|
1059 | if p0 == 0: | |
1060 | self.specOpComRemoveDC.setEnabled(False) |
|
1060 | self.specOpComRemoveDC.setEnabled(False) | |
1061 |
|
1061 | |||
1062 | @pyqtSignature("int") |
|
1062 | @pyqtSignature("int") | |
1063 | def on_specOpCebgetNoise_stateChanged(self, p0): |
|
1063 | def on_specOpCebgetNoise_stateChanged(self, p0): | |
1064 | """ |
|
1064 | """ | |
1065 | Habilita la opcion de aοΏ½adir la estimacion de ruido a la Unidad de Procesamiento . |
|
1065 | Habilita la opcion de aοΏ½adir la estimacion de ruido a la Unidad de Procesamiento . | |
1066 | """ |
|
1066 | """ | |
1067 | if p0 == 2: |
|
1067 | if p0 == 2: | |
1068 | self.specOpgetNoise.setEnabled(True) |
|
1068 | self.specOpgetNoise.setEnabled(True) | |
1069 |
|
1069 | |||
1070 | if p0 == 0: |
|
1070 | if p0 == 0: | |
1071 | self.specOpgetNoise.setEnabled(False) |
|
1071 | self.specOpgetNoise.setEnabled(False) | |
1072 |
|
1072 | |||
1073 | @pyqtSignature("") |
|
1073 | @pyqtSignature("") | |
1074 | def on_specOpOk_clicked(self): |
|
1074 | def on_specOpOk_clicked(self): | |
1075 | """ |
|
1075 | """ | |
1076 | AΓADE OPERACION SPECTRA |
|
1076 | AΓADE OPERACION SPECTRA | |
1077 | """ |
|
1077 | """ | |
1078 |
|
1078 | |||
1079 | addFTP = False |
|
1079 | addFTP = False | |
1080 | checkPath = False |
|
1080 | checkPath = False | |
1081 |
|
1081 | |||
1082 | self.actionSaveToolbar.setEnabled(False) |
|
1082 | self.actionSaveToolbar.setEnabled(False) | |
1083 | self.actionStarToolbar.setEnabled(False) |
|
1083 | self.actionStarToolbar.setEnabled(False) | |
1084 |
|
1084 | |||
1085 | projectObj = self.getSelectedProjectObj() |
|
1085 | projectObj = self.getSelectedProjectObj() | |
1086 | puObj = self.getSelectedItemObj() |
|
1086 | puObj = self.getSelectedItemObj() | |
1087 |
|
1087 | |||
1088 | puObj.removeOperations() |
|
1088 | puObj.removeOperations() | |
1089 |
|
1089 | |||
1090 | if self.specOpCebRadarfrequency.isChecked(): |
|
1090 | if self.specOpCebRadarfrequency.isChecked(): | |
1091 | value = self.specOpRadarfrequency.text() |
|
1091 | value = self.specOpRadarfrequency.text() | |
1092 | format = 'float' |
|
1092 | format = 'float' | |
1093 | name_operation = 'setRadarFrequency' |
|
1093 | name_operation = 'setRadarFrequency' | |
1094 | name_parameter = 'frequency' |
|
1094 | name_parameter = 'frequency' | |
1095 | if not value == "": |
|
1095 | if not value == "": | |
1096 | try: |
|
1096 | try: | |
1097 | radarfreq = float(self.specOpRadarfrequency.text())*1e6 |
|
1097 | radarfreq = float(self.specOpRadarfrequency.text())*1e6 | |
1098 | except: |
|
1098 | except: | |
1099 | self.console.clear() |
|
1099 | self.console.clear() | |
1100 | self.console.append("Write the parameter Radar Frequency type float") |
|
1100 | self.console.append("Write the parameter Radar Frequency type float") | |
1101 | return 0 |
|
1101 | return 0 | |
1102 | opObj = puObj.addOperation(name=name_operation) |
|
1102 | opObj = puObj.addOperation(name=name_operation) | |
1103 | opObj.addParameter(name=name_parameter, value=radarfreq, format=format) |
|
1103 | opObj.addParameter(name=name_parameter, value=radarfreq, format=format) | |
1104 |
|
1104 | |||
1105 | inputId = puObj.getInputId() |
|
1105 | inputId = puObj.getInputId() | |
1106 | inputPuObj = projectObj.getProcUnitObj(inputId) |
|
1106 | inputPuObj = projectObj.getProcUnitObj(inputId) | |
1107 |
|
1107 | |||
1108 | if inputPuObj.datatype == 'Voltage' or inputPuObj.datatype == 'USRP': |
|
1108 | if inputPuObj.datatype == 'Voltage' or inputPuObj.datatype == 'USRP': | |
1109 |
|
1109 | |||
1110 | try: |
|
1110 | try: | |
1111 | value = int(self.specOpnFFTpoints.text()) |
|
1111 | value = int(self.specOpnFFTpoints.text()) | |
1112 | puObj.addParameter(name='nFFTPoints', value=value, format='int') |
|
1112 | puObj.addParameter(name='nFFTPoints', value=value, format='int') | |
1113 | except: |
|
1113 | except: | |
1114 | self.console.clear() |
|
1114 | self.console.clear() | |
1115 | self.console.append("Please write the number of FFT") |
|
1115 | self.console.append("Please write the number of FFT") | |
1116 | return 0 |
|
1116 | return 0 | |
1117 |
|
1117 | |||
1118 | try: |
|
1118 | try: | |
1119 | value1 = int(self.specOpProfiles.text()) |
|
1119 | value1 = int(self.specOpProfiles.text()) | |
1120 | puObj.addParameter(name='nProfiles', value=value1, format='int') |
|
1120 | puObj.addParameter(name='nProfiles', value=value1, format='int') | |
1121 | except: |
|
1121 | except: | |
1122 | self.console.append("Please Write the number of Profiles") |
|
1122 | self.console.append("Please Write the number of Profiles") | |
1123 |
|
1123 | |||
1124 | try: |
|
1124 | try: | |
1125 | value2 = int(self.specOpippFactor.text()) |
|
1125 | value2 = int(self.specOpippFactor.text()) | |
1126 | puObj.addParameter(name='ippFactor' , value=value2 , format='int') |
|
1126 | puObj.addParameter(name='ippFactor' , value=value2 , format='int') | |
1127 | except: |
|
1127 | except: | |
1128 | self.console.append("Please Write the Number of IppFactor") |
|
1128 | self.console.append("Please Write the Number of IppFactor") | |
1129 |
|
1129 | |||
1130 |
|
1130 | |||
1131 | if self.specOpCebCrossSpectra.isChecked(): |
|
1131 | if self.specOpCebCrossSpectra.isChecked(): | |
1132 | name_parameter = 'pairsList' |
|
1132 | name_parameter = 'pairsList' | |
1133 | format = 'pairslist' |
|
1133 | format = 'pairslist' | |
1134 | value2 = self.specOppairsList.text() |
|
1134 | value2 = self.specOppairsList.text() | |
1135 |
|
1135 | |||
1136 | if value2 == "": |
|
1136 | if value2 == "": | |
1137 | print "Please fill the pairs list field" |
|
1137 | print "Please fill the pairs list field" | |
1138 | return 0 |
|
1138 | return 0 | |
1139 |
|
1139 | |||
1140 | puObj.addParameter(name=name_parameter, value=value2, format=format) |
|
1140 | puObj.addParameter(name=name_parameter, value=value2, format=format) | |
1141 |
|
1141 | |||
1142 | if self.specOpCebHeights.isChecked(): |
|
1142 | if self.specOpCebHeights.isChecked(): | |
1143 | value = str(self.specOpHeights.text()) |
|
1143 | value = str(self.specOpHeights.text()) | |
1144 |
|
1144 | |||
1145 | if value == "": |
|
1145 | if value == "": | |
1146 | print "Please fill height range" |
|
1146 | print "Please fill height range" | |
1147 | return 0 |
|
1147 | return 0 | |
1148 |
|
1148 | |||
1149 | valueList = value.split(',') |
|
1149 | valueList = value.split(',') | |
1150 | format = 'float' |
|
1150 | format = 'float' | |
1151 | value0 = valueList[0] |
|
1151 | value0 = valueList[0] | |
1152 | value1 = valueList[1] |
|
1152 | value1 = valueList[1] | |
1153 |
|
1153 | |||
1154 | if self.specOpComHeights.currentIndex() == 0: |
|
1154 | if self.specOpComHeights.currentIndex() == 0: | |
1155 | name_operation = 'selectHeights' |
|
1155 | name_operation = 'selectHeights' | |
1156 | name_parameter1 = 'minHei' |
|
1156 | name_parameter1 = 'minHei' | |
1157 | name_parameter2 = 'maxHei' |
|
1157 | name_parameter2 = 'maxHei' | |
1158 | else: |
|
1158 | else: | |
1159 | name_operation = 'selectHeightsByIndex' |
|
1159 | name_operation = 'selectHeightsByIndex' | |
1160 | name_parameter1 = 'minIndex' |
|
1160 | name_parameter1 = 'minIndex' | |
1161 | name_parameter2 = 'maxIndex' |
|
1161 | name_parameter2 = 'maxIndex' | |
1162 | opObj = puObj.addOperation(name=name_operation) |
|
1162 | opObj = puObj.addOperation(name=name_operation) | |
1163 | opObj.addParameter(name=name_parameter1, value=value0, format=format) |
|
1163 | opObj.addParameter(name=name_parameter1, value=value0, format=format) | |
1164 | opObj.addParameter(name=name_parameter2, value=value1, format=format) |
|
1164 | opObj.addParameter(name=name_parameter2, value=value1, format=format) | |
1165 |
|
1165 | |||
1166 | if self.specOpCebChannel.isChecked(): |
|
1166 | if self.specOpCebChannel.isChecked(): | |
1167 | value = str(self.specOpChannel.text()) |
|
1167 | value = str(self.specOpChannel.text()) | |
1168 |
|
1168 | |||
1169 | if value == "": |
|
1169 | if value == "": | |
1170 | print "Please fill channel list" |
|
1170 | print "Please fill channel list" | |
1171 | return 0 |
|
1171 | return 0 | |
1172 |
|
1172 | |||
1173 | format = 'intlist' |
|
1173 | format = 'intlist' | |
1174 | if self.specOpComChannel.currentIndex() == 0: |
|
1174 | if self.specOpComChannel.currentIndex() == 0: | |
1175 | name_operation = "selectChannels" |
|
1175 | name_operation = "selectChannels" | |
1176 | name_parameter = 'channelList' |
|
1176 | name_parameter = 'channelList' | |
1177 | else: |
|
1177 | else: | |
1178 | name_operation = "selectChannelsByIndex" |
|
1178 | name_operation = "selectChannelsByIndex" | |
1179 | name_parameter = 'channelIndexList' |
|
1179 | name_parameter = 'channelIndexList' | |
1180 |
|
1180 | |||
1181 | opObj = puObj.addOperation(name=name_operation) |
|
1181 | opObj = puObj.addOperation(name=name_operation) | |
1182 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1182 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
1183 |
|
1183 | |||
1184 | if self.specOpCebIncoherent.isChecked(): |
|
1184 | if self.specOpCebIncoherent.isChecked(): | |
1185 | value = str(self.specOpIncoherent.text()) |
|
1185 | value = str(self.specOpIncoherent.text()) | |
1186 |
|
1186 | |||
1187 | if value == "": |
|
1187 | if value == "": | |
1188 | print "Please fill Incoherent integration value" |
|
1188 | print "Please fill Incoherent integration value" | |
1189 | return 0 |
|
1189 | return 0 | |
1190 |
|
1190 | |||
1191 | name_operation = 'IncohInt' |
|
1191 | name_operation = 'IncohInt' | |
1192 | optype = 'other' |
|
1192 | optype = 'other' | |
1193 | if self.specOpCobIncInt.currentIndex() == 0: |
|
1193 | if self.specOpCobIncInt.currentIndex() == 0: | |
1194 | name_parameter = 'timeInterval' |
|
1194 | name_parameter = 'timeInterval' | |
1195 | format = 'float' |
|
1195 | format = 'float' | |
1196 | else: |
|
1196 | else: | |
1197 | name_parameter = 'n' |
|
1197 | name_parameter = 'n' | |
1198 | format = 'float' |
|
1198 | format = 'float' | |
1199 |
|
1199 | |||
1200 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1200 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
1201 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1201 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
1202 |
|
1202 | |||
1203 | if self.specOpCebRemoveDC.isChecked(): |
|
1203 | if self.specOpCebRemoveDC.isChecked(): | |
1204 | name_operation = 'removeDC' |
|
1204 | name_operation = 'removeDC' | |
1205 | name_parameter = 'mode' |
|
1205 | name_parameter = 'mode' | |
1206 | format = 'int' |
|
1206 | format = 'int' | |
1207 | if self.specOpComRemoveDC.currentIndex() == 0: |
|
1207 | if self.specOpComRemoveDC.currentIndex() == 0: | |
1208 | value = 1 |
|
1208 | value = 1 | |
1209 | else: |
|
1209 | else: | |
1210 | value = 2 |
|
1210 | value = 2 | |
1211 | opObj = puObj.addOperation(name=name_operation) |
|
1211 | opObj = puObj.addOperation(name=name_operation) | |
1212 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1212 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
1213 |
|
1213 | |||
1214 | if self.specOpCebRemoveInt.isChecked(): |
|
1214 | if self.specOpCebRemoveInt.isChecked(): | |
1215 | name_operation = 'removeInterference' |
|
1215 | name_operation = 'removeInterference' | |
1216 | opObj = puObj.addOperation(name=name_operation) |
|
1216 | opObj = puObj.addOperation(name=name_operation) | |
1217 |
|
1217 | |||
1218 |
|
1218 | |||
1219 | if self.specOpCebgetNoise.isChecked(): |
|
1219 | if self.specOpCebgetNoise.isChecked(): | |
1220 | value = self.specOpgetNoise.text() |
|
1220 | value = self.specOpgetNoise.text() | |
1221 | valueList = value.split(',') |
|
1221 | valueList = value.split(',') | |
1222 | format = 'float' |
|
1222 | format = 'float' | |
1223 | name_operation = "getNoise" |
|
1223 | name_operation = "getNoise" | |
1224 | opObj = puObj.addOperation(name=name_operation) |
|
1224 | opObj = puObj.addOperation(name=name_operation) | |
1225 |
|
1225 | |||
1226 | if not value == '': |
|
1226 | if not value == '': | |
1227 | valueList = value.split(',') |
|
1227 | valueList = value.split(',') | |
1228 | length = len(valueList) |
|
1228 | length = len(valueList) | |
1229 | if length == 1: |
|
1229 | if length == 1: | |
1230 | try: |
|
1230 | try: | |
1231 | value1 = float(valueList[0]) |
|
1231 | value1 = float(valueList[0]) | |
1232 | except: |
|
1232 | except: | |
1233 | self.console.clear() |
|
1233 | self.console.clear() | |
1234 | self.console.append("Please Write correct parameter Get Noise") |
|
1234 | self.console.append("Please Write correct parameter Get Noise") | |
1235 | return 0 |
|
1235 | return 0 | |
1236 | name1 = 'minHei' |
|
1236 | name1 = 'minHei' | |
1237 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1237 | opObj.addParameter(name=name1, value=value1, format=format) | |
1238 | elif length == 2: |
|
1238 | elif length == 2: | |
1239 | try: |
|
1239 | try: | |
1240 | value1 = float(valueList[0]) |
|
1240 | value1 = float(valueList[0]) | |
1241 | value2 = float(valueList[1]) |
|
1241 | value2 = float(valueList[1]) | |
1242 | except: |
|
1242 | except: | |
1243 | self.console.clear() |
|
1243 | self.console.clear() | |
1244 | self.console.append("Please Write corrects parameter Get Noise") |
|
1244 | self.console.append("Please Write corrects parameter Get Noise") | |
1245 | return 0 |
|
1245 | return 0 | |
1246 | name1 = 'minHei' |
|
1246 | name1 = 'minHei' | |
1247 | name2 = 'maxHei' |
|
1247 | name2 = 'maxHei' | |
1248 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1248 | opObj.addParameter(name=name1, value=value1, format=format) | |
1249 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1249 | opObj.addParameter(name=name2, value=value2, format=format) | |
1250 |
|
1250 | |||
1251 | elif length == 3: |
|
1251 | elif length == 3: | |
1252 | try: |
|
1252 | try: | |
1253 | value1 = float(valueList[0]) |
|
1253 | value1 = float(valueList[0]) | |
1254 | value2 = float(valueList[1]) |
|
1254 | value2 = float(valueList[1]) | |
1255 | value3 = float(valueList[2]) |
|
1255 | value3 = float(valueList[2]) | |
1256 | except: |
|
1256 | except: | |
1257 | self.console.clear() |
|
1257 | self.console.clear() | |
1258 | self.console.append("Please Write corrects parameter Get Noise") |
|
1258 | self.console.append("Please Write corrects parameter Get Noise") | |
1259 | return 0 |
|
1259 | return 0 | |
1260 | name1 = 'minHei' |
|
1260 | name1 = 'minHei' | |
1261 | name2 = 'maxHei' |
|
1261 | name2 = 'maxHei' | |
1262 | name3 = 'minVel' |
|
1262 | name3 = 'minVel' | |
1263 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1263 | opObj.addParameter(name=name1, value=value1, format=format) | |
1264 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1264 | opObj.addParameter(name=name2, value=value2, format=format) | |
1265 | opObj.addParameter(name=name3, value=value3, format=format) |
|
1265 | opObj.addParameter(name=name3, value=value3, format=format) | |
1266 |
|
1266 | |||
1267 | elif length == 4: |
|
1267 | elif length == 4: | |
1268 | try: |
|
1268 | try: | |
1269 | value1 = float(valueList[0]) |
|
1269 | value1 = float(valueList[0]) | |
1270 | value2 = float(valueList[1]) |
|
1270 | value2 = float(valueList[1]) | |
1271 | value3 = float(valueList[2]) |
|
1271 | value3 = float(valueList[2]) | |
1272 | value4 = float(valueList[3]) |
|
1272 | value4 = float(valueList[3]) | |
1273 | except: |
|
1273 | except: | |
1274 | self.console.clear() |
|
1274 | self.console.clear() | |
1275 | self.console.append("Please Write corrects parameter Get Noise") |
|
1275 | self.console.append("Please Write corrects parameter Get Noise") | |
1276 | return 0 |
|
1276 | return 0 | |
1277 | name1 = 'minHei' |
|
1277 | name1 = 'minHei' | |
1278 | name2 = 'maxHei' |
|
1278 | name2 = 'maxHei' | |
1279 | name3 = 'minVel' |
|
1279 | name3 = 'minVel' | |
1280 | name4 = 'maxVel' |
|
1280 | name4 = 'maxVel' | |
1281 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1281 | opObj.addParameter(name=name1, value=value1, format=format) | |
1282 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1282 | opObj.addParameter(name=name2, value=value2, format=format) | |
1283 | opObj.addParameter(name=name3, value=value3, format=format) |
|
1283 | opObj.addParameter(name=name3, value=value3, format=format) | |
1284 | opObj.addParameter(name=name4, value=value4, format=format) |
|
1284 | opObj.addParameter(name=name4, value=value4, format=format) | |
1285 |
|
1285 | |||
1286 | elif length > 4: |
|
1286 | elif length > 4: | |
1287 | self.console.clear() |
|
1287 | self.console.clear() | |
1288 | self.console.append("Get Noise Operation only accepts 4 parameters") |
|
1288 | self.console.append("Get Noise Operation only accepts 4 parameters") | |
1289 | return 0 |
|
1289 | return 0 | |
1290 |
|
1290 | |||
1291 | channelList = str(self.specGgraphChannelList.text()).replace(" ","") |
|
1291 | channelList = str(self.specGgraphChannelList.text()).replace(" ","") | |
1292 | vel_range = str(self.specGgraphFreq.text()).replace(" ","") |
|
1292 | vel_range = str(self.specGgraphFreq.text()).replace(" ","") | |
1293 | hei_range = str(self.specGgraphHeight.text()).replace(" ","") |
|
1293 | hei_range = str(self.specGgraphHeight.text()).replace(" ","") | |
1294 | db_range = str(self.specGgraphDbsrange.text()).replace(" ","") |
|
1294 | db_range = str(self.specGgraphDbsrange.text()).replace(" ","") | |
1295 |
|
1295 | |||
1296 | trange = str(self.specGgraphTminTmax.text()).replace(" ","") |
|
1296 | trange = str(self.specGgraphTminTmax.text()).replace(" ","") | |
1297 | magrange = str(self.specGgraphmagnitud.text()).replace(" ","") |
|
1297 | magrange = str(self.specGgraphmagnitud.text()).replace(" ","") | |
1298 | phaserange = str(self.specGgraphPhase.text()).replace(" ","") |
|
1298 | phaserange = str(self.specGgraphPhase.text()).replace(" ","") | |
1299 | # timerange = str(self.specGgraphTimeRange.text()).replace(" ","") |
|
1299 | # timerange = str(self.specGgraphTimeRange.text()).replace(" ","") | |
1300 |
|
1300 | |||
1301 | figpath = str(self.specGraphPath.text()) |
|
1301 | figpath = str(self.specGraphPath.text()) | |
1302 | figfile = str(self.specGraphPrefix.text()).replace(" ","") |
|
1302 | figfile = str(self.specGraphPrefix.text()).replace(" ","") | |
1303 | try: |
|
1303 | try: | |
1304 | wrperiod = int(str(self.specGgraphftpratio.text()).replace(" ","")) |
|
1304 | wrperiod = int(str(self.specGgraphftpratio.text()).replace(" ","")) | |
1305 | except: |
|
1305 | except: | |
1306 | wrperiod = None |
|
1306 | wrperiod = None | |
1307 |
|
1307 | |||
1308 | #-----Spectra Plot----- |
|
1308 | #-----Spectra Plot----- | |
1309 | if self.specGraphCebSpectraplot.isChecked(): |
|
1309 | if self.specGraphCebSpectraplot.isChecked(): | |
1310 |
|
1310 | |||
1311 | opObj = puObj.addOperation(name='SpectraPlot', optype='other') |
|
1311 | opObj = puObj.addOperation(name='SpectraPlot', optype='other') | |
1312 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1312 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
1313 |
|
1313 | |||
1314 | if not channelList == '': |
|
1314 | if not channelList == '': | |
1315 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1315 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
1316 |
|
1316 | |||
1317 | if not vel_range == '': |
|
1317 | if not vel_range == '': | |
1318 | xvalueList = vel_range.split(',') |
|
1318 | xvalueList = vel_range.split(',') | |
1319 | try: |
|
1319 | try: | |
1320 | value1 = float(xvalueList[0]) |
|
1320 | value1 = float(xvalueList[0]) | |
1321 | value2 = float(xvalueList[1]) |
|
1321 | value2 = float(xvalueList[1]) | |
1322 | except: |
|
1322 | except: | |
1323 | self.console.clear() |
|
1323 | self.console.clear() | |
1324 | self.console.append("Invalid velocity/frequency range") |
|
1324 | self.console.append("Invalid velocity/frequency range") | |
1325 | return 0 |
|
1325 | return 0 | |
1326 |
|
1326 | |||
1327 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1327 | opObj.addParameter(name='xmin', value=value1, format='float') | |
1328 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1328 | opObj.addParameter(name='xmax', value=value2, format='float') | |
1329 |
|
1329 | |||
1330 | if not hei_range == '': |
|
1330 | if not hei_range == '': | |
1331 | yvalueList = hei_range.split(",") |
|
1331 | yvalueList = hei_range.split(",") | |
1332 | try: |
|
1332 | try: | |
1333 | value1 = float(yvalueList[0]) |
|
1333 | value1 = float(yvalueList[0]) | |
1334 | value2 = float(yvalueList[1]) |
|
1334 | value2 = float(yvalueList[1]) | |
1335 | except: |
|
1335 | except: | |
1336 | self.console.clear() |
|
1336 | self.console.clear() | |
1337 | self.console.append("Invalid height range") |
|
1337 | self.console.append("Invalid height range") | |
1338 | return 0 |
|
1338 | return 0 | |
1339 |
|
1339 | |||
1340 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1340 | opObj.addParameter(name='ymin', value=value1, format='float') | |
1341 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1341 | opObj.addParameter(name='ymax', value=value2, format='float') | |
1342 |
|
1342 | |||
1343 | if not db_range == '': |
|
1343 | if not db_range == '': | |
1344 | zvalueList = db_range.split(",") |
|
1344 | zvalueList = db_range.split(",") | |
1345 | try: |
|
1345 | try: | |
1346 | value1 = float(zvalueList[0]) |
|
1346 | value1 = float(zvalueList[0]) | |
1347 | value2 = float(zvalueList[1]) |
|
1347 | value2 = float(zvalueList[1]) | |
1348 | except: |
|
1348 | except: | |
1349 | self.console.clear() |
|
1349 | self.console.clear() | |
1350 | self.console.append("Invalid db range") |
|
1350 | self.console.append("Invalid db range") | |
1351 | return 0 |
|
1351 | return 0 | |
1352 |
|
1352 | |||
1353 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1353 | opObj.addParameter(name='zmin', value=value1, format='float') | |
1354 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1354 | opObj.addParameter(name='zmax', value=value2, format='float') | |
1355 |
|
1355 | |||
1356 | if self.specGraphSaveSpectra.isChecked(): |
|
1356 | if self.specGraphSaveSpectra.isChecked(): | |
1357 | checkPath = True |
|
1357 | checkPath = True | |
1358 | opObj.addParameter(name='save', value=1 , format='bool') |
|
1358 | opObj.addParameter(name='save', value=1 , format='bool') | |
1359 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1359 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
1360 | if figfile: |
|
1360 | if figfile: | |
1361 | opObj.addParameter(name='figfile', value=figfile, format='str') |
|
1361 | opObj.addParameter(name='figfile', value=figfile, format='str') | |
1362 | if wrperiod: |
|
1362 | if wrperiod: | |
1363 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1363 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
1364 |
|
1364 | |||
1365 | if self.specGraphftpSpectra.isChecked(): |
|
1365 | if self.specGraphftpSpectra.isChecked(): | |
1366 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1366 | opObj.addParameter(name='ftp', value='1', format='int') | |
1367 | self.addFTPConf2Operation(puObj, opObj) |
|
1367 | self.addFTPConf2Operation(puObj, opObj) | |
1368 | addFTP = True |
|
1368 | addFTP = True | |
1369 |
|
1369 | |||
1370 | if self.specGraphCebCrossSpectraplot.isChecked(): |
|
1370 | if self.specGraphCebCrossSpectraplot.isChecked(): | |
1371 |
|
1371 | |||
1372 | opObj = puObj.addOperation(name='CrossSpectraPlot', optype='other') |
|
1372 | opObj = puObj.addOperation(name='CrossSpectraPlot', optype='other') | |
1373 | # opObj.addParameter(name='power_cmap', value='jet', format='str') |
|
1373 | # opObj.addParameter(name='power_cmap', value='jet', format='str') | |
1374 | # opObj.addParameter(name='coherence_cmap', value='jet', format='str') |
|
1374 | # opObj.addParameter(name='coherence_cmap', value='jet', format='str') | |
1375 | # opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') |
|
1375 | # opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') | |
1376 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1376 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
1377 |
|
1377 | |||
1378 | if not vel_range == '': |
|
1378 | if not vel_range == '': | |
1379 | xvalueList = vel_range.split(',') |
|
1379 | xvalueList = vel_range.split(',') | |
1380 | try: |
|
1380 | try: | |
1381 | value1 = float(xvalueList[0]) |
|
1381 | value1 = float(xvalueList[0]) | |
1382 | value2 = float(xvalueList[1]) |
|
1382 | value2 = float(xvalueList[1]) | |
1383 | except: |
|
1383 | except: | |
1384 | self.console.clear() |
|
1384 | self.console.clear() | |
1385 | self.console.append("Invalid velocity/frequency range") |
|
1385 | self.console.append("Invalid velocity/frequency range") | |
1386 | return 0 |
|
1386 | return 0 | |
1387 |
|
1387 | |||
1388 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1388 | opObj.addParameter(name='xmin', value=value1, format='float') | |
1389 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1389 | opObj.addParameter(name='xmax', value=value2, format='float') | |
1390 |
|
1390 | |||
1391 | if not hei_range == '': |
|
1391 | if not hei_range == '': | |
1392 | yvalueList = hei_range.split(",") |
|
1392 | yvalueList = hei_range.split(",") | |
1393 | try: |
|
1393 | try: | |
1394 | value1 = float(yvalueList[0]) |
|
1394 | value1 = float(yvalueList[0]) | |
1395 | value2 = float(yvalueList[1]) |
|
1395 | value2 = float(yvalueList[1]) | |
1396 | except: |
|
1396 | except: | |
1397 | self.console.clear() |
|
1397 | self.console.clear() | |
1398 | self.console.append("Invalid height range") |
|
1398 | self.console.append("Invalid height range") | |
1399 | return 0 |
|
1399 | return 0 | |
1400 |
|
1400 | |||
1401 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1401 | opObj.addParameter(name='ymin', value=value1, format='float') | |
1402 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1402 | opObj.addParameter(name='ymax', value=value2, format='float') | |
1403 |
|
1403 | |||
1404 | if not db_range == '': |
|
1404 | if not db_range == '': | |
1405 | zvalueList = db_range.split(",") |
|
1405 | zvalueList = db_range.split(",") | |
1406 | try: |
|
1406 | try: | |
1407 | value1 = float(zvalueList[0]) |
|
1407 | value1 = float(zvalueList[0]) | |
1408 | value2 = float(zvalueList[1]) |
|
1408 | value2 = float(zvalueList[1]) | |
1409 | except: |
|
1409 | except: | |
1410 | self.console.clear() |
|
1410 | self.console.clear() | |
1411 | self.console.append("Invalid db range") |
|
1411 | self.console.append("Invalid db range") | |
1412 | return 0 |
|
1412 | return 0 | |
1413 |
|
1413 | |||
1414 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1414 | opObj.addParameter(name='zmin', value=value1, format='float') | |
1415 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1415 | opObj.addParameter(name='zmax', value=value2, format='float') | |
1416 |
|
1416 | |||
1417 | if not magrange == '': |
|
1417 | if not magrange == '': | |
1418 | zvalueList = magrange.split(",") |
|
1418 | zvalueList = magrange.split(",") | |
1419 | try: |
|
1419 | try: | |
1420 | value1 = float(zvalueList[0]) |
|
1420 | value1 = float(zvalueList[0]) | |
1421 | value2 = float(zvalueList[1]) |
|
1421 | value2 = float(zvalueList[1]) | |
1422 | except: |
|
1422 | except: | |
1423 | self.console.clear() |
|
1423 | self.console.clear() | |
1424 | self.console.append("Invalid magnitude range") |
|
1424 | self.console.append("Invalid magnitude range") | |
1425 | return 0 |
|
1425 | return 0 | |
1426 |
|
1426 | |||
1427 | opObj.addParameter(name='coh_min', value=value1, format='float') |
|
1427 | opObj.addParameter(name='coh_min', value=value1, format='float') | |
1428 | opObj.addParameter(name='coh_max', value=value2, format='float') |
|
1428 | opObj.addParameter(name='coh_max', value=value2, format='float') | |
1429 |
|
1429 | |||
1430 | if not phaserange == '': |
|
1430 | if not phaserange == '': | |
1431 | zvalueList = phaserange.split(",") |
|
1431 | zvalueList = phaserange.split(",") | |
1432 | try: |
|
1432 | try: | |
1433 | value1 = float(zvalueList[0]) |
|
1433 | value1 = float(zvalueList[0]) | |
1434 | value2 = float(zvalueList[1]) |
|
1434 | value2 = float(zvalueList[1]) | |
1435 | except: |
|
1435 | except: | |
1436 | self.console.clear() |
|
1436 | self.console.clear() | |
1437 | self.console.append("Invalid phase range") |
|
1437 | self.console.append("Invalid phase range") | |
1438 | return 0 |
|
1438 | return 0 | |
1439 |
|
1439 | |||
1440 | opObj.addParameter(name='phase_min', value=value1, format='float') |
|
1440 | opObj.addParameter(name='phase_min', value=value1, format='float') | |
1441 | opObj.addParameter(name='phase_max', value=value2, format='float') |
|
1441 | opObj.addParameter(name='phase_max', value=value2, format='float') | |
1442 |
|
1442 | |||
1443 | if self.specGraphSaveCross.isChecked(): |
|
1443 | if self.specGraphSaveCross.isChecked(): | |
1444 | checkPath = True |
|
1444 | checkPath = True | |
1445 | opObj.addParameter(name='save', value='1', format='bool') |
|
1445 | opObj.addParameter(name='save', value='1', format='bool') | |
1446 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1446 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
1447 | if figfile: |
|
1447 | if figfile: | |
1448 | opObj.addParameter(name='figfile', value=figfile, format='str') |
|
1448 | opObj.addParameter(name='figfile', value=figfile, format='str') | |
1449 | if wrperiod: |
|
1449 | if wrperiod: | |
1450 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1450 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
1451 |
|
1451 | |||
1452 | if self.specGraphftpCross.isChecked(): |
|
1452 | if self.specGraphftpCross.isChecked(): | |
1453 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1453 | opObj.addParameter(name='ftp', value='1', format='int') | |
1454 | self.addFTPConf2Operation(puObj, opObj) |
|
1454 | self.addFTPConf2Operation(puObj, opObj) | |
1455 | addFTP = True |
|
1455 | addFTP = True | |
1456 |
|
1456 | |||
1457 | if self.specGraphCebRTIplot.isChecked(): |
|
1457 | if self.specGraphCebRTIplot.isChecked(): | |
1458 |
|
1458 | |||
1459 | opObj = puObj.addOperation(name='RTIPlot', optype='other') |
|
1459 | opObj = puObj.addOperation(name='RTIPlot', optype='other') | |
1460 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1460 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
1461 |
|
1461 | |||
1462 | if not channelList == '': |
|
1462 | if not channelList == '': | |
1463 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1463 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
1464 |
|
1464 | |||
1465 | if not trange == '': |
|
1465 | if not trange == '': | |
1466 | xvalueList = trange.split(',') |
|
1466 | xvalueList = trange.split(',') | |
1467 | try: |
|
1467 | try: | |
1468 | value1 = float(xvalueList[0]) |
|
1468 | value1 = float(xvalueList[0]) | |
1469 | value2 = float(xvalueList[1]) |
|
1469 | value2 = float(xvalueList[1]) | |
1470 | except: |
|
1470 | except: | |
1471 | self.console.clear() |
|
1471 | self.console.clear() | |
1472 | self.console.append("Invalid time range") |
|
1472 | self.console.append("Invalid time range") | |
1473 | return 0 |
|
1473 | return 0 | |
1474 |
|
1474 | |||
1475 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1475 | opObj.addParameter(name='xmin', value=value1, format='float') | |
1476 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1476 | opObj.addParameter(name='xmax', value=value2, format='float') | |
1477 |
|
1477 | |||
1478 | # if not timerange == '': |
|
1478 | # if not timerange == '': | |
1479 | # try: |
|
1479 | # try: | |
1480 | # timerange = float(timerange) |
|
1480 | # timerange = float(timerange) | |
1481 | # except: |
|
1481 | # except: | |
1482 | # self.console.clear() |
|
1482 | # self.console.clear() | |
1483 | # self.console.append("Invalid time range") |
|
1483 | # self.console.append("Invalid time range") | |
1484 | # return 0 |
|
1484 | # return 0 | |
1485 | # |
|
1485 | # | |
1486 | # opObj.addParameter(name='timerange', value=timerange, format='float') |
|
1486 | # opObj.addParameter(name='timerange', value=timerange, format='float') | |
1487 |
|
1487 | |||
1488 | if not hei_range == '': |
|
1488 | if not hei_range == '': | |
1489 | yvalueList = hei_range.split(",") |
|
1489 | yvalueList = hei_range.split(",") | |
1490 | try: |
|
1490 | try: | |
1491 | value1 = float(yvalueList[0]) |
|
1491 | value1 = float(yvalueList[0]) | |
1492 | value2 = float(yvalueList[1]) |
|
1492 | value2 = float(yvalueList[1]) | |
1493 | except: |
|
1493 | except: | |
1494 | self.console.clear() |
|
1494 | self.console.clear() | |
1495 | self.console.append("Invalid height range") |
|
1495 | self.console.append("Invalid height range") | |
1496 | return 0 |
|
1496 | return 0 | |
1497 |
|
1497 | |||
1498 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1498 | opObj.addParameter(name='ymin', value=value1, format='float') | |
1499 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1499 | opObj.addParameter(name='ymax', value=value2, format='float') | |
1500 |
|
1500 | |||
1501 | if not db_range == '': |
|
1501 | if not db_range == '': | |
1502 | zvalueList = db_range.split(",") |
|
1502 | zvalueList = db_range.split(",") | |
1503 | try: |
|
1503 | try: | |
1504 | value1 = float(zvalueList[0]) |
|
1504 | value1 = float(zvalueList[0]) | |
1505 | value2 = float(zvalueList[1]) |
|
1505 | value2 = float(zvalueList[1]) | |
1506 | except: |
|
1506 | except: | |
1507 | self.console.clear() |
|
1507 | self.console.clear() | |
1508 | self.console.append("Invalid db range") |
|
1508 | self.console.append("Invalid db range") | |
1509 | return 0 |
|
1509 | return 0 | |
1510 |
|
1510 | |||
1511 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1511 | opObj.addParameter(name='zmin', value=value1, format='float') | |
1512 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1512 | opObj.addParameter(name='zmax', value=value2, format='float') | |
1513 |
|
1513 | |||
1514 | if self.specGraphSaveRTIplot.isChecked(): |
|
1514 | if self.specGraphSaveRTIplot.isChecked(): | |
1515 | checkPath = True |
|
1515 | checkPath = True | |
1516 | opObj.addParameter(name='save', value='1', format='bool') |
|
1516 | opObj.addParameter(name='save', value='1', format='bool') | |
1517 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1517 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
1518 | if figfile: |
|
1518 | if figfile: | |
1519 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1519 | opObj.addParameter(name='figfile', value=value, format='str') | |
1520 | if wrperiod: |
|
1520 | if wrperiod: | |
1521 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1521 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
1522 |
|
1522 | |||
1523 | if self.specGraphftpRTIplot.isChecked(): |
|
1523 | if self.specGraphftpRTIplot.isChecked(): | |
1524 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1524 | opObj.addParameter(name='ftp', value='1', format='int') | |
1525 | self.addFTPConf2Operation(puObj, opObj) |
|
1525 | self.addFTPConf2Operation(puObj, opObj) | |
1526 | addFTP = True |
|
1526 | addFTP = True | |
1527 |
|
1527 | |||
1528 | if self.specGraphCebCoherencmap.isChecked(): |
|
1528 | if self.specGraphCebCoherencmap.isChecked(): | |
1529 |
|
1529 | |||
1530 | opObj = puObj.addOperation(name='CoherenceMap', optype='other') |
|
1530 | opObj = puObj.addOperation(name='CoherenceMap', optype='other') | |
1531 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1531 | # opObj.addParameter(name=name_parameter, value=value, format=format) | |
1532 | # opObj.addParameter(name='coherence_cmap', value='jet', format='str') |
|
1532 | # opObj.addParameter(name='coherence_cmap', value='jet', format='str') | |
1533 | # opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') |
|
1533 | # opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') | |
1534 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1534 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
1535 |
|
1535 | |||
1536 | # if not timerange == '': |
|
1536 | # if not timerange == '': | |
1537 | # try: |
|
1537 | # try: | |
1538 | # timerange = int(timerange) |
|
1538 | # timerange = int(timerange) | |
1539 | # except: |
|
1539 | # except: | |
1540 | # self.console.clear() |
|
1540 | # self.console.clear() | |
1541 | # self.console.append("Invalid time range") |
|
1541 | # self.console.append("Invalid time range") | |
1542 | # return 0 |
|
1542 | # return 0 | |
1543 | # |
|
1543 | # | |
1544 | # opObj.addParameter(name='timerange', value=timerange, format='int') |
|
1544 | # opObj.addParameter(name='timerange', value=timerange, format='int') | |
1545 |
|
1545 | |||
1546 | if not trange == '': |
|
1546 | if not trange == '': | |
1547 | xvalueList = trange.split(',') |
|
1547 | xvalueList = trange.split(',') | |
1548 | try: |
|
1548 | try: | |
1549 | value1 = float(xvalueList[0]) |
|
1549 | value1 = float(xvalueList[0]) | |
1550 | value2 = float(xvalueList[1]) |
|
1550 | value2 = float(xvalueList[1]) | |
1551 | except: |
|
1551 | except: | |
1552 | self.console.clear() |
|
1552 | self.console.clear() | |
1553 | self.console.append("Invalid time range") |
|
1553 | self.console.append("Invalid time range") | |
1554 | return 0 |
|
1554 | return 0 | |
1555 |
|
1555 | |||
1556 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1556 | opObj.addParameter(name='xmin', value=value1, format='float') | |
1557 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1557 | opObj.addParameter(name='xmax', value=value2, format='float') | |
1558 |
|
1558 | |||
1559 | if not hei_range == '': |
|
1559 | if not hei_range == '': | |
1560 | yvalueList = hei_range.split(",") |
|
1560 | yvalueList = hei_range.split(",") | |
1561 | try: |
|
1561 | try: | |
1562 | value1 = float(yvalueList[0]) |
|
1562 | value1 = float(yvalueList[0]) | |
1563 | value2 = float(yvalueList[1]) |
|
1563 | value2 = float(yvalueList[1]) | |
1564 | except: |
|
1564 | except: | |
1565 | self.console.clear() |
|
1565 | self.console.clear() | |
1566 | self.console.append("Invalid height range") |
|
1566 | self.console.append("Invalid height range") | |
1567 | return 0 |
|
1567 | return 0 | |
1568 |
|
1568 | |||
1569 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1569 | opObj.addParameter(name='ymin', value=value1, format='float') | |
1570 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1570 | opObj.addParameter(name='ymax', value=value2, format='float') | |
1571 |
|
1571 | |||
1572 | if not magrange == '': |
|
1572 | if not magrange == '': | |
1573 | zvalueList = magrange.split(",") |
|
1573 | zvalueList = magrange.split(",") | |
1574 | try: |
|
1574 | try: | |
1575 | value1 = float(zvalueList[0]) |
|
1575 | value1 = float(zvalueList[0]) | |
1576 | value2 = float(zvalueList[1]) |
|
1576 | value2 = float(zvalueList[1]) | |
1577 | except: |
|
1577 | except: | |
1578 | self.console.clear() |
|
1578 | self.console.clear() | |
1579 | self.console.append("Invalid magnitude range") |
|
1579 | self.console.append("Invalid magnitude range") | |
1580 | return 0 |
|
1580 | return 0 | |
1581 |
|
1581 | |||
1582 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1582 | opObj.addParameter(name='zmin', value=value1, format='float') | |
1583 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1583 | opObj.addParameter(name='zmax', value=value2, format='float') | |
1584 |
|
1584 | |||
1585 | if not phaserange == '': |
|
1585 | if not phaserange == '': | |
1586 | zvalueList = phaserange.split(",") |
|
1586 | zvalueList = phaserange.split(",") | |
1587 | try: |
|
1587 | try: | |
1588 | value1 = float(zvalueList[0]) |
|
1588 | value1 = float(zvalueList[0]) | |
1589 | value2 = float(zvalueList[1]) |
|
1589 | value2 = float(zvalueList[1]) | |
1590 | except: |
|
1590 | except: | |
1591 | self.console.clear() |
|
1591 | self.console.clear() | |
1592 | self.console.append("Invalid phase range") |
|
1592 | self.console.append("Invalid phase range") | |
1593 | return 0 |
|
1593 | return 0 | |
1594 |
|
1594 | |||
1595 | opObj.addParameter(name='phase_min', value=value1, format='float') |
|
1595 | opObj.addParameter(name='phase_min', value=value1, format='float') | |
1596 | opObj.addParameter(name='phase_max', value=value2, format='float') |
|
1596 | opObj.addParameter(name='phase_max', value=value2, format='float') | |
1597 |
|
1597 | |||
1598 | if self.specGraphSaveCoherencemap.isChecked(): |
|
1598 | if self.specGraphSaveCoherencemap.isChecked(): | |
1599 | checkPath = True |
|
1599 | checkPath = True | |
1600 | opObj.addParameter(name='save', value='1', format='bool') |
|
1600 | opObj.addParameter(name='save', value='1', format='bool') | |
1601 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1601 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
1602 | if figfile: |
|
1602 | if figfile: | |
1603 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1603 | opObj.addParameter(name='figfile', value=value, format='str') | |
1604 | if wrperiod: |
|
1604 | if wrperiod: | |
1605 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1605 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
1606 |
|
1606 | |||
1607 | if self.specGraphftpCoherencemap.isChecked(): |
|
1607 | if self.specGraphftpCoherencemap.isChecked(): | |
1608 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1608 | opObj.addParameter(name='ftp', value='1', format='int') | |
1609 | self.addFTPConf2Operation(puObj, opObj) |
|
1609 | self.addFTPConf2Operation(puObj, opObj) | |
1610 | addFTP = True |
|
1610 | addFTP = True | |
1611 |
|
1611 | |||
1612 | if self.specGraphPowerprofile.isChecked(): |
|
1612 | if self.specGraphPowerprofile.isChecked(): | |
1613 |
|
1613 | |||
1614 | opObj = puObj.addOperation(name='PowerProfilePlot', optype='other') |
|
1614 | opObj = puObj.addOperation(name='PowerProfilePlot', optype='other') | |
1615 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1615 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
1616 |
|
1616 | |||
1617 | if not channelList == '': |
|
1617 | if not channelList == '': | |
1618 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1618 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
1619 |
|
1619 | |||
1620 | if not db_range == '': |
|
1620 | if not db_range == '': | |
1621 | xvalueList = db_range.split(',') |
|
1621 | xvalueList = db_range.split(',') | |
1622 | try: |
|
1622 | try: | |
1623 | value1 = float(xvalueList[0]) |
|
1623 | value1 = float(xvalueList[0]) | |
1624 | value2 = float(xvalueList[1]) |
|
1624 | value2 = float(xvalueList[1]) | |
1625 | except: |
|
1625 | except: | |
1626 | self.console.clear() |
|
1626 | self.console.clear() | |
1627 | self.console.append("Invalid db range") |
|
1627 | self.console.append("Invalid db range") | |
1628 | return 0 |
|
1628 | return 0 | |
1629 |
|
1629 | |||
1630 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1630 | opObj.addParameter(name='xmin', value=value1, format='float') | |
1631 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1631 | opObj.addParameter(name='xmax', value=value2, format='float') | |
1632 |
|
1632 | |||
1633 | if not hei_range == '': |
|
1633 | if not hei_range == '': | |
1634 | yvalueList = hei_range.split(",") |
|
1634 | yvalueList = hei_range.split(",") | |
1635 | try: |
|
1635 | try: | |
1636 | value1 = float(yvalueList[0]) |
|
1636 | value1 = float(yvalueList[0]) | |
1637 | value2 = float(yvalueList[1]) |
|
1637 | value2 = float(yvalueList[1]) | |
1638 | except: |
|
1638 | except: | |
1639 | self.console.clear() |
|
1639 | self.console.clear() | |
1640 | self.console.append("Invalid height range") |
|
1640 | self.console.append("Invalid height range") | |
1641 | return 0 |
|
1641 | return 0 | |
1642 |
|
1642 | |||
1643 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1643 | opObj.addParameter(name='ymin', value=value1, format='float') | |
1644 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1644 | opObj.addParameter(name='ymax', value=value2, format='float') | |
1645 |
|
1645 | |||
1646 | if self.specGraphSavePowerprofile.isChecked(): |
|
1646 | if self.specGraphSavePowerprofile.isChecked(): | |
1647 | checkPath = True |
|
1647 | checkPath = True | |
1648 | opObj.addParameter(name='save', value='1', format='bool') |
|
1648 | opObj.addParameter(name='save', value='1', format='bool') | |
1649 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1649 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
1650 | if figfile: |
|
1650 | if figfile: | |
1651 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1651 | opObj.addParameter(name='figfile', value=value, format='str') | |
1652 | if wrperiod: |
|
1652 | if wrperiod: | |
1653 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1653 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
1654 |
|
1654 | |||
1655 | if self.specGraphftpPowerprofile.isChecked(): |
|
1655 | if self.specGraphftpPowerprofile.isChecked(): | |
1656 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1656 | opObj.addParameter(name='ftp', value='1', format='int') | |
1657 | self.addFTPConf2Operation(puObj, opObj) |
|
1657 | self.addFTPConf2Operation(puObj, opObj) | |
1658 | addFTP = True |
|
1658 | addFTP = True | |
1659 | # rti noise |
|
1659 | # rti noise | |
1660 |
|
1660 | |||
1661 | if self.specGraphCebRTInoise.isChecked(): |
|
1661 | if self.specGraphCebRTInoise.isChecked(): | |
1662 |
|
1662 | |||
1663 | opObj = puObj.addOperation(name='Noise', optype='other') |
|
1663 | opObj = puObj.addOperation(name='Noise', optype='other') | |
1664 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1664 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
1665 |
|
1665 | |||
1666 | if not channelList == '': |
|
1666 | if not channelList == '': | |
1667 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1667 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
1668 |
|
1668 | |||
1669 | # if not timerange == '': |
|
1669 | # if not timerange == '': | |
1670 | # try: |
|
1670 | # try: | |
1671 | # timerange = float(timerange) |
|
1671 | # timerange = float(timerange) | |
1672 | # except: |
|
1672 | # except: | |
1673 | # self.console.clear() |
|
1673 | # self.console.clear() | |
1674 | # self.console.append("Invalid time range") |
|
1674 | # self.console.append("Invalid time range") | |
1675 | # return 0 |
|
1675 | # return 0 | |
1676 | # |
|
1676 | # | |
1677 | # opObj.addParameter(name='timerange', value=timerange, format='float') |
|
1677 | # opObj.addParameter(name='timerange', value=timerange, format='float') | |
1678 |
|
1678 | |||
1679 | if not trange == '': |
|
1679 | if not trange == '': | |
1680 | xvalueList = trange.split(',') |
|
1680 | xvalueList = trange.split(',') | |
1681 | try: |
|
1681 | try: | |
1682 | value1 = float(xvalueList[0]) |
|
1682 | value1 = float(xvalueList[0]) | |
1683 | value2 = float(xvalueList[1]) |
|
1683 | value2 = float(xvalueList[1]) | |
1684 | except: |
|
1684 | except: | |
1685 | self.console.clear() |
|
1685 | self.console.clear() | |
1686 | self.console.append("Invalid time range") |
|
1686 | self.console.append("Invalid time range") | |
1687 | return 0 |
|
1687 | return 0 | |
1688 |
|
1688 | |||
1689 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1689 | opObj.addParameter(name='xmin', value=value1, format='float') | |
1690 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1690 | opObj.addParameter(name='xmax', value=value2, format='float') | |
1691 |
|
1691 | |||
1692 | if not db_range == '': |
|
1692 | if not db_range == '': | |
1693 | yvalueList = db_range.split(",") |
|
1693 | yvalueList = db_range.split(",") | |
1694 | try: |
|
1694 | try: | |
1695 | value1 = float(yvalueList[0]) |
|
1695 | value1 = float(yvalueList[0]) | |
1696 | value2 = float(yvalueList[1]) |
|
1696 | value2 = float(yvalueList[1]) | |
1697 | except: |
|
1697 | except: | |
1698 | self.console.clear() |
|
1698 | self.console.clear() | |
1699 | self.console.append("Invalid db range") |
|
1699 | self.console.append("Invalid db range") | |
1700 | return 0 |
|
1700 | return 0 | |
1701 |
|
1701 | |||
1702 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1702 | opObj.addParameter(name='ymin', value=value1, format='float') | |
1703 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1703 | opObj.addParameter(name='ymax', value=value2, format='float') | |
1704 |
|
1704 | |||
1705 | if self.specGraphSaveRTInoise.isChecked(): |
|
1705 | if self.specGraphSaveRTInoise.isChecked(): | |
1706 | checkPath = True |
|
1706 | checkPath = True | |
1707 | opObj.addParameter(name='save', value='1', format='bool') |
|
1707 | opObj.addParameter(name='save', value='1', format='bool') | |
1708 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1708 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
1709 | if figfile: |
|
1709 | if figfile: | |
1710 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1710 | opObj.addParameter(name='figfile', value=value, format='str') | |
1711 | if wrperiod: |
|
1711 | if wrperiod: | |
1712 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1712 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
1713 |
|
1713 | |||
1714 | # test_ftp |
|
1714 | # test_ftp | |
1715 | if self.specGraphftpRTInoise.isChecked(): |
|
1715 | if self.specGraphftpRTInoise.isChecked(): | |
1716 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1716 | opObj.addParameter(name='ftp', value='1', format='int') | |
1717 | self.addFTPConf2Operation(puObj, opObj) |
|
1717 | self.addFTPConf2Operation(puObj, opObj) | |
1718 | addFTP = True |
|
1718 | addFTP = True | |
1719 |
|
1719 | |||
1720 | if checkPath: |
|
1720 | if checkPath: | |
1721 | if not figpath: |
|
1721 | if not figpath: | |
1722 | self.console.clear() |
|
1722 | self.console.clear() | |
1723 | self.console.append("Graphic path should be defined") |
|
1723 | self.console.append("Graphic path should be defined") | |
1724 | return 0 |
|
1724 | return 0 | |
1725 |
|
1725 | |||
1726 | if addFTP and not figpath: |
|
1726 | if addFTP and not figpath: | |
1727 | self.console.clear() |
|
1727 | self.console.clear() | |
1728 | self.console.append("You have to save the plots before sending them to FTP Server") |
|
1728 | self.console.append("You have to save the plots before sending them to FTP Server") | |
1729 | return 0 |
|
1729 | return 0 | |
1730 |
|
1730 | |||
1731 | # if something happend |
|
1731 | # if something happend | |
1732 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Spectra') |
|
1732 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Spectra') | |
1733 | if parms_ok: |
|
1733 | if parms_ok: | |
1734 | opObj = puObj.addOperation(name='SpectraWriter', optype='other') |
|
1734 | opObj = puObj.addOperation(name='SpectraWriter', optype='other') | |
1735 | opObj.addParameter(name='path', value=output_path) |
|
1735 | opObj.addParameter(name='path', value=output_path) | |
1736 | opObj.addParameter(name='blocksPerFile', value=blocksperfile, format='int') |
|
1736 | opObj.addParameter(name='blocksPerFile', value=blocksperfile, format='int') | |
1737 | opObj.addParameter(name='profilesPerBlock', value=profilesperblock, format='int') |
|
1737 | opObj.addParameter(name='profilesPerBlock', value=profilesperblock, format='int') | |
1738 |
|
1738 | |||
1739 | self.console.clear() |
|
1739 | self.console.clear() | |
1740 | try: |
|
1740 | try: | |
1741 | self.refreshPUProperties(puObj) |
|
1741 | self.refreshPUProperties(puObj) | |
1742 | except: |
|
1742 | except: | |
1743 | self.console.append("Check input parameters") |
|
1743 | self.console.append("Check input parameters") | |
1744 | return 0 |
|
1744 | return 0 | |
1745 |
|
1745 | |||
1746 | self.console.append("If you want to save your project") |
|
1746 | self.console.append("If you want to save your project") | |
1747 | self.console.append("click on your project name in the Tree Project Explorer") |
|
1747 | self.console.append("click on your project name in the Tree Project Explorer") | |
1748 |
|
1748 | |||
1749 | self.actionSaveToolbar.setEnabled(True) |
|
1749 | self.actionSaveToolbar.setEnabled(True) | |
1750 | self.actionStarToolbar.setEnabled(True) |
|
1750 | self.actionStarToolbar.setEnabled(True) | |
1751 |
|
1751 | |||
1752 | return 1 |
|
1752 | return 1 | |
1753 |
|
1753 | |||
1754 | """ |
|
1754 | """ | |
1755 | Spectra Graph |
|
1755 | Spectra Graph | |
1756 | """ |
|
1756 | """ | |
1757 | @pyqtSignature("int") |
|
1757 | @pyqtSignature("int") | |
1758 | def on_specGraphCebSpectraplot_stateChanged(self, p0): |
|
1758 | def on_specGraphCebSpectraplot_stateChanged(self, p0): | |
1759 |
|
1759 | |||
1760 | self.__checkSpecGraphFilters() |
|
1760 | self.__checkSpecGraphFilters() | |
1761 |
|
1761 | |||
1762 |
|
1762 | |||
1763 | @pyqtSignature("int") |
|
1763 | @pyqtSignature("int") | |
1764 | def on_specGraphCebCrossSpectraplot_stateChanged(self, p0): |
|
1764 | def on_specGraphCebCrossSpectraplot_stateChanged(self, p0): | |
1765 |
|
1765 | |||
1766 | self.__checkSpecGraphFilters() |
|
1766 | self.__checkSpecGraphFilters() | |
1767 |
|
1767 | |||
1768 | @pyqtSignature("int") |
|
1768 | @pyqtSignature("int") | |
1769 | def on_specGraphCebRTIplot_stateChanged(self, p0): |
|
1769 | def on_specGraphCebRTIplot_stateChanged(self, p0): | |
1770 |
|
1770 | |||
1771 | self.__checkSpecGraphFilters() |
|
1771 | self.__checkSpecGraphFilters() | |
1772 |
|
1772 | |||
1773 |
|
1773 | |||
1774 | @pyqtSignature("int") |
|
1774 | @pyqtSignature("int") | |
1775 | def on_specGraphCebRTInoise_stateChanged(self, p0): |
|
1775 | def on_specGraphCebRTInoise_stateChanged(self, p0): | |
1776 |
|
1776 | |||
1777 | self.__checkSpecGraphFilters() |
|
1777 | self.__checkSpecGraphFilters() | |
1778 |
|
1778 | |||
1779 |
|
1779 | |||
1780 | @pyqtSignature("int") |
|
1780 | @pyqtSignature("int") | |
1781 | def on_specGraphCebCoherencmap_stateChanged(self, p0): |
|
1781 | def on_specGraphCebCoherencmap_stateChanged(self, p0): | |
1782 |
|
1782 | |||
1783 | self.__checkSpecGraphFilters() |
|
1783 | self.__checkSpecGraphFilters() | |
1784 |
|
1784 | |||
1785 | @pyqtSignature("int") |
|
1785 | @pyqtSignature("int") | |
1786 | def on_specGraphPowerprofile_stateChanged(self, p0): |
|
1786 | def on_specGraphPowerprofile_stateChanged(self, p0): | |
1787 |
|
1787 | |||
1788 | self.__checkSpecGraphFilters() |
|
1788 | self.__checkSpecGraphFilters() | |
1789 |
|
1789 | |||
1790 | @pyqtSignature("int") |
|
1790 | @pyqtSignature("int") | |
1791 | def on_specGraphPhase_stateChanged(self, p0): |
|
1791 | def on_specGraphPhase_stateChanged(self, p0): | |
1792 |
|
1792 | |||
1793 | self.__checkSpecGraphFilters() |
|
1793 | self.__checkSpecGraphFilters() | |
1794 |
|
1794 | |||
1795 | @pyqtSignature("int") |
|
1795 | @pyqtSignature("int") | |
1796 | def on_specGraphSaveSpectra_stateChanged(self, p0): |
|
1796 | def on_specGraphSaveSpectra_stateChanged(self, p0): | |
1797 | """ |
|
1797 | """ | |
1798 | """ |
|
1798 | """ | |
1799 | self.__checkSpecGraphSaving() |
|
1799 | self.__checkSpecGraphSaving() | |
1800 |
|
1800 | |||
1801 | @pyqtSignature("int") |
|
1801 | @pyqtSignature("int") | |
1802 | def on_specGraphSaveCross_stateChanged(self, p0): |
|
1802 | def on_specGraphSaveCross_stateChanged(self, p0): | |
1803 |
|
1803 | |||
1804 | self.__checkSpecGraphSaving() |
|
1804 | self.__checkSpecGraphSaving() | |
1805 |
|
1805 | |||
1806 | @pyqtSignature("int") |
|
1806 | @pyqtSignature("int") | |
1807 | def on_specGraphSaveRTIplot_stateChanged(self, p0): |
|
1807 | def on_specGraphSaveRTIplot_stateChanged(self, p0): | |
1808 |
|
1808 | |||
1809 | self.__checkSpecGraphSaving() |
|
1809 | self.__checkSpecGraphSaving() | |
1810 |
|
1810 | |||
1811 | @pyqtSignature("int") |
|
1811 | @pyqtSignature("int") | |
1812 | def on_specGraphSaveRTInoise_stateChanged(self, p0): |
|
1812 | def on_specGraphSaveRTInoise_stateChanged(self, p0): | |
1813 |
|
1813 | |||
1814 | self.__checkSpecGraphSaving() |
|
1814 | self.__checkSpecGraphSaving() | |
1815 |
|
1815 | |||
1816 | @pyqtSignature("int") |
|
1816 | @pyqtSignature("int") | |
1817 | def on_specGraphSaveCoherencemap_stateChanged(self, p0): |
|
1817 | def on_specGraphSaveCoherencemap_stateChanged(self, p0): | |
1818 |
|
1818 | |||
1819 | self.__checkSpecGraphSaving() |
|
1819 | self.__checkSpecGraphSaving() | |
1820 |
|
1820 | |||
1821 | @pyqtSignature("int") |
|
1821 | @pyqtSignature("int") | |
1822 | def on_specGraphSavePowerprofile_stateChanged(self, p0): |
|
1822 | def on_specGraphSavePowerprofile_stateChanged(self, p0): | |
1823 |
|
1823 | |||
1824 | self.__checkSpecGraphSaving() |
|
1824 | self.__checkSpecGraphSaving() | |
1825 |
|
1825 | |||
1826 | @pyqtSignature("int") |
|
1826 | @pyqtSignature("int") | |
1827 | def on_specGraphftpSpectra_stateChanged(self, p0): |
|
1827 | def on_specGraphftpSpectra_stateChanged(self, p0): | |
1828 | """ |
|
1828 | """ | |
1829 | """ |
|
1829 | """ | |
1830 | self.__checkSpecGraphFTP() |
|
1830 | self.__checkSpecGraphFTP() | |
1831 |
|
1831 | |||
1832 |
|
1832 | |||
1833 | @pyqtSignature("int") |
|
1833 | @pyqtSignature("int") | |
1834 | def on_specGraphftpCross_stateChanged(self, p0): |
|
1834 | def on_specGraphftpCross_stateChanged(self, p0): | |
1835 |
|
1835 | |||
1836 | self.__checkSpecGraphFTP() |
|
1836 | self.__checkSpecGraphFTP() | |
1837 |
|
1837 | |||
1838 | @pyqtSignature("int") |
|
1838 | @pyqtSignature("int") | |
1839 | def on_specGraphftpRTIplot_stateChanged(self, p0): |
|
1839 | def on_specGraphftpRTIplot_stateChanged(self, p0): | |
1840 |
|
1840 | |||
1841 | self.__checkSpecGraphFTP() |
|
1841 | self.__checkSpecGraphFTP() | |
1842 |
|
1842 | |||
1843 | @pyqtSignature("int") |
|
1843 | @pyqtSignature("int") | |
1844 | def on_specGraphftpRTInoise_stateChanged(self, p0): |
|
1844 | def on_specGraphftpRTInoise_stateChanged(self, p0): | |
1845 |
|
1845 | |||
1846 | self.__checkSpecGraphFTP() |
|
1846 | self.__checkSpecGraphFTP() | |
1847 |
|
1847 | |||
1848 | @pyqtSignature("int") |
|
1848 | @pyqtSignature("int") | |
1849 | def on_specGraphftpCoherencemap_stateChanged(self, p0): |
|
1849 | def on_specGraphftpCoherencemap_stateChanged(self, p0): | |
1850 |
|
1850 | |||
1851 | self.__checkSpecGraphFTP() |
|
1851 | self.__checkSpecGraphFTP() | |
1852 |
|
1852 | |||
1853 | @pyqtSignature("int") |
|
1853 | @pyqtSignature("int") | |
1854 | def on_specGraphftpPowerprofile_stateChanged(self, p0): |
|
1854 | def on_specGraphftpPowerprofile_stateChanged(self, p0): | |
1855 |
|
1855 | |||
1856 | self.__checkSpecGraphFTP() |
|
1856 | self.__checkSpecGraphFTP() | |
1857 |
|
1857 | |||
1858 | @pyqtSignature("") |
|
1858 | @pyqtSignature("") | |
1859 | def on_specGraphToolPath_clicked(self): |
|
1859 | def on_specGraphToolPath_clicked(self): | |
1860 | """ |
|
1860 | """ | |
1861 | """ |
|
1861 | """ | |
1862 | self.savePath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
1862 | self.savePath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
1863 | self.specGraphPath.setText(self.savePath) |
|
1863 | self.specGraphPath.setText(self.savePath) | |
1864 | if not os.path.exists(self.savePath): |
|
1864 | if not os.path.exists(self.savePath): | |
1865 | self.console.clear() |
|
1865 | self.console.clear() | |
1866 | self.console.append("Write a correct a path") |
|
1866 | self.console.append("Write a correct a path") | |
1867 | return |
|
1867 | return | |
1868 |
|
1868 | |||
1869 | @pyqtSignature("") |
|
1869 | @pyqtSignature("") | |
1870 | def on_specGraphClear_clicked(self): |
|
1870 | def on_specGraphClear_clicked(self): | |
1871 | return |
|
1871 | return | |
1872 |
|
1872 | |||
1873 | @pyqtSignature("") |
|
1873 | @pyqtSignature("") | |
1874 | def on_specHeisGraphToolPath_clicked(self): |
|
1874 | def on_specHeisGraphToolPath_clicked(self): | |
1875 | """ |
|
1875 | """ | |
1876 | """ |
|
1876 | """ | |
1877 | self.savePath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
1877 | self.savePath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
1878 | self.specHeisGraphPath.setText(self.savePath) |
|
1878 | self.specHeisGraphPath.setText(self.savePath) | |
1879 | if not os.path.exists(self.savePath): |
|
1879 | if not os.path.exists(self.savePath): | |
1880 | self.console.clear() |
|
1880 | self.console.clear() | |
1881 | self.console.append("Write a correct a path") |
|
1881 | self.console.append("Write a correct a path") | |
1882 | return |
|
1882 | return | |
1883 |
|
1883 | |||
1884 | @pyqtSignature("int") |
|
1884 | @pyqtSignature("int") | |
1885 | def on_specHeisOpCebIncoherent_stateChanged(self, p0): |
|
1885 | def on_specHeisOpCebIncoherent_stateChanged(self, p0): | |
1886 | """ |
|
1886 | """ | |
1887 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . |
|
1887 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . | |
1888 | """ |
|
1888 | """ | |
1889 | if p0 == 2: |
|
1889 | if p0 == 2: | |
1890 | self.specHeisOpIncoherent.setEnabled(True) |
|
1890 | self.specHeisOpIncoherent.setEnabled(True) | |
1891 | self.specHeisOpCobIncInt.setEnabled(True) |
|
1891 | self.specHeisOpCobIncInt.setEnabled(True) | |
1892 | if p0 == 0: |
|
1892 | if p0 == 0: | |
1893 | self.specHeisOpIncoherent.setEnabled(False) |
|
1893 | self.specHeisOpIncoherent.setEnabled(False) | |
1894 | self.specHeisOpCobIncInt.setEnabled(False) |
|
1894 | self.specHeisOpCobIncInt.setEnabled(False) | |
1895 |
|
1895 | |||
1896 | @pyqtSignature("") |
|
1896 | @pyqtSignature("") | |
1897 | def on_specHeisOpOk_clicked(self): |
|
1897 | def on_specHeisOpOk_clicked(self): | |
1898 | """ |
|
1898 | """ | |
1899 | AΓADE OPERACION SPECTRAHEIS |
|
1899 | AΓADE OPERACION SPECTRAHEIS | |
1900 | """ |
|
1900 | """ | |
1901 | addFTP = False |
|
1901 | addFTP = False | |
1902 | checkPath = False |
|
1902 | checkPath = False | |
1903 |
|
1903 | |||
1904 | self.actionSaveToolbar.setEnabled(False) |
|
1904 | self.actionSaveToolbar.setEnabled(False) | |
1905 | self.actionStarToolbar.setEnabled(False) |
|
1905 | self.actionStarToolbar.setEnabled(False) | |
1906 |
|
1906 | |||
1907 | puObj = self.getSelectedItemObj() |
|
1907 | puObj = self.getSelectedItemObj() | |
1908 | puObj.removeOperations() |
|
1908 | puObj.removeOperations() | |
1909 |
|
1909 | |||
1910 | if self.specHeisOpCebIncoherent.isChecked(): |
|
1910 | if self.specHeisOpCebIncoherent.isChecked(): | |
1911 | value = self.specHeisOpIncoherent.text() |
|
1911 | value = self.specHeisOpIncoherent.text() | |
1912 | name_operation = 'IncohInt4SpectraHeis' |
|
1912 | name_operation = 'IncohInt4SpectraHeis' | |
1913 | optype = 'other' |
|
1913 | optype = 'other' | |
1914 | if self.specOpCobIncInt.currentIndex() == 0: |
|
1914 | if self.specOpCobIncInt.currentIndex() == 0: | |
1915 | name_parameter = 'timeInterval' |
|
1915 | name_parameter = 'timeInterval' | |
1916 | format = 'float' |
|
1916 | format = 'float' | |
1917 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1917 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
1918 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1918 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
1919 |
|
1919 | |||
1920 | # ---- Spectra Plot----- |
|
1920 | # ---- Spectra Plot----- | |
1921 | if self.specHeisGraphCebSpectraplot.isChecked(): |
|
1921 | if self.specHeisGraphCebSpectraplot.isChecked(): | |
1922 | name_operation = 'SpectraHeisScope' |
|
1922 | name_operation = 'SpectraHeisScope' | |
1923 | optype = 'other' |
|
1923 | optype = 'other' | |
1924 | name_parameter = 'type' |
|
1924 | name_parameter = 'type' | |
1925 | value = 'SpectraHeisScope' |
|
1925 | value = 'SpectraHeisScope' | |
1926 | format = 'str' |
|
1926 | format = 'str' | |
1927 | if self.idImagspectraHeis == 0: |
|
1927 | if self.idImagspectraHeis == 0: | |
1928 | self.idImagspectraHeis = 800 |
|
1928 | self.idImagspectraHeis = 800 | |
1929 | else: |
|
1929 | else: | |
1930 | self.idImagspectraHeis = self.idImagspectraHeis + 1 |
|
1930 | self.idImagspectraHeis = self.idImagspectraHeis + 1 | |
1931 | name_parameter1 = 'id' |
|
1931 | name_parameter1 = 'id' | |
1932 | value1 = int(self.idImagspectraHeis) |
|
1932 | value1 = int(self.idImagspectraHeis) | |
1933 | format1 = 'int' |
|
1933 | format1 = 'int' | |
1934 |
|
1934 | |||
1935 | format = 'str' |
|
1935 | format = 'str' | |
1936 |
|
1936 | |||
1937 | channelList = self.specHeisGgraphChannelList.text() |
|
1937 | channelList = self.specHeisGgraphChannelList.text() | |
1938 | xvalue = self.specHeisGgraphXminXmax.text() |
|
1938 | xvalue = self.specHeisGgraphXminXmax.text() | |
1939 | yvalue = self.specHeisGgraphYminYmax.text() |
|
1939 | yvalue = self.specHeisGgraphYminYmax.text() | |
1940 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1940 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
1941 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1941 | # opObj.addParameter(name=name_parameter, value=value, format=format) | |
1942 | opObj.addParameter(name=name_parameter1, value=value1, format=format1) |
|
1942 | opObj.addParameter(name=name_parameter1, value=value1, format=format1) | |
1943 |
|
1943 | |||
1944 | if not channelList == '': |
|
1944 | if not channelList == '': | |
1945 | name_parameter = 'channelList' |
|
1945 | name_parameter = 'channelList' | |
1946 | format = 'intlist' |
|
1946 | format = 'intlist' | |
1947 | opObj.addParameter(name=name_parameter, value=channelList, format=format) |
|
1947 | opObj.addParameter(name=name_parameter, value=channelList, format=format) | |
1948 |
|
1948 | |||
1949 | if not xvalue == '': |
|
1949 | if not xvalue == '': | |
1950 | xvalueList = xvalue.split(',') |
|
1950 | xvalueList = xvalue.split(',') | |
1951 | try: |
|
1951 | try: | |
1952 | value1 = float(xvalueList[0]) |
|
1952 | value1 = float(xvalueList[0]) | |
1953 | value2 = float(xvalueList[1]) |
|
1953 | value2 = float(xvalueList[1]) | |
1954 | except: |
|
1954 | except: | |
1955 | self.console.clear() |
|
1955 | self.console.clear() | |
1956 | self.console.append("Please Write corrects parameter xmin-xmax") |
|
1956 | self.console.append("Please Write corrects parameter xmin-xmax") | |
1957 | return 0 |
|
1957 | return 0 | |
1958 | name1 = 'xmin' |
|
1958 | name1 = 'xmin' | |
1959 | name2 = 'xmax' |
|
1959 | name2 = 'xmax' | |
1960 | format = 'float' |
|
1960 | format = 'float' | |
1961 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1961 | opObj.addParameter(name=name1, value=value1, format=format) | |
1962 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1962 | opObj.addParameter(name=name2, value=value2, format=format) | |
1963 | #------specHeisGgraphYmin-Ymax--- |
|
1963 | #------specHeisGgraphYmin-Ymax--- | |
1964 | if not yvalue == '': |
|
1964 | if not yvalue == '': | |
1965 | yvalueList = yvalue.split(",") |
|
1965 | yvalueList = yvalue.split(",") | |
1966 | try: |
|
1966 | try: | |
1967 | value1 = float(yvalueList[0]) |
|
1967 | value1 = float(yvalueList[0]) | |
1968 | value2 = float(yvalueList[1]) |
|
1968 | value2 = float(yvalueList[1]) | |
1969 | except: |
|
1969 | except: | |
1970 | self.console.clear() |
|
1970 | self.console.clear() | |
1971 | self.console.append("Please Write corrects parameter Ymix-Ymax") |
|
1971 | self.console.append("Please Write corrects parameter Ymix-Ymax") | |
1972 | return 0 |
|
1972 | return 0 | |
1973 | name1 = 'ymin' |
|
1973 | name1 = 'ymin' | |
1974 | name2 = 'ymax' |
|
1974 | name2 = 'ymax' | |
1975 | format = 'float' |
|
1975 | format = 'float' | |
1976 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1976 | opObj.addParameter(name=name1, value=value1, format=format) | |
1977 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1977 | opObj.addParameter(name=name2, value=value2, format=format) | |
1978 |
|
1978 | |||
1979 | if self.specHeisGraphSaveSpectra.isChecked(): |
|
1979 | if self.specHeisGraphSaveSpectra.isChecked(): | |
1980 | checkPath = True |
|
1980 | checkPath = True | |
1981 | name_parameter1 = 'save' |
|
1981 | name_parameter1 = 'save' | |
1982 | name_parameter2 = 'figpath' |
|
1982 | name_parameter2 = 'figpath' | |
1983 | name_parameter3 = 'figfile' |
|
1983 | name_parameter3 = 'figfile' | |
1984 | value1 = '1' |
|
1984 | value1 = '1' | |
1985 | value2 = self.specHeisGraphPath.text() |
|
1985 | value2 = self.specHeisGraphPath.text() | |
1986 | value3 = self.specHeisGraphPrefix.text() |
|
1986 | value3 = self.specHeisGraphPrefix.text() | |
1987 | format1 = 'bool' |
|
1987 | format1 = 'bool' | |
1988 | format2 = 'str' |
|
1988 | format2 = 'str' | |
1989 | opObj.addParameter(name=name_parameter1, value=value1 , format=format1) |
|
1989 | opObj.addParameter(name=name_parameter1, value=value1 , format=format1) | |
1990 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) |
|
1990 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) | |
1991 | if not value3 == "": |
|
1991 | if not value3 == "": | |
1992 | try: |
|
1992 | try: | |
1993 | value3 = str(self.specHeisGraphPrefix.text()) |
|
1993 | value3 = str(self.specHeisGraphPrefix.text()) | |
1994 | except: |
|
1994 | except: | |
1995 | self.console.clear() |
|
1995 | self.console.clear() | |
1996 | self.console.append("Please Write prefix") |
|
1996 | self.console.append("Please Write prefix") | |
1997 | return 0 |
|
1997 | return 0 | |
1998 | opObj.addParameter(name='figfile', value=self.specHeisGraphPrefix.text(), format='str') |
|
1998 | opObj.addParameter(name='figfile', value=self.specHeisGraphPrefix.text(), format='str') | |
1999 |
|
1999 | |||
2000 | # opObj.addParameter(name=name_parameter3, value=value3, format=format2) |
|
2000 | # opObj.addParameter(name=name_parameter3, value=value3, format=format2) | |
2001 | # opObj.addParameter(name='wr_period', value='5',format='int') |
|
2001 | # opObj.addParameter(name='wr_period', value='5',format='int') | |
2002 |
|
2002 | |||
2003 | if self.specHeisGraphftpSpectra.isChecked(): |
|
2003 | if self.specHeisGraphftpSpectra.isChecked(): | |
2004 | opObj.addParameter(name='ftp', value='1', format='int') |
|
2004 | opObj.addParameter(name='ftp', value='1', format='int') | |
2005 | self.addFTPConf2Operation(puObj, opObj) |
|
2005 | self.addFTPConf2Operation(puObj, opObj) | |
2006 | addFTP = True |
|
2006 | addFTP = True | |
2007 |
|
2007 | |||
2008 | if self.specHeisGraphCebRTIplot.isChecked(): |
|
2008 | if self.specHeisGraphCebRTIplot.isChecked(): | |
2009 | name_operation = 'RTIfromSpectraHeis' |
|
2009 | name_operation = 'RTIfromSpectraHeis' | |
2010 | optype = 'other' |
|
2010 | optype = 'other' | |
2011 | name_parameter = 'type' |
|
2011 | name_parameter = 'type' | |
2012 | value = 'RTIfromSpectraHeis' |
|
2012 | value = 'RTIfromSpectraHeis' | |
2013 | format = 'str' |
|
2013 | format = 'str' | |
2014 |
|
2014 | |||
2015 | if self.idImagrtiHeis == 0: |
|
2015 | if self.idImagrtiHeis == 0: | |
2016 | self.idImagrtiHeis = 900 |
|
2016 | self.idImagrtiHeis = 900 | |
2017 | else: |
|
2017 | else: | |
2018 | self.idImagrtiHeis = self.idImagrtiHeis + 1 |
|
2018 | self.idImagrtiHeis = self.idImagrtiHeis + 1 | |
2019 |
|
2019 | |||
2020 | name_parameter1 = 'id' |
|
2020 | name_parameter1 = 'id' | |
2021 | value1 = int(self.idImagrtiHeis) |
|
2021 | value1 = int(self.idImagrtiHeis) | |
2022 | format1 = 'int' |
|
2022 | format1 = 'int' | |
2023 |
|
2023 | |||
2024 | format = 'str' |
|
2024 | format = 'str' | |
2025 |
|
2025 | |||
2026 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2026 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
2027 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
2027 | # opObj.addParameter(name=name_parameter, value=value, format=format) | |
2028 | opObj.addParameter(name=name_parameter1, value=value1, format=format1) |
|
2028 | opObj.addParameter(name=name_parameter1, value=value1, format=format1) | |
2029 |
|
2029 | |||
2030 | channelList = self.specHeisGgraphChannelList.text() |
|
2030 | channelList = self.specHeisGgraphChannelList.text() | |
2031 | xvalue = self.specHeisGgraphTminTmax.text() |
|
2031 | xvalue = self.specHeisGgraphTminTmax.text() | |
2032 | yvalue = self.specHeisGgraphYminYmax.text() |
|
2032 | yvalue = self.specHeisGgraphYminYmax.text() | |
2033 | timerange = self.specHeisGgraphTimeRange.text() |
|
2033 | timerange = self.specHeisGgraphTimeRange.text() | |
2034 |
|
2034 | |||
2035 | if not channelList == '': |
|
2035 | if not channelList == '': | |
2036 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
2036 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
2037 |
|
2037 | |||
2038 | if not xvalue == '': |
|
2038 | if not xvalue == '': | |
2039 | xvalueList = xvalue.split(',') |
|
2039 | xvalueList = xvalue.split(',') | |
2040 | try: |
|
2040 | try: | |
2041 | value = float(xvalueList[0]) |
|
2041 | value = float(xvalueList[0]) | |
2042 | value = float(xvalueList[1]) |
|
2042 | value = float(xvalueList[1]) | |
2043 | except: |
|
2043 | except: | |
2044 | return 0 |
|
2044 | return 0 | |
2045 | format = 'float' |
|
2045 | format = 'float' | |
2046 | opObj.addParameter(name='xmin', value=xvalueList[0], format=format) |
|
2046 | opObj.addParameter(name='xmin', value=xvalueList[0], format=format) | |
2047 | opObj.addParameter(name='xmax', value=xvalueList[1], format=format) |
|
2047 | opObj.addParameter(name='xmax', value=xvalueList[1], format=format) | |
2048 |
|
2048 | |||
2049 | if not timerange == '': |
|
2049 | if not timerange == '': | |
2050 | format = 'int' |
|
2050 | format = 'int' | |
2051 | try: |
|
2051 | try: | |
2052 | timerange = int(timerange) |
|
2052 | timerange = int(timerange) | |
2053 | except: |
|
2053 | except: | |
2054 | return 0 |
|
2054 | return 0 | |
2055 | opObj.addParameter(name='timerange', value=timerange, format=format) |
|
2055 | opObj.addParameter(name='timerange', value=timerange, format=format) | |
2056 |
|
2056 | |||
2057 |
|
2057 | |||
2058 | if not yvalue == '': |
|
2058 | if not yvalue == '': | |
2059 | yvalueList = yvalue.split(",") |
|
2059 | yvalueList = yvalue.split(",") | |
2060 | try: |
|
2060 | try: | |
2061 | value = float(yvalueList[0]) |
|
2061 | value = float(yvalueList[0]) | |
2062 | value = float(yvalueList[1]) |
|
2062 | value = float(yvalueList[1]) | |
2063 | except: |
|
2063 | except: | |
2064 | return 0 |
|
2064 | return 0 | |
2065 | format = 'float' |
|
2065 | format = 'float' | |
2066 | opObj.addParameter(name='ymin', value=yvalueList[0], format=format) |
|
2066 | opObj.addParameter(name='ymin', value=yvalueList[0], format=format) | |
2067 | opObj.addParameter(name='ymax', value=yvalueList[1], format=format) |
|
2067 | opObj.addParameter(name='ymax', value=yvalueList[1], format=format) | |
2068 |
|
2068 | |||
2069 | if self.specHeisGraphSaveRTIplot.isChecked(): |
|
2069 | if self.specHeisGraphSaveRTIplot.isChecked(): | |
2070 | checkPath = True |
|
2070 | checkPath = True | |
2071 | opObj.addParameter(name='save', value='1', format='bool') |
|
2071 | opObj.addParameter(name='save', value='1', format='bool') | |
2072 | opObj.addParameter(name='figpath', value=self.specHeisGraphPath.text(), format='str') |
|
2072 | opObj.addParameter(name='figpath', value=self.specHeisGraphPath.text(), format='str') | |
2073 | value = self.specHeisGraphPrefix.text() |
|
2073 | value = self.specHeisGraphPrefix.text() | |
2074 | if not value == "": |
|
2074 | if not value == "": | |
2075 | try: |
|
2075 | try: | |
2076 | value = str(self.specHeisGraphPrefix.text()) |
|
2076 | value = str(self.specHeisGraphPrefix.text()) | |
2077 | except: |
|
2077 | except: | |
2078 | self.console.clear() |
|
2078 | self.console.clear() | |
2079 | self.console.append("Please Write prefix") |
|
2079 | self.console.append("Please Write prefix") | |
2080 | return 0 |
|
2080 | return 0 | |
2081 | opObj.addParameter(name='figfile', value=value, format='str') |
|
2081 | opObj.addParameter(name='figfile', value=value, format='str') | |
2082 |
|
2082 | |||
2083 | # test_ftp |
|
2083 | # test_ftp | |
2084 | if self.specHeisGraphftpRTIplot.isChecked(): |
|
2084 | if self.specHeisGraphftpRTIplot.isChecked(): | |
2085 | opObj.addParameter(name='ftp', value='1', format='int') |
|
2085 | opObj.addParameter(name='ftp', value='1', format='int') | |
2086 | self.addFTPConf2Operation(puObj, opObj) |
|
2086 | self.addFTPConf2Operation(puObj, opObj) | |
2087 | addFTP = True |
|
2087 | addFTP = True | |
2088 |
|
2088 | |||
2089 | localfolder = None |
|
2089 | localfolder = None | |
2090 | if checkPath: |
|
2090 | if checkPath: | |
2091 | localfolder = str(self.specGraphPath.text()) |
|
2091 | localfolder = str(self.specGraphPath.text()) | |
2092 | if localfolder == '': |
|
2092 | if localfolder == '': | |
2093 | self.console.clear() |
|
2093 | self.console.clear() | |
2094 | self.console.append("Graphic path should be defined") |
|
2094 | self.console.append("Graphic path should be defined") | |
2095 | return 0 |
|
2095 | return 0 | |
2096 |
|
2096 | |||
2097 | if addFTP and not localfolder: |
|
2097 | if addFTP and not localfolder: | |
2098 | self.console.clear() |
|
2098 | self.console.clear() | |
2099 | self.console.append("You have to save the plots before sending them to FTP Server") |
|
2099 | self.console.append("You have to save the plots before sending them to FTP Server") | |
2100 | return 0 |
|
2100 | return 0 | |
2101 |
|
2101 | |||
2102 | # if something happened |
|
2102 | # if something happened | |
2103 | parms_ok, output_path, blocksperfile, metada = self.checkInputsPUSave(datatype='SpectraHeis') |
|
2103 | parms_ok, output_path, blocksperfile, metada = self.checkInputsPUSave(datatype='SpectraHeis') | |
2104 | if parms_ok: |
|
2104 | if parms_ok: | |
2105 | name_operation = 'FitsWriter' |
|
2105 | name_operation = 'FitsWriter' | |
2106 | optype = 'other' |
|
2106 | optype = 'other' | |
2107 | name_parameter1 = 'path' |
|
2107 | name_parameter1 = 'path' | |
2108 | name_parameter2 = 'dataBlocksPerFile' |
|
2108 | name_parameter2 = 'dataBlocksPerFile' | |
2109 | name_parameter3 = 'metadatafile' |
|
2109 | name_parameter3 = 'metadatafile' | |
2110 | value1 = output_path |
|
2110 | value1 = output_path | |
2111 | value2 = blocksperfile |
|
2111 | value2 = blocksperfile | |
2112 | value3 = metada |
|
2112 | value3 = metada | |
2113 | format2 = "int" |
|
2113 | format2 = "int" | |
2114 | format3 = "str" |
|
2114 | format3 = "str" | |
2115 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2115 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
2116 | opObj.addParameter(name=name_parameter1, value=value1) |
|
2116 | opObj.addParameter(name=name_parameter1, value=value1) | |
2117 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) |
|
2117 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) | |
2118 | opObj.addParameter(name=name_parameter3, value=value3, format=format3) |
|
2118 | opObj.addParameter(name=name_parameter3, value=value3, format=format3) | |
2119 |
|
2119 | |||
2120 | self.console.clear() |
|
2120 | self.console.clear() | |
2121 | try: |
|
2121 | try: | |
2122 | self.refreshPUProperties(puObj) |
|
2122 | self.refreshPUProperties(puObj) | |
2123 | except: |
|
2123 | except: | |
2124 | self.console.append("Check input parameters") |
|
2124 | self.console.append("Check input parameters") | |
2125 | return 0 |
|
2125 | return 0 | |
2126 |
|
2126 | |||
2127 | self.console.append("Click on save icon ff you want to save your project") |
|
2127 | self.console.append("Click on save icon ff you want to save your project") | |
2128 |
|
2128 | |||
2129 | self.actionSaveToolbar.setEnabled(True) |
|
2129 | self.actionSaveToolbar.setEnabled(True) | |
2130 | self.actionStarToolbar.setEnabled(True) |
|
2130 | self.actionStarToolbar.setEnabled(True) | |
2131 |
|
2131 | |||
2132 | return 1 |
|
2132 | return 1 | |
2133 | @pyqtSignature("int") |
|
2133 | @pyqtSignature("int") | |
2134 | def on_specHeisGraphCebSpectraplot_stateChanged(self, p0): |
|
2134 | def on_specHeisGraphCebSpectraplot_stateChanged(self, p0): | |
2135 |
|
2135 | |||
2136 | if p0 == 2: |
|
2136 | if p0 == 2: | |
2137 | self.specHeisGgraphChannelList.setEnabled(True) |
|
2137 | self.specHeisGgraphChannelList.setEnabled(True) | |
2138 | self.specHeisGgraphXminXmax.setEnabled(True) |
|
2138 | self.specHeisGgraphXminXmax.setEnabled(True) | |
2139 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
2139 | self.specHeisGgraphYminYmax.setEnabled(True) | |
2140 | if p0 == 0: |
|
2140 | if p0 == 0: | |
2141 | self.specHeisGgraphXminXmax.setEnabled(False) |
|
2141 | self.specHeisGgraphXminXmax.setEnabled(False) | |
2142 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
2142 | self.specHeisGgraphYminYmax.setEnabled(False) | |
2143 |
|
2143 | |||
2144 | @pyqtSignature("int") |
|
2144 | @pyqtSignature("int") | |
2145 | def on_specHeisGraphCebRTIplot_stateChanged(self, p0): |
|
2145 | def on_specHeisGraphCebRTIplot_stateChanged(self, p0): | |
2146 |
|
2146 | |||
2147 | if p0 == 2: |
|
2147 | if p0 == 2: | |
2148 | self.specHeisGgraphChannelList.setEnabled(True) |
|
2148 | self.specHeisGgraphChannelList.setEnabled(True) | |
2149 | self.specHeisGgraphTminTmax.setEnabled(True) |
|
2149 | self.specHeisGgraphTminTmax.setEnabled(True) | |
2150 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
2150 | self.specHeisGgraphYminYmax.setEnabled(True) | |
2151 | self.specHeisGgraphTimeRange.setEnabled(True) |
|
2151 | self.specHeisGgraphTimeRange.setEnabled(True) | |
2152 |
|
2152 | |||
2153 | if p0 == 0: |
|
2153 | if p0 == 0: | |
2154 | self.specHeisGgraphTminTmax.setEnabled(False) |
|
2154 | self.specHeisGgraphTminTmax.setEnabled(False) | |
2155 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
2155 | self.specHeisGgraphYminYmax.setEnabled(False) | |
2156 | self.specHeisGgraphTimeRange.setEnabled(False) |
|
2156 | self.specHeisGgraphTimeRange.setEnabled(False) | |
2157 |
|
2157 | |||
2158 | @pyqtSignature("int") |
|
2158 | @pyqtSignature("int") | |
2159 | def on_specHeisGraphSaveSpectra_stateChanged(self, p0): |
|
2159 | def on_specHeisGraphSaveSpectra_stateChanged(self, p0): | |
2160 | """ |
|
2160 | """ | |
2161 | """ |
|
2161 | """ | |
2162 | if p0 == 2: |
|
2162 | if p0 == 2: | |
2163 | self.specHeisGraphPath.setEnabled(True) |
|
2163 | self.specHeisGraphPath.setEnabled(True) | |
2164 | self.specHeisGraphPrefix.setEnabled(True) |
|
2164 | self.specHeisGraphPrefix.setEnabled(True) | |
2165 | self.specHeisGraphToolPath.setEnabled(True) |
|
2165 | self.specHeisGraphToolPath.setEnabled(True) | |
2166 | if p0 == 0: |
|
2166 | if p0 == 0: | |
2167 | self.specHeisGraphPath.setEnabled(False) |
|
2167 | self.specHeisGraphPath.setEnabled(False) | |
2168 | self.specHeisGraphPrefix.setEnabled(False) |
|
2168 | self.specHeisGraphPrefix.setEnabled(False) | |
2169 | self.specHeisGraphToolPath.setEnabled(False) |
|
2169 | self.specHeisGraphToolPath.setEnabled(False) | |
2170 |
|
2170 | |||
2171 | @pyqtSignature("int") |
|
2171 | @pyqtSignature("int") | |
2172 | def on_specHeisGraphSaveRTIplot_stateChanged(self, p0): |
|
2172 | def on_specHeisGraphSaveRTIplot_stateChanged(self, p0): | |
2173 | if p0 == 2: |
|
2173 | if p0 == 2: | |
2174 | self.specHeisGraphPath.setEnabled(True) |
|
2174 | self.specHeisGraphPath.setEnabled(True) | |
2175 | self.specHeisGraphPrefix.setEnabled(True) |
|
2175 | self.specHeisGraphPrefix.setEnabled(True) | |
2176 | self.specHeisGraphToolPath.setEnabled(True) |
|
2176 | self.specHeisGraphToolPath.setEnabled(True) | |
2177 |
|
2177 | |||
2178 | @pyqtSignature("int") |
|
2178 | @pyqtSignature("int") | |
2179 | def on_specHeisGraphftpSpectra_stateChanged(self, p0): |
|
2179 | def on_specHeisGraphftpSpectra_stateChanged(self, p0): | |
2180 | """ |
|
2180 | """ | |
2181 | """ |
|
2181 | """ | |
2182 | if p0 == 2: |
|
2182 | if p0 == 2: | |
2183 | self.specHeisGgraphftpratio.setEnabled(True) |
|
2183 | self.specHeisGgraphftpratio.setEnabled(True) | |
2184 |
|
2184 | |||
2185 | if p0 == 0: |
|
2185 | if p0 == 0: | |
2186 | self.specHeisGgraphftpratio.setEnabled(False) |
|
2186 | self.specHeisGgraphftpratio.setEnabled(False) | |
2187 |
|
2187 | |||
2188 | @pyqtSignature("int") |
|
2188 | @pyqtSignature("int") | |
2189 | def on_specHeisGraphftpRTIplot_stateChanged(self, p0): |
|
2189 | def on_specHeisGraphftpRTIplot_stateChanged(self, p0): | |
2190 | if p0 == 2: |
|
2190 | if p0 == 2: | |
2191 | self.specHeisGgraphftpratio.setEnabled(True) |
|
2191 | self.specHeisGgraphftpratio.setEnabled(True) | |
2192 |
|
2192 | |||
2193 | @pyqtSignature("") |
|
2193 | @pyqtSignature("") | |
2194 | def on_specHeisGraphClear_clicked(self): |
|
2194 | def on_specHeisGraphClear_clicked(self): | |
2195 | pass |
|
2195 | pass | |
2196 |
|
2196 | |||
2197 | def __checkSpecGraphSaving(self): |
|
2197 | def __checkSpecGraphSaving(self): | |
2198 |
|
2198 | |||
2199 | enable = False |
|
2199 | enable = False | |
2200 |
|
2200 | |||
2201 | if self.specGraphSaveSpectra.checkState(): |
|
2201 | if self.specGraphSaveSpectra.checkState(): | |
2202 | enable = True |
|
2202 | enable = True | |
2203 |
|
2203 | |||
2204 | if self.specGraphSaveCross.checkState(): |
|
2204 | if self.specGraphSaveCross.checkState(): | |
2205 | enable = True |
|
2205 | enable = True | |
2206 |
|
2206 | |||
2207 | if self.specGraphSaveRTIplot.checkState(): |
|
2207 | if self.specGraphSaveRTIplot.checkState(): | |
2208 | enable = True |
|
2208 | enable = True | |
2209 |
|
2209 | |||
2210 | if self.specGraphSaveCoherencemap.checkState(): |
|
2210 | if self.specGraphSaveCoherencemap.checkState(): | |
2211 | enable = True |
|
2211 | enable = True | |
2212 |
|
2212 | |||
2213 | if self.specGraphSavePowerprofile.checkState(): |
|
2213 | if self.specGraphSavePowerprofile.checkState(): | |
2214 | enable = True |
|
2214 | enable = True | |
2215 |
|
2215 | |||
2216 | if self.specGraphSaveRTInoise.checkState(): |
|
2216 | if self.specGraphSaveRTInoise.checkState(): | |
2217 | enable = True |
|
2217 | enable = True | |
2218 |
|
2218 | |||
2219 | self.specGraphPath.setEnabled(enable) |
|
2219 | self.specGraphPath.setEnabled(enable) | |
2220 | self.specGraphPrefix.setEnabled(enable) |
|
2220 | self.specGraphPrefix.setEnabled(enable) | |
2221 | self.specGraphToolPath.setEnabled(enable) |
|
2221 | self.specGraphToolPath.setEnabled(enable) | |
2222 |
|
2222 | |||
2223 | self.specGgraphftpratio.setEnabled(enable) |
|
2223 | self.specGgraphftpratio.setEnabled(enable) | |
2224 |
|
2224 | |||
2225 | def __checkSpecGraphFTP(self): |
|
2225 | def __checkSpecGraphFTP(self): | |
2226 |
|
2226 | |||
2227 | enable = False |
|
2227 | enable = False | |
2228 |
|
2228 | |||
2229 | if self.specGraphftpSpectra.checkState(): |
|
2229 | if self.specGraphftpSpectra.checkState(): | |
2230 | enable = True |
|
2230 | enable = True | |
2231 |
|
2231 | |||
2232 | if self.specGraphftpCross.checkState(): |
|
2232 | if self.specGraphftpCross.checkState(): | |
2233 | enable = True |
|
2233 | enable = True | |
2234 |
|
2234 | |||
2235 | if self.specGraphftpRTIplot.checkState(): |
|
2235 | if self.specGraphftpRTIplot.checkState(): | |
2236 | enable = True |
|
2236 | enable = True | |
2237 |
|
2237 | |||
2238 | if self.specGraphftpCoherencemap.checkState(): |
|
2238 | if self.specGraphftpCoherencemap.checkState(): | |
2239 | enable = True |
|
2239 | enable = True | |
2240 |
|
2240 | |||
2241 | if self.specGraphftpPowerprofile.checkState(): |
|
2241 | if self.specGraphftpPowerprofile.checkState(): | |
2242 | enable = True |
|
2242 | enable = True | |
2243 |
|
2243 | |||
2244 | if self.specGraphftpRTInoise.checkState(): |
|
2244 | if self.specGraphftpRTInoise.checkState(): | |
2245 | enable = True |
|
2245 | enable = True | |
2246 |
|
2246 | |||
2247 | # self.specGgraphftpratio.setEnabled(enable) |
|
2247 | # self.specGgraphftpratio.setEnabled(enable) | |
2248 |
|
2248 | |||
2249 | def __checkSpecGraphFilters(self): |
|
2249 | def __checkSpecGraphFilters(self): | |
2250 |
|
2250 | |||
2251 | freq = False |
|
2251 | freq = False | |
2252 | height = False |
|
2252 | height = False | |
2253 | db = False |
|
2253 | db = False | |
2254 | time = False |
|
2254 | time = False | |
2255 | magnitud = False |
|
2255 | magnitud = False | |
2256 | phase = False |
|
2256 | phase = False | |
2257 | channelList = False |
|
2257 | channelList = False | |
2258 |
|
2258 | |||
2259 | if self.specGraphCebSpectraplot.checkState(): |
|
2259 | if self.specGraphCebSpectraplot.checkState(): | |
2260 | freq = True |
|
2260 | freq = True | |
2261 | height = True |
|
2261 | height = True | |
2262 | db = True |
|
2262 | db = True | |
2263 | channelList = True |
|
2263 | channelList = True | |
2264 |
|
2264 | |||
2265 | if self.specGraphCebCrossSpectraplot.checkState(): |
|
2265 | if self.specGraphCebCrossSpectraplot.checkState(): | |
2266 | freq = True |
|
2266 | freq = True | |
2267 | height = True |
|
2267 | height = True | |
2268 | db = True |
|
2268 | db = True | |
2269 | magnitud = True |
|
2269 | magnitud = True | |
2270 | phase = True |
|
2270 | phase = True | |
2271 |
|
2271 | |||
2272 | if self.specGraphCebRTIplot.checkState(): |
|
2272 | if self.specGraphCebRTIplot.checkState(): | |
2273 | height = True |
|
2273 | height = True | |
2274 | db = True |
|
2274 | db = True | |
2275 | time = True |
|
2275 | time = True | |
2276 | channelList = True |
|
2276 | channelList = True | |
2277 |
|
2277 | |||
2278 | if self.specGraphCebCoherencmap.checkState(): |
|
2278 | if self.specGraphCebCoherencmap.checkState(): | |
2279 | height = True |
|
2279 | height = True | |
2280 | time = True |
|
2280 | time = True | |
2281 | magnitud = True |
|
2281 | magnitud = True | |
2282 | phase = True |
|
2282 | phase = True | |
2283 |
|
2283 | |||
2284 | if self.specGraphPowerprofile.checkState(): |
|
2284 | if self.specGraphPowerprofile.checkState(): | |
2285 | height = True |
|
2285 | height = True | |
2286 | db = True |
|
2286 | db = True | |
2287 | channelList = True |
|
2287 | channelList = True | |
2288 |
|
2288 | |||
2289 | if self.specGraphCebRTInoise.checkState(): |
|
2289 | if self.specGraphCebRTInoise.checkState(): | |
2290 | db = True |
|
2290 | db = True | |
2291 | time = True |
|
2291 | time = True | |
2292 | channelList = True |
|
2292 | channelList = True | |
2293 |
|
2293 | |||
2294 |
|
2294 | |||
2295 | self.specGgraphFreq.setEnabled(freq) |
|
2295 | self.specGgraphFreq.setEnabled(freq) | |
2296 | self.specGgraphHeight.setEnabled(height) |
|
2296 | self.specGgraphHeight.setEnabled(height) | |
2297 | self.specGgraphDbsrange.setEnabled(db) |
|
2297 | self.specGgraphDbsrange.setEnabled(db) | |
2298 | self.specGgraphTminTmax.setEnabled(time) |
|
2298 | self.specGgraphTminTmax.setEnabled(time) | |
2299 |
|
2299 | |||
2300 | self.specGgraphmagnitud.setEnabled(magnitud) |
|
2300 | self.specGgraphmagnitud.setEnabled(magnitud) | |
2301 | self.specGgraphPhase.setEnabled(phase) |
|
2301 | self.specGgraphPhase.setEnabled(phase) | |
2302 | self.specGgraphChannelList.setEnabled(channelList) |
|
2302 | self.specGgraphChannelList.setEnabled(channelList) | |
2303 |
|
2303 | |||
2304 | def __getParmsFromProjectWindow(self): |
|
2304 | def __getParmsFromProjectWindow(self): | |
2305 | """ |
|
2305 | """ | |
2306 | Check Inputs Project: |
|
2306 | Check Inputs Project: | |
2307 | - project_name |
|
2307 | - project_name | |
2308 | - datatype |
|
2308 | - datatype | |
2309 | - ext |
|
2309 | - ext | |
2310 | - data_path |
|
2310 | - data_path | |
2311 | - readmode |
|
2311 | - readmode | |
2312 | - delay |
|
2312 | - delay | |
2313 | - set |
|
2313 | - set | |
2314 | - walk |
|
2314 | - walk | |
2315 | """ |
|
2315 | """ | |
2316 | parms_ok = True |
|
2316 | parms_ok = True | |
2317 |
|
2317 | |||
2318 | project_name = str(self.proName.text()) |
|
2318 | project_name = str(self.proName.text()) | |
2319 |
|
2319 | |||
2320 | if project_name == '' or project_name == None: |
|
2320 | if project_name == '' or project_name == None: | |
2321 | outputstr = "Enter a project Name" |
|
2321 | outputstr = "Enter a project Name" | |
2322 | self.console.append(outputstr) |
|
2322 | self.console.append(outputstr) | |
2323 | parms_ok = False |
|
2323 | parms_ok = False | |
2324 | project_name = None |
|
2324 | project_name = None | |
2325 |
|
2325 | |||
2326 | description = str(self.proDescription.toPlainText()) |
|
2326 | description = str(self.proDescription.toPlainText()) | |
2327 |
|
2327 | |||
2328 | datatype = str(self.proComDataType.currentText()) |
|
2328 | datatype = str(self.proComDataType.currentText()) | |
2329 |
|
2329 | |||
2330 | ext = str(self.proDataType.text()) |
|
2330 | ext = str(self.proDataType.text()) | |
2331 |
|
2331 | |||
2332 | dpath = str(self.proDataPath.text()) |
|
2332 | dpath = str(self.proDataPath.text()) | |
2333 |
|
2333 | |||
2334 | if dpath == '': |
|
2334 | if dpath == '': | |
2335 | outputstr = 'Datapath is empty' |
|
2335 | outputstr = 'Datapath is empty' | |
2336 | self.console.append(outputstr) |
|
2336 | self.console.append(outputstr) | |
2337 | parms_ok = False |
|
2337 | parms_ok = False | |
2338 | dpath = None |
|
2338 | dpath = None | |
2339 |
|
2339 | |||
2340 | if dpath != None: |
|
2340 | if dpath != None: | |
2341 | if not os.path.isdir(dpath): |
|
2341 | if not os.path.isdir(dpath): | |
2342 | outputstr = 'Datapath (%s) does not exist' % dpath |
|
2342 | outputstr = 'Datapath (%s) does not exist' % dpath | |
2343 | self.console.append(outputstr) |
|
2343 | self.console.append(outputstr) | |
2344 | parms_ok = False |
|
2344 | parms_ok = False | |
2345 | dpath = None |
|
2345 | dpath = None | |
2346 |
|
2346 | |||
2347 | online = int(self.proComReadMode.currentIndex()) |
|
2347 | online = int(self.proComReadMode.currentIndex()) | |
2348 |
|
2348 | |||
2349 | delay = None |
|
2349 | delay = None | |
2350 | if online==1: |
|
2350 | if online==1: | |
2351 | try: |
|
2351 | try: | |
2352 | delay = int(str(self.proDelay.text())) |
|
2352 | delay = int(str(self.proDelay.text())) | |
2353 | except: |
|
2353 | except: | |
2354 | outputstr = 'Delay value (%s) must be a integer number' %str(self.proDelay.text()) |
|
2354 | outputstr = 'Delay value (%s) must be a integer number' %str(self.proDelay.text()) | |
2355 | self.console.append(outputstr) |
|
2355 | self.console.append(outputstr) | |
2356 | parms_ok = False |
|
2356 | parms_ok = False | |
2357 |
|
2357 | |||
2358 |
|
2358 | |||
2359 | set = None |
|
2359 | set = None | |
2360 | value = str(self.proSet.text()) |
|
2360 | value = str(self.proSet.text()) | |
2361 | try: |
|
2361 | try: | |
2362 | set = int(value) |
|
2362 | set = int(value) | |
2363 | except: |
|
2363 | except: | |
2364 | pass |
|
2364 | pass | |
2365 |
|
2365 | |||
2366 | ippKm = None |
|
2366 | ippKm = None | |
2367 |
|
2367 | |||
2368 | value = str(self.proIPPKm.text()) |
|
2368 | value = str(self.proIPPKm.text()) | |
2369 |
|
2369 | |||
2370 | try: |
|
2370 | try: | |
2371 | ippKm = float(value) |
|
2371 | ippKm = float(value) | |
2372 | except: |
|
2372 | except: | |
2373 | if datatype=="USRP": |
|
2373 | if datatype=="USRP": | |
2374 | outputstr = 'IPP value (%s) must be a float number' % str(self.proIPPKm.text()) |
|
2374 | outputstr = 'IPP value (%s) must be a float number' % str(self.proIPPKm.text()) | |
2375 | self.console.append(outputstr) |
|
2375 | self.console.append(outputstr) | |
2376 | parms_ok = False |
|
2376 | parms_ok = False | |
2377 |
|
2377 | |||
2378 | walk = int(self.proComWalk.currentIndex()) |
|
2378 | walk = int(self.proComWalk.currentIndex()) | |
2379 |
|
2379 | |||
2380 | startDate = str(self.proComStartDate.currentText()) |
|
2380 | startDate = str(self.proComStartDate.currentText()) | |
2381 | endDate = str(self.proComEndDate.currentText()) |
|
2381 | endDate = str(self.proComEndDate.currentText()) | |
2382 |
|
2382 | |||
2383 | # startDateList = startDate.split("/") |
|
2383 | # startDateList = startDate.split("/") | |
2384 | # endDateList = endDate.split("/") |
|
2384 | # endDateList = endDate.split("/") | |
2385 | # |
|
2385 | # | |
2386 | # startDate = datetime.date(int(startDateList[0]), int(startDateList[1]), int(startDateList[2])) |
|
2386 | # startDate = datetime.date(int(startDateList[0]), int(startDateList[1]), int(startDateList[2])) | |
2387 | # endDate = datetime.date(int(endDateList[0]), int(endDateList[1]), int(endDateList[2])) |
|
2387 | # endDate = datetime.date(int(endDateList[0]), int(endDateList[1]), int(endDateList[2])) | |
2388 |
|
2388 | |||
2389 | startTime = self.proStartTime.time() |
|
2389 | startTime = self.proStartTime.time() | |
2390 | endTime = self.proEndTime.time() |
|
2390 | endTime = self.proEndTime.time() | |
2391 |
|
2391 | |||
2392 | startTime = str(startTime.toString("H:m:s")) |
|
2392 | startTime = str(startTime.toString("H:m:s")) | |
2393 | endTime = str(endTime.toString("H:m:s")) |
|
2393 | endTime = str(endTime.toString("H:m:s")) | |
2394 |
|
2394 | |||
2395 | projectParms = ProjectParms() |
|
2395 | projectParms = ProjectParms() | |
2396 |
|
2396 | |||
2397 | projectParms.name = project_name |
|
2397 | projectParms.name = project_name | |
2398 | projectParms.description = description |
|
2398 | projectParms.description = description | |
2399 | projectParms.datatype = datatype |
|
2399 | projectParms.datatype = datatype | |
2400 | projectParms.ext = ext |
|
2400 | projectParms.ext = ext | |
2401 | projectParms.dpath = dpath |
|
2401 | projectParms.dpath = dpath | |
2402 | projectParms.online = online |
|
2402 | projectParms.online = online | |
2403 | projectParms.startDate = startDate |
|
2403 | projectParms.startDate = startDate | |
2404 | projectParms.endDate = endDate |
|
2404 | projectParms.endDate = endDate | |
2405 | projectParms.startTime = startTime |
|
2405 | projectParms.startTime = startTime | |
2406 | projectParms.endTime = endTime |
|
2406 | projectParms.endTime = endTime | |
2407 | projectParms.delay=delay |
|
2407 | projectParms.delay=delay | |
2408 | projectParms.walk=walk |
|
2408 | projectParms.walk=walk | |
2409 | projectParms.set=set |
|
2409 | projectParms.set=set | |
2410 | projectParms.ippKm=ippKm |
|
2410 | projectParms.ippKm=ippKm | |
2411 | projectParms.parmsOk=parms_ok |
|
2411 | projectParms.parmsOk=parms_ok | |
2412 |
|
2412 | |||
2413 | return projectParms |
|
2413 | return projectParms | |
2414 |
|
2414 | |||
2415 |
|
2415 | |||
2416 | def __getParmsFromProjectObj(self, projectObjView): |
|
2416 | def __getParmsFromProjectObj(self, projectObjView): | |
2417 |
|
2417 | |||
2418 | parms_ok = True |
|
2418 | parms_ok = True | |
2419 |
|
2419 | |||
2420 | project_name, description = projectObjView.name, projectObjView.description |
|
2420 | project_name, description = projectObjView.name, projectObjView.description | |
2421 |
|
2421 | |||
2422 | readUnitObj = projectObjView.getReadUnitObj() |
|
2422 | readUnitObj = projectObjView.getReadUnitObj() | |
2423 | datatype = readUnitObj.datatype |
|
2423 | datatype = readUnitObj.datatype | |
2424 |
|
2424 | |||
2425 | operationObj = readUnitObj.getOperationObj(name='run') |
|
2425 | operationObj = readUnitObj.getOperationObj(name='run') | |
2426 |
|
2426 | |||
2427 | dpath = operationObj.getParameterValue(parameterName='path') |
|
2427 | dpath = operationObj.getParameterValue(parameterName='path') | |
2428 | startDate = operationObj.getParameterValue(parameterName='startDate') |
|
2428 | startDate = operationObj.getParameterValue(parameterName='startDate') | |
2429 | endDate = operationObj.getParameterValue(parameterName='endDate') |
|
2429 | endDate = operationObj.getParameterValue(parameterName='endDate') | |
2430 |
|
2430 | |||
2431 | startDate = startDate.strftime("%Y/%m/%d") |
|
2431 | startDate = startDate.strftime("%Y/%m/%d") | |
2432 | endDate = endDate.strftime("%Y/%m/%d") |
|
2432 | endDate = endDate.strftime("%Y/%m/%d") | |
2433 |
|
2433 | |||
2434 | startTime = operationObj.getParameterValue(parameterName='startTime') |
|
2434 | startTime = operationObj.getParameterValue(parameterName='startTime') | |
2435 | endTime = operationObj.getParameterValue(parameterName='endTime') |
|
2435 | endTime = operationObj.getParameterValue(parameterName='endTime') | |
2436 |
|
2436 | |||
2437 | startTime = startTime.strftime("%H:%M:%S") |
|
2437 | startTime = startTime.strftime("%H:%M:%S") | |
2438 | endTime = endTime.strftime("%H:%M:%S") |
|
2438 | endTime = endTime.strftime("%H:%M:%S") | |
2439 |
|
2439 | |||
2440 | online = 0 |
|
2440 | online = 0 | |
2441 | try: |
|
2441 | try: | |
2442 | online = operationObj.getParameterValue(parameterName='online') |
|
2442 | online = operationObj.getParameterValue(parameterName='online') | |
2443 | except: |
|
2443 | except: | |
2444 | pass |
|
2444 | pass | |
2445 |
|
2445 | |||
2446 | delay = '' |
|
2446 | delay = '' | |
2447 | try: |
|
2447 | try: | |
2448 | delay = operationObj.getParameterValue(parameterName='delay') |
|
2448 | delay = operationObj.getParameterValue(parameterName='delay') | |
2449 | except: |
|
2449 | except: | |
2450 | pass |
|
2450 | pass | |
2451 |
|
2451 | |||
2452 | walk = 0 |
|
2452 | walk = 0 | |
2453 | try: |
|
2453 | try: | |
2454 | walk = operationObj.getParameterValue(parameterName='walk') |
|
2454 | walk = operationObj.getParameterValue(parameterName='walk') | |
2455 | except: |
|
2455 | except: | |
2456 | pass |
|
2456 | pass | |
2457 |
|
2457 | |||
2458 | set = '' |
|
2458 | set = '' | |
2459 | try: |
|
2459 | try: | |
2460 | set = operationObj.getParameterValue(parameterName='set') |
|
2460 | set = operationObj.getParameterValue(parameterName='set') | |
2461 | except: |
|
2461 | except: | |
2462 | pass |
|
2462 | pass | |
2463 |
|
2463 | |||
2464 | ippKm = '' |
|
2464 | ippKm = '' | |
2465 | if datatype.lower() == 'usrp': |
|
2465 | if datatype.lower() == 'usrp': | |
2466 | try: |
|
2466 | try: | |
2467 | ippKm = operationObj.getParameterValue(parameterName='ippKm') |
|
2467 | ippKm = operationObj.getParameterValue(parameterName='ippKm') | |
2468 | except: |
|
2468 | except: | |
2469 | pass |
|
2469 | pass | |
2470 |
|
2470 | |||
2471 | projectParms = ProjectParms() |
|
2471 | projectParms = ProjectParms() | |
2472 |
|
2472 | |||
2473 | projectParms.name = project_name |
|
2473 | projectParms.name = project_name | |
2474 | projectParms.description = description |
|
2474 | projectParms.description = description | |
2475 | projectParms.datatype = datatype |
|
2475 | projectParms.datatype = datatype | |
2476 | projectParms.ext = None |
|
2476 | projectParms.ext = None | |
2477 | projectParms.dpath = dpath |
|
2477 | projectParms.dpath = dpath | |
2478 | projectParms.online = online |
|
2478 | projectParms.online = online | |
2479 | projectParms.startDate = startDate |
|
2479 | projectParms.startDate = startDate | |
2480 | projectParms.endDate = endDate |
|
2480 | projectParms.endDate = endDate | |
2481 | projectParms.startTime = startTime |
|
2481 | projectParms.startTime = startTime | |
2482 | projectParms.endTime = endTime |
|
2482 | projectParms.endTime = endTime | |
2483 | projectParms.delay=delay |
|
2483 | projectParms.delay=delay | |
2484 | projectParms.walk=walk |
|
2484 | projectParms.walk=walk | |
2485 | projectParms.set=set |
|
2485 | projectParms.set=set | |
2486 | projectParms.ippKm=ippKm |
|
2486 | projectParms.ippKm=ippKm | |
2487 | projectParms.parmsOk=parms_ok |
|
2487 | projectParms.parmsOk=parms_ok | |
2488 |
|
2488 | |||
2489 | return projectParms |
|
2489 | return projectParms | |
2490 |
|
2490 | |||
2491 | def refreshProjectWindow2(self, projectObjView): |
|
2491 | def refreshProjectWindow2(self, projectObjView): | |
2492 |
|
2492 | |||
2493 | projectParms = self.__getParmsFromProjectObj(projectObjView) |
|
2493 | projectParms = self.__getParmsFromProjectObj(projectObjView) | |
2494 |
|
2494 | |||
2495 | index = projectParms.getDatatypeIndex() |
|
2495 | index = projectParms.getDatatypeIndex() | |
2496 |
|
2496 | |||
2497 | self.proName.setText(projectParms.name) |
|
2497 | self.proName.setText(projectParms.name) | |
2498 | self.proDescription.clear() |
|
2498 | self.proDescription.clear() | |
2499 | self.proDescription.append(projectParms.description) |
|
2499 | self.proDescription.append(projectParms.description) | |
2500 |
|
2500 | |||
2501 | self.on_proComDataType_activated(index=index) |
|
2501 | self.on_proComDataType_activated(index=index) | |
2502 | self.proDataPath.setText(projectParms.dpath) |
|
2502 | self.proDataPath.setText(projectParms.dpath) | |
2503 | self.proComDataType.setCurrentIndex(index) |
|
2503 | self.proComDataType.setCurrentIndex(index) | |
2504 | self.proComReadMode.setCurrentIndex(projectParms.online) |
|
2504 | self.proComReadMode.setCurrentIndex(projectParms.online) | |
2505 | self.proDelay.setText(str(projectParms.delay)) |
|
2505 | self.proDelay.setText(str(projectParms.delay)) | |
2506 | self.proSet.setText(str(projectParms.set)) |
|
2506 | self.proSet.setText(str(projectParms.set)) | |
2507 | self.proIPPKm.setText(str(projectParms.ippKm)) |
|
2507 | self.proIPPKm.setText(str(projectParms.ippKm)) | |
2508 |
|
2508 | |||
2509 | dateList = self.loadDays(data_path = projectParms.dpath, |
|
2509 | dateList = self.loadDays(data_path = projectParms.dpath, | |
2510 | ext = projectParms.getExt(), |
|
2510 | ext = projectParms.getExt(), | |
2511 | walk = projectParms.walk, |
|
2511 | walk = projectParms.walk, | |
2512 | expLabel = projectParms.expLabel) |
|
2512 | expLabel = projectParms.expLabel) | |
2513 |
|
2513 | |||
2514 | try: |
|
2514 | try: | |
2515 | startDateIndex = dateList.index(projectParms.startDate) |
|
2515 | startDateIndex = dateList.index(projectParms.startDate) | |
2516 | except: |
|
2516 | except: | |
2517 | startDateIndex = 0 |
|
2517 | startDateIndex = 0 | |
2518 |
|
2518 | |||
2519 | try: |
|
2519 | try: | |
2520 | endDateIndex = dateList.index(projectParms.endDate) |
|
2520 | endDateIndex = dateList.index(projectParms.endDate) | |
2521 | except: |
|
2521 | except: | |
2522 | endDateIndex = int(self.proComEndDate.count()-1) |
|
2522 | endDateIndex = int(self.proComEndDate.count()-1) | |
2523 |
|
2523 | |||
2524 | self.proComStartDate.setCurrentIndex(startDateIndex) |
|
2524 | self.proComStartDate.setCurrentIndex(startDateIndex) | |
2525 | self.proComEndDate.setCurrentIndex(endDateIndex) |
|
2525 | self.proComEndDate.setCurrentIndex(endDateIndex) | |
2526 |
|
2526 | |||
2527 | startlist = projectParms.startTime.split(":") |
|
2527 | startlist = projectParms.startTime.split(":") | |
2528 | endlist = projectParms.endTime.split(":") |
|
2528 | endlist = projectParms.endTime.split(":") | |
2529 |
|
2529 | |||
2530 | self.time.setHMS(int(startlist[0]), int(startlist[1]), int(startlist[2])) |
|
2530 | self.time.setHMS(int(startlist[0]), int(startlist[1]), int(startlist[2])) | |
2531 | self.proStartTime.setTime(self.time) |
|
2531 | self.proStartTime.setTime(self.time) | |
2532 |
|
2532 | |||
2533 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
2533 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) | |
2534 | self.proEndTime.setTime(self.time) |
|
2534 | self.proEndTime.setTime(self.time) | |
2535 |
|
2535 | |||
2536 |
|
2536 | |||
2537 | def __refreshVoltageWindow(self, puObj): |
|
2537 | def __refreshVoltageWindow(self, puObj): | |
2538 |
|
2538 | |||
2539 | opObj = puObj.getOperationObj(name='setRadarFrequency') |
|
2539 | opObj = puObj.getOperationObj(name='setRadarFrequency') | |
2540 | if opObj == None: |
|
2540 | if opObj == None: | |
2541 | self.volOpRadarfrequency.clear() |
|
2541 | self.volOpRadarfrequency.clear() | |
2542 | self.volOpCebRadarfrequency.setCheckState(0) |
|
2542 | self.volOpCebRadarfrequency.setCheckState(0) | |
2543 | else: |
|
2543 | else: | |
2544 | value = opObj.getParameterValue(parameterName='frequency') |
|
2544 | value = opObj.getParameterValue(parameterName='frequency') | |
2545 | value = str(float(value)/1e6) |
|
2545 | value = str(float(value)/1e6) | |
2546 | self.volOpRadarfrequency.setText(value) |
|
2546 | self.volOpRadarfrequency.setText(value) | |
2547 | self.volOpRadarfrequency.setEnabled(True) |
|
2547 | self.volOpRadarfrequency.setEnabled(True) | |
2548 | self.volOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) |
|
2548 | self.volOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) | |
2549 |
|
2549 | |||
2550 | opObj = puObj.getOperationObj(name="selectChannels") |
|
2550 | opObj = puObj.getOperationObj(name="selectChannels") | |
2551 |
|
2551 | |||
2552 | if opObj == None: |
|
2552 | if opObj == None: | |
2553 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") |
|
2553 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") | |
2554 |
|
2554 | |||
2555 | if opObj == None: |
|
2555 | if opObj == None: | |
2556 | self.volOpChannel.clear() |
|
2556 | self.volOpChannel.clear() | |
2557 | self.volOpCebChannels.setCheckState(0) |
|
2557 | self.volOpCebChannels.setCheckState(0) | |
2558 | else: |
|
2558 | else: | |
2559 | channelEnabled = False |
|
2559 | channelEnabled = False | |
2560 | try: |
|
2560 | try: | |
2561 | value = opObj.getParameterValue(parameterName='channelList') |
|
2561 | value = opObj.getParameterValue(parameterName='channelList') | |
2562 | value = str(value)[1:-1] |
|
2562 | value = str(value)[1:-1] | |
2563 | channelEnabled = True |
|
2563 | channelEnabled = True | |
2564 | channelMode = 0 |
|
2564 | channelMode = 0 | |
2565 | except: |
|
2565 | except: | |
2566 | pass |
|
2566 | pass | |
2567 | try: |
|
2567 | try: | |
2568 | value = opObj.getParameterValue(parameterName='channelIndexList') |
|
2568 | value = opObj.getParameterValue(parameterName='channelIndexList') | |
2569 | value = str(value)[1:-1] |
|
2569 | value = str(value)[1:-1] | |
2570 | channelEnabled = True |
|
2570 | channelEnabled = True | |
2571 | channelMode = 1 |
|
2571 | channelMode = 1 | |
2572 | except: |
|
2572 | except: | |
2573 | pass |
|
2573 | pass | |
2574 |
|
2574 | |||
2575 | if channelEnabled: |
|
2575 | if channelEnabled: | |
2576 | self.volOpChannel.setText(value) |
|
2576 | self.volOpChannel.setText(value) | |
2577 | self.volOpChannel.setEnabled(True) |
|
2577 | self.volOpChannel.setEnabled(True) | |
2578 | self.volOpCebChannels.setCheckState(QtCore.Qt.Checked) |
|
2578 | self.volOpCebChannels.setCheckState(QtCore.Qt.Checked) | |
2579 | self.volOpComChannels.setCurrentIndex(channelMode) |
|
2579 | self.volOpComChannels.setCurrentIndex(channelMode) | |
2580 |
|
2580 | |||
2581 | opObj = puObj.getOperationObj(name="selectHeights") |
|
2581 | opObj = puObj.getOperationObj(name="selectHeights") | |
2582 | if opObj == None: |
|
2582 | if opObj == None: | |
2583 | self.volOpHeights.clear() |
|
2583 | self.volOpHeights.clear() | |
2584 | self.volOpCebHeights.setCheckState(0) |
|
2584 | self.volOpCebHeights.setCheckState(0) | |
2585 | else: |
|
2585 | else: | |
2586 | value1 = int(opObj.getParameterValue(parameterName='minHei')) |
|
2586 | value1 = int(opObj.getParameterValue(parameterName='minHei')) | |
2587 | value1 = str(value1) |
|
2587 | value1 = str(value1) | |
2588 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) |
|
2588 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) | |
2589 | value2 = str(value2) |
|
2589 | value2 = str(value2) | |
2590 | value = value1 + "," + value2 |
|
2590 | value = value1 + "," + value2 | |
2591 | self.volOpHeights.setText(value) |
|
2591 | self.volOpHeights.setText(value) | |
2592 | self.volOpHeights.setEnabled(True) |
|
2592 | self.volOpHeights.setEnabled(True) | |
2593 | self.volOpCebHeights.setCheckState(QtCore.Qt.Checked) |
|
2593 | self.volOpCebHeights.setCheckState(QtCore.Qt.Checked) | |
2594 |
|
2594 | |||
2595 | opObj = puObj.getOperationObj(name="filterByHeights") |
|
2595 | opObj = puObj.getOperationObj(name="filterByHeights") | |
2596 | if opObj == None: |
|
2596 | if opObj == None: | |
2597 | self.volOpFilter.clear() |
|
2597 | self.volOpFilter.clear() | |
2598 | self.volOpCebFilter.setCheckState(0) |
|
2598 | self.volOpCebFilter.setCheckState(0) | |
2599 | else: |
|
2599 | else: | |
2600 | value = opObj.getParameterValue(parameterName='window') |
|
2600 | value = opObj.getParameterValue(parameterName='window') | |
2601 | value = str(value) |
|
2601 | value = str(value) | |
2602 | self.volOpFilter.setText(value) |
|
2602 | self.volOpFilter.setText(value) | |
2603 | self.volOpFilter.setEnabled(True) |
|
2603 | self.volOpFilter.setEnabled(True) | |
2604 | self.volOpCebFilter.setCheckState(QtCore.Qt.Checked) |
|
2604 | self.volOpCebFilter.setCheckState(QtCore.Qt.Checked) | |
2605 |
|
2605 | |||
2606 | opObj = puObj.getOperationObj(name="ProfileSelector") |
|
2606 | opObj = puObj.getOperationObj(name="ProfileSelector") | |
2607 | if opObj == None: |
|
2607 | if opObj == None: | |
2608 | self.volOpProfile.clear() |
|
2608 | self.volOpProfile.clear() | |
2609 | self.volOpCebProfile.setCheckState(0) |
|
2609 | self.volOpCebProfile.setCheckState(0) | |
2610 | else: |
|
2610 | else: | |
2611 | for parmObj in opObj.getParameterObjList(): |
|
2611 | for parmObj in opObj.getParameterObjList(): | |
2612 |
|
2612 | |||
2613 | if parmObj.name == "profileList": |
|
2613 | if parmObj.name == "profileList": | |
2614 | value = parmObj.getValue() |
|
2614 | value = parmObj.getValue() | |
2615 | value = str(value)[1:-1] |
|
2615 | value = str(value)[1:-1] | |
2616 | self.volOpProfile.setText(value) |
|
2616 | self.volOpProfile.setText(value) | |
2617 | self.volOpProfile.setEnabled(True) |
|
2617 | self.volOpProfile.setEnabled(True) | |
2618 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2618 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) | |
2619 | self.volOpComProfile.setCurrentIndex(0) |
|
2619 | self.volOpComProfile.setCurrentIndex(0) | |
2620 |
|
2620 | |||
2621 | if parmObj.name == "profileRangeList": |
|
2621 | if parmObj.name == "profileRangeList": | |
2622 | value = parmObj.getValue() |
|
2622 | value = parmObj.getValue() | |
2623 | value = str(value)[1:-1] |
|
2623 | value = str(value)[1:-1] | |
2624 | self.volOpProfile.setText(value) |
|
2624 | self.volOpProfile.setText(value) | |
2625 | self.volOpProfile.setEnabled(True) |
|
2625 | self.volOpProfile.setEnabled(True) | |
2626 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2626 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) | |
2627 | self.volOpComProfile.setCurrentIndex(1) |
|
2627 | self.volOpComProfile.setCurrentIndex(1) | |
2628 |
|
2628 | |||
2629 | if parmObj.name == "rangeList": |
|
2629 | if parmObj.name == "rangeList": | |
2630 | value = parmObj.getValue() |
|
2630 | value = parmObj.getValue() | |
2631 | value = str(value)[1:-1] |
|
2631 | value = str(value)[1:-1] | |
2632 | self.volOpProfile.setText(value) |
|
2632 | self.volOpProfile.setText(value) | |
2633 | self.volOpProfile.setEnabled(True) |
|
2633 | self.volOpProfile.setEnabled(True) | |
2634 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2634 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) | |
2635 | self.volOpComProfile.setCurrentIndex(2) |
|
2635 | self.volOpComProfile.setCurrentIndex(2) | |
2636 |
|
2636 | |||
2637 | opObj = puObj.getOperationObj(name="Decoder") |
|
2637 | opObj = puObj.getOperationObj(name="Decoder") | |
2638 | self.volOpCode.setText("") |
|
2638 | self.volOpCode.setText("") | |
2639 | if opObj == None: |
|
2639 | if opObj == None: | |
2640 | self.volOpCebDecodification.setCheckState(0) |
|
2640 | self.volOpCebDecodification.setCheckState(0) | |
2641 | else: |
|
2641 | else: | |
2642 | self.volOpCebDecodification.setCheckState(QtCore.Qt.Checked) |
|
2642 | self.volOpCebDecodification.setCheckState(QtCore.Qt.Checked) | |
2643 |
|
2643 | |||
2644 | parmObj = opObj.getParameterObj('code') |
|
2644 | parmObj = opObj.getParameterObj('code') | |
2645 |
|
2645 | |||
2646 | if parmObj == None: |
|
2646 | if parmObj == None: | |
2647 | self.volOpComCode.setCurrentIndex(0) |
|
2647 | self.volOpComCode.setCurrentIndex(0) | |
2648 | else: |
|
2648 | else: | |
2649 |
|
2649 | |||
2650 | parmObj1 = opObj.getParameterObj('nCode') |
|
2650 | parmObj1 = opObj.getParameterObj('nCode') | |
2651 | parmObj2 = opObj.getParameterObj('nBaud') |
|
2651 | parmObj2 = opObj.getParameterObj('nBaud') | |
2652 |
|
2652 | |||
2653 | if parmObj1 == None or parmObj2 == None: |
|
2653 | if parmObj1 == None or parmObj2 == None: | |
2654 | self.volOpComCode.setCurrentIndex(0) |
|
2654 | self.volOpComCode.setCurrentIndex(0) | |
2655 | else: |
|
2655 | else: | |
2656 | code = ast.literal_eval(str(parmObj.getValue())) |
|
2656 | code = ast.literal_eval(str(parmObj.getValue())) | |
2657 | nCode = parmObj1.getValue() |
|
2657 | nCode = parmObj1.getValue() | |
2658 | nBaud = parmObj2.getValue() |
|
2658 | nBaud = parmObj2.getValue() | |
2659 |
|
2659 | |||
2660 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() |
|
2660 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() | |
2661 |
|
2661 | |||
2662 | #User defined by default |
|
2662 | #User defined by default | |
2663 | self.volOpComCode.setCurrentIndex(13) |
|
2663 | self.volOpComCode.setCurrentIndex(13) | |
2664 | self.volOpCode.setText(str(code)) |
|
2664 | self.volOpCode.setText(str(code)) | |
2665 |
|
2665 | |||
2666 | if nCode == 1: |
|
2666 | if nCode == 1: | |
2667 | if nBaud == 3: |
|
2667 | if nBaud == 3: | |
2668 | self.volOpComCode.setCurrentIndex(1) |
|
2668 | self.volOpComCode.setCurrentIndex(1) | |
2669 | if nBaud == 4: |
|
2669 | if nBaud == 4: | |
2670 | self.volOpComCode.setCurrentIndex(2) |
|
2670 | self.volOpComCode.setCurrentIndex(2) | |
2671 | if nBaud == 5: |
|
2671 | if nBaud == 5: | |
2672 | self.volOpComCode.setCurrentIndex(3) |
|
2672 | self.volOpComCode.setCurrentIndex(3) | |
2673 | if nBaud == 7: |
|
2673 | if nBaud == 7: | |
2674 | self.volOpComCode.setCurrentIndex(4) |
|
2674 | self.volOpComCode.setCurrentIndex(4) | |
2675 | if nBaud == 11: |
|
2675 | if nBaud == 11: | |
2676 | self.volOpComCode.setCurrentIndex(5) |
|
2676 | self.volOpComCode.setCurrentIndex(5) | |
2677 | if nBaud == 13: |
|
2677 | if nBaud == 13: | |
2678 | self.volOpComCode.setCurrentIndex(6) |
|
2678 | self.volOpComCode.setCurrentIndex(6) | |
2679 |
|
2679 | |||
2680 | if nCode == 2: |
|
2680 | if nCode == 2: | |
2681 | if nBaud == 3: |
|
2681 | if nBaud == 3: | |
2682 | self.volOpComCode.setCurrentIndex(7) |
|
2682 | self.volOpComCode.setCurrentIndex(7) | |
2683 | if nBaud == 4: |
|
2683 | if nBaud == 4: | |
2684 | self.volOpComCode.setCurrentIndex(8) |
|
2684 | self.volOpComCode.setCurrentIndex(8) | |
2685 | if nBaud == 5: |
|
2685 | if nBaud == 5: | |
2686 | self.volOpComCode.setCurrentIndex(9) |
|
2686 | self.volOpComCode.setCurrentIndex(9) | |
2687 | if nBaud == 7: |
|
2687 | if nBaud == 7: | |
2688 | self.volOpComCode.setCurrentIndex(10) |
|
2688 | self.volOpComCode.setCurrentIndex(10) | |
2689 | if nBaud == 11: |
|
2689 | if nBaud == 11: | |
2690 | self.volOpComCode.setCurrentIndex(11) |
|
2690 | self.volOpComCode.setCurrentIndex(11) | |
2691 | if nBaud == 13: |
|
2691 | if nBaud == 13: | |
2692 | self.volOpComCode.setCurrentIndex(12) |
|
2692 | self.volOpComCode.setCurrentIndex(12) | |
2693 |
|
2693 | |||
2694 |
|
2694 | |||
2695 | opObj = puObj.getOperationObj(name="deFlip") |
|
2695 | opObj = puObj.getOperationObj(name="deFlip") | |
2696 | if opObj == None: |
|
2696 | if opObj == None: | |
2697 | self.volOpFlip.clear() |
|
2697 | self.volOpFlip.clear() | |
2698 | self.volOpFlip.setEnabled(False) |
|
2698 | self.volOpFlip.setEnabled(False) | |
2699 | self.volOpCebFlip.setCheckState(0) |
|
2699 | self.volOpCebFlip.setCheckState(0) | |
2700 | else: |
|
2700 | else: | |
2701 | try: |
|
2701 | try: | |
2702 | value = opObj.getParameterValue(parameterName='channelList') |
|
2702 | value = opObj.getParameterValue(parameterName='channelList') | |
2703 | value = str(value)[1:-1] |
|
2703 | value = str(value)[1:-1] | |
2704 | except: |
|
2704 | except: | |
2705 | value = "" |
|
2705 | value = "" | |
2706 |
|
2706 | |||
2707 | self.volOpFlip.setText(value) |
|
2707 | self.volOpFlip.setText(value) | |
2708 | self.volOpFlip.setEnabled(True) |
|
2708 | self.volOpFlip.setEnabled(True) | |
2709 | self.volOpCebFlip.setCheckState(QtCore.Qt.Checked) |
|
2709 | self.volOpCebFlip.setCheckState(QtCore.Qt.Checked) | |
2710 |
|
2710 | |||
2711 | opObj = puObj.getOperationObj(name="CohInt") |
|
2711 | opObj = puObj.getOperationObj(name="CohInt") | |
2712 | if opObj == None: |
|
2712 | if opObj == None: | |
2713 | self.volOpCohInt.clear() |
|
2713 | self.volOpCohInt.clear() | |
2714 | self.volOpCebCohInt.setCheckState(0) |
|
2714 | self.volOpCebCohInt.setCheckState(0) | |
2715 | else: |
|
2715 | else: | |
2716 | value = opObj.getParameterValue(parameterName='n') |
|
2716 | value = opObj.getParameterValue(parameterName='n') | |
2717 | self.volOpCohInt.setText(str(value)) |
|
2717 | self.volOpCohInt.setText(str(value)) | |
2718 | self.volOpCohInt.setEnabled(True) |
|
2718 | self.volOpCohInt.setEnabled(True) | |
2719 | self.volOpCebCohInt.setCheckState(QtCore.Qt.Checked) |
|
2719 | self.volOpCebCohInt.setCheckState(QtCore.Qt.Checked) | |
2720 |
|
2720 | |||
2721 | opObj = puObj.getOperationObj(name='Scope') |
|
2721 | opObj = puObj.getOperationObj(name='Scope') | |
2722 | if opObj == None: |
|
2722 | if opObj == None: | |
2723 | self.volGraphCebshow.setCheckState(0) |
|
2723 | self.volGraphCebshow.setCheckState(0) | |
2724 | else: |
|
2724 | else: | |
2725 | self.volGraphCebshow.setCheckState(QtCore.Qt.Checked) |
|
2725 | self.volGraphCebshow.setCheckState(QtCore.Qt.Checked) | |
2726 |
|
2726 | |||
2727 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
2727 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
2728 |
|
2728 | |||
2729 | if parmObj == None: |
|
2729 | if parmObj == None: | |
2730 | self.volGraphChannelList.clear() |
|
2730 | self.volGraphChannelList.clear() | |
2731 | else: |
|
2731 | else: | |
2732 | value = parmObj.getValue() |
|
2732 | value = parmObj.getValue() | |
2733 | value = str(value) |
|
2733 | value = str(value) | |
2734 | self.volGraphChannelList.setText(value) |
|
2734 | self.volGraphChannelList.setText(value) | |
2735 | self.volOpProfile.setEnabled(True) |
|
2735 | self.volOpProfile.setEnabled(True) | |
2736 |
|
2736 | |||
2737 | parmObj1 = opObj.getParameterObj(parameterName='xmin') |
|
2737 | parmObj1 = opObj.getParameterObj(parameterName='xmin') | |
2738 | parmObj2 = opObj.getParameterObj(parameterName='xmax') |
|
2738 | parmObj2 = opObj.getParameterObj(parameterName='xmax') | |
2739 |
|
2739 | |||
2740 | if parmObj1 == None or parmObj2 ==None: |
|
2740 | if parmObj1 == None or parmObj2 ==None: | |
2741 | self.volGraphfreqrange.clear() |
|
2741 | self.volGraphfreqrange.clear() | |
2742 | else: |
|
2742 | else: | |
2743 | value1 = parmObj1.getValue() |
|
2743 | value1 = parmObj1.getValue() | |
2744 | value1 = str(value1) |
|
2744 | value1 = str(value1) | |
2745 | value2 = parmObj2.getValue() |
|
2745 | value2 = parmObj2.getValue() | |
2746 | value2 = str(value2) |
|
2746 | value2 = str(value2) | |
2747 | value = value1 + "," + value2 |
|
2747 | value = value1 + "," + value2 | |
2748 | self.volGraphfreqrange.setText(value) |
|
2748 | self.volGraphfreqrange.setText(value) | |
2749 |
|
2749 | |||
2750 | parmObj1 = opObj.getParameterObj(parameterName='ymin') |
|
2750 | parmObj1 = opObj.getParameterObj(parameterName='ymin') | |
2751 | parmObj2 = opObj.getParameterObj(parameterName='ymax') |
|
2751 | parmObj2 = opObj.getParameterObj(parameterName='ymax') | |
2752 |
|
2752 | |||
2753 | if parmObj1 == None or parmObj2 ==None: |
|
2753 | if parmObj1 == None or parmObj2 ==None: | |
2754 | self.volGraphHeightrange.clear() |
|
2754 | self.volGraphHeightrange.clear() | |
2755 | else: |
|
2755 | else: | |
2756 | value1 = parmObj1.getValue() |
|
2756 | value1 = parmObj1.getValue() | |
2757 | value1 = str(value1) |
|
2757 | value1 = str(value1) | |
2758 | value2 = parmObj2.getValue() |
|
2758 | value2 = parmObj2.getValue() | |
2759 | value2 = str(value2) |
|
2759 | value2 = str(value2) | |
2760 | value = value1 + "," + value2 |
|
2760 | value = value1 + "," + value2 | |
2761 | value2 = str(value2) |
|
2761 | value2 = str(value2) | |
2762 | self.volGraphHeightrange.setText(value) |
|
2762 | self.volGraphHeightrange.setText(value) | |
2763 |
|
2763 | |||
2764 | parmObj = opObj.getParameterObj(parameterName='save') |
|
2764 | parmObj = opObj.getParameterObj(parameterName='save') | |
2765 |
|
2765 | |||
2766 | if parmObj == None: |
|
2766 | if parmObj == None: | |
2767 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) |
|
2767 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) | |
2768 | else: |
|
2768 | else: | |
2769 | value = parmObj.getValue() |
|
2769 | value = parmObj.getValue() | |
2770 | if int(value): |
|
2770 | if int(value): | |
2771 | self.volGraphCebSave.setCheckState(QtCore.Qt.Checked) |
|
2771 | self.volGraphCebSave.setCheckState(QtCore.Qt.Checked) | |
2772 | else: |
|
2772 | else: | |
2773 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) |
|
2773 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) | |
2774 |
|
2774 | |||
2775 | parmObj = opObj.getParameterObj(parameterName='figpath') |
|
2775 | parmObj = opObj.getParameterObj(parameterName='figpath') | |
2776 | if parmObj == None: |
|
2776 | if parmObj == None: | |
2777 | self.volGraphPath.clear() |
|
2777 | self.volGraphPath.clear() | |
2778 | else: |
|
2778 | else: | |
2779 | value = parmObj.getValue() |
|
2779 | value = parmObj.getValue() | |
2780 | path = str(value) |
|
2780 | path = str(value) | |
2781 | self.volGraphPath.setText(path) |
|
2781 | self.volGraphPath.setText(path) | |
2782 |
|
2782 | |||
2783 | parmObj = opObj.getParameterObj(parameterName='figfile') |
|
2783 | parmObj = opObj.getParameterObj(parameterName='figfile') | |
2784 | if parmObj == None: |
|
2784 | if parmObj == None: | |
2785 | self.volGraphPrefix.clear() |
|
2785 | self.volGraphPrefix.clear() | |
2786 | else: |
|
2786 | else: | |
2787 | value = parmObj.getValue() |
|
2787 | value = parmObj.getValue() | |
2788 | figfile = str(value) |
|
2788 | figfile = str(value) | |
2789 | self.volGraphPrefix.setText(figfile) |
|
2789 | self.volGraphPrefix.setText(figfile) | |
2790 |
|
2790 | |||
2791 | # outputVoltageWrite |
|
2791 | # outputVoltageWrite | |
2792 | opObj = puObj.getOperationObj(name='VoltageWriter') |
|
2792 | opObj = puObj.getOperationObj(name='VoltageWriter') | |
2793 |
|
2793 | |||
2794 | if opObj == None: |
|
2794 | if opObj == None: | |
2795 | self.volOutputPath.clear() |
|
2795 | self.volOutputPath.clear() | |
2796 | self.volOutputblocksperfile.clear() |
|
2796 | self.volOutputblocksperfile.clear() | |
2797 | self.volOutputprofilesperblock.clear() |
|
2797 | self.volOutputprofilesperblock.clear() | |
2798 | else: |
|
2798 | else: | |
2799 | parmObj = opObj.getParameterObj(parameterName='path') |
|
2799 | parmObj = opObj.getParameterObj(parameterName='path') | |
2800 | if parmObj == None: |
|
2800 | if parmObj == None: | |
2801 | self.volOutputPath.clear() |
|
2801 | self.volOutputPath.clear() | |
2802 | else: |
|
2802 | else: | |
2803 | value = parmObj.getValue() |
|
2803 | value = parmObj.getValue() | |
2804 | path = str(value) |
|
2804 | path = str(value) | |
2805 | self.volOutputPath.setText(path) |
|
2805 | self.volOutputPath.setText(path) | |
2806 |
|
2806 | |||
2807 | parmObj = opObj.getParameterObj(parameterName='blocksPerFile') |
|
2807 | parmObj = opObj.getParameterObj(parameterName='blocksPerFile') | |
2808 | if parmObj == None: |
|
2808 | if parmObj == None: | |
2809 | self.volOutputblocksperfile.clear() |
|
2809 | self.volOutputblocksperfile.clear() | |
2810 | else: |
|
2810 | else: | |
2811 | value = parmObj.getValue() |
|
2811 | value = parmObj.getValue() | |
2812 | blocksperfile = str(value) |
|
2812 | blocksperfile = str(value) | |
2813 | self.volOutputblocksperfile.setText(blocksperfile) |
|
2813 | self.volOutputblocksperfile.setText(blocksperfile) | |
2814 |
|
2814 | |||
2815 | parmObj = opObj.getParameterObj(parameterName='profilesPerBlock') |
|
2815 | parmObj = opObj.getParameterObj(parameterName='profilesPerBlock') | |
2816 | if parmObj == None: |
|
2816 | if parmObj == None: | |
2817 | self.volOutputprofilesperblock.clear() |
|
2817 | self.volOutputprofilesperblock.clear() | |
2818 | else: |
|
2818 | else: | |
2819 | value = parmObj.getValue() |
|
2819 | value = parmObj.getValue() | |
2820 | profilesPerBlock = str(value) |
|
2820 | profilesPerBlock = str(value) | |
2821 | self.volOutputprofilesperblock.setText(profilesPerBlock) |
|
2821 | self.volOutputprofilesperblock.setText(profilesPerBlock) | |
2822 |
|
2822 | |||
2823 | return |
|
2823 | return | |
2824 |
|
2824 | |||
2825 | def __refreshSpectraWindow(self, puObj): |
|
2825 | def __refreshSpectraWindow(self, puObj): | |
2826 |
|
2826 | |||
2827 | inputId = puObj.getInputId() |
|
2827 | inputId = puObj.getInputId() | |
2828 | inputPUObj = self.__puObjDict[inputId] |
|
2828 | inputPUObj = self.__puObjDict[inputId] | |
2829 |
|
2829 | |||
2830 | if inputPUObj.datatype == 'Voltage': |
|
2830 | if inputPUObj.datatype == 'Voltage': | |
2831 | self.specOpnFFTpoints.setEnabled(True) |
|
2831 | self.specOpnFFTpoints.setEnabled(True) | |
2832 | self.specOpProfiles.setEnabled(True) |
|
2832 | self.specOpProfiles.setEnabled(True) | |
2833 | self.specOpippFactor.setEnabled(True) |
|
2833 | self.specOpippFactor.setEnabled(True) | |
2834 | else: |
|
2834 | else: | |
2835 | self.specOpnFFTpoints.setEnabled(False) |
|
2835 | self.specOpnFFTpoints.setEnabled(False) | |
2836 | self.specOpProfiles.setEnabled(False) |
|
2836 | self.specOpProfiles.setEnabled(False) | |
2837 | self.specOpippFactor.setEnabled(False) |
|
2837 | self.specOpippFactor.setEnabled(False) | |
2838 |
|
2838 | |||
2839 | opObj = puObj.getOperationObj(name='setRadarFrequency') |
|
2839 | opObj = puObj.getOperationObj(name='setRadarFrequency') | |
2840 | if opObj == None: |
|
2840 | if opObj == None: | |
2841 | self.specOpRadarfrequency.clear() |
|
2841 | self.specOpRadarfrequency.clear() | |
2842 | self.specOpCebRadarfrequency.setCheckState(0) |
|
2842 | self.specOpCebRadarfrequency.setCheckState(0) | |
2843 | else: |
|
2843 | else: | |
2844 | value = opObj.getParameterValue(parameterName='frequency') |
|
2844 | value = opObj.getParameterValue(parameterName='frequency') | |
2845 | value = str(float(value)/1e6) |
|
2845 | value = str(float(value)/1e6) | |
2846 | self.specOpRadarfrequency.setText(value) |
|
2846 | self.specOpRadarfrequency.setText(value) | |
2847 | self.specOpRadarfrequency.setEnabled(True) |
|
2847 | self.specOpRadarfrequency.setEnabled(True) | |
2848 | self.specOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) |
|
2848 | self.specOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) | |
2849 |
|
2849 | |||
2850 | opObj = puObj.getOperationObj(name="run") |
|
2850 | opObj = puObj.getOperationObj(name="run") | |
2851 | if opObj == None: |
|
2851 | if opObj == None: | |
2852 | self.specOpnFFTpoints.clear() |
|
2852 | self.specOpnFFTpoints.clear() | |
2853 | self.specOpProfiles.clear() |
|
2853 | self.specOpProfiles.clear() | |
2854 | self.specOpippFactor.clear() |
|
2854 | self.specOpippFactor.clear() | |
2855 | else: |
|
2855 | else: | |
2856 | parmObj = opObj.getParameterObj(parameterName='nFFTPoints') |
|
2856 | parmObj = opObj.getParameterObj(parameterName='nFFTPoints') | |
2857 | if parmObj == None: |
|
2857 | if parmObj == None: | |
2858 | self.specOpnFFTpoints.clear() |
|
2858 | self.specOpnFFTpoints.clear() | |
2859 | else: |
|
2859 | else: | |
2860 | self.specOpnFFTpoints.setEnabled(True) |
|
2860 | self.specOpnFFTpoints.setEnabled(True) | |
2861 | value = opObj.getParameterValue(parameterName='nFFTPoints') |
|
2861 | value = opObj.getParameterValue(parameterName='nFFTPoints') | |
2862 | self.specOpnFFTpoints.setText(str(value)) |
|
2862 | self.specOpnFFTpoints.setText(str(value)) | |
2863 |
|
2863 | |||
2864 | parmObj = opObj.getParameterObj(parameterName='nProfiles') |
|
2864 | parmObj = opObj.getParameterObj(parameterName='nProfiles') | |
2865 | if parmObj == None: |
|
2865 | if parmObj == None: | |
2866 | self.specOpProfiles.clear() |
|
2866 | self.specOpProfiles.clear() | |
2867 | else: |
|
2867 | else: | |
2868 | self.specOpProfiles.setEnabled(True) |
|
2868 | self.specOpProfiles.setEnabled(True) | |
2869 | value = opObj.getParameterValue(parameterName='nProfiles') |
|
2869 | value = opObj.getParameterValue(parameterName='nProfiles') | |
2870 | self.specOpProfiles.setText(str(value)) |
|
2870 | self.specOpProfiles.setText(str(value)) | |
2871 |
|
2871 | |||
2872 | parmObj = opObj.getParameterObj(parameterName='ippFactor') |
|
2872 | parmObj = opObj.getParameterObj(parameterName='ippFactor') | |
2873 | if parmObj == None: |
|
2873 | if parmObj == None: | |
2874 | self.specOpippFactor.clear() |
|
2874 | self.specOpippFactor.clear() | |
2875 | else: |
|
2875 | else: | |
2876 | self.specOpippFactor.setEnabled(True) |
|
2876 | self.specOpippFactor.setEnabled(True) | |
2877 | value = opObj.getParameterValue(parameterName='ippFactor') |
|
2877 | value = opObj.getParameterValue(parameterName='ippFactor') | |
2878 | self.specOpippFactor.setText(str(value)) |
|
2878 | self.specOpippFactor.setText(str(value)) | |
2879 |
|
2879 | |||
2880 | opObj = puObj.getOperationObj(name="run") |
|
2880 | opObj = puObj.getOperationObj(name="run") | |
2881 | if opObj == None: |
|
2881 | if opObj == None: | |
2882 | self.specOppairsList.clear() |
|
2882 | self.specOppairsList.clear() | |
2883 | self.specOpCebCrossSpectra.setCheckState(0) |
|
2883 | self.specOpCebCrossSpectra.setCheckState(0) | |
2884 | else: |
|
2884 | else: | |
2885 | parmObj = opObj.getParameterObj(parameterName='pairsList') |
|
2885 | parmObj = opObj.getParameterObj(parameterName='pairsList') | |
2886 | if parmObj == None: |
|
2886 | if parmObj == None: | |
2887 | self.specOppairsList.clear() |
|
2887 | self.specOppairsList.clear() | |
2888 | self.specOpCebCrossSpectra.setCheckState(0) |
|
2888 | self.specOpCebCrossSpectra.setCheckState(0) | |
2889 | else: |
|
2889 | else: | |
2890 | value = opObj.getParameterValue(parameterName='pairsList') |
|
2890 | value = opObj.getParameterValue(parameterName='pairsList') | |
2891 | value = str(value)[1:-1] |
|
2891 | value = str(value)[1:-1] | |
2892 | self.specOppairsList.setText(str(value)) |
|
2892 | self.specOppairsList.setText(str(value)) | |
2893 | self.specOppairsList.setEnabled(True) |
|
2893 | self.specOppairsList.setEnabled(True) | |
2894 | self.specOpCebCrossSpectra.setCheckState(QtCore.Qt.Checked) |
|
2894 | self.specOpCebCrossSpectra.setCheckState(QtCore.Qt.Checked) | |
2895 |
|
2895 | |||
2896 | opObj = puObj.getOperationObj(name="selectChannels") |
|
2896 | opObj = puObj.getOperationObj(name="selectChannels") | |
2897 |
|
2897 | |||
2898 | if opObj == None: |
|
2898 | if opObj == None: | |
2899 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") |
|
2899 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") | |
2900 |
|
2900 | |||
2901 | if opObj == None: |
|
2901 | if opObj == None: | |
2902 | self.specOpChannel.clear() |
|
2902 | self.specOpChannel.clear() | |
2903 | self.specOpCebChannel.setCheckState(0) |
|
2903 | self.specOpCebChannel.setCheckState(0) | |
2904 | else: |
|
2904 | else: | |
2905 | channelEnabled = False |
|
2905 | channelEnabled = False | |
2906 | try: |
|
2906 | try: | |
2907 | value = opObj.getParameterValue(parameterName='channelList') |
|
2907 | value = opObj.getParameterValue(parameterName='channelList') | |
2908 | value = str(value)[1:-1] |
|
2908 | value = str(value)[1:-1] | |
2909 | channelEnabled = True |
|
2909 | channelEnabled = True | |
2910 | channelMode = 0 |
|
2910 | channelMode = 0 | |
2911 | except: |
|
2911 | except: | |
2912 | pass |
|
2912 | pass | |
2913 | try: |
|
2913 | try: | |
2914 | value = opObj.getParameterValue(parameterName='channelIndexList') |
|
2914 | value = opObj.getParameterValue(parameterName='channelIndexList') | |
2915 | value = str(value)[1:-1] |
|
2915 | value = str(value)[1:-1] | |
2916 | channelEnabled = True |
|
2916 | channelEnabled = True | |
2917 | channelMode = 1 |
|
2917 | channelMode = 1 | |
2918 | except: |
|
2918 | except: | |
2919 | pass |
|
2919 | pass | |
2920 |
|
2920 | |||
2921 | if channelEnabled: |
|
2921 | if channelEnabled: | |
2922 | self.specOpChannel.setText(value) |
|
2922 | self.specOpChannel.setText(value) | |
2923 | self.specOpChannel.setEnabled(True) |
|
2923 | self.specOpChannel.setEnabled(True) | |
2924 | self.specOpCebChannel.setCheckState(QtCore.Qt.Checked) |
|
2924 | self.specOpCebChannel.setCheckState(QtCore.Qt.Checked) | |
2925 | self.specOpComChannel.setCurrentIndex(channelMode) |
|
2925 | self.specOpComChannel.setCurrentIndex(channelMode) | |
2926 |
|
2926 | |||
2927 | opObj = puObj.getOperationObj(name="selectHeights") |
|
2927 | opObj = puObj.getOperationObj(name="selectHeights") | |
2928 | if opObj == None: |
|
2928 | if opObj == None: | |
2929 | self.specOpHeights.clear() |
|
2929 | self.specOpHeights.clear() | |
2930 | self.specOpCebHeights.setCheckState(0) |
|
2930 | self.specOpCebHeights.setCheckState(0) | |
2931 | else: |
|
2931 | else: | |
2932 | value1 = int(opObj.getParameterValue(parameterName='minHei')) |
|
2932 | value1 = int(opObj.getParameterValue(parameterName='minHei')) | |
2933 | value1 = str(value1) |
|
2933 | value1 = str(value1) | |
2934 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) |
|
2934 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) | |
2935 | value2 = str(value2) |
|
2935 | value2 = str(value2) | |
2936 | value = value1 + "," + value2 |
|
2936 | value = value1 + "," + value2 | |
2937 | self.specOpHeights.setText(value) |
|
2937 | self.specOpHeights.setText(value) | |
2938 | self.specOpHeights.setEnabled(True) |
|
2938 | self.specOpHeights.setEnabled(True) | |
2939 | self.specOpCebHeights.setCheckState(QtCore.Qt.Checked) |
|
2939 | self.specOpCebHeights.setCheckState(QtCore.Qt.Checked) | |
2940 |
|
2940 | |||
2941 | opObj = puObj.getOperationObj(name="IncohInt") |
|
2941 | opObj = puObj.getOperationObj(name="IncohInt") | |
2942 | if opObj == None: |
|
2942 | if opObj == None: | |
2943 | self.specOpIncoherent.clear() |
|
2943 | self.specOpIncoherent.clear() | |
2944 | self.specOpCebIncoherent.setCheckState(0) |
|
2944 | self.specOpCebIncoherent.setCheckState(0) | |
2945 | else: |
|
2945 | else: | |
2946 | for parmObj in opObj.getParameterObjList(): |
|
2946 | for parmObj in opObj.getParameterObjList(): | |
2947 | if parmObj.name == 'timeInterval': |
|
2947 | if parmObj.name == 'timeInterval': | |
2948 | value = opObj.getParameterValue(parameterName='timeInterval') |
|
2948 | value = opObj.getParameterValue(parameterName='timeInterval') | |
2949 | value = float(value) |
|
2949 | value = float(value) | |
2950 | self.specOpIncoherent.setText(str(value)) |
|
2950 | self.specOpIncoherent.setText(str(value)) | |
2951 | self.specOpIncoherent.setEnabled(True) |
|
2951 | self.specOpIncoherent.setEnabled(True) | |
2952 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
2952 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) | |
2953 | self.specOpCobIncInt.setCurrentIndex(0) |
|
2953 | self.specOpCobIncInt.setCurrentIndex(0) | |
2954 |
|
2954 | |||
2955 | if parmObj.name == 'n': |
|
2955 | if parmObj.name == 'n': | |
2956 | value = opObj.getParameterValue(parameterName='n') |
|
2956 | value = opObj.getParameterValue(parameterName='n') | |
2957 | value = float(value) |
|
2957 | value = float(value) | |
2958 | self.specOpIncoherent.setText(str(value)) |
|
2958 | self.specOpIncoherent.setText(str(value)) | |
2959 | self.specOpIncoherent.setEnabled(True) |
|
2959 | self.specOpIncoherent.setEnabled(True) | |
2960 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
2960 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) | |
2961 | self.specOpCobIncInt.setCurrentIndex(1) |
|
2961 | self.specOpCobIncInt.setCurrentIndex(1) | |
2962 |
|
2962 | |||
2963 | opObj = puObj.getOperationObj(name="removeDC") |
|
2963 | opObj = puObj.getOperationObj(name="removeDC") | |
2964 | if opObj == None: |
|
2964 | if opObj == None: | |
2965 | self.specOpCebRemoveDC.setCheckState(0) |
|
2965 | self.specOpCebRemoveDC.setCheckState(0) | |
2966 | else: |
|
2966 | else: | |
2967 | self.specOpCebRemoveDC.setCheckState(QtCore.Qt.Checked) |
|
2967 | self.specOpCebRemoveDC.setCheckState(QtCore.Qt.Checked) | |
2968 | value = opObj.getParameterValue(parameterName='mode') |
|
2968 | value = opObj.getParameterValue(parameterName='mode') | |
2969 | if value == 1: |
|
2969 | if value == 1: | |
2970 | self.specOpComRemoveDC.setCurrentIndex(0) |
|
2970 | self.specOpComRemoveDC.setCurrentIndex(0) | |
2971 | elif value == 2: |
|
2971 | elif value == 2: | |
2972 | self.specOpComRemoveDC.setCurrentIndex(1) |
|
2972 | self.specOpComRemoveDC.setCurrentIndex(1) | |
2973 |
|
2973 | |||
2974 | opObj = puObj.getOperationObj(name="removeInterference") |
|
2974 | opObj = puObj.getOperationObj(name="removeInterference") | |
2975 | if opObj == None: |
|
2975 | if opObj == None: | |
2976 | self.specOpCebRemoveInt.setCheckState(0) |
|
2976 | self.specOpCebRemoveInt.setCheckState(0) | |
2977 | else: |
|
2977 | else: | |
2978 | self.specOpCebRemoveInt.setCheckState(QtCore.Qt.Checked) |
|
2978 | self.specOpCebRemoveInt.setCheckState(QtCore.Qt.Checked) | |
2979 |
|
2979 | |||
2980 | opObj = puObj.getOperationObj(name='getNoise') |
|
2980 | opObj = puObj.getOperationObj(name='getNoise') | |
2981 | if opObj == None: |
|
2981 | if opObj == None: | |
2982 | self.specOpCebgetNoise.setCheckState(0) |
|
2982 | self.specOpCebgetNoise.setCheckState(0) | |
2983 | self.specOpgetNoise.clear() |
|
2983 | self.specOpgetNoise.clear() | |
2984 | else: |
|
2984 | else: | |
2985 | self.specOpCebgetNoise.setCheckState(QtCore.Qt.Checked) |
|
2985 | self.specOpCebgetNoise.setCheckState(QtCore.Qt.Checked) | |
2986 | parmObj = opObj.getParameterObj(parameterName='minHei') |
|
2986 | parmObj = opObj.getParameterObj(parameterName='minHei') | |
2987 | if parmObj == None: |
|
2987 | if parmObj == None: | |
2988 | self.specOpgetNoise.clear() |
|
2988 | self.specOpgetNoise.clear() | |
2989 | value1 = None |
|
2989 | value1 = None | |
2990 | else: |
|
2990 | else: | |
2991 | value1 = opObj.getParameterValue(parameterName='minHei') |
|
2991 | value1 = opObj.getParameterValue(parameterName='minHei') | |
2992 | value1 = str(value1) |
|
2992 | value1 = str(value1) | |
2993 | parmObj = opObj.getParameterObj(parameterName='maxHei') |
|
2993 | parmObj = opObj.getParameterObj(parameterName='maxHei') | |
2994 | if parmObj == None: |
|
2994 | if parmObj == None: | |
2995 | value2 = None |
|
2995 | value2 = None | |
2996 | value = value1 |
|
2996 | value = value1 | |
2997 | self.specOpgetNoise.setText(value) |
|
2997 | self.specOpgetNoise.setText(value) | |
2998 | self.specOpgetNoise.setEnabled(True) |
|
2998 | self.specOpgetNoise.setEnabled(True) | |
2999 | else: |
|
2999 | else: | |
3000 | value2 = opObj.getParameterValue(parameterName='maxHei') |
|
3000 | value2 = opObj.getParameterValue(parameterName='maxHei') | |
3001 | value2 = str(value2) |
|
3001 | value2 = str(value2) | |
3002 | parmObj = opObj.getParameterObj(parameterName='minVel') |
|
3002 | parmObj = opObj.getParameterObj(parameterName='minVel') | |
3003 | if parmObj == None: |
|
3003 | if parmObj == None: | |
3004 | value3 = None |
|
3004 | value3 = None | |
3005 | value = value1 + "," + value2 |
|
3005 | value = value1 + "," + value2 | |
3006 | self.specOpgetNoise.setText(value) |
|
3006 | self.specOpgetNoise.setText(value) | |
3007 | self.specOpgetNoise.setEnabled(True) |
|
3007 | self.specOpgetNoise.setEnabled(True) | |
3008 | else: |
|
3008 | else: | |
3009 | value3 = opObj.getParameterValue(parameterName='minVel') |
|
3009 | value3 = opObj.getParameterValue(parameterName='minVel') | |
3010 | value3 = str(value3) |
|
3010 | value3 = str(value3) | |
3011 | parmObj = opObj.getParameterObj(parameterName='maxVel') |
|
3011 | parmObj = opObj.getParameterObj(parameterName='maxVel') | |
3012 | if parmObj == None: |
|
3012 | if parmObj == None: | |
3013 | value4 = None |
|
3013 | value4 = None | |
3014 | value = value1 + "," + value2 + "," + value3 |
|
3014 | value = value1 + "," + value2 + "," + value3 | |
3015 | self.specOpgetNoise.setText(value) |
|
3015 | self.specOpgetNoise.setText(value) | |
3016 | self.specOpgetNoise.setEnabled(True) |
|
3016 | self.specOpgetNoise.setEnabled(True) | |
3017 | else: |
|
3017 | else: | |
3018 | value4 = opObj.getParameterValue(parameterName='maxVel') |
|
3018 | value4 = opObj.getParameterValue(parameterName='maxVel') | |
3019 | value4 = str(value4) |
|
3019 | value4 = str(value4) | |
3020 | value = value1 + "," + value2 + "," + value3 + ',' + value4 |
|
3020 | value = value1 + "," + value2 + "," + value3 + ',' + value4 | |
3021 | self.specOpgetNoise.setText(value) |
|
3021 | self.specOpgetNoise.setText(value) | |
3022 | self.specOpgetNoise.setEnabled(True) |
|
3022 | self.specOpgetNoise.setEnabled(True) | |
3023 |
|
3023 | |||
3024 | self.specGraphPath.clear() |
|
3024 | self.specGraphPath.clear() | |
3025 | self.specGraphPrefix.clear() |
|
3025 | self.specGraphPrefix.clear() | |
3026 | self.specGgraphFreq.clear() |
|
3026 | self.specGgraphFreq.clear() | |
3027 | self.specGgraphHeight.clear() |
|
3027 | self.specGgraphHeight.clear() | |
3028 | self.specGgraphDbsrange.clear() |
|
3028 | self.specGgraphDbsrange.clear() | |
3029 | self.specGgraphmagnitud.clear() |
|
3029 | self.specGgraphmagnitud.clear() | |
3030 | self.specGgraphPhase.clear() |
|
3030 | self.specGgraphPhase.clear() | |
3031 | self.specGgraphChannelList.clear() |
|
3031 | self.specGgraphChannelList.clear() | |
3032 | self.specGgraphTminTmax.clear() |
|
3032 | self.specGgraphTminTmax.clear() | |
3033 | self.specGgraphTimeRange.clear() |
|
3033 | self.specGgraphTimeRange.clear() | |
3034 | self.specGgraphftpratio.clear() |
|
3034 | self.specGgraphftpratio.clear() | |
3035 |
|
3035 | |||
3036 | opObj = puObj.getOperationObj(name='SpectraPlot') |
|
3036 | opObj = puObj.getOperationObj(name='SpectraPlot') | |
3037 |
|
3037 | |||
3038 | if opObj == None: |
|
3038 | if opObj == None: | |
3039 | self.specGraphCebSpectraplot.setCheckState(0) |
|
3039 | self.specGraphCebSpectraplot.setCheckState(0) | |
3040 | self.specGraphSaveSpectra.setCheckState(0) |
|
3040 | self.specGraphSaveSpectra.setCheckState(0) | |
3041 | self.specGraphftpSpectra.setCheckState(0) |
|
3041 | self.specGraphftpSpectra.setCheckState(0) | |
3042 | else: |
|
3042 | else: | |
3043 | operationSpectraPlot = "Enable" |
|
3043 | operationSpectraPlot = "Enable" | |
3044 | self.specGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3044 | self.specGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) | |
3045 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3045 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
3046 | if parmObj == None: |
|
3046 | if parmObj == None: | |
3047 | self.specGgraphChannelList.clear() |
|
3047 | self.specGgraphChannelList.clear() | |
3048 | else: |
|
3048 | else: | |
3049 | value = opObj.getParameterValue(parameterName='channelList') |
|
3049 | value = opObj.getParameterValue(parameterName='channelList') | |
3050 | channelListSpectraPlot = str(value)[1:-1] |
|
3050 | channelListSpectraPlot = str(value)[1:-1] | |
3051 | self.specGgraphChannelList.setText(channelListSpectraPlot) |
|
3051 | self.specGgraphChannelList.setText(channelListSpectraPlot) | |
3052 | self.specGgraphChannelList.setEnabled(True) |
|
3052 | self.specGgraphChannelList.setEnabled(True) | |
3053 |
|
3053 | |||
3054 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3054 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3055 | if parmObj == None: |
|
3055 | if parmObj == None: | |
3056 | self.specGgraphFreq.clear() |
|
3056 | self.specGgraphFreq.clear() | |
3057 | else: |
|
3057 | else: | |
3058 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3058 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3059 | value1 = str(value1) |
|
3059 | value1 = str(value1) | |
3060 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3060 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3061 | value2 = str(value2) |
|
3061 | value2 = str(value2) | |
3062 | value = value1 + "," + value2 |
|
3062 | value = value1 + "," + value2 | |
3063 | self.specGgraphFreq.setText(value) |
|
3063 | self.specGgraphFreq.setText(value) | |
3064 | self.specGgraphFreq.setEnabled(True) |
|
3064 | self.specGgraphFreq.setEnabled(True) | |
3065 |
|
3065 | |||
3066 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3066 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3067 | if parmObj == None: |
|
3067 | if parmObj == None: | |
3068 | self.specGgraphHeight.clear() |
|
3068 | self.specGgraphHeight.clear() | |
3069 | else: |
|
3069 | else: | |
3070 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3070 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3071 | value1 = str(value1) |
|
3071 | value1 = str(value1) | |
3072 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3072 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3073 | value2 = str(value2) |
|
3073 | value2 = str(value2) | |
3074 | value = value1 + "," + value2 |
|
3074 | value = value1 + "," + value2 | |
3075 | self.specGgraphHeight.setText(value) |
|
3075 | self.specGgraphHeight.setText(value) | |
3076 | self.specGgraphHeight.setEnabled(True) |
|
3076 | self.specGgraphHeight.setEnabled(True) | |
3077 |
|
3077 | |||
3078 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3078 | parmObj = opObj.getParameterObj(parameterName='zmin') | |
3079 | if parmObj == None: |
|
3079 | if parmObj == None: | |
3080 | self.specGgraphDbsrange.clear() |
|
3080 | self.specGgraphDbsrange.clear() | |
3081 | else: |
|
3081 | else: | |
3082 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3082 | value1 = opObj.getParameterValue(parameterName='zmin') | |
3083 | value1 = str(value1) |
|
3083 | value1 = str(value1) | |
3084 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3084 | value2 = opObj.getParameterValue(parameterName='zmax') | |
3085 | value2 = str(value2) |
|
3085 | value2 = str(value2) | |
3086 | value = value1 + "," + value2 |
|
3086 | value = value1 + "," + value2 | |
3087 | self.specGgraphDbsrange.setText(value) |
|
3087 | self.specGgraphDbsrange.setText(value) | |
3088 | self.specGgraphDbsrange.setEnabled(True) |
|
3088 | self.specGgraphDbsrange.setEnabled(True) | |
3089 |
|
3089 | |||
3090 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3090 | parmObj = opObj.getParameterObj(parameterName="save") | |
3091 | if parmObj == None: |
|
3091 | if parmObj == None: | |
3092 | self.specGraphSaveSpectra.setCheckState(0) |
|
3092 | self.specGraphSaveSpectra.setCheckState(0) | |
3093 | else: |
|
3093 | else: | |
3094 | self.specGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) |
|
3094 | self.specGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) | |
3095 |
|
3095 | |||
3096 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3096 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3097 | if parmObj == None: |
|
3097 | if parmObj == None: | |
3098 | self.specGraphftpSpectra.setCheckState(0) |
|
3098 | self.specGraphftpSpectra.setCheckState(0) | |
3099 | else: |
|
3099 | else: | |
3100 | self.specGraphftpSpectra.setCheckState(QtCore.Qt.Checked) |
|
3100 | self.specGraphftpSpectra.setCheckState(QtCore.Qt.Checked) | |
3101 |
|
3101 | |||
3102 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3102 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3103 | if parmObj: |
|
3103 | if parmObj: | |
3104 | value = parmObj.getValue() |
|
3104 | value = parmObj.getValue() | |
3105 | self.specGraphPath.setText(value) |
|
3105 | self.specGraphPath.setText(value) | |
3106 |
|
3106 | |||
3107 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3107 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3108 | if parmObj: |
|
3108 | if parmObj: | |
3109 | value = parmObj.getValue() |
|
3109 | value = parmObj.getValue() | |
3110 | self.specGgraphftpratio.setText(str(value)) |
|
3110 | self.specGgraphftpratio.setText(str(value)) | |
3111 |
|
3111 | |||
3112 | ######################################################## |
|
|||
3113 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") |
|
|||
3114 | if parmObj: |
|
|||
3115 | value = parmObj.getValue() |
|
|||
3116 | self.temporalFTP.ftp_wei = str(value) |
|
|||
3117 |
|
||||
3118 | parmObj = opObj.getParameterObj(parameterName="exp_code") |
|
|||
3119 | if parmObj: |
|
|||
3120 | value = parmObj.getValue() |
|
|||
3121 | self.temporalFTP.exp_code = str(value) |
|
|||
3122 |
|
||||
3123 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") |
|
|||
3124 | if parmObj: |
|
|||
3125 | value = parmObj.getValue() |
|
|||
3126 | self.temporalFTP.sub_exp_code = str(value) |
|
|||
3127 |
|
||||
3128 | parmObj = opObj.getParameterObj(parameterName="plot_pos") |
|
|||
3129 | if parmObj: |
|
|||
3130 | value = parmObj.getValue() |
|
|||
3131 | self.temporalFTP.plot_pos = str(value) |
|
|||
3132 |
|
||||
3133 | opObj = puObj.getOperationObj(name='CrossSpectraPlot') |
|
3112 | opObj = puObj.getOperationObj(name='CrossSpectraPlot') | |
3134 |
|
3113 | |||
3135 | if opObj == None: |
|
3114 | if opObj == None: | |
3136 | self.specGraphCebCrossSpectraplot.setCheckState(0) |
|
3115 | self.specGraphCebCrossSpectraplot.setCheckState(0) | |
3137 | self.specGraphSaveCross.setCheckState(0) |
|
3116 | self.specGraphSaveCross.setCheckState(0) | |
3138 | self.specGraphftpCross.setCheckState(0) |
|
3117 | self.specGraphftpCross.setCheckState(0) | |
3139 | else: |
|
3118 | else: | |
3140 | operationCrossSpectraPlot = "Enable" |
|
3119 | operationCrossSpectraPlot = "Enable" | |
3141 | self.specGraphCebCrossSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3120 | self.specGraphCebCrossSpectraplot.setCheckState(QtCore.Qt.Checked) | |
3142 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3121 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3143 | if parmObj == None: |
|
3122 | if parmObj == None: | |
3144 | self.specGgraphFreq.clear() |
|
3123 | self.specGgraphFreq.clear() | |
3145 | else: |
|
3124 | else: | |
3146 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3125 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3147 | value1 = str(value1) |
|
3126 | value1 = str(value1) | |
3148 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3127 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3149 | value2 = str(value2) |
|
3128 | value2 = str(value2) | |
3150 | value = value1 + "," + value2 |
|
3129 | value = value1 + "," + value2 | |
3151 | self.specGgraphFreq.setText(value) |
|
3130 | self.specGgraphFreq.setText(value) | |
3152 | self.specGgraphFreq.setEnabled(True) |
|
3131 | self.specGgraphFreq.setEnabled(True) | |
3153 |
|
3132 | |||
3154 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3133 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3155 | if parmObj == None: |
|
3134 | if parmObj == None: | |
3156 | self.specGgraphHeight.clear() |
|
3135 | self.specGgraphHeight.clear() | |
3157 | else: |
|
3136 | else: | |
3158 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3137 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3159 | value1 = str(value1) |
|
3138 | value1 = str(value1) | |
3160 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3139 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3161 | value2 = str(value2) |
|
3140 | value2 = str(value2) | |
3162 | value = value1 + "," + value2 |
|
3141 | value = value1 + "," + value2 | |
3163 | self.specGgraphHeight.setText(value) |
|
3142 | self.specGgraphHeight.setText(value) | |
3164 | self.specGgraphHeight.setEnabled(True) |
|
3143 | self.specGgraphHeight.setEnabled(True) | |
3165 |
|
3144 | |||
3166 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3145 | parmObj = opObj.getParameterObj(parameterName='zmin') | |
3167 | if parmObj == None: |
|
3146 | if parmObj == None: | |
3168 | self.specGgraphDbsrange.clear() |
|
3147 | self.specGgraphDbsrange.clear() | |
3169 | else: |
|
3148 | else: | |
3170 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3149 | value1 = opObj.getParameterValue(parameterName='zmin') | |
3171 | value1 = str(value1) |
|
3150 | value1 = str(value1) | |
3172 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3151 | value2 = opObj.getParameterValue(parameterName='zmax') | |
3173 | value2 = str(value2) |
|
3152 | value2 = str(value2) | |
3174 | value = value1 + "," + value2 |
|
3153 | value = value1 + "," + value2 | |
3175 | self.specGgraphDbsrange.setText(value) |
|
3154 | self.specGgraphDbsrange.setText(value) | |
3176 | self.specGgraphDbsrange.setEnabled(True) |
|
3155 | self.specGgraphDbsrange.setEnabled(True) | |
3177 |
|
3156 | |||
3178 | parmObj = opObj.getParameterObj(parameterName='coh_min') |
|
3157 | parmObj = opObj.getParameterObj(parameterName='coh_min') | |
3179 | if parmObj == None: |
|
3158 | if parmObj == None: | |
3180 | self.specGgraphmagnitud.clear() |
|
3159 | self.specGgraphmagnitud.clear() | |
3181 | else: |
|
3160 | else: | |
3182 | value1 = opObj.getParameterValue(parameterName='coh_min') |
|
3161 | value1 = opObj.getParameterValue(parameterName='coh_min') | |
3183 | value1 = str(value1) |
|
3162 | value1 = str(value1) | |
3184 | value2 = opObj.getParameterValue(parameterName='coh_max') |
|
3163 | value2 = opObj.getParameterValue(parameterName='coh_max') | |
3185 | value2 = str(value2) |
|
3164 | value2 = str(value2) | |
3186 | value = value1 + "," + value2 |
|
3165 | value = value1 + "," + value2 | |
3187 | self.specGgraphmagnitud.setText(value) |
|
3166 | self.specGgraphmagnitud.setText(value) | |
3188 | self.specGgraphmagnitud.setEnabled(True) |
|
3167 | self.specGgraphmagnitud.setEnabled(True) | |
3189 |
|
3168 | |||
3190 | parmObj = opObj.getParameterObj(parameterName='phase_min') |
|
3169 | parmObj = opObj.getParameterObj(parameterName='phase_min') | |
3191 | if parmObj == None: |
|
3170 | if parmObj == None: | |
3192 | self.specGgraphPhase.clear() |
|
3171 | self.specGgraphPhase.clear() | |
3193 | else: |
|
3172 | else: | |
3194 | value1 = opObj.getParameterValue(parameterName='phase_min') |
|
3173 | value1 = opObj.getParameterValue(parameterName='phase_min') | |
3195 | value1 = str(value1) |
|
3174 | value1 = str(value1) | |
3196 | value2 = opObj.getParameterValue(parameterName='phase_max') |
|
3175 | value2 = opObj.getParameterValue(parameterName='phase_max') | |
3197 | value2 = str(value2) |
|
3176 | value2 = str(value2) | |
3198 | value = value1 + "," + value2 |
|
3177 | value = value1 + "," + value2 | |
3199 | self.specGgraphPhase.setText(value) |
|
3178 | self.specGgraphPhase.setText(value) | |
3200 | self.specGgraphPhase.setEnabled(True) |
|
3179 | self.specGgraphPhase.setEnabled(True) | |
3201 |
|
3180 | |||
3202 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3181 | parmObj = opObj.getParameterObj(parameterName="save") | |
3203 | if parmObj == None: |
|
3182 | if parmObj == None: | |
3204 | self.specGraphSaveCross.setCheckState(0) |
|
3183 | self.specGraphSaveCross.setCheckState(0) | |
3205 | else: |
|
3184 | else: | |
3206 | self.specGraphSaveCross.setCheckState(QtCore.Qt.Checked) |
|
3185 | self.specGraphSaveCross.setCheckState(QtCore.Qt.Checked) | |
3207 |
|
3186 | |||
3208 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3187 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3209 | if parmObj == None: |
|
3188 | if parmObj == None: | |
3210 | self.specGraphftpCross.setCheckState(0) |
|
3189 | self.specGraphftpCross.setCheckState(0) | |
3211 | else: |
|
3190 | else: | |
3212 | self.specGraphftpCross.setCheckState(QtCore.Qt.Checked) |
|
3191 | self.specGraphftpCross.setCheckState(QtCore.Qt.Checked) | |
3213 |
|
3192 | |||
3214 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3193 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3215 | if parmObj: |
|
3194 | if parmObj: | |
3216 | value = parmObj.getValue() |
|
3195 | value = parmObj.getValue() | |
3217 | self.specGraphPath.setText(value) |
|
3196 | self.specGraphPath.setText(value) | |
3218 |
|
3197 | |||
3219 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3198 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3220 | if parmObj: |
|
3199 | if parmObj: | |
3221 | value = parmObj.getValue() |
|
3200 | value = parmObj.getValue() | |
3222 | self.specGgraphftpratio.setText(str(value)) |
|
3201 | self.specGgraphftpratio.setText(str(value)) | |
3223 |
|
3202 | |||
3224 | ######################################################## |
|
|||
3225 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") |
|
|||
3226 | if parmObj: |
|
|||
3227 | value = parmObj.getValue() |
|
|||
3228 | self.temporalFTP.ftp_wei = str(value) |
|
|||
3229 |
|
||||
3230 | parmObj = opObj.getParameterObj(parameterName="exp_code") |
|
|||
3231 | if parmObj: |
|
|||
3232 | value = parmObj.getValue() |
|
|||
3233 | self.temporalFTP.exp_code = str(value) |
|
|||
3234 |
|
||||
3235 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") |
|
|||
3236 | if parmObj: |
|
|||
3237 | value = parmObj.getValue() |
|
|||
3238 | self.temporalFTP.sub_exp_code = str(value) |
|
|||
3239 |
|
||||
3240 | parmObj = opObj.getParameterObj(parameterName="plot_pos") |
|
|||
3241 | if parmObj: |
|
|||
3242 | value = parmObj.getValue() |
|
|||
3243 | self.temporalFTP.plot_pos = str(value) |
|
|||
3244 |
|
||||
3245 | opObj = puObj.getOperationObj(name='RTIPlot') |
|
3203 | opObj = puObj.getOperationObj(name='RTIPlot') | |
3246 |
|
3204 | |||
3247 | if opObj == None: |
|
3205 | if opObj == None: | |
3248 | self.specGraphCebRTIplot.setCheckState(0) |
|
3206 | self.specGraphCebRTIplot.setCheckState(0) | |
3249 | self.specGraphSaveRTIplot.setCheckState(0) |
|
3207 | self.specGraphSaveRTIplot.setCheckState(0) | |
3250 | self.specGraphftpRTIplot.setCheckState(0) |
|
3208 | self.specGraphftpRTIplot.setCheckState(0) | |
3251 | else: |
|
3209 | else: | |
3252 | self.specGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3210 | self.specGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) | |
3253 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3211 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
3254 | if parmObj == None: |
|
3212 | if parmObj == None: | |
3255 | self.specGgraphChannelList.clear() |
|
3213 | self.specGgraphChannelList.clear() | |
3256 | else: |
|
3214 | else: | |
3257 | value = opObj.getParameterValue(parameterName='channelList') |
|
3215 | value = opObj.getParameterValue(parameterName='channelList') | |
3258 | channelListRTIPlot = str(value)[1:-1] |
|
3216 | channelListRTIPlot = str(value)[1:-1] | |
3259 | self.specGgraphChannelList.setText(channelListRTIPlot) |
|
3217 | self.specGgraphChannelList.setText(channelListRTIPlot) | |
3260 | self.specGgraphChannelList.setEnabled(True) |
|
3218 | self.specGgraphChannelList.setEnabled(True) | |
3261 |
|
3219 | |||
3262 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3220 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3263 | if parmObj == None: |
|
3221 | if parmObj == None: | |
3264 | self.specGgraphTminTmax.clear() |
|
3222 | self.specGgraphTminTmax.clear() | |
3265 | else: |
|
3223 | else: | |
3266 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3224 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3267 | value1 = str(value1) |
|
3225 | value1 = str(value1) | |
3268 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3226 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3269 | value2 = str(value2) |
|
3227 | value2 = str(value2) | |
3270 | value = value1 + "," + value2 |
|
3228 | value = value1 + "," + value2 | |
3271 | self.specGgraphTminTmax.setText(value) |
|
3229 | self.specGgraphTminTmax.setText(value) | |
3272 | self.specGgraphTminTmax.setEnabled(True) |
|
3230 | self.specGgraphTminTmax.setEnabled(True) | |
3273 |
|
3231 | |||
3274 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3232 | parmObj = opObj.getParameterObj(parameterName='timerange') | |
3275 | if parmObj == None: |
|
3233 | if parmObj == None: | |
3276 | self.specGgraphTimeRange.clear() |
|
3234 | self.specGgraphTimeRange.clear() | |
3277 | else: |
|
3235 | else: | |
3278 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3236 | value1 = opObj.getParameterValue(parameterName='timerange') | |
3279 | value1 = str(value1) |
|
3237 | value1 = str(value1) | |
3280 | self.specGgraphTimeRange.setText(value1) |
|
3238 | self.specGgraphTimeRange.setText(value1) | |
3281 | self.specGgraphTimeRange.setEnabled(True) |
|
3239 | self.specGgraphTimeRange.setEnabled(True) | |
3282 |
|
3240 | |||
3283 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3241 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3284 | if parmObj == None: |
|
3242 | if parmObj == None: | |
3285 | self.specGgraphHeight.clear() |
|
3243 | self.specGgraphHeight.clear() | |
3286 | else: |
|
3244 | else: | |
3287 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3245 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3288 | value1 = str(value1) |
|
3246 | value1 = str(value1) | |
3289 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3247 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3290 | value2 = str(value2) |
|
3248 | value2 = str(value2) | |
3291 | value = value1 + "," + value2 |
|
3249 | value = value1 + "," + value2 | |
3292 | self.specGgraphHeight.setText(value) |
|
3250 | self.specGgraphHeight.setText(value) | |
3293 | self.specGgraphHeight.setEnabled(True) |
|
3251 | self.specGgraphHeight.setEnabled(True) | |
3294 |
|
3252 | |||
3295 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3253 | parmObj = opObj.getParameterObj(parameterName='zmin') | |
3296 | if parmObj == None: |
|
3254 | if parmObj == None: | |
3297 | self.specGgraphDbsrange.clear() |
|
3255 | self.specGgraphDbsrange.clear() | |
3298 | else: |
|
3256 | else: | |
3299 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3257 | value1 = opObj.getParameterValue(parameterName='zmin') | |
3300 | value1 = str(value1) |
|
3258 | value1 = str(value1) | |
3301 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3259 | value2 = opObj.getParameterValue(parameterName='zmax') | |
3302 | value2 = str(value2) |
|
3260 | value2 = str(value2) | |
3303 | value = value1 + "," + value2 |
|
3261 | value = value1 + "," + value2 | |
3304 | self.specGgraphDbsrange.setText(value) |
|
3262 | self.specGgraphDbsrange.setText(value) | |
3305 | self.specGgraphDbsrange.setEnabled(True) |
|
3263 | self.specGgraphDbsrange.setEnabled(True) | |
3306 |
|
3264 | |||
3307 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3265 | parmObj = opObj.getParameterObj(parameterName="save") | |
3308 | if parmObj == None: |
|
3266 | if parmObj == None: | |
3309 | self.specGraphSaveRTIplot.setCheckState(0) |
|
3267 | self.specGraphSaveRTIplot.setCheckState(0) | |
3310 | else: |
|
3268 | else: | |
3311 | self.specGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3269 | self.specGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) | |
3312 |
|
3270 | |||
3313 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3271 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3314 | if parmObj == None: |
|
3272 | if parmObj == None: | |
3315 | self.specGraphftpRTIplot.setCheckState(0) |
|
3273 | self.specGraphftpRTIplot.setCheckState(0) | |
3316 | else: |
|
3274 | else: | |
3317 | self.specGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3275 | self.specGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) | |
3318 |
|
3276 | |||
3319 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3277 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3320 | if parmObj: |
|
3278 | if parmObj: | |
3321 | value = parmObj.getValue() |
|
3279 | value = parmObj.getValue() | |
3322 | self.specGraphPath.setText(value) |
|
3280 | self.specGraphPath.setText(value) | |
3323 |
|
3281 | |||
3324 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3282 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3325 | if parmObj: |
|
3283 | if parmObj: | |
3326 | value = parmObj.getValue() |
|
3284 | value = parmObj.getValue() | |
3327 | self.specGgraphftpratio.setText(str(value)) |
|
3285 | self.specGgraphftpratio.setText(str(value)) | |
3328 |
|
||||
3329 | ######################################################## |
|
|||
3330 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") |
|
|||
3331 | if parmObj: |
|
|||
3332 | value = parmObj.getValue() |
|
|||
3333 | self.temporalFTP.ftp_wei = str(value) |
|
|||
3334 |
|
||||
3335 | parmObj = opObj.getParameterObj(parameterName="exp_code") |
|
|||
3336 | if parmObj: |
|
|||
3337 | value = parmObj.getValue() |
|
|||
3338 | self.temporalFTP.exp_code = str(value) |
|
|||
3339 |
|
||||
3340 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") |
|
|||
3341 | if parmObj: |
|
|||
3342 | value = parmObj.getValue() |
|
|||
3343 | self.temporalFTP.sub_exp_code = str(value) |
|
|||
3344 |
|
||||
3345 | parmObj = opObj.getParameterObj(parameterName="plot_pos") |
|
|||
3346 | if parmObj: |
|
|||
3347 | value = parmObj.getValue() |
|
|||
3348 | self.temporalFTP.plot_pos = str(value) |
|
|||
3349 |
|
3286 | |||
3350 | opObj = puObj.getOperationObj(name='CoherenceMap') |
|
3287 | opObj = puObj.getOperationObj(name='CoherenceMap') | |
3351 |
|
3288 | |||
3352 | if opObj == None: |
|
3289 | if opObj == None: | |
3353 | self.specGraphCebCoherencmap.setCheckState(0) |
|
3290 | self.specGraphCebCoherencmap.setCheckState(0) | |
3354 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
3291 | self.specGraphSaveCoherencemap.setCheckState(0) | |
3355 | self.specGraphftpCoherencemap.setCheckState(0) |
|
3292 | self.specGraphftpCoherencemap.setCheckState(0) | |
3356 | else: |
|
3293 | else: | |
3357 | operationCoherenceMap = "Enable" |
|
3294 | operationCoherenceMap = "Enable" | |
3358 | self.specGraphCebCoherencmap.setCheckState(QtCore.Qt.Checked) |
|
3295 | self.specGraphCebCoherencmap.setCheckState(QtCore.Qt.Checked) | |
3359 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3296 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3360 | if parmObj == None: |
|
3297 | if parmObj == None: | |
3361 | self.specGgraphTminTmax.clear() |
|
3298 | self.specGgraphTminTmax.clear() | |
3362 | else: |
|
3299 | else: | |
3363 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3300 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3364 | value1 = str(value1) |
|
3301 | value1 = str(value1) | |
3365 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3302 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3366 | value2 = str(value2) |
|
3303 | value2 = str(value2) | |
3367 | value = value1 + "," + value2 |
|
3304 | value = value1 + "," + value2 | |
3368 | self.specGgraphTminTmax.setText(value) |
|
3305 | self.specGgraphTminTmax.setText(value) | |
3369 | self.specGgraphTminTmax.setEnabled(True) |
|
3306 | self.specGgraphTminTmax.setEnabled(True) | |
3370 |
|
3307 | |||
3371 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3308 | parmObj = opObj.getParameterObj(parameterName='timerange') | |
3372 | if parmObj == None: |
|
3309 | if parmObj == None: | |
3373 | self.specGgraphTimeRange.clear() |
|
3310 | self.specGgraphTimeRange.clear() | |
3374 | else: |
|
3311 | else: | |
3375 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3312 | value1 = opObj.getParameterValue(parameterName='timerange') | |
3376 | value1 = str(value1) |
|
3313 | value1 = str(value1) | |
3377 | self.specGgraphTimeRange.setText(value1) |
|
3314 | self.specGgraphTimeRange.setText(value1) | |
3378 | self.specGgraphTimeRange.setEnabled(True) |
|
3315 | self.specGgraphTimeRange.setEnabled(True) | |
3379 |
|
3316 | |||
3380 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3317 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3381 | if parmObj == None: |
|
3318 | if parmObj == None: | |
3382 | self.specGgraphHeight.clear() |
|
3319 | self.specGgraphHeight.clear() | |
3383 | else: |
|
3320 | else: | |
3384 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3321 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3385 | value1 = str(value1) |
|
3322 | value1 = str(value1) | |
3386 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3323 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3387 | value2 = str(value2) |
|
3324 | value2 = str(value2) | |
3388 | value = value1 + "," + value2 |
|
3325 | value = value1 + "," + value2 | |
3389 | self.specGgraphHeight.setText(value) |
|
3326 | self.specGgraphHeight.setText(value) | |
3390 | self.specGgraphHeight.setEnabled(True) |
|
3327 | self.specGgraphHeight.setEnabled(True) | |
3391 |
|
3328 | |||
3392 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3329 | parmObj = opObj.getParameterObj(parameterName='zmin') | |
3393 | if parmObj == None: |
|
3330 | if parmObj == None: | |
3394 | self.specGgraphmagnitud.clear() |
|
3331 | self.specGgraphmagnitud.clear() | |
3395 | else: |
|
3332 | else: | |
3396 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3333 | value1 = opObj.getParameterValue(parameterName='zmin') | |
3397 | value1 = str(value1) |
|
3334 | value1 = str(value1) | |
3398 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3335 | value2 = opObj.getParameterValue(parameterName='zmax') | |
3399 | value2 = str(value2) |
|
3336 | value2 = str(value2) | |
3400 | value = value1 + "," + value2 |
|
3337 | value = value1 + "," + value2 | |
3401 | self.specGgraphmagnitud.setText(value) |
|
3338 | self.specGgraphmagnitud.setText(value) | |
3402 | self.specGgraphmagnitud.setEnabled(True) |
|
3339 | self.specGgraphmagnitud.setEnabled(True) | |
3403 |
|
3340 | |||
3404 | parmObj = opObj.getParameterObj(parameterName='coh_min') |
|
3341 | parmObj = opObj.getParameterObj(parameterName='coh_min') | |
3405 | if parmObj == None: |
|
3342 | if parmObj == None: | |
3406 | self.specGgraphmagnitud.clear() |
|
3343 | self.specGgraphmagnitud.clear() | |
3407 | else: |
|
3344 | else: | |
3408 | value1 = opObj.getParameterValue(parameterName='coh_min') |
|
3345 | value1 = opObj.getParameterValue(parameterName='coh_min') | |
3409 | value1 = str(value1) |
|
3346 | value1 = str(value1) | |
3410 | value2 = opObj.getParameterValue(parameterName='coh_max') |
|
3347 | value2 = opObj.getParameterValue(parameterName='coh_max') | |
3411 | value2 = str(value2) |
|
3348 | value2 = str(value2) | |
3412 | value = value1 + "," + value2 |
|
3349 | value = value1 + "," + value2 | |
3413 | self.specGgraphmagnitud.setText(value) |
|
3350 | self.specGgraphmagnitud.setText(value) | |
3414 | self.specGgraphmagnitud.setEnabled(True) |
|
3351 | self.specGgraphmagnitud.setEnabled(True) | |
3415 |
|
3352 | |||
3416 | parmObj = opObj.getParameterObj(parameterName='phase_min') |
|
3353 | parmObj = opObj.getParameterObj(parameterName='phase_min') | |
3417 | if parmObj == None: |
|
3354 | if parmObj == None: | |
3418 | self.specGgraphPhase.clear() |
|
3355 | self.specGgraphPhase.clear() | |
3419 | else: |
|
3356 | else: | |
3420 | value1 = opObj.getParameterValue(parameterName='phase_min') |
|
3357 | value1 = opObj.getParameterValue(parameterName='phase_min') | |
3421 | value1 = str(value1) |
|
3358 | value1 = str(value1) | |
3422 | value2 = opObj.getParameterValue(parameterName='phase_max') |
|
3359 | value2 = opObj.getParameterValue(parameterName='phase_max') | |
3423 | value2 = str(value2) |
|
3360 | value2 = str(value2) | |
3424 | value = value1 + "," + value2 |
|
3361 | value = value1 + "," + value2 | |
3425 | self.specGgraphPhase.setText(value) |
|
3362 | self.specGgraphPhase.setText(value) | |
3426 | self.specGgraphPhase.setEnabled(True) |
|
3363 | self.specGgraphPhase.setEnabled(True) | |
3427 |
|
3364 | |||
3428 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3365 | parmObj = opObj.getParameterObj(parameterName="save") | |
3429 | if parmObj == None: |
|
3366 | if parmObj == None: | |
3430 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
3367 | self.specGraphSaveCoherencemap.setCheckState(0) | |
3431 | else: |
|
3368 | else: | |
3432 | self.specGraphSaveCoherencemap.setCheckState(QtCore.Qt.Checked) |
|
3369 | self.specGraphSaveCoherencemap.setCheckState(QtCore.Qt.Checked) | |
3433 |
|
3370 | |||
3434 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3371 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3435 | if parmObj == None: |
|
3372 | if parmObj == None: | |
3436 | self.specGraphftpCoherencemap.setCheckState(0) |
|
3373 | self.specGraphftpCoherencemap.setCheckState(0) | |
3437 | else: |
|
3374 | else: | |
3438 | self.specGraphftpCoherencemap.setCheckState(QtCore.Qt.Checked) |
|
3375 | self.specGraphftpCoherencemap.setCheckState(QtCore.Qt.Checked) | |
3439 |
|
3376 | |||
3440 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3377 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3441 | if parmObj: |
|
3378 | if parmObj: | |
3442 | value = parmObj.getValue() |
|
3379 | value = parmObj.getValue() | |
3443 | self.specGraphPath.setText(value) |
|
3380 | self.specGraphPath.setText(value) | |
3444 |
|
3381 | |||
3445 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3382 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3446 | if parmObj: |
|
3383 | if parmObj: | |
3447 | value = parmObj.getValue() |
|
3384 | value = parmObj.getValue() | |
3448 | self.specGgraphftpratio.setText(str(value)) |
|
3385 | self.specGgraphftpratio.setText(str(value)) | |
3449 |
|
||||
3450 | ######################################################## |
|
|||
3451 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") |
|
|||
3452 | if parmObj: |
|
|||
3453 | value = parmObj.getValue() |
|
|||
3454 | self.temporalFTP.ftp_wei = str(value) |
|
|||
3455 |
|
||||
3456 | parmObj = opObj.getParameterObj(parameterName="exp_code") |
|
|||
3457 | if parmObj: |
|
|||
3458 | value = parmObj.getValue() |
|
|||
3459 | self.temporalFTP.exp_code = str(value) |
|
|||
3460 |
|
||||
3461 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") |
|
|||
3462 | if parmObj: |
|
|||
3463 | value = parmObj.getValue() |
|
|||
3464 | self.temporalFTP.sub_exp_code = str(value) |
|
|||
3465 |
|
||||
3466 | parmObj = opObj.getParameterObj(parameterName="plot_pos") |
|
|||
3467 | if parmObj: |
|
|||
3468 | value = parmObj.getValue() |
|
|||
3469 | self.temporalFTP.plot_pos = str(value) |
|
|||
3470 |
|
3386 | |||
3471 | opObj = puObj.getOperationObj(name='PowerProfilePlot') |
|
3387 | opObj = puObj.getOperationObj(name='PowerProfilePlot') | |
3472 |
|
3388 | |||
3473 | if opObj == None: |
|
3389 | if opObj == None: | |
3474 | self.specGraphPowerprofile.setCheckState(0) |
|
3390 | self.specGraphPowerprofile.setCheckState(0) | |
3475 | self.specGraphSavePowerprofile.setCheckState(0) |
|
3391 | self.specGraphSavePowerprofile.setCheckState(0) | |
3476 | self.specGraphftpPowerprofile.setCheckState(0) |
|
3392 | self.specGraphftpPowerprofile.setCheckState(0) | |
3477 | operationPowerProfilePlot = "Disabled" |
|
3393 | operationPowerProfilePlot = "Disabled" | |
3478 | channelList = None |
|
3394 | channelList = None | |
3479 | freq_vel = None |
|
3395 | freq_vel = None | |
3480 | heightsrange = None |
|
3396 | heightsrange = None | |
3481 | else: |
|
3397 | else: | |
3482 | operationPowerProfilePlot = "Enable" |
|
3398 | operationPowerProfilePlot = "Enable" | |
3483 | self.specGraphPowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3399 | self.specGraphPowerprofile.setCheckState(QtCore.Qt.Checked) | |
3484 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3400 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3485 | if parmObj == None: |
|
3401 | if parmObj == None: | |
3486 | self.specGgraphDbsrange.clear() |
|
3402 | self.specGgraphDbsrange.clear() | |
3487 | else: |
|
3403 | else: | |
3488 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3404 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3489 | value1 = str(value1) |
|
3405 | value1 = str(value1) | |
3490 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3406 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3491 | value2 = str(value2) |
|
3407 | value2 = str(value2) | |
3492 | value = value1 + "," + value2 |
|
3408 | value = value1 + "," + value2 | |
3493 | self.specGgraphDbsrange.setText(value) |
|
3409 | self.specGgraphDbsrange.setText(value) | |
3494 | self.specGgraphDbsrange.setEnabled(True) |
|
3410 | self.specGgraphDbsrange.setEnabled(True) | |
3495 |
|
3411 | |||
3496 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3412 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3497 | if parmObj == None: |
|
3413 | if parmObj == None: | |
3498 | self.specGgraphHeight.clear() |
|
3414 | self.specGgraphHeight.clear() | |
3499 | else: |
|
3415 | else: | |
3500 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3416 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3501 | value1 = str(value1) |
|
3417 | value1 = str(value1) | |
3502 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3418 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3503 | value2 = str(value2) |
|
3419 | value2 = str(value2) | |
3504 | value = value1 + "," + value2 |
|
3420 | value = value1 + "," + value2 | |
3505 | self.specGgraphHeight.setText(value) |
|
3421 | self.specGgraphHeight.setText(value) | |
3506 | self.specGgraphHeight.setEnabled(True) |
|
3422 | self.specGgraphHeight.setEnabled(True) | |
3507 |
|
3423 | |||
3508 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3424 | parmObj = opObj.getParameterObj(parameterName="save") | |
3509 | if parmObj == None: |
|
3425 | if parmObj == None: | |
3510 | self.specGraphSavePowerprofile.setCheckState(0) |
|
3426 | self.specGraphSavePowerprofile.setCheckState(0) | |
3511 | else: |
|
3427 | else: | |
3512 | self.specGraphSavePowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3428 | self.specGraphSavePowerprofile.setCheckState(QtCore.Qt.Checked) | |
3513 |
|
3429 | |||
3514 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3430 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3515 | if parmObj == None: |
|
3431 | if parmObj == None: | |
3516 | self.specGraphftpPowerprofile.setCheckState(0) |
|
3432 | self.specGraphftpPowerprofile.setCheckState(0) | |
3517 | else: |
|
3433 | else: | |
3518 | self.specGraphftpPowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3434 | self.specGraphftpPowerprofile.setCheckState(QtCore.Qt.Checked) | |
3519 |
|
3435 | |||
3520 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3436 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3521 | if parmObj: |
|
3437 | if parmObj: | |
3522 | value = parmObj.getValue() |
|
3438 | value = parmObj.getValue() | |
3523 | self.specGraphPath.setText(value) |
|
3439 | self.specGraphPath.setText(value) | |
3524 |
|
3440 | |||
3525 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3441 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3526 | if parmObj: |
|
3442 | if parmObj: | |
3527 | value = parmObj.getValue() |
|
3443 | value = parmObj.getValue() | |
3528 | self.specGgraphftpratio.setText(str(value)) |
|
3444 | self.specGgraphftpratio.setText(str(value)) | |
3529 |
|
||||
3530 | ######################################################## |
|
|||
3531 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") |
|
|||
3532 | if parmObj: |
|
|||
3533 | value = parmObj.getValue() |
|
|||
3534 | self.temporalFTP.ftp_wei = str(value) |
|
|||
3535 |
|
||||
3536 | parmObj = opObj.getParameterObj(parameterName="exp_code") |
|
|||
3537 | if parmObj: |
|
|||
3538 | value = parmObj.getValue() |
|
|||
3539 | self.temporalFTP.exp_code = str(value) |
|
|||
3540 |
|
||||
3541 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") |
|
|||
3542 | if parmObj: |
|
|||
3543 | value = parmObj.getValue() |
|
|||
3544 | self.temporalFTP.sub_exp_code = str(value) |
|
|||
3545 |
|
||||
3546 | parmObj = opObj.getParameterObj(parameterName="plot_pos") |
|
|||
3547 | if parmObj: |
|
|||
3548 | value = parmObj.getValue() |
|
|||
3549 | self.temporalFTP.plot_pos = str(value) |
|
|||
3550 |
|
3445 | |||
3551 | opObj = puObj.getOperationObj(name='Noise') |
|
3446 | opObj = puObj.getOperationObj(name='Noise') | |
3552 |
|
3447 | |||
3553 | if opObj == None: |
|
3448 | if opObj == None: | |
3554 | self.specGraphCebRTInoise.setCheckState(0) |
|
3449 | self.specGraphCebRTInoise.setCheckState(0) | |
3555 | self.specGraphSaveRTInoise.setCheckState(0) |
|
3450 | self.specGraphSaveRTInoise.setCheckState(0) | |
3556 | self.specGraphftpRTInoise.setCheckState(0) |
|
3451 | self.specGraphftpRTInoise.setCheckState(0) | |
3557 | else: |
|
3452 | else: | |
3558 | self.specGraphCebRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3453 | self.specGraphCebRTInoise.setCheckState(QtCore.Qt.Checked) | |
3559 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3454 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
3560 | if parmObj == None: |
|
3455 | if parmObj == None: | |
3561 | self.specGgraphChannelList.clear() |
|
3456 | self.specGgraphChannelList.clear() | |
3562 | else: |
|
3457 | else: | |
3563 | value = opObj.getParameterValue(parameterName='channelList') |
|
3458 | value = opObj.getParameterValue(parameterName='channelList') | |
3564 | channelListRTINoise = str(value)[1:-1] |
|
3459 | channelListRTINoise = str(value)[1:-1] | |
3565 | self.specGgraphChannelList.setText(channelListRTINoise) |
|
3460 | self.specGgraphChannelList.setText(channelListRTINoise) | |
3566 | self.specGgraphChannelList.setEnabled(True) |
|
3461 | self.specGgraphChannelList.setEnabled(True) | |
3567 |
|
3462 | |||
3568 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3463 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3569 | if parmObj == None: |
|
3464 | if parmObj == None: | |
3570 | self.specGgraphTminTmax.clear() |
|
3465 | self.specGgraphTminTmax.clear() | |
3571 | else: |
|
3466 | else: | |
3572 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3467 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3573 | value1 = str(value1) |
|
3468 | value1 = str(value1) | |
3574 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3469 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3575 | value2 = str(value2) |
|
3470 | value2 = str(value2) | |
3576 | value = value1 + "," + value2 |
|
3471 | value = value1 + "," + value2 | |
3577 | self.specGgraphTminTmax.setText(value) |
|
3472 | self.specGgraphTminTmax.setText(value) | |
3578 | self.specGgraphTminTmax.setEnabled(True) |
|
3473 | self.specGgraphTminTmax.setEnabled(True) | |
3579 |
|
3474 | |||
3580 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3475 | parmObj = opObj.getParameterObj(parameterName='timerange') | |
3581 | if parmObj == None: |
|
3476 | if parmObj == None: | |
3582 | self.specGgraphTimeRange.clear() |
|
3477 | self.specGgraphTimeRange.clear() | |
3583 | else: |
|
3478 | else: | |
3584 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3479 | value1 = opObj.getParameterValue(parameterName='timerange') | |
3585 | value1 = str(value1) |
|
3480 | value1 = str(value1) | |
3586 | self.specGgraphTimeRange.setText(value1) |
|
3481 | self.specGgraphTimeRange.setText(value1) | |
3587 | self.specGgraphTimeRange.setEnabled(True) |
|
3482 | self.specGgraphTimeRange.setEnabled(True) | |
3588 |
|
3483 | |||
3589 |
|
3484 | |||
3590 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3485 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3591 | if parmObj == None: |
|
3486 | if parmObj == None: | |
3592 | self.specGgraphDbsrange.clear() |
|
3487 | self.specGgraphDbsrange.clear() | |
3593 | else: |
|
3488 | else: | |
3594 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3489 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3595 | value1 = str(value1) |
|
3490 | value1 = str(value1) | |
3596 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3491 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3597 | value2 = str(value2) |
|
3492 | value2 = str(value2) | |
3598 | value = value1 + "," + value2 |
|
3493 | value = value1 + "," + value2 | |
3599 | self.specGgraphDbsrange.setText(value) |
|
3494 | self.specGgraphDbsrange.setText(value) | |
3600 | self.specGgraphDbsrange.setEnabled(True) |
|
3495 | self.specGgraphDbsrange.setEnabled(True) | |
3601 |
|
3496 | |||
3602 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3497 | parmObj = opObj.getParameterObj(parameterName="save") | |
3603 | if parmObj == None: |
|
3498 | if parmObj == None: | |
3604 | self.specGraphSaveRTInoise.setCheckState(0) |
|
3499 | self.specGraphSaveRTInoise.setCheckState(0) | |
3605 | else: |
|
3500 | else: | |
3606 | self.specGraphSaveRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3501 | self.specGraphSaveRTInoise.setCheckState(QtCore.Qt.Checked) | |
3607 |
|
3502 | |||
3608 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3503 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3609 | if parmObj == None: |
|
3504 | if parmObj == None: | |
3610 | self.specGraphftpRTInoise.setCheckState(0) |
|
3505 | self.specGraphftpRTInoise.setCheckState(0) | |
3611 | else: |
|
3506 | else: | |
3612 | self.specGraphftpRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3507 | self.specGraphftpRTInoise.setCheckState(QtCore.Qt.Checked) | |
3613 |
|
3508 | |||
3614 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3509 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3615 | if parmObj: |
|
3510 | if parmObj: | |
3616 | value = parmObj.getValue() |
|
3511 | value = parmObj.getValue() | |
3617 | self.specGraphPath.setText(value) |
|
3512 | self.specGraphPath.setText(value) | |
3618 |
|
3513 | |||
3619 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3514 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3620 | if parmObj: |
|
3515 | if parmObj: | |
3621 | value = parmObj.getValue() |
|
3516 | value = parmObj.getValue() | |
3622 | self.specGgraphftpratio.setText(str(value)) |
|
3517 | self.specGgraphftpratio.setText(str(value)) | |
3623 |
|
||||
3624 | ######################################################## |
|
|||
3625 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") |
|
|||
3626 | if parmObj: |
|
|||
3627 | value = parmObj.getValue() |
|
|||
3628 | self.temporalFTP.ftp_wei = str(value) |
|
|||
3629 |
|
||||
3630 | parmObj = opObj.getParameterObj(parameterName="exp_code") |
|
|||
3631 | if parmObj: |
|
|||
3632 | value = parmObj.getValue() |
|
|||
3633 | self.temporalFTP.exp_code = str(value) |
|
|||
3634 |
|
||||
3635 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") |
|
|||
3636 | if parmObj: |
|
|||
3637 | value = parmObj.getValue() |
|
|||
3638 | self.temporalFTP.sub_exp_code = str(value) |
|
|||
3639 |
|
||||
3640 | parmObj = opObj.getParameterObj(parameterName="plot_pos") |
|
|||
3641 | if parmObj: |
|
|||
3642 | value = parmObj.getValue() |
|
|||
3643 | self.temporalFTP.plot_pos = str(value) |
|
|||
3644 |
|
3518 | |||
3645 | opObj = puObj.getOperationObj(name='SpectraWriter') |
|
3519 | opObj = puObj.getOperationObj(name='SpectraWriter') | |
3646 | if opObj == None: |
|
3520 | if opObj == None: | |
3647 | self.specOutputPath.clear() |
|
3521 | self.specOutputPath.clear() | |
3648 | self.specOutputblocksperfile.clear() |
|
3522 | self.specOutputblocksperfile.clear() | |
3649 | self.specOutputprofileperblock.clear() |
|
3523 | self.specOutputprofileperblock.clear() | |
3650 | else: |
|
3524 | else: | |
3651 | value = opObj.getParameterObj(parameterName='path') |
|
3525 | value = opObj.getParameterObj(parameterName='path') | |
3652 | if value == None: |
|
3526 | if value == None: | |
3653 | self.specOutputPath.clear() |
|
3527 | self.specOutputPath.clear() | |
3654 | else: |
|
3528 | else: | |
3655 | value = opObj.getParameterValue(parameterName='path') |
|
3529 | value = opObj.getParameterValue(parameterName='path') | |
3656 | path = str(value) |
|
3530 | path = str(value) | |
3657 | self.specOutputPath.setText(path) |
|
3531 | self.specOutputPath.setText(path) | |
3658 | value = opObj.getParameterObj(parameterName='blocksPerFile') |
|
3532 | value = opObj.getParameterObj(parameterName='blocksPerFile') | |
3659 | if value == None: |
|
3533 | if value == None: | |
3660 | self.specOutputblocksperfile.clear() |
|
3534 | self.specOutputblocksperfile.clear() | |
3661 | else: |
|
3535 | else: | |
3662 | value = opObj.getParameterValue(parameterName='blocksPerFile') |
|
3536 | value = opObj.getParameterValue(parameterName='blocksPerFile') | |
3663 | blocksperfile = str(value) |
|
3537 | blocksperfile = str(value) | |
3664 | self.specOutputblocksperfile.setText(blocksperfile) |
|
3538 | self.specOutputblocksperfile.setText(blocksperfile) | |
3665 | value = opObj.getParameterObj(parameterName='profilesPerBlock') |
|
3539 | value = opObj.getParameterObj(parameterName='profilesPerBlock') | |
3666 | if value == None: |
|
3540 | if value == None: | |
3667 | self.specOutputprofileperblock.clear() |
|
3541 | self.specOutputprofileperblock.clear() | |
3668 | else: |
|
3542 | else: | |
3669 | value = opObj.getParameterValue(parameterName='profilesPerBlock') |
|
3543 | value = opObj.getParameterValue(parameterName='profilesPerBlock') | |
3670 | profilesPerBlock = str(value) |
|
3544 | profilesPerBlock = str(value) | |
3671 | self.specOutputprofileperblock.setText(profilesPerBlock) |
|
3545 | self.specOutputprofileperblock.setText(profilesPerBlock) | |
3672 |
|
3546 | |||
3673 | return |
|
3547 | return | |
3674 |
|
3548 | |||
3675 | def __refreshSpectraHeisWindow(self, puObj): |
|
3549 | def __refreshSpectraHeisWindow(self, puObj): | |
3676 |
|
3550 | |||
3677 | opObj = puObj.getOperationObj(name="IncohInt4SpectraHeis") |
|
3551 | opObj = puObj.getOperationObj(name="IncohInt4SpectraHeis") | |
3678 | if opObj == None: |
|
3552 | if opObj == None: | |
3679 | self.specHeisOpIncoherent.clear() |
|
3553 | self.specHeisOpIncoherent.clear() | |
3680 | self.specHeisOpCebIncoherent.setCheckState(0) |
|
3554 | self.specHeisOpCebIncoherent.setCheckState(0) | |
3681 | else: |
|
3555 | else: | |
3682 | for parmObj in opObj.getParameterObjList(): |
|
3556 | for parmObj in opObj.getParameterObjList(): | |
3683 | if parmObj.name == 'timeInterval': |
|
3557 | if parmObj.name == 'timeInterval': | |
3684 | value = opObj.getParameterValue(parameterName='timeInterval') |
|
3558 | value = opObj.getParameterValue(parameterName='timeInterval') | |
3685 | value = float(value) |
|
3559 | value = float(value) | |
3686 | self.specHeisOpIncoherent.setText(str(value)) |
|
3560 | self.specHeisOpIncoherent.setText(str(value)) | |
3687 | self.specHeisOpIncoherent.setEnabled(True) |
|
3561 | self.specHeisOpIncoherent.setEnabled(True) | |
3688 | self.specHeisOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3562 | self.specHeisOpCebIncoherent.setCheckState(QtCore.Qt.Checked) | |
3689 | self.specHeisOpCobIncInt.setCurrentIndex(0) |
|
3563 | self.specHeisOpCobIncInt.setCurrentIndex(0) | |
3690 |
|
3564 | |||
3691 | # SpectraHeis Graph |
|
3565 | # SpectraHeis Graph | |
3692 |
|
3566 | |||
3693 | self.specHeisGgraphXminXmax.clear() |
|
3567 | self.specHeisGgraphXminXmax.clear() | |
3694 | self.specHeisGgraphYminYmax.clear() |
|
3568 | self.specHeisGgraphYminYmax.clear() | |
3695 |
|
3569 | |||
3696 | self.specHeisGgraphChannelList.clear() |
|
3570 | self.specHeisGgraphChannelList.clear() | |
3697 | self.specHeisGgraphTminTmax.clear() |
|
3571 | self.specHeisGgraphTminTmax.clear() | |
3698 | self.specHeisGgraphTimeRange.clear() |
|
3572 | self.specHeisGgraphTimeRange.clear() | |
3699 | self.specHeisGgraphftpratio.clear() |
|
3573 | self.specHeisGgraphftpratio.clear() | |
3700 |
|
3574 | |||
3701 | opObj = puObj.getOperationObj(name='SpectraHeisScope') |
|
3575 | opObj = puObj.getOperationObj(name='SpectraHeisScope') | |
3702 | if opObj == None: |
|
3576 | if opObj == None: | |
3703 | self.specHeisGraphCebSpectraplot.setCheckState(0) |
|
3577 | self.specHeisGraphCebSpectraplot.setCheckState(0) | |
3704 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
3578 | self.specHeisGraphSaveSpectra.setCheckState(0) | |
3705 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
3579 | self.specHeisGraphftpSpectra.setCheckState(0) | |
3706 | else: |
|
3580 | else: | |
3707 | operationSpectraHeisScope = "Enable" |
|
3581 | operationSpectraHeisScope = "Enable" | |
3708 | self.specHeisGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3582 | self.specHeisGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) | |
3709 |
|
3583 | |||
3710 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3584 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
3711 | if parmObj == None: |
|
3585 | if parmObj == None: | |
3712 | self.specHeisGgraphChannelList.clear() |
|
3586 | self.specHeisGgraphChannelList.clear() | |
3713 | else: |
|
3587 | else: | |
3714 | value = opObj.getParameterValue(parameterName='channelList') |
|
3588 | value = opObj.getParameterValue(parameterName='channelList') | |
3715 | channelListSpectraHeisScope = str(value)[1:-1] |
|
3589 | channelListSpectraHeisScope = str(value)[1:-1] | |
3716 | self.specHeisGgraphChannelList.setText(channelListSpectraHeisScope) |
|
3590 | self.specHeisGgraphChannelList.setText(channelListSpectraHeisScope) | |
3717 | self.specHeisGgraphChannelList.setEnabled(True) |
|
3591 | self.specHeisGgraphChannelList.setEnabled(True) | |
3718 |
|
3592 | |||
3719 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3593 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3720 | if parmObj == None: |
|
3594 | if parmObj == None: | |
3721 | self.specHeisGgraphXminXmax.clear() |
|
3595 | self.specHeisGgraphXminXmax.clear() | |
3722 | else: |
|
3596 | else: | |
3723 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3597 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3724 | value1 = str(value1) |
|
3598 | value1 = str(value1) | |
3725 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3599 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3726 | value2 = str(value2) |
|
3600 | value2 = str(value2) | |
3727 | value = value1 + "," + value2 |
|
3601 | value = value1 + "," + value2 | |
3728 | self.specHeisGgraphXminXmax.setText(value) |
|
3602 | self.specHeisGgraphXminXmax.setText(value) | |
3729 | self.specHeisGgraphXminXmax.setEnabled(True) |
|
3603 | self.specHeisGgraphXminXmax.setEnabled(True) | |
3730 |
|
3604 | |||
3731 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3605 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3732 | if parmObj == None: |
|
3606 | if parmObj == None: | |
3733 | self.specHeisGgraphYminYmax.clear() |
|
3607 | self.specHeisGgraphYminYmax.clear() | |
3734 | else: |
|
3608 | else: | |
3735 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3609 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3736 | value1 = str(value1) |
|
3610 | value1 = str(value1) | |
3737 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3611 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3738 | value2 = str(value2) |
|
3612 | value2 = str(value2) | |
3739 | value = value1 + "," + value2 |
|
3613 | value = value1 + "," + value2 | |
3740 | self.specHeisGgraphYminYmax.setText(value) |
|
3614 | self.specHeisGgraphYminYmax.setText(value) | |
3741 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
3615 | self.specHeisGgraphYminYmax.setEnabled(True) | |
3742 |
|
3616 | |||
3743 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3617 | parmObj = opObj.getParameterObj(parameterName="save") | |
3744 | if parmObj == None: |
|
3618 | if parmObj == None: | |
3745 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
3619 | self.specHeisGraphSaveSpectra.setCheckState(0) | |
3746 | else: |
|
3620 | else: | |
3747 | self.specHeisGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) |
|
3621 | self.specHeisGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) | |
3748 |
|
3622 | |||
3749 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3623 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3750 | if parmObj == None: |
|
3624 | if parmObj == None: | |
3751 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
3625 | self.specHeisGraphftpSpectra.setCheckState(0) | |
3752 | else: |
|
3626 | else: | |
3753 | self.specHeisGraphftpSpectra.setCheckState(QtCore.Qt.Checked) |
|
3627 | self.specHeisGraphftpSpectra.setCheckState(QtCore.Qt.Checked) | |
3754 |
|
3628 | |||
3755 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3629 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3756 | if parmObj: |
|
3630 | if parmObj: | |
3757 | value = parmObj.getValue() |
|
3631 | value = parmObj.getValue() | |
3758 | self.specHeisGraphPath.setText(value) |
|
3632 | self.specHeisGraphPath.setText(value) | |
3759 |
|
3633 | |||
3760 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3634 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3761 | if parmObj: |
|
3635 | if parmObj: | |
3762 | value = parmObj.getValue() |
|
3636 | value = parmObj.getValue() | |
3763 | self.specHeisGgraphftpratio.setText(str(value)) |
|
3637 | self.specHeisGgraphftpratio.setText(str(value)) | |
3764 |
|
||||
3765 | ######################################################## |
|
|||
3766 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") |
|
|||
3767 | if parmObj: |
|
|||
3768 | value = parmObj.getValue() |
|
|||
3769 | self.temporalFTP.ftp_wei = str(value) |
|
|||
3770 |
|
||||
3771 | parmObj = opObj.getParameterObj(parameterName="exp_code") |
|
|||
3772 | if parmObj: |
|
|||
3773 | value = parmObj.getValue() |
|
|||
3774 | self.temporalFTP.exp_code = str(value) |
|
|||
3775 |
|
||||
3776 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") |
|
|||
3777 | if parmObj: |
|
|||
3778 | value = parmObj.getValue() |
|
|||
3779 | self.temporalFTP.sub_exp_code = str(value) |
|
|||
3780 |
|
||||
3781 | parmObj = opObj.getParameterObj(parameterName="plot_pos") |
|
|||
3782 | if parmObj: |
|
|||
3783 | value = parmObj.getValue() |
|
|||
3784 | self.temporalFTP.plot_pos = str(value) |
|
|||
3785 |
|
3638 | |||
3786 | opObj = puObj.getOperationObj(name='RTIfromSpectraHeis') |
|
3639 | opObj = puObj.getOperationObj(name='RTIfromSpectraHeis') | |
3787 |
|
3640 | |||
3788 | if opObj == None: |
|
3641 | if opObj == None: | |
3789 | self.specHeisGraphCebRTIplot.setCheckState(0) |
|
3642 | self.specHeisGraphCebRTIplot.setCheckState(0) | |
3790 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
3643 | self.specHeisGraphSaveRTIplot.setCheckState(0) | |
3791 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
3644 | self.specHeisGraphftpRTIplot.setCheckState(0) | |
3792 | else: |
|
3645 | else: | |
3793 | self.specHeisGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3646 | self.specHeisGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) | |
3794 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3647 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
3795 | if parmObj == None: |
|
3648 | if parmObj == None: | |
3796 | self.specHeisGgraphChannelList.clear() |
|
3649 | self.specHeisGgraphChannelList.clear() | |
3797 | else: |
|
3650 | else: | |
3798 | value = opObj.getParameterValue(parameterName='channelList') |
|
3651 | value = opObj.getParameterValue(parameterName='channelList') | |
3799 | channelListRTIPlot = str(value)[1:-1] |
|
3652 | channelListRTIPlot = str(value)[1:-1] | |
3800 | self.specGgraphChannelList.setText(channelListRTIPlot) |
|
3653 | self.specGgraphChannelList.setText(channelListRTIPlot) | |
3801 | self.specGgraphChannelList.setEnabled(True) |
|
3654 | self.specGgraphChannelList.setEnabled(True) | |
3802 |
|
3655 | |||
3803 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3656 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3804 | if parmObj == None: |
|
3657 | if parmObj == None: | |
3805 | self.specHeisGgraphTminTmax.clear() |
|
3658 | self.specHeisGgraphTminTmax.clear() | |
3806 | else: |
|
3659 | else: | |
3807 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3660 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3808 | value1 = str(value1) |
|
3661 | value1 = str(value1) | |
3809 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3662 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3810 | value2 = str(value2) |
|
3663 | value2 = str(value2) | |
3811 | value = value1 + "," + value2 |
|
3664 | value = value1 + "," + value2 | |
3812 | self.specHeisGgraphTminTmax.setText(value) |
|
3665 | self.specHeisGgraphTminTmax.setText(value) | |
3813 | self.specHeisGgraphTminTmax.setEnabled(True) |
|
3666 | self.specHeisGgraphTminTmax.setEnabled(True) | |
3814 |
|
3667 | |||
3815 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3668 | parmObj = opObj.getParameterObj(parameterName='timerange') | |
3816 | if parmObj == None: |
|
3669 | if parmObj == None: | |
3817 | self.specGgraphTimeRange.clear() |
|
3670 | self.specGgraphTimeRange.clear() | |
3818 | else: |
|
3671 | else: | |
3819 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3672 | value1 = opObj.getParameterValue(parameterName='timerange') | |
3820 | value1 = str(value1) |
|
3673 | value1 = str(value1) | |
3821 | self.specHeisGgraphTimeRange.setText(value1) |
|
3674 | self.specHeisGgraphTimeRange.setText(value1) | |
3822 | self.specHeisGgraphTimeRange.setEnabled(True) |
|
3675 | self.specHeisGgraphTimeRange.setEnabled(True) | |
3823 |
|
3676 | |||
3824 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3677 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3825 | if parmObj == None: |
|
3678 | if parmObj == None: | |
3826 | self.specHeisGgraphYminYmax.clear() |
|
3679 | self.specHeisGgraphYminYmax.clear() | |
3827 | else: |
|
3680 | else: | |
3828 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3681 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3829 | value1 = str(value1) |
|
3682 | value1 = str(value1) | |
3830 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3683 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3831 | value2 = str(value2) |
|
3684 | value2 = str(value2) | |
3832 | value = value1 + "," + value2 |
|
3685 | value = value1 + "," + value2 | |
3833 | self.specHeisGgraphYminYmax.setText(value) |
|
3686 | self.specHeisGgraphYminYmax.setText(value) | |
3834 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
3687 | self.specHeisGgraphYminYmax.setEnabled(True) | |
3835 |
|
3688 | |||
3836 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3689 | parmObj = opObj.getParameterObj(parameterName="save") | |
3837 | if parmObj == None: |
|
3690 | if parmObj == None: | |
3838 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
3691 | self.specHeisGraphSaveRTIplot.setCheckState(0) | |
3839 | else: |
|
3692 | else: | |
3840 | self.specHeisGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3693 | self.specHeisGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) | |
3841 |
|
3694 | |||
3842 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3695 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3843 | if parmObj == None: |
|
3696 | if parmObj == None: | |
3844 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
3697 | self.specHeisGraphftpRTIplot.setCheckState(0) | |
3845 | else: |
|
3698 | else: | |
3846 | self.specHeisGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3699 | self.specHeisGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) | |
3847 |
|
3700 | |||
3848 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3701 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3849 | if parmObj: |
|
3702 | if parmObj: | |
3850 | value = parmObj.getValue() |
|
3703 | value = parmObj.getValue() | |
3851 | self.specHeisGraphPath.setText(value) |
|
3704 | self.specHeisGraphPath.setText(value) | |
3852 |
|
3705 | |||
3853 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3706 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3854 | if parmObj: |
|
3707 | if parmObj: | |
3855 | value = parmObj.getValue() |
|
3708 | value = parmObj.getValue() | |
3856 | self.specHeisGgraphftpratio.setText(str(value)) |
|
3709 | self.specHeisGgraphftpratio.setText(str(value)) | |
3857 |
|
||||
3858 | ######################################################## |
|
|||
3859 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") |
|
|||
3860 | if parmObj: |
|
|||
3861 | value = parmObj.getValue() |
|
|||
3862 | self.temporalFTP.ftp_wei = str(value) |
|
|||
3863 |
|
||||
3864 | parmObj = opObj.getParameterObj(parameterName="exp_code") |
|
|||
3865 | if parmObj: |
|
|||
3866 | value = parmObj.getValue() |
|
|||
3867 | self.temporalFTP.exp_code = str(value) |
|
|||
3868 |
|
||||
3869 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") |
|
|||
3870 | if parmObj: |
|
|||
3871 | value = parmObj.getValue() |
|
|||
3872 | self.temporalFTP.sub_exp_code = str(value) |
|
|||
3873 |
|
||||
3874 | parmObj = opObj.getParameterObj(parameterName="plot_pos") |
|
|||
3875 | if parmObj: |
|
|||
3876 | value = parmObj.getValue() |
|
|||
3877 | self.temporalFTP.plot_pos = str(value) |
|
|||
3878 |
|
3710 | |||
3879 | # outputSpectraHeisWrite |
|
3711 | # outputSpectraHeisWrite | |
3880 | opObj = puObj.getOperationObj(name='FitsWriter') |
|
3712 | opObj = puObj.getOperationObj(name='FitsWriter') | |
3881 | if opObj == None: |
|
3713 | if opObj == None: | |
3882 | self.specHeisOutputPath.clear() |
|
3714 | self.specHeisOutputPath.clear() | |
3883 | self.specHeisOutputblocksperfile.clear() |
|
3715 | self.specHeisOutputblocksperfile.clear() | |
3884 | self.specHeisOutputMetada.clear() |
|
3716 | self.specHeisOutputMetada.clear() | |
3885 | else: |
|
3717 | else: | |
3886 | value = opObj.getParameterObj(parameterName='path') |
|
3718 | value = opObj.getParameterObj(parameterName='path') | |
3887 | if value == None: |
|
3719 | if value == None: | |
3888 | self.specHeisOutputPath.clear() |
|
3720 | self.specHeisOutputPath.clear() | |
3889 | else: |
|
3721 | else: | |
3890 | value = opObj.getParameterValue(parameterName='path') |
|
3722 | value = opObj.getParameterValue(parameterName='path') | |
3891 | path = str(value) |
|
3723 | path = str(value) | |
3892 | self.specHeisOutputPath.setText(path) |
|
3724 | self.specHeisOutputPath.setText(path) | |
3893 | value = opObj.getParameterObj(parameterName='dataBlocksPerFile') |
|
3725 | value = opObj.getParameterObj(parameterName='dataBlocksPerFile') | |
3894 | if value == None: |
|
3726 | if value == None: | |
3895 | self.specHeisOutputblocksperfile.clear() |
|
3727 | self.specHeisOutputblocksperfile.clear() | |
3896 | else: |
|
3728 | else: | |
3897 | value = opObj.getParameterValue(parameterName='dataBlocksPerFile') |
|
3729 | value = opObj.getParameterValue(parameterName='dataBlocksPerFile') | |
3898 | blocksperfile = str(value) |
|
3730 | blocksperfile = str(value) | |
3899 | self.specHeisOutputblocksperfile.setText(blocksperfile) |
|
3731 | self.specHeisOutputblocksperfile.setText(blocksperfile) | |
3900 | value = opObj.getParameterObj(parameterName='metadatafile') |
|
3732 | value = opObj.getParameterObj(parameterName='metadatafile') | |
3901 | if value == None: |
|
3733 | if value == None: | |
3902 | self.specHeisOutputMetada.clear() |
|
3734 | self.specHeisOutputMetada.clear() | |
3903 | else: |
|
3735 | else: | |
3904 | value = opObj.getParameterValue(parameterName='metadatafile') |
|
3736 | value = opObj.getParameterValue(parameterName='metadatafile') | |
3905 | metada = str(value) |
|
3737 | metada = str(value) | |
3906 | self.specHeisOutputMetada.setText(metada) |
|
3738 | self.specHeisOutputMetada.setText(metada) | |
3907 |
|
3739 | |||
3908 | return |
|
3740 | return | |
3909 |
|
3741 | |||
3910 | def __refreshCorrelationWindow(self, puObj): |
|
3742 | def __refreshCorrelationWindow(self, puObj): | |
3911 | pass |
|
3743 | pass | |
3912 |
|
3744 | |||
3913 | def refreshPUWindow(self, puObj): |
|
3745 | def refreshPUWindow(self, puObj): | |
3914 |
|
3746 | |||
3915 | if puObj.datatype == 'Voltage': |
|
3747 | if puObj.datatype == 'Voltage': | |
3916 | self.__refreshVoltageWindow(puObj) |
|
3748 | self.__refreshVoltageWindow(puObj) | |
3917 |
|
3749 | |||
3918 | if puObj.datatype == 'Spectra': |
|
3750 | if puObj.datatype == 'Spectra': | |
3919 | self.__refreshSpectraWindow(puObj) |
|
3751 | self.__refreshSpectraWindow(puObj) | |
3920 |
|
3752 | |||
3921 | if puObj.datatype == 'SpectraHeis': |
|
3753 | if puObj.datatype == 'SpectraHeis': | |
3922 | self.__refreshSpectraHeisWindow(puObj) |
|
3754 | self.__refreshSpectraHeisWindow(puObj) | |
3923 |
|
3755 | |||
3924 | def refreshProjectProperties(self, projectObjView): |
|
3756 | def refreshProjectProperties(self, projectObjView): | |
3925 |
|
3757 | |||
3926 | propertyBuffObj = PropertyBuffer() |
|
3758 | propertyBuffObj = PropertyBuffer() | |
3927 | name = projectObjView.name |
|
3759 | name = projectObjView.name | |
3928 |
|
3760 | |||
3929 | propertyBuffObj.append("Properties", "Name", projectObjView.name), |
|
3761 | propertyBuffObj.append("Properties", "Name", projectObjView.name), | |
3930 | propertyBuffObj.append("Properties", "Description", projectObjView.description) |
|
3762 | propertyBuffObj.append("Properties", "Description", projectObjView.description) | |
3931 | propertyBuffObj.append("Properties", "Workspace", self.pathWorkSpace) |
|
3763 | propertyBuffObj.append("Properties", "Workspace", self.pathWorkSpace) | |
3932 |
|
3764 | |||
3933 | readUnitObj = projectObjView.getReadUnitObj() |
|
3765 | readUnitObj = projectObjView.getReadUnitObj() | |
3934 | runOperationObj = readUnitObj.getOperationObj(name='run') |
|
3766 | runOperationObj = readUnitObj.getOperationObj(name='run') | |
3935 |
|
3767 | |||
3936 | for thisParmObj in runOperationObj.getParameterObjList(): |
|
3768 | for thisParmObj in runOperationObj.getParameterObjList(): | |
3937 | propertyBuffObj.append("Reading parms", thisParmObj.name, str(thisParmObj.getValue())) |
|
3769 | propertyBuffObj.append("Reading parms", thisParmObj.name, str(thisParmObj.getValue())) | |
3938 |
|
3770 | |||
3939 | propertiesModel = propertyBuffObj.getPropertyModel() |
|
3771 | propertiesModel = propertyBuffObj.getPropertyModel() | |
3940 |
|
3772 | |||
3941 | self.treeProjectProperties.setModel(propertiesModel) |
|
3773 | self.treeProjectProperties.setModel(propertiesModel) | |
3942 | self.treeProjectProperties.expandAll() |
|
3774 | self.treeProjectProperties.expandAll() | |
3943 | self.treeProjectProperties.resizeColumnToContents(0) |
|
3775 | self.treeProjectProperties.resizeColumnToContents(0) | |
3944 | self.treeProjectProperties.resizeColumnToContents(1) |
|
3776 | self.treeProjectProperties.resizeColumnToContents(1) | |
3945 |
|
3777 | |||
3946 | def refreshPUProperties(self, puObjView): |
|
3778 | def refreshPUProperties(self, puObjView): | |
3947 |
|
3779 | |||
3948 | ############ FTP CONFIG ################################ |
|
3780 | ############ FTP CONFIG ################################ | |
|
3781 | #Deleting FTP Conf. This processing unit have not got any | |||
|
3782 | #FTP configuration by default | |||
3949 | if puObjView.id in self.__puLocalFolder2FTP.keys(): |
|
3783 | if puObjView.id in self.__puLocalFolder2FTP.keys(): | |
3950 | self.__puLocalFolder2FTP.pop(puObjView.id) |
|
3784 | self.__puLocalFolder2FTP.pop(puObjView.id) | |
3951 | ######################################################## |
|
3785 | ######################################################## | |
3952 |
|
3786 | |||
3953 | propertyBuffObj = PropertyBuffer() |
|
3787 | propertyBuffObj = PropertyBuffer() | |
3954 |
|
3788 | |||
3955 | for thisOp in puObjView.getOperationObjList(): |
|
3789 | for thisOp in puObjView.getOperationObjList(): | |
3956 |
|
3790 | |||
3957 | operationName = thisOp.name |
|
3791 | operationName = thisOp.name | |
3958 |
|
3792 | |||
3959 | if operationName == 'run': |
|
3793 | if operationName == 'run': | |
3960 | operationName = 'Properties' |
|
3794 | operationName = 'Properties' | |
3961 |
|
3795 | |||
3962 | if not thisOp.getParameterObjList(): |
|
3796 | else: | |
3963 | propertyBuffObj.append(operationName, '--', '--') |
|
3797 | if not thisOp.getParameterObjList(): | |
3964 | continue |
|
3798 | propertyBuffObj.append(operationName, '--', '--') | |
|
3799 | continue | |||
3965 |
|
3800 | |||
3966 | for thisParmObj in thisOp.getParameterObjList(): |
|
3801 | for thisParmObj in thisOp.getParameterObjList(): | |
3967 | propertyBuffObj.append(operationName, thisParmObj.name, str(thisParmObj.getValue())) |
|
3802 | propertyBuffObj.append(operationName, thisParmObj.name, str(thisParmObj.getValue())) | |
3968 |
|
3803 | |||
3969 | ############ FTP CONFIG ################################ |
|
3804 | ############ FTP CONFIG ################################ | |
|
3805 | if thisParmObj.name == "ftp_wei" and thisParmObj.getValue(): | |||
|
3806 | value = thisParmObj.getValue() | |||
|
3807 | self.temporalFTP.ftp_wei = value | |||
|
3808 | ||||
|
3809 | if thisParmObj.name == "exp_code" and thisParmObj.getValue(): | |||
|
3810 | value = thisParmObj.getValue() | |||
|
3811 | self.temporalFTP.exp_code = value | |||
|
3812 | ||||
|
3813 | if thisParmObj.name == "sub_exp_code" and thisParmObj.getValue(): | |||
|
3814 | value = thisParmObj.getValue() | |||
|
3815 | self.temporalFTP.sub_exp_code = value | |||
|
3816 | ||||
|
3817 | if thisParmObj.name == "plot_pos" and thisParmObj.getValue(): | |||
|
3818 | value = thisParmObj.getValue() | |||
|
3819 | self.temporalFTP.plot_pos = value | |||
|
3820 | ||||
3970 | if thisParmObj.name == 'ftp' and thisParmObj.getValue(): |
|
3821 | if thisParmObj.name == 'ftp' and thisParmObj.getValue(): | |
3971 |
figpath = thisOp.getParameter |
|
3822 | figpathObj = thisOp.getParameterObj('figpath') | |
3972 |
if |
|
3823 | if figpathObj: | |
3973 | continue |
|
3824 | self.__puLocalFolder2FTP[puObjView.id] = figpathObj.getValue() | |
3974 | self.__puLocalFolder2FTP[puObjView.id] = figpath |
|
3825 | ||
3975 | ######################################################## |
|
3826 | ######################################################## | |
3976 |
|
3827 | |||
3977 | propertiesModel = propertyBuffObj.getPropertyModel() |
|
3828 | propertiesModel = propertyBuffObj.getPropertyModel() | |
3978 |
|
3829 | |||
3979 | self.treeProjectProperties.setModel(propertiesModel) |
|
3830 | self.treeProjectProperties.setModel(propertiesModel) | |
3980 | self.treeProjectProperties.expandAll() |
|
3831 | self.treeProjectProperties.expandAll() | |
3981 | self.treeProjectProperties.resizeColumnToContents(0) |
|
3832 | self.treeProjectProperties.resizeColumnToContents(0) | |
3982 | self.treeProjectProperties.resizeColumnToContents(1) |
|
3833 | self.treeProjectProperties.resizeColumnToContents(1) | |
3983 |
|
3834 | |||
3984 | def refreshGraphicsId(self): |
|
3835 | def refreshGraphicsId(self): | |
3985 |
|
3836 | |||
3986 | projectObj = self.getSelectedProjectObj() |
|
3837 | projectObj = self.getSelectedProjectObj() | |
3987 |
|
3838 | |||
3988 | for idPU, puObj in projectObj.procUnitConfObjDict.items(): |
|
3839 | for idPU, puObj in projectObj.procUnitConfObjDict.items(): | |
3989 |
|
3840 | |||
3990 | for opObj in puObj.getOperationObjList(): |
|
3841 | for opObj in puObj.getOperationObjList(): | |
3991 |
|
3842 | |||
3992 | if opObj.name not in ('Scope', 'SpectraPlot', 'CrossSpectraPlot', 'RTIPlot', 'CoherenceMap', 'PowerProfilePlot', 'Noise', 'SpectraHeisScope', 'RTIfromSpectraHeis'): |
|
3843 | if opObj.name not in ('Scope', 'SpectraPlot', 'CrossSpectraPlot', 'RTIPlot', 'CoherenceMap', 'PowerProfilePlot', 'Noise', 'SpectraHeisScope', 'RTIfromSpectraHeis'): | |
3993 | continue |
|
3844 | continue | |
3994 |
|
3845 | |||
3995 | opObj.changeParameter(name='id', value=opObj.id, format='int') |
|
3846 | opObj.changeParameter(name='id', value=opObj.id, format='int') | |
3996 |
|
3847 | |||
3997 | def on_click(self, index): |
|
3848 | def on_click(self, index): | |
3998 |
|
3849 | |||
3999 | self.selectedItemTree = self.projectExplorerModel.itemFromIndex(index) |
|
3850 | self.selectedItemTree = self.projectExplorerModel.itemFromIndex(index) | |
4000 |
|
3851 | |||
4001 | projectObjView = self.getSelectedProjectObj() |
|
3852 | projectObjView = self.getSelectedProjectObj() | |
4002 |
|
3853 | |||
4003 | if not projectObjView: |
|
3854 | if not projectObjView: | |
4004 | return |
|
3855 | return | |
4005 |
|
3856 | |||
4006 | self.create = False |
|
3857 | self.create = False | |
4007 | selectedObjView = self.getSelectedItemObj() |
|
3858 | selectedObjView = self.getSelectedItemObj() | |
4008 |
|
3859 | |||
4009 | #A project has been selected |
|
3860 | #A project has been selected | |
4010 | if projectObjView == selectedObjView: |
|
3861 | if projectObjView == selectedObjView: | |
4011 |
|
3862 | |||
4012 | self.refreshProjectWindow2(projectObjView) |
|
3863 | self.refreshProjectWindow2(projectObjView) | |
4013 | self.refreshProjectProperties(projectObjView) |
|
3864 | self.refreshProjectProperties(projectObjView) | |
4014 |
|
3865 | |||
4015 | self.tabProject.setEnabled(True) |
|
3866 | self.tabProject.setEnabled(True) | |
4016 | self.tabVoltage.setEnabled(False) |
|
3867 | self.tabVoltage.setEnabled(False) | |
4017 | self.tabSpectra.setEnabled(False) |
|
3868 | self.tabSpectra.setEnabled(False) | |
4018 | self.tabCorrelation.setEnabled(False) |
|
3869 | self.tabCorrelation.setEnabled(False) | |
4019 | self.tabSpectraHeis.setEnabled(False) |
|
3870 | self.tabSpectraHeis.setEnabled(False) | |
4020 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
3871 | self.tabWidgetProject.setCurrentWidget(self.tabProject) | |
4021 |
|
3872 | |||
4022 | return |
|
3873 | return | |
4023 |
|
3874 | |||
4024 | #A processing unit has been selected |
|
3875 | #A processing unit has been selected | |
4025 | voltEnable = False |
|
3876 | voltEnable = False | |
4026 | specEnable = False |
|
3877 | specEnable = False | |
4027 | corrEnable = False |
|
3878 | corrEnable = False | |
4028 | specHeisEnable = False |
|
3879 | specHeisEnable = False | |
4029 | tabSelected = self.tabProject |
|
3880 | tabSelected = self.tabProject | |
4030 |
|
3881 | |||
4031 | puObj = selectedObjView |
|
3882 | puObj = selectedObjView | |
4032 |
|
3883 | |||
4033 | self.refreshPUWindow(puObj) |
|
3884 | self.refreshPUWindow(puObj) | |
4034 | self.refreshPUProperties(puObj) |
|
3885 | self.refreshPUProperties(puObj) | |
4035 | self.showtabPUCreated(puObj.datatype) |
|
3886 | self.showtabPUCreated(puObj.datatype) | |
4036 |
|
3887 | |||
4037 | def on_right_click(self, pos): |
|
3888 | def on_right_click(self, pos): | |
4038 |
|
3889 | |||
4039 | self.menu = QtGui.QMenu() |
|
3890 | self.menu = QtGui.QMenu() | |
4040 | quitAction0 = self.menu.addAction("Create a New Project") |
|
3891 | quitAction0 = self.menu.addAction("Create a New Project") | |
4041 | quitAction1 = self.menu.addAction("Create a New Processing Unit") |
|
3892 | quitAction1 = self.menu.addAction("Create a New Processing Unit") | |
4042 | quitAction2 = self.menu.addAction("Delete Item") |
|
3893 | quitAction2 = self.menu.addAction("Delete Item") | |
4043 | quitAction3 = self.menu.addAction("Quit") |
|
3894 | quitAction3 = self.menu.addAction("Quit") | |
4044 |
|
3895 | |||
4045 | if len(self.__itemTreeDict) == 0: |
|
3896 | if len(self.__itemTreeDict) == 0: | |
4046 | quitAction2.setEnabled(False) |
|
3897 | quitAction2.setEnabled(False) | |
4047 | else: |
|
3898 | else: | |
4048 | quitAction2.setEnabled(True) |
|
3899 | quitAction2.setEnabled(True) | |
4049 |
|
3900 | |||
4050 | action = self.menu.exec_(self.mapToGlobal(pos)) |
|
3901 | action = self.menu.exec_(self.mapToGlobal(pos)) | |
4051 |
|
3902 | |||
4052 | if action == quitAction0: |
|
3903 | if action == quitAction0: | |
4053 | self. setInputsProject_View() |
|
3904 | self. setInputsProject_View() | |
4054 | self.create = True |
|
3905 | self.create = True | |
4055 |
|
3906 | |||
4056 | if action == quitAction1: |
|
3907 | if action == quitAction1: | |
4057 | if len(self.__projectObjDict) == 0: |
|
3908 | if len(self.__projectObjDict) == 0: | |
4058 | outputstr = "You need to create a Project before adding a Processing Unit" |
|
3909 | outputstr = "You need to create a Project before adding a Processing Unit" | |
4059 | self.console.clear() |
|
3910 | self.console.clear() | |
4060 | self.console.append(outputstr) |
|
3911 | self.console.append(outputstr) | |
4061 | return 0 |
|
3912 | return 0 | |
4062 | else: |
|
3913 | else: | |
4063 | self.addPUWindow() |
|
3914 | self.addPUWindow() | |
4064 | self.console.clear() |
|
3915 | self.console.clear() | |
4065 | self.console.append("Please, Choose the type of Processing Unit") |
|
3916 | self.console.append("Please, Choose the type of Processing Unit") | |
4066 | # self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") |
|
3917 | # self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") | |
4067 | # self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") |
|
3918 | # self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") | |
4068 | # self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") |
|
3919 | # self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") | |
4069 |
|
3920 | |||
4070 | if action == quitAction2: |
|
3921 | if action == quitAction2: | |
4071 | index = self.selectedItemTree |
|
3922 | index = self.selectedItemTree | |
4072 | try: |
|
3923 | try: | |
4073 | index.parent() |
|
3924 | index.parent() | |
4074 | except: |
|
3925 | except: | |
4075 | self.console.append('Please first select a Project or Processing Unit') |
|
3926 | self.console.append('Please first select a Project or Processing Unit') | |
4076 | return 0 |
|
3927 | return 0 | |
4077 | # print index.parent(),index |
|
3928 | # print index.parent(),index | |
4078 | if index.parent() == None: |
|
3929 | if index.parent() == None: | |
4079 | self.projectExplorerModel.removeRow(index.row()) |
|
3930 | self.projectExplorerModel.removeRow(index.row()) | |
4080 | else: |
|
3931 | else: | |
4081 | index.parent().removeRow(index.row()) |
|
3932 | index.parent().removeRow(index.row()) | |
4082 | self.removeItemTreeFromProject() |
|
3933 | self.removeItemTreeFromProject() | |
4083 | self.console.clear() |
|
3934 | self.console.clear() | |
4084 | # for i in self.projectExplorerTree.selectionModel().selection().indexes(): |
|
3935 | # for i in self.projectExplorerTree.selectionModel().selection().indexes(): | |
4085 | # print i.row() |
|
3936 | # print i.row() | |
4086 |
|
3937 | |||
4087 | if action == quitAction3: |
|
3938 | if action == quitAction3: | |
4088 | self.close() |
|
3939 | self.close() | |
4089 | return 0 |
|
3940 | return 0 | |
4090 |
|
3941 | |||
4091 | def create_updating_timer(self): |
|
3942 | def create_updating_timer(self): | |
4092 | self.comm_data_timer = QtCore.QTimer(self) |
|
3943 | self.comm_data_timer = QtCore.QTimer(self) | |
4093 | self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) |
|
3944 | self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) | |
4094 | self.comm_data_timer.start(1000) |
|
3945 | self.comm_data_timer.start(1000) | |
4095 |
|
3946 | |||
4096 | def createProjectView(self, id): |
|
3947 | def createProjectView(self, id): | |
4097 |
|
3948 | |||
4098 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
3949 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() | |
4099 | id = str(id) |
|
3950 | id = str(id) | |
4100 | projectParms = self.__getParmsFromProjectWindow() |
|
3951 | projectParms = self.__getParmsFromProjectWindow() | |
4101 |
|
3952 | |||
4102 | if not projectParms.isValid(): |
|
3953 | if not projectParms.isValid(): | |
4103 | return None |
|
3954 | return None | |
4104 |
|
3955 | |||
4105 | projectObjView = Project() |
|
3956 | projectObjView = Project() | |
4106 | projectObjView.setup(id=id, name=projectParms.name, description=projectParms.description) |
|
3957 | projectObjView.setup(id=id, name=projectParms.name, description=projectParms.description) | |
4107 |
|
3958 | |||
4108 | self.__projectObjDict[id] = projectObjView |
|
3959 | self.__projectObjDict[id] = projectObjView | |
4109 | self.addProject2ProjectExplorer(id=id, name=projectObjView.name) |
|
3960 | self.addProject2ProjectExplorer(id=id, name=projectObjView.name) | |
4110 |
|
3961 | |||
4111 | self.create = False |
|
3962 | self.create = False | |
4112 |
|
3963 | |||
4113 | return projectObjView |
|
3964 | return projectObjView | |
4114 |
|
3965 | |||
4115 | def updateProjectView(self): |
|
3966 | def updateProjectView(self): | |
4116 |
|
3967 | |||
4117 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
3968 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() | |
4118 |
|
3969 | |||
4119 | projectParms = self.__getParmsFromProjectWindow() |
|
3970 | projectParms = self.__getParmsFromProjectWindow() | |
4120 |
|
3971 | |||
4121 | if not projectParms.isValid(): |
|
3972 | if not projectParms.isValid(): | |
4122 | return None |
|
3973 | return None | |
4123 |
|
3974 | |||
4124 | projectObjView = self.getSelectedProjectObj() |
|
3975 | projectObjView = self.getSelectedProjectObj() | |
4125 | projectObjView.update(name=projectParms.name, description=projectParms.description) |
|
3976 | projectObjView.update(name=projectParms.name, description=projectParms.description) | |
4126 |
|
3977 | |||
4127 | return projectObjView |
|
3978 | return projectObjView | |
4128 |
|
3979 | |||
4129 | def createReadUnitView(self, projectObjView): |
|
3980 | def createReadUnitView(self, projectObjView): | |
4130 |
|
3981 | |||
4131 | # project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
3982 | # project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() | |
4132 |
|
3983 | |||
4133 | projectParms = self.__getParmsFromProjectWindow() |
|
3984 | projectParms = self.__getParmsFromProjectWindow() | |
4134 |
|
3985 | |||
4135 | if not projectParms.isValid(): |
|
3986 | if not projectParms.isValid(): | |
4136 | return None |
|
3987 | return None | |
4137 |
|
3988 | |||
4138 | if projectParms.datatype in ("Voltage", "Spectra", "Fits"): |
|
3989 | if projectParms.datatype in ("Voltage", "Spectra", "Fits"): | |
4139 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, |
|
3990 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, | |
4140 | path=projectParms.dpath, |
|
3991 | path=projectParms.dpath, | |
4141 | startDate=projectParms.startDate, |
|
3992 | startDate=projectParms.startDate, | |
4142 | endDate=projectParms.endDate, |
|
3993 | endDate=projectParms.endDate, | |
4143 | startTime=projectParms.startTime, |
|
3994 | startTime=projectParms.startTime, | |
4144 | endTime=projectParms.endTime, |
|
3995 | endTime=projectParms.endTime, | |
4145 | online=projectParms.online, |
|
3996 | online=projectParms.online, | |
4146 | walk=projectParms.walk |
|
3997 | walk=projectParms.walk | |
4147 | ) |
|
3998 | ) | |
4148 |
|
3999 | |||
4149 | if projectParms.set: |
|
4000 | if projectParms.set: | |
4150 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") |
|
4001 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") | |
4151 |
|
4002 | |||
4152 | if projectParms.delay: |
|
4003 | if projectParms.delay: | |
4153 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4004 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") | |
4154 |
|
4005 | |||
4155 | if projectParms.datatype == "USRP": |
|
4006 | if projectParms.datatype == "USRP": | |
4156 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, |
|
4007 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, | |
4157 | path=projectParms.dpath, |
|
4008 | path=projectParms.dpath, | |
4158 | startDate=projectParms.startDate, |
|
4009 | startDate=projectParms.startDate, | |
4159 | endDate=projectParms.endDate, |
|
4010 | endDate=projectParms.endDate, | |
4160 | startTime=projectParms.startTime, |
|
4011 | startTime=projectParms.startTime, | |
4161 | endTime=projectParms.endTime, |
|
4012 | endTime=projectParms.endTime, | |
4162 | online=projectParms.online, |
|
4013 | online=projectParms.online, | |
4163 | ippKm=projectParms.ippKm |
|
4014 | ippKm=projectParms.ippKm | |
4164 | ) |
|
4015 | ) | |
4165 |
|
4016 | |||
4166 | if projectParms.delay: |
|
4017 | if projectParms.delay: | |
4167 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4018 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") | |
4168 |
|
4019 | |||
4169 | return readUnitConfObj |
|
4020 | return readUnitConfObj | |
4170 |
|
4021 | |||
4171 | def updateReadUnitView(self, projectObjView, idReadUnit): |
|
4022 | def updateReadUnitView(self, projectObjView, idReadUnit): | |
4172 |
|
4023 | |||
4173 | # project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk , set = self.getParmsFromProjectWindow() |
|
4024 | # project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk , set = self.getParmsFromProjectWindow() | |
4174 |
|
4025 | |||
4175 | readUnitConfObj = projectObjView.getProcUnitObj(idReadUnit) |
|
4026 | readUnitConfObj = projectObjView.getProcUnitObj(idReadUnit) | |
4176 |
|
4027 | |||
4177 | projectParms = self.__getParmsFromProjectWindow() |
|
4028 | projectParms = self.__getParmsFromProjectWindow() | |
4178 |
|
4029 | |||
4179 | if not projectParms.isValid(): |
|
4030 | if not projectParms.isValid(): | |
4180 | return None |
|
4031 | return None | |
4181 |
|
4032 | |||
4182 | if projectParms.datatype in ["Voltage", "Spectra", "Fits"]: |
|
4033 | if projectParms.datatype in ["Voltage", "Spectra", "Fits"]: | |
4183 | readUnitConfObj.update(datatype=projectParms.datatype, |
|
4034 | readUnitConfObj.update(datatype=projectParms.datatype, | |
4184 | path=projectParms.dpath, |
|
4035 | path=projectParms.dpath, | |
4185 | startDate=projectParms.startDate, |
|
4036 | startDate=projectParms.startDate, | |
4186 | endDate=projectParms.endDate, |
|
4037 | endDate=projectParms.endDate, | |
4187 | startTime=projectParms.startTime, |
|
4038 | startTime=projectParms.startTime, | |
4188 | endTime=projectParms.endTime, |
|
4039 | endTime=projectParms.endTime, | |
4189 | online=projectParms.online, |
|
4040 | online=projectParms.online, | |
4190 | walk=projectParms.walk |
|
4041 | walk=projectParms.walk | |
4191 | ) |
|
4042 | ) | |
4192 | if projectParms.set: |
|
4043 | if projectParms.set: | |
4193 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") |
|
4044 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") | |
4194 |
|
4045 | |||
4195 | if projectParms.delay: |
|
4046 | if projectParms.delay: | |
4196 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4047 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") | |
4197 |
|
4048 | |||
4198 | if projectParms.datatype == "USRP": |
|
4049 | if projectParms.datatype == "USRP": | |
4199 | readUnitConfObj.update(datatype=projectParms.datatype, |
|
4050 | readUnitConfObj.update(datatype=projectParms.datatype, | |
4200 | path=projectParms.dpath, |
|
4051 | path=projectParms.dpath, | |
4201 | startDate=projectParms.startDate, |
|
4052 | startDate=projectParms.startDate, | |
4202 | endDate=projectParms.endDate, |
|
4053 | endDate=projectParms.endDate, | |
4203 | startTime=projectParms.startTime, |
|
4054 | startTime=projectParms.startTime, | |
4204 | endTime=projectParms.endTime, |
|
4055 | endTime=projectParms.endTime, | |
4205 | online=projectParms.online, |
|
4056 | online=projectParms.online, | |
4206 | ippKm=projectParms.ippKm |
|
4057 | ippKm=projectParms.ippKm | |
4207 | ) |
|
4058 | ) | |
4208 |
|
4059 | |||
4209 | if projectParms.delay: |
|
4060 | if projectParms.delay: | |
4210 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4061 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") | |
4211 |
|
4062 | |||
4212 | return readUnitConfObj |
|
4063 | return readUnitConfObj | |
4213 |
|
4064 | |||
4214 | def createProcUnitView(self, projectObjView, datatype, inputId): |
|
4065 | def createProcUnitView(self, projectObjView, datatype, inputId): | |
4215 |
|
4066 | |||
4216 | procUnitConfObj = projectObjView.addProcUnit(datatype=datatype, inputId=inputId) |
|
4067 | procUnitConfObj = projectObjView.addProcUnit(datatype=datatype, inputId=inputId) | |
4217 |
|
4068 | |||
4218 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
4069 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj | |
4219 |
|
4070 | |||
4220 | return procUnitConfObj |
|
4071 | return procUnitConfObj | |
4221 |
|
4072 | |||
4222 | def updateProcUnitView(self, id): |
|
4073 | def updateProcUnitView(self, id): | |
4223 |
|
4074 | |||
4224 | procUnitConfObj = projectObjView.getProcUnitObj(id) |
|
4075 | procUnitConfObj = projectObjView.getProcUnitObj(id) | |
4225 | procUnitConfObj.removeOperations() |
|
4076 | procUnitConfObj.removeOperations() | |
4226 |
|
4077 | |||
4227 | return procUnitConfObj |
|
4078 | return procUnitConfObj | |
4228 |
|
4079 | |||
4229 | def addPUWindow(self): |
|
4080 | def addPUWindow(self): | |
4230 |
|
4081 | |||
4231 | self.configUPWindowObj = UnitProcessWindow(self) |
|
4082 | self.configUPWindowObj = UnitProcessWindow(self) | |
4232 | fatherObj = self.getSelectedItemObj() |
|
4083 | fatherObj = self.getSelectedItemObj() | |
4233 | try: |
|
4084 | try: | |
4234 | fatherObj.getElementName() |
|
4085 | fatherObj.getElementName() | |
4235 | except: |
|
4086 | except: | |
4236 | self.console.append("First left click on Project or Processing Unit") |
|
4087 | self.console.append("First left click on Project or Processing Unit") | |
4237 | return 0 |
|
4088 | return 0 | |
4238 |
|
4089 | |||
4239 | if fatherObj.getElementName() == 'Project': |
|
4090 | if fatherObj.getElementName() == 'Project': | |
4240 | readUnitConfObj = fatherObj.getReadUnitObj() |
|
4091 | readUnitConfObj = fatherObj.getReadUnitObj() | |
4241 | self.configUPWindowObj.dataTypeProject = str(readUnitConfObj.datatype) |
|
4092 | self.configUPWindowObj.dataTypeProject = str(readUnitConfObj.datatype) | |
4242 |
|
4093 | |||
4243 | self.configUPWindowObj.getfromWindowList.append(fatherObj) |
|
4094 | self.configUPWindowObj.getfromWindowList.append(fatherObj) | |
4244 | self.configUPWindowObj.loadTotalList() |
|
4095 | self.configUPWindowObj.loadTotalList() | |
4245 | self.configUPWindowObj.show() |
|
4096 | self.configUPWindowObj.show() | |
4246 | self.configUPWindowObj.closed.connect(self.createPUWindow) |
|
4097 | self.configUPWindowObj.closed.connect(self.createPUWindow) | |
4247 |
|
4098 | |||
4248 | def createPUWindow(self): |
|
4099 | def createPUWindow(self): | |
4249 |
|
4100 | |||
4250 | if not self.configUPWindowObj.create: |
|
4101 | if not self.configUPWindowObj.create: | |
4251 | return |
|
4102 | return | |
4252 |
|
4103 | |||
4253 | fatherObj = self.configUPWindowObj.getFromWindow |
|
4104 | fatherObj = self.configUPWindowObj.getFromWindow | |
4254 | datatype = self.configUPWindowObj.typeofUP |
|
4105 | datatype = self.configUPWindowObj.typeofUP | |
4255 |
|
4106 | |||
4256 | if fatherObj.getElementName() == 'Project': |
|
4107 | if fatherObj.getElementName() == 'Project': | |
4257 | inputId = fatherObj.getReadUnitId() |
|
4108 | inputId = fatherObj.getReadUnitId() | |
4258 | projectObjView = fatherObj |
|
4109 | projectObjView = fatherObj | |
4259 | else: |
|
4110 | else: | |
4260 | inputId = fatherObj.getId() |
|
4111 | inputId = fatherObj.getId() | |
4261 | projectObjView = self.getSelectedProjectObj() |
|
4112 | projectObjView = self.getSelectedProjectObj() | |
4262 |
|
4113 | |||
4263 | puObj = self.createProcUnitView(projectObjView, datatype, inputId) |
|
4114 | puObj = self.createProcUnitView(projectObjView, datatype, inputId) | |
4264 |
|
4115 | |||
4265 | self.addPU2ProjectExplorer(puObj) |
|
4116 | self.addPU2ProjectExplorer(puObj) | |
4266 |
|
4117 | |||
4267 | self.showtabPUCreated(datatype) |
|
4118 | self.showtabPUCreated(datatype) | |
4268 |
|
4119 | |||
4269 | self.clearPUWindow(datatype) |
|
4120 | self.clearPUWindow(datatype) | |
4270 |
|
4121 | |||
4271 | self.showPUinitView() |
|
4122 | self.showPUinitView() | |
4272 |
|
4123 | |||
4273 | def addFTPConf2Operation(self, puObj, opObj): |
|
4124 | def addFTPConf2Operation(self, puObj, opObj): | |
4274 |
|
4125 | |||
4275 | if not self.temporalFTP.create: |
|
4126 | if not self.temporalFTP.create: | |
4276 | self.temporalFTP.setwithoutconfiguration() |
|
4127 | self.temporalFTP.setwithoutconfiguration() | |
4277 |
|
4128 | |||
4278 | # opObj.addParameter(name='server', value=self.temporalFTP.server, format='str') |
|
4129 | # opObj.addParameter(name='server', value=self.temporalFTP.server, format='str') | |
4279 | # opObj.addParameter(name='remotefolder', value=self.temporalFTP.remotefolder, format='str') |
|
4130 | # opObj.addParameter(name='remotefolder', value=self.temporalFTP.remotefolder, format='str') | |
4280 | # opObj.addParameter(name='username', value=self.temporalFTP.username, format='str') |
|
4131 | # opObj.addParameter(name='username', value=self.temporalFTP.username, format='str') | |
4281 | # opObj.addParameter(name='password', value=self.temporalFTP.password, format='str') |
|
4132 | # opObj.addParameter(name='password', value=self.temporalFTP.password, format='str') | |
4282 |
|
4133 | |||
4283 | if self.temporalFTP.ftp_wei: |
|
4134 | if self.temporalFTP.ftp_wei: | |
4284 | opObj.addParameter(name='ftp_wei', value=int(self.temporalFTP.ftp_wei), format='int') |
|
4135 | opObj.addParameter(name='ftp_wei', value=int(self.temporalFTP.ftp_wei), format='int') | |
4285 | if self.temporalFTP.exp_code: |
|
4136 | if self.temporalFTP.exp_code: | |
4286 | opObj.addParameter(name='exp_code', value=int(self.temporalFTP.exp_code), format='int') |
|
4137 | opObj.addParameter(name='exp_code', value=int(self.temporalFTP.exp_code), format='int') | |
4287 | if self.temporalFTP.sub_exp_code: |
|
4138 | if self.temporalFTP.sub_exp_code: | |
4288 | opObj.addParameter(name='sub_exp_code', value=int(self.temporalFTP.sub_exp_code), format='int') |
|
4139 | opObj.addParameter(name='sub_exp_code', value=int(self.temporalFTP.sub_exp_code), format='int') | |
4289 | if self.temporalFTP.plot_pos: |
|
4140 | if self.temporalFTP.plot_pos: | |
4290 | opObj.addParameter(name='plot_pos', value=int(self.temporalFTP.plot_pos), format='int') |
|
4141 | opObj.addParameter(name='plot_pos', value=int(self.temporalFTP.plot_pos), format='int') | |
4291 |
|
4142 | |||
4292 | def __checkFTPProcUnit(self, projectObj, localfolder): |
|
4143 | def __checkFTPProcUnit(self, projectObj, localfolder): | |
4293 |
|
4144 | |||
4294 | puId = None |
|
4145 | puId = None | |
4295 | puObj = None |
|
4146 | puObj = None | |
4296 |
|
4147 | |||
4297 | for thisPuId, thisPuObj in projectObj.procUnitItems(): |
|
4148 | for thisPuId, thisPuObj in projectObj.procUnitItems(): | |
4298 |
|
4149 | |||
4299 | if not thisPuObj.name == "SendToServer": |
|
4150 | if not thisPuObj.name == "SendToServer": | |
4300 | continue |
|
4151 | continue | |
4301 |
|
4152 | |||
4302 | opObj = thisPuObj.getOperationObj(name='run') |
|
4153 | opObj = thisPuObj.getOperationObj(name='run') | |
4303 |
|
4154 | |||
4304 | parmObj = opObj.getParameterObj('localfolder') |
|
4155 | parmObj = opObj.getParameterObj('localfolder') | |
4305 |
|
4156 | |||
4306 | #localfolder parameter should always be set, if it is not set then ProcUnit should be removed |
|
4157 | #localfolder parameter should always be set, if it is not set then ProcUnit should be removed | |
4307 | if not parmObj: |
|
4158 | if not parmObj: | |
4308 | projectObj.removeProcUnit(thisPuId) |
|
4159 | projectObj.removeProcUnit(thisPuId) | |
4309 | continue |
|
4160 | continue | |
4310 |
|
4161 | |||
4311 | thisLocalfolder = parmObj.getValue() |
|
4162 | thisLocalfolder = parmObj.getValue() | |
4312 |
|
4163 | |||
4313 | if localfolder != thisLocalfolder: |
|
4164 | if localfolder != thisLocalfolder: | |
4314 | continue |
|
4165 | continue | |
4315 |
|
4166 | |||
4316 | puId = thisPuId |
|
4167 | puId = thisPuId | |
4317 | puObj = thisPuObj |
|
4168 | puObj = thisPuObj | |
4318 | break |
|
4169 | break | |
4319 |
|
4170 | |||
4320 | return puObj |
|
4171 | return puObj | |
4321 |
|
4172 | |||
4322 |
def |
|
4173 | def createFTPProcUnitView(self): | |
4323 |
|
||||
4324 | if operationObj.name != "SendByFTP": |
|
|||
4325 | return |
|
|||
4326 |
|
||||
4327 | projectObj = self.getSelectedProjectObj() |
|
|||
4328 |
|
||||
4329 | self.removeAllFTPProcUnitView(projectObj) |
|
|||
4330 |
|
||||
4331 | procUnitConfObj = projectObj.addProcUnit(name="SendToServer") |
|
|||
4332 |
|
||||
4333 | server = operationObj.getParameterValue("server") |
|
|||
4334 | username = operationObj.getParameterValue("username") |
|
|||
4335 | password = operationObj.getParameterValue("pasword") |
|
|||
4336 | localfolder = operationObj.getParameterValue("localfolder") |
|
|||
4337 | remotefolder = operationObj.getParameterValue("remotefolder") |
|
|||
4338 | ext = operationObj.getParameterValue("ext") |
|
|||
4339 | period = operationObj.getParameterValue("period") |
|
|||
4340 |
|
||||
4341 | procUnitConfObj.addParameter(name='server', value=server, format='str') |
|
|||
4342 | procUnitConfObj.addParameter(name='username', value=username, format='str') |
|
|||
4343 | procUnitConfObj.addParameter(name='password', value=password, format='str') |
|
|||
4344 | procUnitConfObj.addParameter(name='localfolder', value=localfolder, format='list') |
|
|||
4345 | procUnitConfObj.addParameter(name='remotefolder', value=remotefolder, format='str') |
|
|||
4346 | procUnitConfObj.addParameter(name='ext', value=ext, format='str') |
|
|||
4347 | procUnitConfObj.addParameter(name='period', value=period, format='int') |
|
|||
4348 |
|
||||
4349 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
|||
4350 |
|
||||
4351 | return procUnitConfObj |
|
|||
4352 |
|
||||
4353 | def addFTPProcUnitView(self): |
|
|||
4354 |
|
4174 | |||
4355 | if not self.temporalFTP.create: |
|
4175 | if not self.temporalFTP.create: | |
4356 | self.temporalFTP.setwithoutconfiguration() |
|
4176 | self.temporalFTP.setwithoutconfiguration() | |
4357 |
|
4177 | |||
4358 | projectObj = self.getSelectedProjectObj() |
|
4178 | projectObj = self.getSelectedProjectObj() | |
4359 |
|
4179 | |||
4360 | self.removeAllFTPProcUnitView(projectObj) |
|
4180 | self.removeAllFTPProcUnitView(projectObj) | |
4361 |
|
4181 | |||
4362 | if not self.__puLocalFolder2FTP: |
|
4182 | if not self.__puLocalFolder2FTP: | |
4363 | return |
|
4183 | return | |
4364 |
|
4184 | |||
4365 | folderList = "" |
|
4185 | folderList = "" | |
4366 |
|
4186 | |||
4367 | for localfolder in self.__puLocalFolder2FTP.values(): |
|
4187 | for localfolder in self.__puLocalFolder2FTP.values(): | |
4368 | folderList += str(localfolder) + "," |
|
4188 | folderList += str(localfolder) + "," | |
4369 |
|
4189 | |||
4370 | procUnitConfObj = projectObj.addProcUnit(name="SendToServer") |
|
4190 | procUnitConfObj = projectObj.addProcUnit(name="SendToServer") | |
4371 |
|
4191 | |||
4372 | procUnitConfObj.addParameter(name='server', value=self.temporalFTP.server, format='str') |
|
4192 | procUnitConfObj.addParameter(name='server', value=self.temporalFTP.server, format='str') | |
4373 | procUnitConfObj.addParameter(name='username', value=self.temporalFTP.username, format='str') |
|
4193 | procUnitConfObj.addParameter(name='username', value=self.temporalFTP.username, format='str') | |
4374 | procUnitConfObj.addParameter(name='password', value=self.temporalFTP.password, format='str') |
|
4194 | procUnitConfObj.addParameter(name='password', value=self.temporalFTP.password, format='str') | |
4375 | procUnitConfObj.addParameter(name='localfolder', value=folderList, format='list') |
|
4195 | procUnitConfObj.addParameter(name='localfolder', value=folderList, format='list') | |
4376 | procUnitConfObj.addParameter(name='remotefolder', value=self.temporalFTP.remotefolder, format='str') |
|
4196 | procUnitConfObj.addParameter(name='remotefolder', value=self.temporalFTP.remotefolder, format='str') | |
4377 | procUnitConfObj.addParameter(name='ext', value=self.temporalFTP.extension, format='str') |
|
4197 | procUnitConfObj.addParameter(name='ext', value=self.temporalFTP.extension, format='str') | |
4378 | procUnitConfObj.addParameter(name='period', value=self.temporalFTP.period, format='int') |
|
4198 | procUnitConfObj.addParameter(name='period', value=self.temporalFTP.period, format='int') | |
4379 | procUnitConfObj.addParameter(name='protocol', value=self.temporalFTP.protocol, format='str') |
|
4199 | procUnitConfObj.addParameter(name='protocol', value=self.temporalFTP.protocol, format='str') | |
4380 |
|
4200 | |||
4381 |
procUnitConfObj.addParameter(name='ftp_wei', value=self.temporalFTP.ftp_wei, format=' |
|
4201 | procUnitConfObj.addParameter(name='ftp_wei', value=self.temporalFTP.ftp_wei, format='int') | |
4382 |
procUnitConfObj.addParameter(name='exp_code', value=self.temporalFTP.exp_code, format=' |
|
4202 | procUnitConfObj.addParameter(name='exp_code', value=self.temporalFTP.exp_code, format='int') | |
4383 |
procUnitConfObj.addParameter(name='sub_exp_code', value=self.temporalFTP.sub_exp_code, format=' |
|
4203 | procUnitConfObj.addParameter(name='sub_exp_code', value=self.temporalFTP.sub_exp_code, format='int') | |
4384 |
procUnitConfObj.addParameter(name='plot_pos', value=self.temporalFTP.plot_pos, format=' |
|
4204 | procUnitConfObj.addParameter(name='plot_pos', value=self.temporalFTP.plot_pos, format='int') | |
4385 |
|
4205 | |||
4386 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
4206 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj | |
4387 |
|
4207 | |||
4388 | def removeAllFTPProcUnitView(self, projectObj): |
|
4208 | def removeAllFTPProcUnitView(self, projectObj): | |
4389 |
|
4209 | |||
4390 | for thisPuId, thisPuObj in projectObj.procUnitItems(): |
|
4210 | for thisPuId, thisPuObj in projectObj.procUnitItems(): | |
4391 |
|
4211 | |||
4392 | if not thisPuObj.name == "SendToServer": |
|
4212 | if not thisPuObj.name == "SendToServer": | |
4393 | continue |
|
4213 | continue | |
4394 |
|
4214 | |||
4395 | projectObj.removeProcUnit(thisPuId) |
|
4215 | projectObj.removeProcUnit(thisPuId) | |
4396 |
|
4216 | |||
4397 | if thisPuId not in self.__puObjDict.keys(): |
|
4217 | if thisPuId not in self.__puObjDict.keys(): | |
4398 | continue |
|
4218 | continue | |
4399 |
|
4219 | |||
4400 | self.__puObjDict.pop(thisPuId) |
|
4220 | self.__puObjDict.pop(thisPuId) | |
4401 |
|
4221 | |||
4402 | def showPUinitView(self): |
|
4222 | def showPUinitView(self): | |
4403 |
|
4223 | |||
4404 | self.propertiesModel = TreeModel() |
|
4224 | self.propertiesModel = TreeModel() | |
4405 | self.propertiesModel.initPUVoltageView() |
|
4225 | self.propertiesModel.initPUVoltageView() | |
4406 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
4226 | self.treeProjectProperties.setModel(self.propertiesModel) | |
4407 | self.treeProjectProperties.expandAll() |
|
4227 | self.treeProjectProperties.expandAll() | |
4408 | self.treeProjectProperties.allColumnsShowFocus() |
|
4228 | self.treeProjectProperties.allColumnsShowFocus() | |
4409 | self.treeProjectProperties.resizeColumnToContents(1) |
|
4229 | self.treeProjectProperties.resizeColumnToContents(1) | |
|
4230 | ||||
|
4231 | def saveFTPFromOpObj(self, operationObj): | |||
|
4232 | ||||
|
4233 | if operationObj.name != "SendByFTP": | |||
|
4234 | return | |||
|
4235 | ||||
|
4236 | server = operationObj.getParameterValue("server") | |||
|
4237 | username = operationObj.getParameterValue("username") | |||
|
4238 | password = operationObj.getParameterValue("password") | |||
|
4239 | localfolder = operationObj.getParameterValue("localfolder") | |||
|
4240 | remotefolder = operationObj.getParameterValue("remotefolder") | |||
|
4241 | ext = operationObj.getParameterValue("ext") | |||
|
4242 | period = operationObj.getParameterValue("period") | |||
4410 |
|
4243 | |||
4411 | def saveFTPvalues(self, puObj): |
|
4244 | self.temporalFTP.save(server=server, | |
|
4245 | remotefolder=remotefolder, | |||
|
4246 | username=username, | |||
|
4247 | password=password, | |||
|
4248 | localfolder=localfolder, | |||
|
4249 | extension=ext) | |||
|
4250 | ||||
|
4251 | return | |||
|
4252 | ||||
|
4253 | def saveFTPFromProcUnitObj(self, puObj): | |||
4412 |
|
4254 | |||
4413 | opObj = puObj.getOperationObj(name="run") |
|
4255 | opObj = puObj.getOperationObj(name="run") | |
4414 |
|
4256 | |||
4415 | parmObj = opObj.getParameterObj(parameterName="server") |
|
4257 | parmObj = opObj.getParameterObj(parameterName="server") | |
4416 | if parmObj == None: |
|
4258 | if parmObj == None: | |
4417 | server = 'jro-app.igp.gob.pe' |
|
4259 | server = 'jro-app.igp.gob.pe' | |
4418 | else: |
|
4260 | else: | |
4419 | server = parmObj.getValue() |
|
4261 | server = parmObj.getValue() | |
4420 |
|
4262 | |||
4421 | parmObj = opObj.getParameterObj(parameterName="remotefolder") |
|
4263 | parmObj = opObj.getParameterObj(parameterName="remotefolder") | |
4422 | if parmObj == None: |
|
4264 | if parmObj == None: | |
4423 | remotefolder = '/home/wmaster/graficos' |
|
4265 | remotefolder = '/home/wmaster/graficos' | |
4424 | else: |
|
4266 | else: | |
4425 | remotefolder = parmObj.getValue() |
|
4267 | remotefolder = parmObj.getValue() | |
4426 |
|
4268 | |||
4427 | parmObj = opObj.getParameterObj(parameterName="username") |
|
4269 | parmObj = opObj.getParameterObj(parameterName="username") | |
4428 | if parmObj == None: |
|
4270 | if parmObj == None: | |
4429 | username = 'wmaster' |
|
4271 | username = 'wmaster' | |
4430 | else: |
|
4272 | else: | |
4431 | username = parmObj.getValue() |
|
4273 | username = parmObj.getValue() | |
4432 |
|
4274 | |||
4433 | parmObj = opObj.getParameterObj(parameterName="password") |
|
4275 | parmObj = opObj.getParameterObj(parameterName="password") | |
4434 | if parmObj == None: |
|
4276 | if parmObj == None: | |
4435 | password = 'mst2010vhf' |
|
4277 | password = 'mst2010vhf' | |
4436 | else: |
|
4278 | else: | |
4437 | password = parmObj.getValue() |
|
4279 | password = parmObj.getValue() | |
4438 |
|
4280 | |||
4439 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") |
|
4281 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") | |
4440 | if parmObj == None: |
|
4282 | if parmObj == None: | |
4441 |
ftp_wei = |
|
4283 | ftp_wei = 0 | |
4442 | else: |
|
4284 | else: | |
4443 | ftp_wei = parmObj.getValue() |
|
4285 | ftp_wei = parmObj.getValue() | |
4444 |
|
4286 | |||
4445 | parmObj = opObj.getParameterObj(parameterName="exp_code") |
|
4287 | parmObj = opObj.getParameterObj(parameterName="exp_code") | |
4446 | if parmObj == None: |
|
4288 | if parmObj == None: | |
4447 |
exp_code = |
|
4289 | exp_code = 0 | |
4448 | else: |
|
4290 | else: | |
4449 | exp_code = parmObj.getValue() |
|
4291 | exp_code = parmObj.getValue() | |
4450 |
|
4292 | |||
4451 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") |
|
4293 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") | |
4452 | if parmObj == None: |
|
4294 | if parmObj == None: | |
4453 |
sub_exp_code = |
|
4295 | sub_exp_code = 0 | |
4454 | else: |
|
4296 | else: | |
4455 | sub_exp_code = parmObj.getValue() |
|
4297 | sub_exp_code = parmObj.getValue() | |
4456 |
|
4298 | |||
4457 | parmObj = opObj.getParameterObj(parameterName="plot_pos") |
|
4299 | parmObj = opObj.getParameterObj(parameterName="plot_pos") | |
4458 | if parmObj == None: |
|
4300 | if parmObj == None: | |
4459 |
plot_pos = |
|
4301 | plot_pos = 0 | |
4460 | else: |
|
4302 | else: | |
4461 | plot_pos = parmObj.getValue() |
|
4303 | plot_pos = parmObj.getValue() | |
4462 |
|
4304 | |||
4463 | parmObj = opObj.getParameterObj(parameterName="localfolder") |
|
4305 | parmObj = opObj.getParameterObj(parameterName="localfolder") | |
4464 | if parmObj == None: |
|
4306 | if parmObj == None: | |
4465 | localfolder = None |
|
4307 | localfolder = None | |
4466 | else: |
|
4308 | else: | |
4467 | localfolder = parmObj.getValue() |
|
4309 | localfolder = parmObj.getValue() | |
4468 |
|
4310 | |||
4469 |
parmObj = opObj.getParameterObj(parameterName="ext |
|
4311 | parmObj = opObj.getParameterObj(parameterName="ext") | |
4470 | if parmObj == None: |
|
4312 | if parmObj == None: | |
4471 | extension = '.png' |
|
4313 | extension = '.png' | |
4472 | else: |
|
4314 | else: | |
4473 | extension = parmObj.getValue() |
|
4315 | extension = parmObj.getValue() | |
4474 |
|
4316 | |||
4475 | self.temporalFTP.save(server=server, |
|
4317 | self.temporalFTP.save(server=server, | |
4476 | remotefolder=remotefolder, |
|
4318 | remotefolder=remotefolder, | |
4477 | username=username, |
|
4319 | username=username, | |
4478 | password=password, |
|
4320 | password=password, | |
4479 | ftp_wei=ftp_wei, |
|
4321 | ftp_wei=ftp_wei, | |
4480 | exp_code=exp_code, |
|
4322 | exp_code=exp_code, | |
4481 | sub_exp_code=sub_exp_code, |
|
4323 | sub_exp_code=sub_exp_code, | |
4482 | plot_pos=plot_pos, |
|
4324 | plot_pos=plot_pos, | |
4483 | localfolder=localfolder, |
|
4325 | localfolder=localfolder, | |
4484 | extension=extension) |
|
4326 | extension=extension) | |
4485 |
|
4327 | |||
4486 | def addProject2ProjectExplorer(self, id, name): |
|
4328 | def addProject2ProjectExplorer(self, id, name): | |
4487 |
|
4329 | |||
4488 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4330 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) | |
4489 |
|
4331 | |||
4490 | parentItem = self.projectExplorerModel.invisibleRootItem() |
|
4332 | parentItem = self.projectExplorerModel.invisibleRootItem() | |
4491 | parentItem.appendRow(itemTree) |
|
4333 | parentItem.appendRow(itemTree) | |
4492 |
|
4334 | |||
4493 | self.projectExplorerTree.setCurrentIndex(itemTree.index()) |
|
4335 | self.projectExplorerTree.setCurrentIndex(itemTree.index()) | |
4494 |
|
4336 | |||
4495 | self.selectedItemTree = itemTree |
|
4337 | self.selectedItemTree = itemTree | |
4496 |
|
4338 | |||
4497 | self.__itemTreeDict[id] = itemTree |
|
4339 | self.__itemTreeDict[id] = itemTree | |
4498 |
|
4340 | |||
4499 | def addPU2ProjectExplorer(self, puObj): |
|
4341 | def addPU2ProjectExplorer(self, puObj): | |
4500 |
|
4342 | |||
4501 | id, name = puObj.id, puObj.datatype |
|
4343 | id, name = puObj.id, puObj.datatype | |
4502 |
|
4344 | |||
4503 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4345 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) | |
4504 |
|
4346 | |||
4505 | parentItem = self.selectedItemTree |
|
4347 | parentItem = self.selectedItemTree | |
4506 | parentItem.appendRow(itemTree) |
|
4348 | parentItem.appendRow(itemTree) | |
4507 | self.projectExplorerTree.expandAll() |
|
4349 | self.projectExplorerTree.expandAll() | |
4508 |
|
4350 | |||
4509 | self.projectExplorerTree.setCurrentIndex(itemTree.index()) |
|
4351 | self.projectExplorerTree.setCurrentIndex(itemTree.index()) | |
4510 |
|
4352 | |||
4511 | self.selectedItemTree = itemTree |
|
4353 | self.selectedItemTree = itemTree | |
4512 |
|
4354 | |||
4513 | self.__itemTreeDict[id] = itemTree |
|
4355 | self.__itemTreeDict[id] = itemTree | |
4514 |
|
4356 | |||
4515 | def addPU2PELoadXML(self, puObj): |
|
4357 | def addPU2PELoadXML(self, puObj): | |
4516 |
|
4358 | |||
4517 | id, name, inputId = puObj.id, puObj.datatype, puObj.inputId |
|
4359 | id, name, inputId = puObj.id, puObj.datatype, puObj.inputId | |
4518 |
|
4360 | |||
4519 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4361 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) | |
4520 |
|
4362 | |||
4521 | if self.__itemTreeDict.has_key(inputId): |
|
4363 | if self.__itemTreeDict.has_key(inputId): | |
4522 | parentItem = self.__itemTreeDict[inputId] |
|
4364 | parentItem = self.__itemTreeDict[inputId] | |
4523 | else: |
|
4365 | else: | |
4524 | #If parent is a Reader object |
|
4366 | #If parent is a Reader object | |
4525 | parentItem = self.__itemTreeDict[id[:-1]] |
|
4367 | parentItem = self.__itemTreeDict[id[:-1]] | |
4526 |
|
4368 | |||
4527 | parentItem.appendRow(itemTree) |
|
4369 | parentItem.appendRow(itemTree) | |
4528 | self.projectExplorerTree.expandAll() |
|
4370 | self.projectExplorerTree.expandAll() | |
4529 | parentItem = itemTree |
|
4371 | parentItem = itemTree | |
4530 | self.projectExplorerTree.setCurrentIndex(parentItem.index()) |
|
4372 | self.projectExplorerTree.setCurrentIndex(parentItem.index()) | |
4531 |
|
4373 | |||
4532 | self.__itemTreeDict[id] = itemTree |
|
4374 | self.__itemTreeDict[id] = itemTree | |
4533 | self.selectedItemTree = itemTree |
|
4375 | self.selectedItemTree = itemTree | |
4534 |
|
4376 | |||
4535 | def getSelectedProjectObj(self): |
|
4377 | def getSelectedProjectObj(self): | |
4536 | """ |
|
4378 | """ | |
4537 | Return the current project object selected. If a processing unit is |
|
4379 | Return the current project object selected. If a processing unit is | |
4538 | actually selected this function returns associated project. |
|
4380 | actually selected this function returns associated project. | |
4539 |
|
4381 | |||
4540 | None if any project or processing unit is selected |
|
4382 | None if any project or processing unit is selected | |
4541 | """ |
|
4383 | """ | |
4542 | for key in self.__itemTreeDict.keys(): |
|
4384 | for key in self.__itemTreeDict.keys(): | |
4543 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
4385 | if self.__itemTreeDict[key] != self.selectedItemTree: | |
4544 | continue |
|
4386 | continue | |
4545 |
|
4387 | |||
4546 | if self.__projectObjDict.has_key(key): |
|
4388 | if self.__projectObjDict.has_key(key): | |
4547 | projectObj = self.__projectObjDict[key] |
|
4389 | projectObj = self.__projectObjDict[key] | |
4548 | return projectObj |
|
4390 | return projectObj | |
4549 |
|
4391 | |||
4550 | puObj = self.__puObjDict[key] |
|
4392 | puObj = self.__puObjDict[key] | |
4551 |
|
4393 | |||
4552 | if puObj.parentId == None: |
|
4394 | if puObj.parentId == None: | |
4553 | projectId = puObj.getId()[0] |
|
4395 | projectId = puObj.getId()[0] | |
4554 | else: |
|
4396 | else: | |
4555 | projectId = puObj.parentId |
|
4397 | projectId = puObj.parentId | |
4556 |
|
4398 | |||
4557 | projectObj = self.__projectObjDict[projectId] |
|
4399 | projectObj = self.__projectObjDict[projectId] | |
4558 | return projectObj |
|
4400 | return projectObj | |
4559 |
|
4401 | |||
4560 | return None |
|
4402 | return None | |
4561 |
|
4403 | |||
4562 | def getSelectedItemObj(self): |
|
4404 | def getSelectedItemObj(self): | |
4563 | """ |
|
4405 | """ | |
4564 | Return the current project or processing unit object selected |
|
4406 | Return the current project or processing unit object selected | |
4565 |
|
4407 | |||
4566 | None if any project or processing unit is selected |
|
4408 | None if any project or processing unit is selected | |
4567 | """ |
|
4409 | """ | |
4568 | for key in self.__itemTreeDict.keys(): |
|
4410 | for key in self.__itemTreeDict.keys(): | |
4569 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
4411 | if self.__itemTreeDict[key] != self.selectedItemTree: | |
4570 | continue |
|
4412 | continue | |
4571 |
|
4413 | |||
4572 | if self.__projectObjDict.has_key(key) == True: |
|
4414 | if self.__projectObjDict.has_key(key) == True: | |
4573 | fatherObj = self.__projectObjDict[key] |
|
4415 | fatherObj = self.__projectObjDict[key] | |
4574 | else: |
|
4416 | else: | |
4575 | fatherObj = self.__puObjDict[key] |
|
4417 | fatherObj = self.__puObjDict[key] | |
4576 |
|
4418 | |||
4577 | return fatherObj |
|
4419 | return fatherObj | |
4578 |
|
4420 | |||
4579 | return None |
|
4421 | return None | |
4580 |
|
4422 | |||
4581 | def _WarningWindow(self, text, information): |
|
4423 | def _WarningWindow(self, text, information): | |
4582 |
|
4424 | |||
4583 | msgBox = QtGui.QMessageBox() |
|
4425 | msgBox = QtGui.QMessageBox() | |
4584 | msgBox.setText(text) |
|
4426 | msgBox.setText(text) | |
4585 | msgBox.setInformativeText(information) |
|
4427 | msgBox.setInformativeText(information) | |
4586 | msgBox.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) |
|
4428 | msgBox.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) | |
4587 | msgBox.setDefaultButton(QtGui.QMessageBox.Ok) |
|
4429 | msgBox.setDefaultButton(QtGui.QMessageBox.Ok) | |
4588 | ret = msgBox.exec_() |
|
4430 | ret = msgBox.exec_() | |
4589 |
|
4431 | |||
4590 | answer = False |
|
4432 | answer = False | |
4591 |
|
4433 | |||
4592 | if ret == QtGui.QMessageBox.Ok: |
|
4434 | if ret == QtGui.QMessageBox.Ok: | |
4593 | answer = True |
|
4435 | answer = True | |
4594 |
|
4436 | |||
4595 | return answer |
|
4437 | return answer | |
4596 |
|
4438 | |||
4597 | def __getNewProjectId(self): |
|
4439 | def __getNewProjectId(self): | |
4598 |
|
4440 | |||
4599 | loadProject = False |
|
4441 | loadProject = False | |
4600 |
|
4442 | |||
4601 | for thisId in range(1,10): |
|
4443 | for thisId in range(1,10): | |
4602 | newId = str(thisId) |
|
4444 | newId = str(thisId) | |
4603 | if newId in self.__projectObjDict.keys(): |
|
4445 | if newId in self.__projectObjDict.keys(): | |
4604 | continue |
|
4446 | continue | |
4605 |
|
4447 | |||
4606 | loadProject = True |
|
4448 | loadProject = True | |
4607 | projectId = newId |
|
4449 | projectId = newId | |
4608 | break |
|
4450 | break | |
4609 |
|
4451 | |||
4610 | if not loadProject: |
|
4452 | if not loadProject: | |
4611 | self.console.clear() |
|
4453 | self.console.clear() | |
4612 | self.console.append("The maximum number of projects has been loaded, a new project can not be loaded") |
|
4454 | self.console.append("The maximum number of projects has been loaded, a new project can not be loaded") | |
4613 | return None |
|
4455 | return None | |
4614 |
|
4456 | |||
4615 | return projectId |
|
4457 | return projectId | |
4616 |
|
4458 | |||
4617 | def openProject(self): |
|
4459 | def openProject(self): | |
4618 |
|
4460 | |||
4619 | self.actionStart.setEnabled(False) |
|
4461 | self.actionStart.setEnabled(False) | |
4620 | self.actionStarToolbar.setEnabled(False) |
|
4462 | self.actionStarToolbar.setEnabled(False) | |
4621 |
|
4463 | |||
4622 | self.create = False |
|
4464 | self.create = False | |
4623 | self.frame_2.setEnabled(True) |
|
4465 | self.frame_2.setEnabled(True) | |
4624 |
|
4466 | |||
4625 | # print self.dir |
|
4467 | # print self.dir | |
4626 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) |
|
4468 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) | |
4627 |
|
4469 | |||
4628 | projectObjLoad = Project() |
|
4470 | projectObjLoad = Project() | |
4629 |
|
4471 | |||
4630 | try: |
|
4472 | try: | |
4631 | projectObjLoad.readXml(filename) |
|
4473 | projectObjLoad.readXml(filename) | |
4632 | except: |
|
4474 | except: | |
4633 | self.console.clear() |
|
4475 | self.console.clear() | |
4634 | self.console.append("The selected xml file could not be loaded ...") |
|
4476 | self.console.append("The selected xml file could not be loaded ...") | |
4635 | return 0 |
|
4477 | return 0 | |
4636 |
|
4478 | |||
4637 | self.refreshProjectWindow2(projectObjLoad) |
|
4479 | self.refreshProjectWindow2(projectObjLoad) | |
4638 | self.refreshProjectProperties(projectObjLoad) |
|
4480 | self.refreshProjectProperties(projectObjLoad) | |
4639 |
|
4481 | |||
4640 | projectId = projectObjLoad.id |
|
4482 | projectId = projectObjLoad.id | |
4641 |
|
4483 | |||
4642 | if projectId in self.__projectObjDict.keys(): |
|
4484 | if projectId in self.__projectObjDict.keys(): | |
4643 |
|
4485 | |||
4644 | # answer = self._WarningWindow("You already have a project loaded with the same Id", |
|
4486 | # answer = self._WarningWindow("You already have a project loaded with the same Id", | |
4645 | # "Do you want to load the file anyway?") |
|
4487 | # "Do you want to load the file anyway?") | |
4646 | # if not answer: |
|
4488 | # if not answer: | |
4647 | # return |
|
4489 | # return | |
4648 |
|
4490 | |||
4649 | projectId = self.__getNewProjectId() |
|
4491 | projectId = self.__getNewProjectId() | |
4650 |
|
4492 | |||
4651 | if not projectId: |
|
4493 | if not projectId: | |
4652 | return |
|
4494 | return | |
4653 |
|
4495 | |||
4654 | projectObjLoad.updateId(projectId) |
|
4496 | projectObjLoad.updateId(projectId) | |
4655 |
|
4497 | |||
4656 | self.__projectObjDict[projectId] = projectObjLoad |
|
4498 | self.__projectObjDict[projectId] = projectObjLoad | |
4657 |
|
4499 | |||
4658 | self.addProject2ProjectExplorer(id=projectId, name=projectObjLoad.name) |
|
4500 | self.addProject2ProjectExplorer(id=projectId, name=projectObjLoad.name) | |
4659 |
|
4501 | |||
4660 | self.tabWidgetProject.setEnabled(True) |
|
4502 | self.tabWidgetProject.setEnabled(True) | |
4661 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
4503 | self.tabWidgetProject.setCurrentWidget(self.tabProject) | |
4662 | # Disable tabProject after finish the creation |
|
4504 | # Disable tabProject after finish the creation | |
4663 | self.tabProject.setEnabled(True) |
|
4505 | self.tabProject.setEnabled(True) | |
4664 | puObjorderList = OrderedDict(sorted(projectObjLoad.procUnitConfObjDict.items(), key=lambda x: x[0])) |
|
4506 | puObjorderList = OrderedDict(sorted(projectObjLoad.procUnitConfObjDict.items(), key=lambda x: x[0])) | |
4665 |
|
4507 | |||
4666 | for puId, puObj in puObjorderList.items(): |
|
4508 | for puId, puObj in puObjorderList.items(): | |
4667 |
|
4509 | |||
4668 | self.__puObjDict[puId] = puObj |
|
4510 | self.__puObjDict[puId] = puObj | |
4669 |
|
4511 | |||
4670 | if puObj.name == "SendToServer": |
|
4512 | if puObj.name == "SendToServer": | |
4671 |
self.saveFTP |
|
4513 | self.saveFTPFromProcUnitObj(puObj) | |
4672 |
|
|
4514 | ||
|
4515 | ############## COMPATIBLE WITH OLD VERSIONS ################ | |||
|
4516 | operationObj = puObj.getOperationObj("SendByFTP") | |||
|
4517 | ||||
|
4518 | if operationObj: | |||
|
4519 | self.saveFTPFromOpObj(operationObj) | |||
|
4520 | ############################################################ | |||
|
4521 | ||||
4673 | if puObj.inputId == '0': |
|
4522 | if puObj.inputId == '0': | |
4674 | continue |
|
4523 | continue | |
4675 |
|
4524 | |||
4676 | self.addPU2PELoadXML(puObj) |
|
4525 | self.addPU2PELoadXML(puObj) | |
4677 |
|
4526 | |||
4678 | self.refreshPUWindow(puObj) |
|
4527 | self.refreshPUWindow(puObj) | |
4679 | self.refreshPUProperties(puObj) |
|
4528 | self.refreshPUProperties(puObj) | |
4680 | self.showtabPUCreated(datatype=puObj.datatype) |
|
4529 | self.showtabPUCreated(datatype=puObj.datatype) | |
4681 |
|
||||
4682 | ############## COMPATIBLE FROM OLD VERSIONS ################ |
|
|||
4683 | operationObj = puObj.getOperationObj("SendByFTP") |
|
|||
4684 |
|
||||
4685 | if operationObj: |
|
|||
4686 | send2ServerObj = self.__addFTPProcUnitFrom(operationObj) |
|
|||
4687 | self.saveFTPvalues(send2ServerObj) |
|
|||
4688 | ############################################################ |
|
|||
4689 |
|
4530 | |||
4690 | self.console.clear() |
|
4531 | self.console.clear() | |
4691 | self.console.append("The selected xml file has been loaded successfully") |
|
4532 | self.console.append("The selected xml file has been loaded successfully") | |
4692 |
|
4533 | |||
4693 | self.actionStart.setEnabled(True) |
|
4534 | self.actionStart.setEnabled(True) | |
4694 | self.actionStarToolbar.setEnabled(True) |
|
4535 | self.actionStarToolbar.setEnabled(True) | |
4695 |
|
4536 | |||
4696 | def on_comm_updating_timer(self): |
|
4537 | def on_comm_updating_timer(self): | |
4697 | # Verifica si algun proceso ha sido inicializado y sigue ejecutandose |
|
4538 | # Verifica si algun proceso ha sido inicializado y sigue ejecutandose | |
4698 |
|
4539 | |||
4699 | if not self.__initialized: |
|
4540 | if not self.__initialized: | |
4700 | return |
|
4541 | return | |
4701 |
|
4542 | |||
4702 | if not self.controllerObj.isAlive(): |
|
4543 | if not self.controllerObj.isAlive(): | |
4703 | self.stopProject() |
|
4544 | self.stopProject() | |
4704 |
|
4545 | |||
4705 | def playProject(self, ext=".xml", save=1): |
|
4546 | def playProject(self, ext=".xml", save=1): | |
4706 |
|
4547 | |||
4707 | # self.console.clear() |
|
4548 | # self.console.clear() | |
4708 | projectObj = self.getSelectedProjectObj() |
|
4549 | projectObj = self.getSelectedProjectObj() | |
4709 |
|
4550 | |||
4710 | if not projectObj: |
|
4551 | if not projectObj: | |
4711 | print "Please select a project before pressing PLAY button" |
|
4552 | print "Please select a project before pressing PLAY button" | |
4712 | return |
|
4553 | return | |
4713 |
|
4554 | |||
4714 | if save: |
|
4555 | if save: | |
4715 | filename = self.saveProject() |
|
4556 | filename = self.saveProject() | |
4716 | if filename == None: |
|
4557 | if filename == None: | |
4717 | self.console.append("Process did not initialize.") |
|
4558 | self.console.append("Process did not initialize.") | |
4718 | return |
|
4559 | return | |
4719 | else: |
|
4560 | else: | |
4720 | filename = TEMPORAL_FILE |
|
4561 | filename = TEMPORAL_FILE | |
4721 | projectObj.writeXml( os.path.join(self.pathWorkSpace,filename) ) |
|
4562 | projectObj.writeXml( os.path.join(self.pathWorkSpace,filename) ) | |
4722 |
|
4563 | |||
4723 | self.actionStart.setEnabled(False) |
|
4564 | self.actionStart.setEnabled(False) | |
4724 | self.actionPause.setEnabled(True) |
|
4565 | self.actionPause.setEnabled(True) | |
4725 | self.actionStop.setEnabled(True) |
|
4566 | self.actionStop.setEnabled(True) | |
4726 |
|
4567 | |||
4727 | self.actionStarToolbar.setEnabled(False) |
|
4568 | self.actionStarToolbar.setEnabled(False) | |
4728 | self.actionPauseToolbar.setEnabled(True) |
|
4569 | self.actionPauseToolbar.setEnabled(True) | |
4729 | self.actionStopToolbar.setEnabled(True) |
|
4570 | self.actionStopToolbar.setEnabled(True) | |
4730 |
|
4571 | |||
4731 | self.console.append("Please Wait...") |
|
4572 | self.console.append("Please Wait...") | |
4732 |
|
4573 | |||
4733 | self.controllerObj = ControllerThread(filename) |
|
4574 | self.controllerObj = ControllerThread(filename) | |
4734 | self.controllerObj.start() |
|
4575 | self.controllerObj.start() | |
4735 | sleep(0.5) |
|
4576 | sleep(0.5) | |
4736 | self.__initialized = True |
|
4577 | self.__initialized = True | |
4737 |
|
4578 | |||
4738 | def stopProject(self): |
|
4579 | def stopProject(self): | |
4739 |
|
4580 | |||
4740 | self.__initialized = False |
|
4581 | self.__initialized = False | |
4741 |
|
4582 | |||
4742 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) |
|
4583 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) | |
4743 | self.controllerObj.stop() |
|
4584 | self.controllerObj.stop() | |
4744 |
|
4585 | |||
4745 | self.actionStart.setEnabled(True) |
|
4586 | self.actionStart.setEnabled(True) | |
4746 | self.actionPause.setEnabled(False) |
|
4587 | self.actionPause.setEnabled(False) | |
4747 | self.actionStop.setEnabled(False) |
|
4588 | self.actionStop.setEnabled(False) | |
4748 |
|
4589 | |||
4749 | self.actionStarToolbar.setEnabled(True) |
|
4590 | self.actionStarToolbar.setEnabled(True) | |
4750 | self.actionPauseToolbar.setEnabled(False) |
|
4591 | self.actionPauseToolbar.setEnabled(False) | |
4751 | self.actionStopToolbar.setEnabled(False) |
|
4592 | self.actionStopToolbar.setEnabled(False) | |
4752 |
|
4593 | |||
4753 | self.restorePauseIcon() |
|
4594 | self.restorePauseIcon() | |
4754 |
|
4595 | |||
4755 | def pauseProject(self): |
|
4596 | def pauseProject(self): | |
4756 |
|
4597 | |||
4757 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PAUSE, data=True)) |
|
4598 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PAUSE, data=True)) | |
4758 | self.controllerObj.pause() |
|
4599 | self.controllerObj.pause() | |
4759 |
|
4600 | |||
4760 | self.actionStart.setEnabled(False) |
|
4601 | self.actionStart.setEnabled(False) | |
4761 | self.actionPause.setEnabled(True) |
|
4602 | self.actionPause.setEnabled(True) | |
4762 | self.actionStop.setEnabled(True) |
|
4603 | self.actionStop.setEnabled(True) | |
4763 |
|
4604 | |||
4764 | self.actionStarToolbar.setEnabled(False) |
|
4605 | self.actionStarToolbar.setEnabled(False) | |
4765 | self.actionPauseToolbar.setEnabled(True) |
|
4606 | self.actionPauseToolbar.setEnabled(True) | |
4766 | self.actionStopToolbar.setEnabled(True) |
|
4607 | self.actionStopToolbar.setEnabled(True) | |
4767 |
|
4608 | |||
4768 | def saveProject(self, filename=None): |
|
4609 | def saveProject(self, filename=None): | |
4769 |
|
4610 | |||
4770 | self.actionStart.setEnabled(False) |
|
4611 | self.actionStart.setEnabled(False) | |
4771 | self.actionStarToolbar.setEnabled(False) |
|
4612 | self.actionStarToolbar.setEnabled(False) | |
4772 |
|
4613 | |||
4773 | projectObj = self.getSelectedProjectObj() |
|
4614 | projectObj = self.getSelectedProjectObj() | |
4774 | self.refreshGraphicsId() |
|
4615 | self.refreshGraphicsId() | |
4775 |
|
4616 | |||
4776 | sts = True |
|
4617 | sts = True | |
4777 | selectedItemObj = self.getSelectedItemObj() |
|
4618 | selectedItemObj = self.getSelectedItemObj() | |
4778 |
|
4619 | |||
4779 | #A Processing Unit has been selected |
|
4620 | #A Processing Unit has been selected | |
4780 | if projectObj == selectedItemObj: |
|
4621 | if projectObj == selectedItemObj: | |
4781 | if not self.on_proOk_clicked(): |
|
4622 | if not self.on_proOk_clicked(): | |
4782 | return None |
|
4623 | return None | |
4783 |
|
4624 | |||
4784 | #A Processing Unit has been selected |
|
4625 | #A Processing Unit has been selected | |
4785 | if projectObj != selectedItemObj: |
|
4626 | if projectObj != selectedItemObj: | |
4786 | puObj = selectedItemObj |
|
4627 | puObj = selectedItemObj | |
4787 |
|
4628 | |||
4788 | if puObj.name == 'VoltageProc': |
|
4629 | if puObj.name == 'VoltageProc': | |
4789 | sts = self.on_volOpOk_clicked() |
|
4630 | sts = self.on_volOpOk_clicked() | |
4790 | if puObj.name == 'SpectraProc': |
|
4631 | if puObj.name == 'SpectraProc': | |
4791 | sts = self.on_specOpOk_clicked() |
|
4632 | sts = self.on_specOpOk_clicked() | |
4792 | if puObj.name == 'SpectraHeisProc': |
|
4633 | if puObj.name == 'SpectraHeisProc': | |
4793 | sts = self.on_specHeisOpOk_clicked() |
|
4634 | sts = self.on_specHeisOpOk_clicked() | |
4794 |
|
4635 | |||
4795 | if not sts: |
|
4636 | if not sts: | |
4796 | return None |
|
4637 | return None | |
4797 |
|
4638 | |||
4798 |
self. |
|
4639 | self.createFTPProcUnitView() | |
4799 |
|
|
4640 | ||
4800 | if not filename: |
|
4641 | if not filename: | |
4801 | filename = os.path.join( str(self.pathWorkSpace), "%s%s" %(str(projectObj.name), '.xml') ) |
|
4642 | filename = os.path.join( str(self.pathWorkSpace), "%s%s" %(str(projectObj.name), '.xml') ) | |
4802 |
|
4643 | |||
4803 | projectObj.writeXml(filename) |
|
4644 | projectObj.writeXml(filename) | |
4804 | self.console.append("Now, you can press Start button") |
|
4645 | self.console.append("Now, you can press Start button") | |
4805 |
|
4646 | |||
4806 | self.actionStart.setEnabled(True) |
|
4647 | self.actionStart.setEnabled(True) | |
4807 | self.actionStarToolbar.setEnabled(True) |
|
4648 | self.actionStarToolbar.setEnabled(True) | |
4808 |
|
4649 | |||
4809 | return filename |
|
4650 | return filename | |
4810 |
|
4651 | |||
4811 | def removeItemTreeFromProject(self): |
|
4652 | def removeItemTreeFromProject(self): | |
4812 | """ |
|
4653 | """ | |
4813 | Metodo para eliminar el proyecto en el dictionario de proyectos y en el dictionario de vista de arbol |
|
4654 | Metodo para eliminar el proyecto en el dictionario de proyectos y en el dictionario de vista de arbol | |
4814 | """ |
|
4655 | """ | |
4815 | for key in self.__itemTreeDict.keys(): |
|
4656 | for key in self.__itemTreeDict.keys(): | |
4816 |
|
4657 | |||
4817 | #Check again because an item can delete multiple items (childs) |
|
4658 | #Check again because an item can delete multiple items (childs) | |
4818 | if key not in self.__itemTreeDict.keys(): |
|
4659 | if key not in self.__itemTreeDict.keys(): | |
4819 | continue |
|
4660 | continue | |
4820 |
|
4661 | |||
4821 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
4662 | if self.__itemTreeDict[key] != self.selectedItemTree: | |
4822 | continue |
|
4663 | continue | |
4823 |
|
4664 | |||
4824 | if self.__projectObjDict.has_key(key) == True: |
|
4665 | if self.__projectObjDict.has_key(key) == True: | |
4825 |
|
4666 | |||
4826 | del self.__projectObjDict[key] |
|
4667 | del self.__projectObjDict[key] | |
4827 | del self.__itemTreeDict[key] |
|
4668 | del self.__itemTreeDict[key] | |
4828 |
|
4669 | |||
4829 | else: |
|
4670 | else: | |
4830 | puObj = self.__puObjDict[key] |
|
4671 | puObj = self.__puObjDict[key] | |
4831 | idProjectParent = puObj.parentId |
|
4672 | idProjectParent = puObj.parentId | |
4832 | projectObj = self.__projectObjDict[idProjectParent] |
|
4673 | projectObj = self.__projectObjDict[idProjectParent] | |
4833 |
|
4674 | |||
4834 | del self.__puObjDict[key] |
|
4675 | del self.__puObjDict[key] | |
4835 | del self.__itemTreeDict[key] |
|
4676 | del self.__itemTreeDict[key] | |
4836 | del projectObj.procUnitConfObjDict[key] |
|
4677 | del projectObj.procUnitConfObjDict[key] | |
4837 |
|
4678 | |||
4838 | for key in projectObj.procUnitConfObjDict.keys(): |
|
4679 | for key in projectObj.procUnitConfObjDict.keys(): | |
4839 | if projectObj.procUnitConfObjDict[key].inputId != puObj.getId(): |
|
4680 | if projectObj.procUnitConfObjDict[key].inputId != puObj.getId(): | |
4840 | continue |
|
4681 | continue | |
4841 | del self.__puObjDict[projectObj.procUnitConfObjDict[key].getId()] |
|
4682 | del self.__puObjDict[projectObj.procUnitConfObjDict[key].getId()] | |
4842 | del self.__itemTreeDict[projectObj.procUnitConfObjDict[key].getId()] |
|
4683 | del self.__itemTreeDict[projectObj.procUnitConfObjDict[key].getId()] | |
4843 | del projectObj.procUnitConfObjDict[key] |
|
4684 | del projectObj.procUnitConfObjDict[key] | |
4844 | # print projectObj.procUnitConfObjDict |
|
4685 | # print projectObj.procUnitConfObjDict | |
4845 | # print self.__itemTreeDict,self.__projectObjDict,self.__puObjDict |
|
4686 | # print self.__itemTreeDict,self.__projectObjDict,self.__puObjDict | |
4846 |
|
4687 | |||
4847 | def setInputsProject_View(self): |
|
4688 | def setInputsProject_View(self): | |
4848 |
|
4689 | |||
4849 | self.tabWidgetProject.setEnabled(True) |
|
4690 | self.tabWidgetProject.setEnabled(True) | |
4850 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
4691 | self.tabWidgetProject.setCurrentWidget(self.tabProject) | |
4851 | self.tabProject.setEnabled(True) |
|
4692 | self.tabProject.setEnabled(True) | |
4852 | self.frame_2.setEnabled(False) |
|
4693 | self.frame_2.setEnabled(False) | |
4853 | self.proName.clear() |
|
4694 | self.proName.clear() | |
4854 | self.proName.setFocus() |
|
4695 | self.proName.setFocus() | |
4855 | self.proName.setSelection(0, 0) |
|
4696 | self.proName.setSelection(0, 0) | |
4856 | self.proName.setCursorPosition(0) |
|
4697 | self.proName.setCursorPosition(0) | |
4857 | self.proDataType.setText('.r') |
|
4698 | self.proDataType.setText('.r') | |
4858 | self.proDataPath.clear() |
|
4699 | self.proDataPath.clear() | |
4859 | self.proComDataType.clear() |
|
4700 | self.proComDataType.clear() | |
4860 | self.proComDataType.addItem("Voltage") |
|
4701 | self.proComDataType.addItem("Voltage") | |
4861 | self.proComDataType.addItem("Spectra") |
|
4702 | self.proComDataType.addItem("Spectra") | |
4862 | self.proComDataType.addItem("Fits") |
|
4703 | self.proComDataType.addItem("Fits") | |
4863 | self.proComDataType.addItem("USRP") |
|
4704 | self.proComDataType.addItem("USRP") | |
4864 |
|
4705 | |||
4865 | self.proComStartDate.clear() |
|
4706 | self.proComStartDate.clear() | |
4866 | self.proComEndDate.clear() |
|
4707 | self.proComEndDate.clear() | |
4867 |
|
4708 | |||
4868 | startTime = "00:00:00" |
|
4709 | startTime = "00:00:00" | |
4869 | endTime = "23:59:59" |
|
4710 | endTime = "23:59:59" | |
4870 | starlist = startTime.split(":") |
|
4711 | starlist = startTime.split(":") | |
4871 | endlist = endTime.split(":") |
|
4712 | endlist = endTime.split(":") | |
4872 | self.proDelay.setText("60") |
|
4713 | self.proDelay.setText("60") | |
4873 | self.proSet.setText("") |
|
4714 | self.proSet.setText("") | |
4874 |
|
4715 | |||
4875 | self.labelSet.show() |
|
4716 | self.labelSet.show() | |
4876 | self.proSet.show() |
|
4717 | self.proSet.show() | |
4877 |
|
4718 | |||
4878 | self.labelIPPKm.hide() |
|
4719 | self.labelIPPKm.hide() | |
4879 | self.proIPPKm.hide() |
|
4720 | self.proIPPKm.hide() | |
4880 |
|
4721 | |||
4881 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) |
|
4722 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) | |
4882 | self.proStartTime.setTime(self.time) |
|
4723 | self.proStartTime.setTime(self.time) | |
4883 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
4724 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) | |
4884 | self.proEndTime.setTime(self.time) |
|
4725 | self.proEndTime.setTime(self.time) | |
4885 | self.proDescription.clear() |
|
4726 | self.proDescription.clear() | |
4886 | self.proOk.setEnabled(False) |
|
4727 | self.proOk.setEnabled(False) | |
4887 | # self.console.append("Please, Write a name Project") |
|
4728 | # self.console.append("Please, Write a name Project") | |
4888 | # self.console.append("Introduce Project Parameters")DC |
|
4729 | # self.console.append("Introduce Project Parameters")DC | |
4889 | # self.console.append("Select data type Voltage( .rawdata) or Spectra(.pdata)") |
|
4730 | # self.console.append("Select data type Voltage( .rawdata) or Spectra(.pdata)") | |
4890 |
|
4731 | |||
4891 | def clearPUWindow(self, datatype): |
|
4732 | def clearPUWindow(self, datatype): | |
4892 |
|
4733 | |||
4893 | projectObjView = self.getSelectedProjectObj() |
|
4734 | projectObjView = self.getSelectedProjectObj() | |
4894 |
|
4735 | |||
4895 | if not projectObjView: |
|
4736 | if not projectObjView: | |
4896 | return |
|
4737 | return | |
4897 |
|
4738 | |||
4898 | puObj = self.getSelectedItemObj() |
|
4739 | puObj = self.getSelectedItemObj() | |
4899 | inputId = puObj.getInputId() |
|
4740 | inputId = puObj.getInputId() | |
4900 | inputPUObj = projectObjView.getProcUnitObj(inputId) |
|
4741 | inputPUObj = projectObjView.getProcUnitObj(inputId) | |
4901 |
|
4742 | |||
4902 | if datatype == 'Voltage': |
|
4743 | if datatype == 'Voltage': | |
4903 | self.volOpComChannels.setEnabled(False) |
|
4744 | self.volOpComChannels.setEnabled(False) | |
4904 | self.volOpComHeights.setEnabled(False) |
|
4745 | self.volOpComHeights.setEnabled(False) | |
4905 | self.volOpFilter.setEnabled(False) |
|
4746 | self.volOpFilter.setEnabled(False) | |
4906 | self.volOpComProfile.setEnabled(False) |
|
4747 | self.volOpComProfile.setEnabled(False) | |
4907 | self.volOpComCode.setEnabled(False) |
|
4748 | self.volOpComCode.setEnabled(False) | |
4908 | self.volOpCohInt.setEnabled(False) |
|
4749 | self.volOpCohInt.setEnabled(False) | |
4909 | self.volOpChannel.setEnabled(False) |
|
4750 | self.volOpChannel.setEnabled(False) | |
4910 | self.volOpHeights.setEnabled(False) |
|
4751 | self.volOpHeights.setEnabled(False) | |
4911 | self.volOpProfile.setEnabled(False) |
|
4752 | self.volOpProfile.setEnabled(False) | |
4912 | self.volOpRadarfrequency.setEnabled(False) |
|
4753 | self.volOpRadarfrequency.setEnabled(False) | |
4913 | self.volOpCebChannels.setCheckState(0) |
|
4754 | self.volOpCebChannels.setCheckState(0) | |
4914 | self.volOpCebRadarfrequency.setCheckState(0) |
|
4755 | self.volOpCebRadarfrequency.setCheckState(0) | |
4915 | self.volOpCebHeights.setCheckState(0) |
|
4756 | self.volOpCebHeights.setCheckState(0) | |
4916 | self.volOpCebFilter.setCheckState(0) |
|
4757 | self.volOpCebFilter.setCheckState(0) | |
4917 | self.volOpCebProfile.setCheckState(0) |
|
4758 | self.volOpCebProfile.setCheckState(0) | |
4918 | self.volOpCebDecodification.setCheckState(0) |
|
4759 | self.volOpCebDecodification.setCheckState(0) | |
4919 | self.volOpCebCohInt.setCheckState(0) |
|
4760 | self.volOpCebCohInt.setCheckState(0) | |
4920 |
|
4761 | |||
4921 | self.volOpChannel.clear() |
|
4762 | self.volOpChannel.clear() | |
4922 | self.volOpHeights.clear() |
|
4763 | self.volOpHeights.clear() | |
4923 | self.volOpProfile.clear() |
|
4764 | self.volOpProfile.clear() | |
4924 | self.volOpFilter.clear() |
|
4765 | self.volOpFilter.clear() | |
4925 | self.volOpCohInt.clear() |
|
4766 | self.volOpCohInt.clear() | |
4926 | self.volOpRadarfrequency.clear() |
|
4767 | self.volOpRadarfrequency.clear() | |
4927 |
|
4768 | |||
4928 | if datatype == 'Spectra': |
|
4769 | if datatype == 'Spectra': | |
4929 |
|
4770 | |||
4930 | if inputPUObj.datatype == 'Spectra': |
|
4771 | if inputPUObj.datatype == 'Spectra': | |
4931 | self.specOpnFFTpoints.setEnabled(False) |
|
4772 | self.specOpnFFTpoints.setEnabled(False) | |
4932 | self.specOpProfiles.setEnabled(False) |
|
4773 | self.specOpProfiles.setEnabled(False) | |
4933 | self.specOpippFactor.setEnabled(False) |
|
4774 | self.specOpippFactor.setEnabled(False) | |
4934 | else: |
|
4775 | else: | |
4935 | self.specOpnFFTpoints.setEnabled(True) |
|
4776 | self.specOpnFFTpoints.setEnabled(True) | |
4936 | self.specOpProfiles.setEnabled(True) |
|
4777 | self.specOpProfiles.setEnabled(True) | |
4937 | self.specOpippFactor.setEnabled(True) |
|
4778 | self.specOpippFactor.setEnabled(True) | |
4938 |
|
4779 | |||
4939 | self.specOpCebCrossSpectra.setCheckState(0) |
|
4780 | self.specOpCebCrossSpectra.setCheckState(0) | |
4940 | self.specOpCebChannel.setCheckState(0) |
|
4781 | self.specOpCebChannel.setCheckState(0) | |
4941 | self.specOpCebHeights.setCheckState(0) |
|
4782 | self.specOpCebHeights.setCheckState(0) | |
4942 | self.specOpCebIncoherent.setCheckState(0) |
|
4783 | self.specOpCebIncoherent.setCheckState(0) | |
4943 | self.specOpCebRemoveDC.setCheckState(0) |
|
4784 | self.specOpCebRemoveDC.setCheckState(0) | |
4944 | self.specOpCebRemoveInt.setCheckState(0) |
|
4785 | self.specOpCebRemoveInt.setCheckState(0) | |
4945 | self.specOpCebgetNoise.setCheckState(0) |
|
4786 | self.specOpCebgetNoise.setCheckState(0) | |
4946 | self.specOpCebRadarfrequency.setCheckState(0) |
|
4787 | self.specOpCebRadarfrequency.setCheckState(0) | |
4947 |
|
4788 | |||
4948 | self.specOpRadarfrequency.setEnabled(False) |
|
4789 | self.specOpRadarfrequency.setEnabled(False) | |
4949 | self.specOppairsList.setEnabled(False) |
|
4790 | self.specOppairsList.setEnabled(False) | |
4950 | self.specOpChannel.setEnabled(False) |
|
4791 | self.specOpChannel.setEnabled(False) | |
4951 | self.specOpHeights.setEnabled(False) |
|
4792 | self.specOpHeights.setEnabled(False) | |
4952 | self.specOpIncoherent.setEnabled(False) |
|
4793 | self.specOpIncoherent.setEnabled(False) | |
4953 | self.specOpgetNoise.setEnabled(False) |
|
4794 | self.specOpgetNoise.setEnabled(False) | |
4954 |
|
4795 | |||
4955 | self.specOpRadarfrequency.clear() |
|
4796 | self.specOpRadarfrequency.clear() | |
4956 | self.specOpnFFTpoints.clear() |
|
4797 | self.specOpnFFTpoints.clear() | |
4957 | self.specOpProfiles.clear() |
|
4798 | self.specOpProfiles.clear() | |
4958 | self.specOpippFactor.clear |
|
4799 | self.specOpippFactor.clear | |
4959 | self.specOppairsList.clear() |
|
4800 | self.specOppairsList.clear() | |
4960 | self.specOpChannel.clear() |
|
4801 | self.specOpChannel.clear() | |
4961 | self.specOpHeights.clear() |
|
4802 | self.specOpHeights.clear() | |
4962 | self.specOpIncoherent.clear() |
|
4803 | self.specOpIncoherent.clear() | |
4963 | self.specOpgetNoise.clear() |
|
4804 | self.specOpgetNoise.clear() | |
4964 |
|
4805 | |||
4965 | self.specGraphCebSpectraplot.setCheckState(0) |
|
4806 | self.specGraphCebSpectraplot.setCheckState(0) | |
4966 | self.specGraphCebCrossSpectraplot.setCheckState(0) |
|
4807 | self.specGraphCebCrossSpectraplot.setCheckState(0) | |
4967 | self.specGraphCebRTIplot.setCheckState(0) |
|
4808 | self.specGraphCebRTIplot.setCheckState(0) | |
4968 | self.specGraphCebRTInoise.setCheckState(0) |
|
4809 | self.specGraphCebRTInoise.setCheckState(0) | |
4969 | self.specGraphCebCoherencmap.setCheckState(0) |
|
4810 | self.specGraphCebCoherencmap.setCheckState(0) | |
4970 | self.specGraphPowerprofile.setCheckState(0) |
|
4811 | self.specGraphPowerprofile.setCheckState(0) | |
4971 |
|
4812 | |||
4972 | self.specGraphSaveSpectra.setCheckState(0) |
|
4813 | self.specGraphSaveSpectra.setCheckState(0) | |
4973 | self.specGraphSaveCross.setCheckState(0) |
|
4814 | self.specGraphSaveCross.setCheckState(0) | |
4974 | self.specGraphSaveRTIplot.setCheckState(0) |
|
4815 | self.specGraphSaveRTIplot.setCheckState(0) | |
4975 | self.specGraphSaveRTInoise.setCheckState(0) |
|
4816 | self.specGraphSaveRTInoise.setCheckState(0) | |
4976 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
4817 | self.specGraphSaveCoherencemap.setCheckState(0) | |
4977 | self.specGraphSavePowerprofile.setCheckState(0) |
|
4818 | self.specGraphSavePowerprofile.setCheckState(0) | |
4978 |
|
4819 | |||
4979 | self.specGraphftpRTIplot.setCheckState(0) |
|
4820 | self.specGraphftpRTIplot.setCheckState(0) | |
4980 | self.specGraphftpRTInoise.setCheckState(0) |
|
4821 | self.specGraphftpRTInoise.setCheckState(0) | |
4981 | self.specGraphftpCoherencemap.setCheckState(0) |
|
4822 | self.specGraphftpCoherencemap.setCheckState(0) | |
4982 |
|
4823 | |||
4983 | self.specGraphPath.clear() |
|
4824 | self.specGraphPath.clear() | |
4984 | self.specGraphPrefix.clear() |
|
4825 | self.specGraphPrefix.clear() | |
4985 |
|
4826 | |||
4986 | self.specGgraphftpratio.clear() |
|
4827 | self.specGgraphftpratio.clear() | |
4987 |
|
4828 | |||
4988 | self.specGgraphChannelList.clear() |
|
4829 | self.specGgraphChannelList.clear() | |
4989 | self.specGgraphFreq.clear() |
|
4830 | self.specGgraphFreq.clear() | |
4990 | self.specGgraphHeight.clear() |
|
4831 | self.specGgraphHeight.clear() | |
4991 | self.specGgraphDbsrange.clear() |
|
4832 | self.specGgraphDbsrange.clear() | |
4992 | self.specGgraphmagnitud.clear() |
|
4833 | self.specGgraphmagnitud.clear() | |
4993 | self.specGgraphTminTmax.clear() |
|
4834 | self.specGgraphTminTmax.clear() | |
4994 | self.specGgraphTimeRange.clear() |
|
4835 | self.specGgraphTimeRange.clear() | |
4995 |
|
4836 | |||
4996 | if datatype == 'SpectraHeis': |
|
4837 | if datatype == 'SpectraHeis': | |
4997 | self.specHeisOpCebIncoherent.setCheckState(0) |
|
4838 | self.specHeisOpCebIncoherent.setCheckState(0) | |
4998 | self.specHeisOpIncoherent.setEnabled(False) |
|
4839 | self.specHeisOpIncoherent.setEnabled(False) | |
4999 | self.specHeisOpIncoherent.clear() |
|
4840 | self.specHeisOpIncoherent.clear() | |
5000 |
|
4841 | |||
5001 | self.specHeisGraphCebSpectraplot.setCheckState(0) |
|
4842 | self.specHeisGraphCebSpectraplot.setCheckState(0) | |
5002 | self.specHeisGraphCebRTIplot.setCheckState(0) |
|
4843 | self.specHeisGraphCebRTIplot.setCheckState(0) | |
5003 |
|
4844 | |||
5004 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
4845 | self.specHeisGraphSaveSpectra.setCheckState(0) | |
5005 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
4846 | self.specHeisGraphSaveRTIplot.setCheckState(0) | |
5006 |
|
4847 | |||
5007 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
4848 | self.specHeisGraphftpSpectra.setCheckState(0) | |
5008 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
4849 | self.specHeisGraphftpRTIplot.setCheckState(0) | |
5009 |
|
4850 | |||
5010 | self.specHeisGraphPath.clear() |
|
4851 | self.specHeisGraphPath.clear() | |
5011 | self.specHeisGraphPrefix.clear() |
|
4852 | self.specHeisGraphPrefix.clear() | |
5012 | self.specHeisGgraphChannelList.clear() |
|
4853 | self.specHeisGgraphChannelList.clear() | |
5013 | self.specHeisGgraphXminXmax.clear() |
|
4854 | self.specHeisGgraphXminXmax.clear() | |
5014 | self.specHeisGgraphYminYmax.clear() |
|
4855 | self.specHeisGgraphYminYmax.clear() | |
5015 | self.specHeisGgraphTminTmax.clear() |
|
4856 | self.specHeisGgraphTminTmax.clear() | |
5016 | self.specHeisGgraphTimeRange.clear() |
|
4857 | self.specHeisGgraphTimeRange.clear() | |
5017 | self.specHeisGgraphftpratio.clear() |
|
4858 | self.specHeisGgraphftpratio.clear() | |
5018 |
|
4859 | |||
5019 | def showtabPUCreated(self, datatype): |
|
4860 | def showtabPUCreated(self, datatype): | |
5020 |
|
4861 | |||
5021 | if datatype == "Voltage": |
|
4862 | if datatype == "Voltage": | |
5022 | self.tabVoltage.setEnabled(True) |
|
4863 | self.tabVoltage.setEnabled(True) | |
5023 | self.tabProject.setEnabled(False) |
|
4864 | self.tabProject.setEnabled(False) | |
5024 | self.tabSpectra.setEnabled(False) |
|
4865 | self.tabSpectra.setEnabled(False) | |
5025 | self.tabCorrelation.setEnabled(False) |
|
4866 | self.tabCorrelation.setEnabled(False) | |
5026 | self.tabSpectraHeis.setEnabled(False) |
|
4867 | self.tabSpectraHeis.setEnabled(False) | |
5027 | self.tabWidgetProject.setCurrentWidget(self.tabVoltage) |
|
4868 | self.tabWidgetProject.setCurrentWidget(self.tabVoltage) | |
5028 |
|
4869 | |||
5029 | if datatype == "Spectra": |
|
4870 | if datatype == "Spectra": | |
5030 | self.tabVoltage.setEnabled(False) |
|
4871 | self.tabVoltage.setEnabled(False) | |
5031 | self.tabProject.setEnabled(False) |
|
4872 | self.tabProject.setEnabled(False) | |
5032 | self.tabSpectra.setEnabled(True) |
|
4873 | self.tabSpectra.setEnabled(True) | |
5033 | self.tabCorrelation.setEnabled(False) |
|
4874 | self.tabCorrelation.setEnabled(False) | |
5034 | self.tabSpectraHeis.setEnabled(False) |
|
4875 | self.tabSpectraHeis.setEnabled(False) | |
5035 | self.tabWidgetProject.setCurrentWidget(self.tabSpectra) |
|
4876 | self.tabWidgetProject.setCurrentWidget(self.tabSpectra) | |
5036 |
|
4877 | |||
5037 | if datatype == "SpectraHeis": |
|
4878 | if datatype == "SpectraHeis": | |
5038 | self.tabVoltage.setEnabled(False) |
|
4879 | self.tabVoltage.setEnabled(False) | |
5039 | self.tabProject.setEnabled(False) |
|
4880 | self.tabProject.setEnabled(False) | |
5040 | self.tabSpectra.setEnabled(False) |
|
4881 | self.tabSpectra.setEnabled(False) | |
5041 | self.tabCorrelation.setEnabled(False) |
|
4882 | self.tabCorrelation.setEnabled(False) | |
5042 | self.tabSpectraHeis.setEnabled(True) |
|
4883 | self.tabSpectraHeis.setEnabled(True) | |
5043 | self.tabWidgetProject.setCurrentWidget(self.tabSpectraHeis) |
|
4884 | self.tabWidgetProject.setCurrentWidget(self.tabSpectraHeis) | |
5044 |
|
4885 | |||
5045 | def checkInputsProject(self): |
|
4886 | def checkInputsProject(self): | |
5046 | """ |
|
4887 | """ | |
5047 | Check Inputs Project: |
|
4888 | Check Inputs Project: | |
5048 | - project_name |
|
4889 | - project_name | |
5049 | - datatype |
|
4890 | - datatype | |
5050 | - ext |
|
4891 | - ext | |
5051 | - data_path |
|
4892 | - data_path | |
5052 | - readmode |
|
4893 | - readmode | |
5053 | - delay |
|
4894 | - delay | |
5054 | - set |
|
4895 | - set | |
5055 | - walk |
|
4896 | - walk | |
5056 | """ |
|
4897 | """ | |
5057 | parms_ok = True |
|
4898 | parms_ok = True | |
5058 | project_name = str(self.proName.text()) |
|
4899 | project_name = str(self.proName.text()) | |
5059 | if project_name == '' or project_name == None: |
|
4900 | if project_name == '' or project_name == None: | |
5060 | outputstr = "Enter the Project Name" |
|
4901 | outputstr = "Enter the Project Name" | |
5061 | self.console.append(outputstr) |
|
4902 | self.console.append(outputstr) | |
5062 | parms_ok = False |
|
4903 | parms_ok = False | |
5063 | project_name = None |
|
4904 | project_name = None | |
5064 |
|
4905 | |||
5065 | datatype = str(self.proComDataType.currentText()) |
|
4906 | datatype = str(self.proComDataType.currentText()) | |
5066 | if not(datatype in ['Voltage', 'Spectra', 'Fits', 'USRP']): |
|
4907 | if not(datatype in ['Voltage', 'Spectra', 'Fits', 'USRP']): | |
5067 | outputstr = 'datatype = %s, this must be either Voltage, Spectra, SpectraHeis or USRP' % datatype |
|
4908 | outputstr = 'datatype = %s, this must be either Voltage, Spectra, SpectraHeis or USRP' % datatype | |
5068 | self.console.append(outputstr) |
|
4909 | self.console.append(outputstr) | |
5069 | parms_ok = False |
|
4910 | parms_ok = False | |
5070 | datatype = None |
|
4911 | datatype = None | |
5071 |
|
4912 | |||
5072 | ext = str(self.proDataType.text()) |
|
4913 | ext = str(self.proDataType.text()) | |
5073 | if not(ext in ['.r', '.pdata', '.fits', '.hdf5']): |
|
4914 | if not(ext in ['.r', '.pdata', '.fits', '.hdf5']): | |
5074 | outputstr = "extension files must be .r , .pdata, .fits or .hdf5" |
|
4915 | outputstr = "extension files must be .r , .pdata, .fits or .hdf5" | |
5075 | self.console.append(outputstr) |
|
4916 | self.console.append(outputstr) | |
5076 | parms_ok = False |
|
4917 | parms_ok = False | |
5077 | ext = None |
|
4918 | ext = None | |
5078 |
|
4919 | |||
5079 | data_path = str(self.proDataPath.text()) |
|
4920 | data_path = str(self.proDataPath.text()) | |
5080 |
|
4921 | |||
5081 | if data_path == '': |
|
4922 | if data_path == '': | |
5082 | outputstr = 'Datapath is empty' |
|
4923 | outputstr = 'Datapath is empty' | |
5083 | self.console.append(outputstr) |
|
4924 | self.console.append(outputstr) | |
5084 | parms_ok = False |
|
4925 | parms_ok = False | |
5085 | data_path = None |
|
4926 | data_path = None | |
5086 |
|
4927 | |||
5087 | if data_path != None: |
|
4928 | if data_path != None: | |
5088 | if not os.path.isdir(data_path): |
|
4929 | if not os.path.isdir(data_path): | |
5089 | outputstr = 'Datapath:%s does not exists' % data_path |
|
4930 | outputstr = 'Datapath:%s does not exists' % data_path | |
5090 | self.console.append(outputstr) |
|
4931 | self.console.append(outputstr) | |
5091 | parms_ok = False |
|
4932 | parms_ok = False | |
5092 | data_path = None |
|
4933 | data_path = None | |
5093 |
|
4934 | |||
5094 | read_mode = str(self.proComReadMode.currentText()) |
|
4935 | read_mode = str(self.proComReadMode.currentText()) | |
5095 | if not(read_mode in ['Online', 'Offline']): |
|
4936 | if not(read_mode in ['Online', 'Offline']): | |
5096 | outputstr = 'Read Mode: %s, this must be either Online or Offline' % read_mode |
|
4937 | outputstr = 'Read Mode: %s, this must be either Online or Offline' % read_mode | |
5097 | self.console.append(outputstr) |
|
4938 | self.console.append(outputstr) | |
5098 | parms_ok = False |
|
4939 | parms_ok = False | |
5099 | read_mode = None |
|
4940 | read_mode = None | |
5100 |
|
4941 | |||
5101 | try: |
|
4942 | try: | |
5102 | delay = int(str(self.proDelay.text())) |
|
4943 | delay = int(str(self.proDelay.text())) | |
5103 | except: |
|
4944 | except: | |
5104 | outputstr = 'Delay: %s, this must be a integer number' % str(self.proDelay.text()) |
|
4945 | outputstr = 'Delay: %s, this must be a integer number' % str(self.proDelay.text()) | |
5105 | self.console.append(outputstr) |
|
4946 | self.console.append(outputstr) | |
5106 | # parms_ok = False |
|
4947 | # parms_ok = False | |
5107 | delay = None |
|
4948 | delay = None | |
5108 |
|
4949 | |||
5109 | try: |
|
4950 | try: | |
5110 | set = int(str(self.proSet.text())) |
|
4951 | set = int(str(self.proSet.text())) | |
5111 | except: |
|
4952 | except: | |
5112 | # outputstr = 'Set: %s, this must be a integer number' % str(self.proName.text()) |
|
4953 | # outputstr = 'Set: %s, this must be a integer number' % str(self.proName.text()) | |
5113 | # self.console.append(outputstr) |
|
4954 | # self.console.append(outputstr) | |
5114 | # parms_ok = False |
|
4955 | # parms_ok = False | |
5115 | set = None |
|
4956 | set = None | |
5116 |
|
4957 | |||
5117 | walk_str = str(self.proComWalk.currentText()) |
|
4958 | walk_str = str(self.proComWalk.currentText()) | |
5118 | if walk_str == 'On Files': |
|
4959 | if walk_str == 'On Files': | |
5119 | walk = 0 |
|
4960 | walk = 0 | |
5120 | elif walk_str == 'On Folder': |
|
4961 | elif walk_str == 'On Folder': | |
5121 | walk = 1 |
|
4962 | walk = 1 | |
5122 | else: |
|
4963 | else: | |
5123 | outputstr = 'Walk: %s, this must be either On Files or On Folders' % walk_str |
|
4964 | outputstr = 'Walk: %s, this must be either On Files or On Folders' % walk_str | |
5124 | self.console.append(outputstr) |
|
4965 | self.console.append(outputstr) | |
5125 | parms_ok = False |
|
4966 | parms_ok = False | |
5126 | walk = None |
|
4967 | walk = None | |
5127 |
|
4968 | |||
5128 | return parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set |
|
4969 | return parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set | |
5129 |
|
4970 | |||
5130 | def checkInputsPUSave(self, datatype): |
|
4971 | def checkInputsPUSave(self, datatype): | |
5131 | """ |
|
4972 | """ | |
5132 | Check Inputs Spectra Save: |
|
4973 | Check Inputs Spectra Save: | |
5133 | - path |
|
4974 | - path | |
5134 | - blocks Per File |
|
4975 | - blocks Per File | |
5135 | - sufix |
|
4976 | - sufix | |
5136 | - dataformat |
|
4977 | - dataformat | |
5137 | """ |
|
4978 | """ | |
5138 | parms_ok = True |
|
4979 | parms_ok = True | |
5139 |
|
4980 | |||
5140 | if datatype == "Voltage": |
|
4981 | if datatype == "Voltage": | |
5141 | output_path = str(self.volOutputPath.text()) |
|
4982 | output_path = str(self.volOutputPath.text()) | |
5142 | blocksperfile = str(self.volOutputblocksperfile.text()) |
|
4983 | blocksperfile = str(self.volOutputblocksperfile.text()) | |
5143 | profilesperblock = str(self.volOutputprofilesperblock.text()) |
|
4984 | profilesperblock = str(self.volOutputprofilesperblock.text()) | |
5144 |
|
4985 | |||
5145 | if datatype == "Spectra": |
|
4986 | if datatype == "Spectra": | |
5146 | output_path = str(self.specOutputPath.text()) |
|
4987 | output_path = str(self.specOutputPath.text()) | |
5147 | blocksperfile = str(self.specOutputblocksperfile.text()) |
|
4988 | blocksperfile = str(self.specOutputblocksperfile.text()) | |
5148 | profilesperblock = str(self.specOutputprofileperblock.text()) |
|
4989 | profilesperblock = str(self.specOutputprofileperblock.text()) | |
5149 |
|
4990 | |||
5150 | if datatype == "SpectraHeis": |
|
4991 | if datatype == "SpectraHeis": | |
5151 | output_path = str(self.specHeisOutputPath.text()) |
|
4992 | output_path = str(self.specHeisOutputPath.text()) | |
5152 | blocksperfile = str(self.specHeisOutputblocksperfile.text()) |
|
4993 | blocksperfile = str(self.specHeisOutputblocksperfile.text()) | |
5153 | metada = str(self.specHeisOutputMetada.text()) |
|
4994 | metada = str(self.specHeisOutputMetada.text()) | |
5154 |
|
4995 | |||
5155 | if output_path == '': |
|
4996 | if output_path == '': | |
5156 | outputstr = 'Outputpath is empty' |
|
4997 | outputstr = 'Outputpath is empty' | |
5157 | self.console.append(outputstr) |
|
4998 | self.console.append(outputstr) | |
5158 | parms_ok = False |
|
4999 | parms_ok = False | |
5159 | data_path = None |
|
5000 | data_path = None | |
5160 |
|
5001 | |||
5161 | if output_path != None: |
|
5002 | if output_path != None: | |
5162 | if not os.path.exists(output_path): |
|
5003 | if not os.path.exists(output_path): | |
5163 | outputstr = 'OutputPath:%s does not exists' % output_path |
|
5004 | outputstr = 'OutputPath:%s does not exists' % output_path | |
5164 | self.console.append(outputstr) |
|
5005 | self.console.append(outputstr) | |
5165 | parms_ok = False |
|
5006 | parms_ok = False | |
5166 | output_path = None |
|
5007 | output_path = None | |
5167 |
|
5008 | |||
5168 |
|
5009 | |||
5169 | try: |
|
5010 | try: | |
5170 | profilesperblock = int(profilesperblock) |
|
5011 | profilesperblock = int(profilesperblock) | |
5171 | except: |
|
5012 | except: | |
5172 | if datatype == "Voltage": |
|
5013 | if datatype == "Voltage": | |
5173 | outputstr = 'Profilesperblock: %s, this must be a integer number' % str(self.volOutputprofilesperblock.text()) |
|
5014 | outputstr = 'Profilesperblock: %s, this must be a integer number' % str(self.volOutputprofilesperblock.text()) | |
5174 | self.console.append(outputstr) |
|
5015 | self.console.append(outputstr) | |
5175 | parms_ok = False |
|
5016 | parms_ok = False | |
5176 | profilesperblock = None |
|
5017 | profilesperblock = None | |
5177 |
|
5018 | |||
5178 | elif datatype == "Spectra": |
|
5019 | elif datatype == "Spectra": | |
5179 | outputstr = 'Profilesperblock: %s, this must be a integer number' % str(self.specOutputprofileperblock.text()) |
|
5020 | outputstr = 'Profilesperblock: %s, this must be a integer number' % str(self.specOutputprofileperblock.text()) | |
5180 | self.console.append(outputstr) |
|
5021 | self.console.append(outputstr) | |
5181 | parms_ok = False |
|
5022 | parms_ok = False | |
5182 | profilesperblock = None |
|
5023 | profilesperblock = None | |
5183 |
|
5024 | |||
5184 | try: |
|
5025 | try: | |
5185 | blocksperfile = int(blocksperfile) |
|
5026 | blocksperfile = int(blocksperfile) | |
5186 | except: |
|
5027 | except: | |
5187 | if datatype == "Voltage": |
|
5028 | if datatype == "Voltage": | |
5188 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.volOutputblocksperfile.text()) |
|
5029 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.volOutputblocksperfile.text()) | |
5189 | elif datatype == "Spectra": |
|
5030 | elif datatype == "Spectra": | |
5190 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.specOutputblocksperfile.text()) |
|
5031 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.specOutputblocksperfile.text()) | |
5191 | elif datatype == "SpectraHeis": |
|
5032 | elif datatype == "SpectraHeis": | |
5192 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.specHeisOutputblocksperfile.text()) |
|
5033 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.specHeisOutputblocksperfile.text()) | |
5193 |
|
5034 | |||
5194 | self.console.append(outputstr) |
|
5035 | self.console.append(outputstr) | |
5195 | parms_ok = False |
|
5036 | parms_ok = False | |
5196 | blocksperfile = None |
|
5037 | blocksperfile = None | |
5197 |
|
5038 | |||
5198 | if datatype == "SpectraHeis": |
|
5039 | if datatype == "SpectraHeis": | |
5199 | if metada == '': |
|
5040 | if metada == '': | |
5200 | outputstr = 'Choose metada file' |
|
5041 | outputstr = 'Choose metada file' | |
5201 | self.console.append(outputstr) |
|
5042 | self.console.append(outputstr) | |
5202 | parms_ok = False |
|
5043 | parms_ok = False | |
5203 | if metada != None: |
|
5044 | if metada != None: | |
5204 | if not os.path.isfile(metada): |
|
5045 | if not os.path.isfile(metada): | |
5205 | outputstr = 'Metadata:%s does not exists' % metada |
|
5046 | outputstr = 'Metadata:%s does not exists' % metada | |
5206 | self.console.append(outputstr) |
|
5047 | self.console.append(outputstr) | |
5207 | parms_ok = False |
|
5048 | parms_ok = False | |
5208 | output_path = None |
|
5049 | output_path = None | |
5209 |
|
5050 | |||
5210 | if datatype == "Voltage": |
|
5051 | if datatype == "Voltage": | |
5211 | return parms_ok, output_path, blocksperfile, profilesperblock |
|
5052 | return parms_ok, output_path, blocksperfile, profilesperblock | |
5212 |
|
5053 | |||
5213 |
|
5054 | |||
5214 | if datatype == "Spectra": |
|
5055 | if datatype == "Spectra": | |
5215 | return parms_ok, output_path, blocksperfile, profilesperblock |
|
5056 | return parms_ok, output_path, blocksperfile, profilesperblock | |
5216 |
|
5057 | |||
5217 |
|
5058 | |||
5218 | if datatype == "SpectraHeis": |
|
5059 | if datatype == "SpectraHeis": | |
5219 | return parms_ok, output_path, blocksperfile, metada |
|
5060 | return parms_ok, output_path, blocksperfile, metada | |
5220 |
|
5061 | |||
5221 | def findDatafiles(self, data_path, ext, walk, expLabel=''): |
|
5062 | def findDatafiles(self, data_path, ext, walk, expLabel=''): | |
5222 |
|
5063 | |||
5223 | dateList = [] |
|
5064 | dateList = [] | |
5224 | fileList = [] |
|
5065 | fileList = [] | |
5225 |
|
5066 | |||
5226 | if ext == ".r": |
|
5067 | if ext == ".r": | |
5227 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5068 | from schainpy.model.io.jroIO_base import JRODataReader | |
5228 |
|
5069 | |||
5229 | readerObj = JRODataReader() |
|
5070 | readerObj = JRODataReader() | |
5230 | dateList = readerObj.findDatafiles(path=data_path, |
|
5071 | dateList = readerObj.findDatafiles(path=data_path, | |
5231 | expLabel=expLabel, |
|
5072 | expLabel=expLabel, | |
5232 | ext=ext, |
|
5073 | ext=ext, | |
5233 | walk=walk) |
|
5074 | walk=walk) | |
5234 |
|
5075 | |||
5235 | if ext == ".pdata": |
|
5076 | if ext == ".pdata": | |
5236 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5077 | from schainpy.model.io.jroIO_base import JRODataReader | |
5237 |
|
5078 | |||
5238 | readerObj = JRODataReader() |
|
5079 | readerObj = JRODataReader() | |
5239 | dateList = readerObj.findDatafiles(path=data_path, |
|
5080 | dateList = readerObj.findDatafiles(path=data_path, | |
5240 | expLabel=expLabel, |
|
5081 | expLabel=expLabel, | |
5241 | ext=ext, |
|
5082 | ext=ext, | |
5242 | walk=walk) |
|
5083 | walk=walk) | |
5243 |
|
5084 | |||
5244 | if ext == ".fits": |
|
5085 | if ext == ".fits": | |
5245 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5086 | from schainpy.model.io.jroIO_base import JRODataReader | |
5246 |
|
5087 | |||
5247 | readerObj = JRODataReader() |
|
5088 | readerObj = JRODataReader() | |
5248 | dateList = readerObj.findDatafiles(path=data_path, |
|
5089 | dateList = readerObj.findDatafiles(path=data_path, | |
5249 | expLabel=expLabel, |
|
5090 | expLabel=expLabel, | |
5250 | ext=ext, |
|
5091 | ext=ext, | |
5251 | walk=walk) |
|
5092 | walk=walk) | |
5252 |
|
5093 | |||
5253 | if ext == ".hdf5": |
|
5094 | if ext == ".hdf5": | |
5254 | from schainpy.model.io.jroIO_usrp import USRPReader |
|
5095 | from schainpy.model.io.jroIO_usrp import USRPReader | |
5255 |
|
5096 | |||
5256 | readerObj = USRPReader() |
|
5097 | readerObj = USRPReader() | |
5257 | dateList = readerObj.findDatafiles(path=data_path) |
|
5098 | dateList = readerObj.findDatafiles(path=data_path) | |
5258 |
|
5099 | |||
5259 | return dateList |
|
5100 | return dateList | |
5260 |
|
5101 | |||
5261 | def loadDays(self, data_path, ext, walk, expLabel=''): |
|
5102 | def loadDays(self, data_path, ext, walk, expLabel=''): | |
5262 | """ |
|
5103 | """ | |
5263 | Method to loads day |
|
5104 | Method to loads day | |
5264 | """ |
|
5105 | """ | |
5265 | self.proOk.setEnabled(False) |
|
5106 | self.proOk.setEnabled(False) | |
|
5107 | self.proComStartDate.clear() | |||
|
5108 | self.proComEndDate.clear() | |||
|
5109 | ||||
5266 | self.dateList = [] |
|
5110 | self.dateList = [] | |
5267 |
|
5111 | |||
|
5112 | if not os.path.isdir(data_path): | |||
|
5113 | return | |||
|
5114 | ||||
5268 | dateList = self.findDatafiles(data_path, ext=ext, walk=walk, expLabel=expLabel) |
|
5115 | dateList = self.findDatafiles(data_path, ext=ext, walk=walk, expLabel=expLabel) | |
5269 |
|
5116 | |||
5270 | if not dateList: |
|
5117 | if not dateList: | |
5271 | # self.console.clear() |
|
5118 | # self.console.clear() | |
5272 | outputstr = "The path: %s is empty with file extension *%s" % (data_path, ext) |
|
5119 | outputstr = "The path: %s is empty with file extension *%s" % (data_path, ext) | |
5273 | self.console.append(outputstr) |
|
5120 | self.console.append(outputstr) | |
5274 | return |
|
5121 | return | |
5275 |
|
5122 | |||
5276 | self.proComStartDate.clear() |
|
|||
5277 | self.proComEndDate.clear() |
|
|||
5278 |
|
||||
5279 | dateStrList = [] |
|
5123 | dateStrList = [] | |
5280 | for thisDate in dateList: |
|
5124 | for thisDate in dateList: | |
5281 | dateStr = thisDate.strftime("%Y/%m/%d") |
|
5125 | dateStr = thisDate.strftime("%Y/%m/%d") | |
5282 |
|
5126 | |||
5283 | self.proComStartDate.addItem(dateStr) |
|
5127 | self.proComStartDate.addItem(dateStr) | |
5284 | self.proComEndDate.addItem(dateStr) |
|
5128 | self.proComEndDate.addItem(dateStr) | |
5285 | dateStrList.append(dateStr) |
|
5129 | dateStrList.append(dateStr) | |
5286 |
|
5130 | |||
5287 | self.proComStartDate.setCurrentIndex(0) |
|
5131 | self.proComStartDate.setCurrentIndex(0) | |
5288 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - 1) |
|
5132 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - 1) | |
5289 |
|
5133 | |||
5290 | self.dateList = dateStrList |
|
5134 | self.dateList = dateStrList | |
5291 | self.proOk.setEnabled(True) |
|
5135 | self.proOk.setEnabled(True) | |
5292 |
|
5136 | |||
5293 | return self.dateList |
|
5137 | return self.dateList | |
5294 |
|
5138 | |||
5295 | def setWorkSpaceGUI(self, pathWorkSpace=None): |
|
5139 | def setWorkSpaceGUI(self, pathWorkSpace=None): | |
5296 |
|
5140 | |||
5297 | if pathWorkSpace == None: |
|
5141 | if pathWorkSpace == None: | |
5298 | home = os.path.expanduser("~") |
|
5142 | home = os.path.expanduser("~") | |
5299 | pathWorkSpace = os.path.join(home,'schain_workspace') |
|
5143 | pathWorkSpace = os.path.join(home,'schain_workspace') | |
5300 |
|
5144 | |||
5301 | self.pathWorkSpace = pathWorkSpace |
|
5145 | self.pathWorkSpace = pathWorkSpace | |
5302 |
|
5146 | |||
5303 | """ |
|
5147 | """ | |
5304 | Comandos Usados en Console |
|
5148 | Comandos Usados en Console | |
5305 | """ |
|
5149 | """ | |
5306 | def __del__(self): |
|
5150 | def __del__(self): | |
5307 | sys.stdout = sys.__stdout__ |
|
5151 | sys.stdout = sys.__stdout__ | |
5308 | sys.stderr = sys.__stderr__ |
|
5152 | sys.stderr = sys.__stderr__ | |
5309 |
|
5153 | |||
5310 | def normalOutputWritten(self, text): |
|
5154 | def normalOutputWritten(self, text): | |
5311 | color_black = QtGui.QColor(0,0,0) |
|
5155 | color_black = QtGui.QColor(0,0,0) | |
5312 | self.console.setTextColor(color_black) |
|
5156 | self.console.setTextColor(color_black) | |
5313 | self.console.append(text) |
|
5157 | self.console.append(text) | |
5314 |
|
5158 | |||
5315 | def errorOutputWritten(self, text): |
|
5159 | def errorOutputWritten(self, text): | |
5316 | color_red = QtGui.QColor(255,0,0) |
|
5160 | color_red = QtGui.QColor(255,0,0) | |
5317 | color_black = QtGui.QColor(0,0,0) |
|
5161 | color_black = QtGui.QColor(0,0,0) | |
5318 |
|
5162 | |||
5319 | self.console.setTextColor(color_red) |
|
5163 | self.console.setTextColor(color_red) | |
5320 | self.console.append(text) |
|
5164 | self.console.append(text) | |
5321 | self.console.setTextColor(color_black) |
|
5165 | self.console.setTextColor(color_black) | |
5322 |
|
5166 | |||
5323 | def setParameter(self): |
|
5167 | def setParameter(self): | |
5324 |
|
5168 | |||
5325 | self.setWindowTitle("ROJ-Signal Chain") |
|
5169 | self.setWindowTitle("ROJ-Signal Chain") | |
5326 | self.setWindowIcon(QtGui.QIcon( os.path.join(FIGURES_PATH,"adn.jpg") )) |
|
5170 | self.setWindowIcon(QtGui.QIcon( os.path.join(FIGURES_PATH,"adn.jpg") )) | |
5327 |
|
5171 | |||
5328 | self.tabWidgetProject.setEnabled(False) |
|
5172 | self.tabWidgetProject.setEnabled(False) | |
5329 | self.tabVoltage.setEnabled(False) |
|
5173 | self.tabVoltage.setEnabled(False) | |
5330 | self.tabSpectra.setEnabled(False) |
|
5174 | self.tabSpectra.setEnabled(False) | |
5331 | self.tabCorrelation.setEnabled(False) |
|
5175 | self.tabCorrelation.setEnabled(False) | |
5332 | self.frame_2.setEnabled(False) |
|
5176 | self.frame_2.setEnabled(False) | |
5333 |
|
5177 | |||
5334 | self.actionCreate.setShortcut('Ctrl+N') |
|
5178 | self.actionCreate.setShortcut('Ctrl+N') | |
5335 | self.actionOpen.setShortcut('Ctrl+O') |
|
5179 | self.actionOpen.setShortcut('Ctrl+O') | |
5336 | self.actionSave.setShortcut('Ctrl+S') |
|
5180 | self.actionSave.setShortcut('Ctrl+S') | |
5337 | self.actionClose.setShortcut('Ctrl+X') |
|
5181 | self.actionClose.setShortcut('Ctrl+X') | |
5338 |
|
5182 | |||
5339 | self.actionStart.setShortcut('Ctrl+1') |
|
5183 | self.actionStart.setShortcut('Ctrl+1') | |
5340 | self.actionPause.setShortcut('Ctrl+2') |
|
5184 | self.actionPause.setShortcut('Ctrl+2') | |
5341 | self.actionStop.setShortcut('Ctrl+3') |
|
5185 | self.actionStop.setShortcut('Ctrl+3') | |
5342 |
|
5186 | |||
5343 | self.actionFTP.setShortcut('Ctrl+F') |
|
5187 | self.actionFTP.setShortcut('Ctrl+F') | |
5344 |
|
5188 | |||
5345 | self.actionStart.setEnabled(False) |
|
5189 | self.actionStart.setEnabled(False) | |
5346 | self.actionPause.setEnabled(False) |
|
5190 | self.actionPause.setEnabled(False) | |
5347 | self.actionStop.setEnabled(False) |
|
5191 | self.actionStop.setEnabled(False) | |
5348 |
|
5192 | |||
5349 | self.actionStarToolbar.setEnabled(False) |
|
5193 | self.actionStarToolbar.setEnabled(False) | |
5350 | self.actionPauseToolbar.setEnabled(False) |
|
5194 | self.actionPauseToolbar.setEnabled(False) | |
5351 | self.actionStopToolbar.setEnabled(False) |
|
5195 | self.actionStopToolbar.setEnabled(False) | |
5352 |
|
5196 | |||
5353 | self.proName.clear() |
|
5197 | self.proName.clear() | |
5354 | self.proDataPath.setText('') |
|
5198 | self.proDataPath.setText('') | |
5355 | self.console.setReadOnly(True) |
|
5199 | self.console.setReadOnly(True) | |
5356 | self.console.append("Welcome to Signal Chain\nOpen a project or Create a new one") |
|
5200 | self.console.append("Welcome to Signal Chain\nOpen a project or Create a new one") | |
5357 | self.proStartTime.setDisplayFormat("hh:mm:ss") |
|
5201 | self.proStartTime.setDisplayFormat("hh:mm:ss") | |
5358 | self.proDataType.setEnabled(False) |
|
5202 | self.proDataType.setEnabled(False) | |
5359 | self.time = QtCore.QTime() |
|
5203 | self.time = QtCore.QTime() | |
5360 | self.hour = 0 |
|
5204 | self.hour = 0 | |
5361 | self.min = 0 |
|
5205 | self.min = 0 | |
5362 | self.sec = 0 |
|
5206 | self.sec = 0 | |
5363 | self.proEndTime.setDisplayFormat("hh:mm:ss") |
|
5207 | self.proEndTime.setDisplayFormat("hh:mm:ss") | |
5364 | startTime = "00:00:00" |
|
5208 | startTime = "00:00:00" | |
5365 | endTime = "23:59:59" |
|
5209 | endTime = "23:59:59" | |
5366 | starlist = startTime.split(":") |
|
5210 | starlist = startTime.split(":") | |
5367 | endlist = endTime.split(":") |
|
5211 | endlist = endTime.split(":") | |
5368 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) |
|
5212 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) | |
5369 | self.proStartTime.setTime(self.time) |
|
5213 | self.proStartTime.setTime(self.time) | |
5370 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
5214 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) | |
5371 | self.proEndTime.setTime(self.time) |
|
5215 | self.proEndTime.setTime(self.time) | |
5372 | self.proOk.setEnabled(False) |
|
5216 | self.proOk.setEnabled(False) | |
5373 | # set model Project Explorer |
|
5217 | # set model Project Explorer | |
5374 | self.projectExplorerModel = QtGui.QStandardItemModel() |
|
5218 | self.projectExplorerModel = QtGui.QStandardItemModel() | |
5375 | self.projectExplorerModel.setHorizontalHeaderLabels(("Project Explorer",)) |
|
5219 | self.projectExplorerModel.setHorizontalHeaderLabels(("Project Explorer",)) | |
5376 | layout = QtGui.QVBoxLayout() |
|
5220 | layout = QtGui.QVBoxLayout() | |
5377 | layout.addWidget(self.projectExplorerTree) |
|
5221 | layout.addWidget(self.projectExplorerTree) | |
5378 | self.projectExplorerTree.setModel(self.projectExplorerModel) |
|
5222 | self.projectExplorerTree.setModel(self.projectExplorerModel) | |
5379 | self.projectExplorerTree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) |
|
5223 | self.projectExplorerTree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) | |
5380 | self.projectExplorerTree.customContextMenuRequested.connect(self.on_right_click) |
|
5224 | self.projectExplorerTree.customContextMenuRequested.connect(self.on_right_click) | |
5381 | self.projectExplorerTree.clicked.connect(self.on_click) |
|
5225 | self.projectExplorerTree.clicked.connect(self.on_click) | |
5382 | self.projectExplorerTree.expandAll() |
|
5226 | self.projectExplorerTree.expandAll() | |
5383 | # set model Project Properties |
|
5227 | # set model Project Properties | |
5384 |
|
5228 | |||
5385 | self.propertiesModel = TreeModel() |
|
5229 | self.propertiesModel = TreeModel() | |
5386 | self.propertiesModel.initProjectView() |
|
5230 | self.propertiesModel.initProjectView() | |
5387 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
5231 | self.treeProjectProperties.setModel(self.propertiesModel) | |
5388 | self.treeProjectProperties.expandAll() |
|
5232 | self.treeProjectProperties.expandAll() | |
5389 | self.treeProjectProperties.allColumnsShowFocus() |
|
5233 | self.treeProjectProperties.allColumnsShowFocus() | |
5390 | self.treeProjectProperties.resizeColumnToContents(1) |
|
5234 | self.treeProjectProperties.resizeColumnToContents(1) | |
5391 |
|
5235 | |||
5392 | # set Project |
|
5236 | # set Project | |
5393 | self.proDelay.setEnabled(False) |
|
5237 | self.proDelay.setEnabled(False) | |
5394 | self.proSet.setEnabled(False) |
|
5238 | self.proSet.setEnabled(False) | |
5395 | self.proDataType.setReadOnly(True) |
|
5239 | self.proDataType.setReadOnly(True) | |
5396 |
|
5240 | |||
5397 | # set Operation Voltage |
|
5241 | # set Operation Voltage | |
5398 | self.volOpComChannels.setEnabled(False) |
|
5242 | self.volOpComChannels.setEnabled(False) | |
5399 | self.volOpComHeights.setEnabled(False) |
|
5243 | self.volOpComHeights.setEnabled(False) | |
5400 | self.volOpFilter.setEnabled(False) |
|
5244 | self.volOpFilter.setEnabled(False) | |
5401 | self.volOpComProfile.setEnabled(False) |
|
5245 | self.volOpComProfile.setEnabled(False) | |
5402 | self.volOpComCode.setEnabled(False) |
|
5246 | self.volOpComCode.setEnabled(False) | |
5403 | self.volOpFlip.setEnabled(False) |
|
5247 | self.volOpFlip.setEnabled(False) | |
5404 | self.volOpCohInt.setEnabled(False) |
|
5248 | self.volOpCohInt.setEnabled(False) | |
5405 | self.volOpRadarfrequency.setEnabled(False) |
|
5249 | self.volOpRadarfrequency.setEnabled(False) | |
5406 |
|
5250 | |||
5407 | self.volOpChannel.setEnabled(False) |
|
5251 | self.volOpChannel.setEnabled(False) | |
5408 | self.volOpHeights.setEnabled(False) |
|
5252 | self.volOpHeights.setEnabled(False) | |
5409 | self.volOpProfile.setEnabled(False) |
|
5253 | self.volOpProfile.setEnabled(False) | |
5410 | self.volOpComMode.setEnabled(False) |
|
5254 | self.volOpComMode.setEnabled(False) | |
5411 |
|
5255 | |||
5412 | self.volGraphPath.setEnabled(False) |
|
5256 | self.volGraphPath.setEnabled(False) | |
5413 | self.volGraphPrefix.setEnabled(False) |
|
5257 | self.volGraphPrefix.setEnabled(False) | |
5414 | self.volGraphToolPath.setEnabled(False) |
|
5258 | self.volGraphToolPath.setEnabled(False) | |
5415 |
|
5259 | |||
5416 | # set Graph Voltage |
|
5260 | # set Graph Voltage | |
5417 | self.volGraphChannelList.setEnabled(False) |
|
5261 | self.volGraphChannelList.setEnabled(False) | |
5418 | self.volGraphfreqrange.setEnabled(False) |
|
5262 | self.volGraphfreqrange.setEnabled(False) | |
5419 | self.volGraphHeightrange.setEnabled(False) |
|
5263 | self.volGraphHeightrange.setEnabled(False) | |
5420 |
|
5264 | |||
5421 | # set Operation Spectra |
|
5265 | # set Operation Spectra | |
5422 | self.specOpnFFTpoints.setEnabled(False) |
|
5266 | self.specOpnFFTpoints.setEnabled(False) | |
5423 | self.specOpProfiles.setEnabled(False) |
|
5267 | self.specOpProfiles.setEnabled(False) | |
5424 | self.specOpippFactor.setEnabled(False) |
|
5268 | self.specOpippFactor.setEnabled(False) | |
5425 | self.specOppairsList.setEnabled(False) |
|
5269 | self.specOppairsList.setEnabled(False) | |
5426 | self.specOpComChannel.setEnabled(False) |
|
5270 | self.specOpComChannel.setEnabled(False) | |
5427 | self.specOpComHeights.setEnabled(False) |
|
5271 | self.specOpComHeights.setEnabled(False) | |
5428 | self.specOpIncoherent.setEnabled(False) |
|
5272 | self.specOpIncoherent.setEnabled(False) | |
5429 | self.specOpgetNoise.setEnabled(False) |
|
5273 | self.specOpgetNoise.setEnabled(False) | |
5430 | self.specOpRadarfrequency.setEnabled(False) |
|
5274 | self.specOpRadarfrequency.setEnabled(False) | |
5431 |
|
5275 | |||
5432 |
|
5276 | |||
5433 | self.specOpChannel.setEnabled(False) |
|
5277 | self.specOpChannel.setEnabled(False) | |
5434 | self.specOpHeights.setEnabled(False) |
|
5278 | self.specOpHeights.setEnabled(False) | |
5435 | # set Graph Spectra |
|
5279 | # set Graph Spectra | |
5436 | self.specGgraphChannelList.setEnabled(False) |
|
5280 | self.specGgraphChannelList.setEnabled(False) | |
5437 | self.specGgraphFreq.setEnabled(False) |
|
5281 | self.specGgraphFreq.setEnabled(False) | |
5438 | self.specGgraphHeight.setEnabled(False) |
|
5282 | self.specGgraphHeight.setEnabled(False) | |
5439 | self.specGgraphDbsrange.setEnabled(False) |
|
5283 | self.specGgraphDbsrange.setEnabled(False) | |
5440 | self.specGgraphmagnitud.setEnabled(False) |
|
5284 | self.specGgraphmagnitud.setEnabled(False) | |
5441 | self.specGgraphTminTmax.setEnabled(False) |
|
5285 | self.specGgraphTminTmax.setEnabled(False) | |
5442 | self.specGgraphTimeRange.setEnabled(False) |
|
5286 | self.specGgraphTimeRange.setEnabled(False) | |
5443 | self.specGraphPath.setEnabled(False) |
|
5287 | self.specGraphPath.setEnabled(False) | |
5444 | self.specGraphToolPath.setEnabled(False) |
|
5288 | self.specGraphToolPath.setEnabled(False) | |
5445 | self.specGraphPrefix.setEnabled(False) |
|
5289 | self.specGraphPrefix.setEnabled(False) | |
5446 |
|
5290 | |||
5447 | self.specGgraphftpratio.setEnabled(False) |
|
5291 | self.specGgraphftpratio.setEnabled(False) | |
5448 | # set Operation SpectraHeis |
|
5292 | # set Operation SpectraHeis | |
5449 | self.specHeisOpIncoherent.setEnabled(False) |
|
5293 | self.specHeisOpIncoherent.setEnabled(False) | |
5450 | self.specHeisOpCobIncInt.setEnabled(False) |
|
5294 | self.specHeisOpCobIncInt.setEnabled(False) | |
5451 | # set Graph SpectraHeis |
|
5295 | # set Graph SpectraHeis | |
5452 | self.specHeisGgraphChannelList.setEnabled(False) |
|
5296 | self.specHeisGgraphChannelList.setEnabled(False) | |
5453 | self.specHeisGgraphXminXmax.setEnabled(False) |
|
5297 | self.specHeisGgraphXminXmax.setEnabled(False) | |
5454 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
5298 | self.specHeisGgraphYminYmax.setEnabled(False) | |
5455 | self.specHeisGgraphTminTmax.setEnabled(False) |
|
5299 | self.specHeisGgraphTminTmax.setEnabled(False) | |
5456 | self.specHeisGgraphTimeRange.setEnabled(False) |
|
5300 | self.specHeisGgraphTimeRange.setEnabled(False) | |
5457 | self.specHeisGgraphftpratio.setEnabled(False) |
|
5301 | self.specHeisGgraphftpratio.setEnabled(False) | |
5458 | self.specHeisGraphPath.setEnabled(False) |
|
5302 | self.specHeisGraphPath.setEnabled(False) | |
5459 | self.specHeisGraphPrefix.setEnabled(False) |
|
5303 | self.specHeisGraphPrefix.setEnabled(False) | |
5460 | self.specHeisGraphToolPath.setEnabled(False) |
|
5304 | self.specHeisGraphToolPath.setEnabled(False) | |
5461 |
|
5305 | |||
5462 |
|
5306 | |||
5463 | # tool tip gui |
|
5307 | # tool tip gui | |
5464 | QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10)) |
|
5308 | QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10)) | |
5465 | self.projectExplorerTree.setToolTip('Right clik to add Project or Unit Process') |
|
5309 | self.projectExplorerTree.setToolTip('Right clik to add Project or Unit Process') | |
5466 | # tool tip gui project |
|
5310 | # tool tip gui project | |
5467 | self.proComWalk.setToolTip('<b>On Files</b>:<i>Search file in format .r or pdata</i> <b>On Folders</b>:<i>Search file in a directory DYYYYDOY</i>') |
|
5311 | self.proComWalk.setToolTip('<b>On Files</b>:<i>Search file in format .r or pdata</i> <b>On Folders</b>:<i>Search file in a directory DYYYYDOY</i>') | |
5468 | self.proComWalk.setCurrentIndex(0) |
|
5312 | self.proComWalk.setCurrentIndex(0) | |
5469 | # tool tip gui volOp |
|
5313 | # tool tip gui volOp | |
5470 | self.volOpChannel.setToolTip('Example: 1,2,3,4,5') |
|
5314 | self.volOpChannel.setToolTip('Example: 1,2,3,4,5') | |
5471 | self.volOpHeights.setToolTip('Example: 90,180') |
|
5315 | self.volOpHeights.setToolTip('Example: 90,180') | |
5472 | self.volOpFilter.setToolTip('Example: 2') |
|
5316 | self.volOpFilter.setToolTip('Example: 2') | |
5473 | self.volOpProfile.setToolTip('Example:0,127') |
|
5317 | self.volOpProfile.setToolTip('Example:0,127') | |
5474 | self.volOpCohInt.setToolTip('Example: 128') |
|
5318 | self.volOpCohInt.setToolTip('Example: 128') | |
5475 | self.volOpFlip.setToolTip('ChannelList where flip will be applied. Example: 0,2,3') |
|
5319 | self.volOpFlip.setToolTip('ChannelList where flip will be applied. Example: 0,2,3') | |
5476 | self.volOpOk.setToolTip('If you have finished, please Ok ') |
|
5320 | self.volOpOk.setToolTip('If you have finished, please Ok ') | |
5477 | # tool tip gui volGraph |
|
5321 | # tool tip gui volGraph | |
5478 | self.volGraphfreqrange.setToolTip('Height range. Example: 50,100') |
|
5322 | self.volGraphfreqrange.setToolTip('Height range. Example: 50,100') | |
5479 | self.volGraphHeightrange.setToolTip('Amplitude. Example: 0,10000') |
|
5323 | self.volGraphHeightrange.setToolTip('Amplitude. Example: 0,10000') | |
5480 | # tool tip gui specOp |
|
5324 | # tool tip gui specOp | |
5481 | self.specOpnFFTpoints.setToolTip('Example: 128') |
|
5325 | self.specOpnFFTpoints.setToolTip('Example: 128') | |
5482 | self.specOpProfiles.setToolTip('Example: 128') |
|
5326 | self.specOpProfiles.setToolTip('Example: 128') | |
5483 | self.specOpippFactor.setToolTip('Example:1.0') |
|
5327 | self.specOpippFactor.setToolTip('Example:1.0') | |
5484 | self.specOpIncoherent.setToolTip('Example: 10') |
|
5328 | self.specOpIncoherent.setToolTip('Example: 10') | |
5485 | self.specOpgetNoise.setToolTip('Example:20,180,30,120 (minHei,maxHei,minVel,maxVel)') |
|
5329 | self.specOpgetNoise.setToolTip('Example:20,180,30,120 (minHei,maxHei,minVel,maxVel)') | |
5486 |
|
5330 | |||
5487 | self.specOpChannel.setToolTip('Example: 0,1,2,3') |
|
5331 | self.specOpChannel.setToolTip('Example: 0,1,2,3') | |
5488 | self.specOpHeights.setToolTip('Example: 90,180') |
|
5332 | self.specOpHeights.setToolTip('Example: 90,180') | |
5489 | self.specOppairsList.setToolTip('Example: (0,1),(2,3)') |
|
5333 | self.specOppairsList.setToolTip('Example: (0,1),(2,3)') | |
5490 | # tool tip gui specGraph |
|
5334 | # tool tip gui specGraph | |
5491 |
|
5335 | |||
5492 | self.specGgraphChannelList.setToolTip('Example: 0,3,4') |
|
5336 | self.specGgraphChannelList.setToolTip('Example: 0,3,4') | |
5493 | self.specGgraphFreq.setToolTip('Example: -20,20') |
|
5337 | self.specGgraphFreq.setToolTip('Example: -20,20') | |
5494 | self.specGgraphHeight.setToolTip('Example: 100,400') |
|
5338 | self.specGgraphHeight.setToolTip('Example: 100,400') | |
5495 | self.specGgraphDbsrange.setToolTip('Example: 30,170') |
|
5339 | self.specGgraphDbsrange.setToolTip('Example: 30,170') | |
5496 |
|
5340 | |||
5497 | self.specGraphPrefix.setToolTip('Example: EXPERIMENT_NAME') |
|
5341 | self.specGraphPrefix.setToolTip('Example: EXPERIMENT_NAME') | |
5498 |
|
5342 | |||
5499 | sys.stdout = ShowMeConsole(textWritten=self.normalOutputWritten) |
|
5343 | sys.stdout = ShowMeConsole(textWritten=self.normalOutputWritten) | |
5500 | sys.stderr = ShowMeConsole(textWritten=self.errorOutputWritten) |
|
5344 | sys.stderr = ShowMeConsole(textWritten=self.errorOutputWritten) | |
5501 |
|
5345 | |||
5502 |
|
5346 | |||
5503 | class UnitProcessWindow(QMainWindow, Ui_UnitProcess): |
|
5347 | class UnitProcessWindow(QMainWindow, Ui_UnitProcess): | |
5504 | """ |
|
5348 | """ | |
5505 | Class documentation goes here. |
|
5349 | Class documentation goes here. | |
5506 | """ |
|
5350 | """ | |
5507 | closed = pyqtSignal() |
|
5351 | closed = pyqtSignal() | |
5508 | create = False |
|
5352 | create = False | |
5509 |
|
5353 | |||
5510 | def __init__(self, parent=None): |
|
5354 | def __init__(self, parent=None): | |
5511 | """ |
|
5355 | """ | |
5512 | Constructor |
|
5356 | Constructor | |
5513 | """ |
|
5357 | """ | |
5514 | QMainWindow.__init__(self, parent) |
|
5358 | QMainWindow.__init__(self, parent) | |
5515 | self.setupUi(self) |
|
5359 | self.setupUi(self) | |
5516 | self.getFromWindow = None |
|
5360 | self.getFromWindow = None | |
5517 | self.getfromWindowList = [] |
|
5361 | self.getfromWindowList = [] | |
5518 | self.dataTypeProject = None |
|
5362 | self.dataTypeProject = None | |
5519 |
|
5363 | |||
5520 | self.listUP = None |
|
5364 | self.listUP = None | |
5521 |
|
5365 | |||
5522 | @pyqtSignature("") |
|
5366 | @pyqtSignature("") | |
5523 | def on_unitPokbut_clicked(self): |
|
5367 | def on_unitPokbut_clicked(self): | |
5524 | """ |
|
5368 | """ | |
5525 | Slot documentation goes here. |
|
5369 | Slot documentation goes here. | |
5526 | """ |
|
5370 | """ | |
5527 | self.create = True |
|
5371 | self.create = True | |
5528 | self.getFromWindow = self.getfromWindowList[int(self.comboInputBox.currentIndex())] |
|
5372 | self.getFromWindow = self.getfromWindowList[int(self.comboInputBox.currentIndex())] | |
5529 | # self.nameofUP= str(self.nameUptxt.text()) |
|
5373 | # self.nameofUP= str(self.nameUptxt.text()) | |
5530 | self.typeofUP = str(self.comboTypeBox.currentText()) |
|
5374 | self.typeofUP = str(self.comboTypeBox.currentText()) | |
5531 | self.close() |
|
5375 | self.close() | |
5532 |
|
5376 | |||
5533 |
|
5377 | |||
5534 | @pyqtSignature("") |
|
5378 | @pyqtSignature("") | |
5535 | def on_unitPcancelbut_clicked(self): |
|
5379 | def on_unitPcancelbut_clicked(self): | |
5536 | """ |
|
5380 | """ | |
5537 | Slot documentation goes here. |
|
5381 | Slot documentation goes here. | |
5538 | """ |
|
5382 | """ | |
5539 | self.create = False |
|
5383 | self.create = False | |
5540 | self.close() |
|
5384 | self.close() | |
5541 |
|
5385 | |||
5542 | def loadTotalList(self): |
|
5386 | def loadTotalList(self): | |
5543 | self.comboInputBox.clear() |
|
5387 | self.comboInputBox.clear() | |
5544 | for i in self.getfromWindowList: |
|
5388 | for i in self.getfromWindowList: | |
5545 |
|
5389 | |||
5546 | name = i.getElementName() |
|
5390 | name = i.getElementName() | |
5547 | if name == 'Project': |
|
5391 | if name == 'Project': | |
5548 | id = i.id |
|
5392 | id = i.id | |
5549 | name = i.name |
|
5393 | name = i.name | |
5550 | if self.dataTypeProject == 'Voltage': |
|
5394 | if self.dataTypeProject == 'Voltage': | |
5551 | self.comboTypeBox.clear() |
|
5395 | self.comboTypeBox.clear() | |
5552 | self.comboTypeBox.addItem("Voltage") |
|
5396 | self.comboTypeBox.addItem("Voltage") | |
5553 |
|
5397 | |||
5554 | if self.dataTypeProject == 'Spectra': |
|
5398 | if self.dataTypeProject == 'Spectra': | |
5555 | self.comboTypeBox.clear() |
|
5399 | self.comboTypeBox.clear() | |
5556 | self.comboTypeBox.addItem("Spectra") |
|
5400 | self.comboTypeBox.addItem("Spectra") | |
5557 | self.comboTypeBox.addItem("Correlation") |
|
5401 | self.comboTypeBox.addItem("Correlation") | |
5558 | if self.dataTypeProject == 'Fits': |
|
5402 | if self.dataTypeProject == 'Fits': | |
5559 | self.comboTypeBox.clear() |
|
5403 | self.comboTypeBox.clear() | |
5560 | self.comboTypeBox.addItem("SpectraHeis") |
|
5404 | self.comboTypeBox.addItem("SpectraHeis") | |
5561 |
|
5405 | |||
5562 |
|
5406 | |||
5563 | if name == 'ProcUnit': |
|
5407 | if name == 'ProcUnit': | |
5564 | id = int(i.id) - 1 |
|
5408 | id = int(i.id) - 1 | |
5565 | name = i.datatype |
|
5409 | name = i.datatype | |
5566 | if name == 'Voltage': |
|
5410 | if name == 'Voltage': | |
5567 | self.comboTypeBox.clear() |
|
5411 | self.comboTypeBox.clear() | |
5568 | self.comboTypeBox.addItem("Spectra") |
|
5412 | self.comboTypeBox.addItem("Spectra") | |
5569 | self.comboTypeBox.addItem("SpectraHeis") |
|
5413 | self.comboTypeBox.addItem("SpectraHeis") | |
5570 | self.comboTypeBox.addItem("Correlation") |
|
5414 | self.comboTypeBox.addItem("Correlation") | |
5571 | if name == 'Spectra': |
|
5415 | if name == 'Spectra': | |
5572 | self.comboTypeBox.clear() |
|
5416 | self.comboTypeBox.clear() | |
5573 | self.comboTypeBox.addItem("Spectra") |
|
5417 | self.comboTypeBox.addItem("Spectra") | |
5574 | self.comboTypeBox.addItem("SpectraHeis") |
|
5418 | self.comboTypeBox.addItem("SpectraHeis") | |
5575 | self.comboTypeBox.addItem("Correlation") |
|
5419 | self.comboTypeBox.addItem("Correlation") | |
5576 | if name == 'SpectraHeis': |
|
5420 | if name == 'SpectraHeis': | |
5577 | self.comboTypeBox.clear() |
|
5421 | self.comboTypeBox.clear() | |
5578 | self.comboTypeBox.addItem("SpectraHeis") |
|
5422 | self.comboTypeBox.addItem("SpectraHeis") | |
5579 |
|
5423 | |||
5580 | self.comboInputBox.addItem(str(name)) |
|
5424 | self.comboInputBox.addItem(str(name)) | |
5581 | # self.comboInputBox.addItem(str(name)+str(id)) |
|
5425 | # self.comboInputBox.addItem(str(name)+str(id)) | |
5582 |
|
5426 | |||
5583 | def closeEvent(self, event): |
|
5427 | def closeEvent(self, event): | |
5584 | self.closed.emit() |
|
5428 | self.closed.emit() | |
5585 | event.accept() |
|
5429 | event.accept() | |
5586 |
|
5430 | |||
5587 | class Ftp(QMainWindow, Ui_Ftp): |
|
5431 | class Ftp(QMainWindow, Ui_Ftp): | |
5588 | """ |
|
5432 | """ | |
5589 | Class documentation goes here. |
|
5433 | Class documentation goes here. | |
5590 | """ |
|
5434 | """ | |
5591 | create = False |
|
5435 | create = False | |
5592 | closed = pyqtSignal() |
|
5436 | closed = pyqtSignal() | |
5593 | server = None |
|
5437 | server = None | |
5594 | remotefolder = None |
|
5438 | remotefolder = None | |
5595 | username = None |
|
5439 | username = None | |
5596 | password = None |
|
5440 | password = None | |
5597 | ftp_wei = None |
|
5441 | ftp_wei = None | |
5598 | exp_code = None |
|
5442 | exp_code = None | |
5599 | sub_exp_code = None |
|
5443 | sub_exp_code = None | |
5600 | plot_pos = None |
|
5444 | plot_pos = None | |
5601 |
|
5445 | |||
5602 | def __init__(self, parent=None): |
|
5446 | def __init__(self, parent=None): | |
5603 | """ |
|
5447 | """ | |
5604 | Constructor |
|
5448 | Constructor | |
5605 | """ |
|
5449 | """ | |
5606 | QMainWindow.__init__(self, parent) |
|
5450 | QMainWindow.__init__(self, parent) | |
5607 | self.setupUi(self) |
|
5451 | self.setupUi(self) | |
5608 | self.setParameter() |
|
5452 | self.setParameter() | |
5609 |
|
5453 | |||
5610 | def setParameter(self): |
|
5454 | def setParameter(self): | |
5611 | self.setWindowTitle("ROJ-Signal Chain") |
|
5455 | self.setWindowTitle("ROJ-Signal Chain") | |
5612 | self.serverFTP.setToolTip('Example: jro-app.igp.gob.pe') |
|
5456 | self.serverFTP.setToolTip('Example: jro-app.igp.gob.pe') | |
5613 | self.folderFTP.setToolTip('Example: /home/wmaster/graficos') |
|
5457 | self.folderFTP.setToolTip('Example: /home/wmaster/graficos') | |
5614 | self.usernameFTP.setToolTip('Example: myusername') |
|
5458 | self.usernameFTP.setToolTip('Example: myusername') | |
5615 | self.passwordFTP.setToolTip('Example: mypass ') |
|
5459 | self.passwordFTP.setToolTip('Example: mypass ') | |
5616 | self.weightFTP.setToolTip('Example: 0') |
|
5460 | self.weightFTP.setToolTip('Example: 0') | |
5617 | self.expcodeFTP.setToolTip('Example: 0') |
|
5461 | self.expcodeFTP.setToolTip('Example: 0') | |
5618 | self.subexpFTP.setToolTip('Example: 0') |
|
5462 | self.subexpFTP.setToolTip('Example: 0') | |
5619 | self.plotposFTP.setToolTip('Example: 0') |
|
5463 | self.plotposFTP.setToolTip('Example: 0') | |
5620 |
|
5464 | |||
5621 | def setParmsfromTemporal(self, server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos): |
|
5465 | def setParmsfromTemporal(self, server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos): | |
5622 | self.serverFTP.setText(str(server)) |
|
5466 | self.serverFTP.setText(str(server)) | |
5623 | self.folderFTP.setText(str(remotefolder)) |
|
5467 | self.folderFTP.setText(str(remotefolder)) | |
5624 | self.usernameFTP.setText(str(username)) |
|
5468 | self.usernameFTP.setText(str(username)) | |
5625 | self.passwordFTP.setText(str(password)) |
|
5469 | self.passwordFTP.setText(str(password)) | |
5626 | self.weightFTP.setText(str(ftp_wei)) |
|
5470 | self.weightFTP.setText(str(ftp_wei)) | |
5627 | self.expcodeFTP.setText(str(exp_code)) |
|
5471 | self.expcodeFTP.setText(str(exp_code)) | |
5628 | self.subexpFTP.setText(str(sub_exp_code)) |
|
5472 | self.subexpFTP.setText(str(sub_exp_code)) | |
5629 | self.plotposFTP.setText(str(plot_pos)) |
|
5473 | self.plotposFTP.setText(str(plot_pos)) | |
5630 |
|
5474 | |||
5631 | def getParmsFromFtpWindow(self): |
|
5475 | def getParmsFromFtpWindow(self): | |
5632 | """ |
|
5476 | """ | |
5633 | Return Inputs Project: |
|
5477 | Return Inputs Project: | |
5634 | - server |
|
5478 | - server | |
5635 | - remotefolder |
|
5479 | - remotefolder | |
5636 | - username |
|
5480 | - username | |
5637 | - password |
|
5481 | - password | |
5638 | - ftp_wei |
|
5482 | - ftp_wei | |
5639 | - exp_code |
|
5483 | - exp_code | |
5640 | - sub_exp_code |
|
5484 | - sub_exp_code | |
5641 | - plot_pos |
|
5485 | - plot_pos | |
5642 | """ |
|
5486 | """ | |
5643 | name_server_ftp = str(self.serverFTP.text()) |
|
5487 | name_server_ftp = str(self.serverFTP.text()) | |
5644 | if not name_server_ftp: |
|
5488 | if not name_server_ftp: | |
5645 | self.console.clear() |
|
5489 | self.console.clear() | |
5646 | self.console.append("Please Write a FTP Server") |
|
5490 | self.console.append("Please Write a FTP Server") | |
5647 | return 0 |
|
5491 | return 0 | |
5648 |
|
5492 | |||
5649 | folder_server_ftp = str(self.folderFTP.text()) |
|
5493 | folder_server_ftp = str(self.folderFTP.text()) | |
5650 | if not folder_server_ftp: |
|
5494 | if not folder_server_ftp: | |
5651 | self.console.clear() |
|
5495 | self.console.clear() | |
5652 | self.console.append("Please Write a Folder") |
|
5496 | self.console.append("Please Write a Folder") | |
5653 | return 0 |
|
5497 | return 0 | |
5654 |
|
5498 | |||
5655 | username_ftp = str(self.usernameFTP.text()) |
|
5499 | username_ftp = str(self.usernameFTP.text()) | |
5656 | if not username_ftp: |
|
5500 | if not username_ftp: | |
5657 | self.console.clear() |
|
5501 | self.console.clear() | |
5658 | self.console.append("Please Write a User Name") |
|
5502 | self.console.append("Please Write a User Name") | |
5659 | return 0 |
|
5503 | return 0 | |
5660 |
|
5504 | |||
5661 | password_ftp = str(self.passwordFTP.text()) |
|
5505 | password_ftp = str(self.passwordFTP.text()) | |
5662 | if not password_ftp: |
|
5506 | if not password_ftp: | |
5663 | self.console.clear() |
|
5507 | self.console.clear() | |
5664 | self.console.append("Please Write a passwordFTP") |
|
5508 | self.console.append("Please Write a passwordFTP") | |
5665 | return 0 |
|
5509 | return 0 | |
5666 |
|
5510 | |||
5667 | ftp_wei = self.weightFTP.text() |
|
5511 | ftp_wei = str(self.weightFTP.text()) | |
5668 | if not ftp_wei == "": |
|
5512 | if not ftp_wei == "": | |
5669 | try: |
|
5513 | try: | |
5670 | ftp_wei = int(self.weightFTP.text()) |
|
5514 | ftp_wei = int(self.weightFTP.text()) | |
5671 | except: |
|
5515 | except: | |
5672 | self.console.clear() |
|
5516 | self.console.clear() | |
5673 | self.console.append("Please Write a ftp_wei number") |
|
5517 | self.console.append("Please Write a ftp_wei number") | |
5674 | return 0 |
|
5518 | return 0 | |
5675 |
|
5519 | |||
5676 | exp_code = self.expcodeFTP.text() |
|
5520 | exp_code = str(self.expcodeFTP.text()) | |
5677 | if not exp_code == "": |
|
5521 | if not exp_code == "": | |
5678 | try: |
|
5522 | try: | |
5679 | exp_code = int(self.expcodeFTP.text()) |
|
5523 | exp_code = int(self.expcodeFTP.text()) | |
5680 | except: |
|
5524 | except: | |
5681 | self.console.clear() |
|
5525 | self.console.clear() | |
5682 | self.console.append("Please Write a exp_code number") |
|
5526 | self.console.append("Please Write a exp_code number") | |
5683 | return 0 |
|
5527 | return 0 | |
5684 |
|
5528 | |||
5685 |
|
5529 | |||
5686 | sub_exp_code = self.subexpFTP.text() |
|
5530 | sub_exp_code = str(self.subexpFTP.text()) | |
5687 | if not sub_exp_code == "": |
|
5531 | if not sub_exp_code == "": | |
5688 | try: |
|
5532 | try: | |
5689 | sub_exp_code = int(self.subexpFTP.text()) |
|
5533 | sub_exp_code = int(self.subexpFTP.text()) | |
5690 | except: |
|
5534 | except: | |
5691 | self.console.clear() |
|
5535 | self.console.clear() | |
5692 | self.console.append("Please Write a sub_exp_code number") |
|
5536 | self.console.append("Please Write a sub_exp_code number") | |
5693 | return 0 |
|
5537 | return 0 | |
5694 |
|
5538 | |||
5695 | plot_pos = self.plotposFTP.text() |
|
5539 | plot_pos = str(self.plotposFTP.text()) | |
5696 | if not plot_pos == "": |
|
5540 | if not plot_pos == "": | |
5697 | try: |
|
5541 | try: | |
5698 | plot_pos = int(self.plotposFTP.text()) |
|
5542 | plot_pos = int(self.plotposFTP.text()) | |
5699 | except: |
|
5543 | except: | |
5700 | self.console.clear() |
|
5544 | self.console.clear() | |
5701 | self.console.append("Please Write a plot_pos number") |
|
5545 | self.console.append("Please Write a plot_pos number") | |
5702 | return 0 |
|
5546 | return 0 | |
5703 |
|
5547 | |||
5704 | return name_server_ftp, folder_server_ftp, username_ftp, password_ftp, ftp_wei, exp_code, sub_exp_code, plot_pos |
|
5548 | return name_server_ftp, folder_server_ftp, username_ftp, password_ftp, ftp_wei, exp_code, sub_exp_code, plot_pos | |
5705 |
|
5549 | |||
5706 | @pyqtSignature("") |
|
5550 | @pyqtSignature("") | |
5707 | def on_ftpOkButton_clicked(self): |
|
5551 | def on_ftpOkButton_clicked(self): | |
5708 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.getParmsFromFtpWindow() |
|
5552 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.getParmsFromFtpWindow() | |
5709 | self.create = True |
|
5553 | self.create = True | |
5710 | self.close() |
|
5554 | self.close() | |
5711 |
|
5555 | |||
5712 | @pyqtSignature("") |
|
5556 | @pyqtSignature("") | |
5713 | def on_ftpCancelButton_clicked(self): |
|
5557 | def on_ftpCancelButton_clicked(self): | |
5714 | self.create = False |
|
5558 | self.create = False | |
5715 | self.close() |
|
5559 | self.close() | |
5716 |
|
5560 | |||
5717 | def closeEvent(self, event): |
|
5561 | def closeEvent(self, event): | |
5718 | self.closed.emit() |
|
5562 | self.closed.emit() | |
5719 | event.accept() |
|
5563 | event.accept() | |
5720 |
|
5564 | |||
5721 | class ftpBuffer(): |
|
5565 | class ftpBuffer(): | |
5722 |
|
5566 | |||
5723 | server = None |
|
5567 | server = None | |
5724 | remotefolder = None |
|
5568 | remotefolder = None | |
5725 | username = None |
|
5569 | username = None | |
5726 | password = None |
|
5570 | password = None | |
5727 | ftp_wei = None |
|
5571 | ftp_wei = None | |
5728 | exp_code = None |
|
5572 | exp_code = None | |
5729 | sub_exp_code = None |
|
5573 | sub_exp_code = None | |
5730 | plot_pos = None |
|
5574 | plot_pos = None | |
5731 | create = False |
|
5575 | create = False | |
5732 | withoutconfig = False |
|
5576 | withoutconfig = False | |
5733 | createforView = False |
|
5577 | createforView = False | |
5734 | localfolder = None |
|
5578 | localfolder = None | |
5735 | extension = None |
|
5579 | extension = None | |
5736 | period = None |
|
5580 | period = None | |
5737 | protocol = None |
|
5581 | protocol = None | |
5738 |
|
5582 | |||
5739 | def __init__(self): |
|
5583 | def __init__(self): | |
5740 |
|
5584 | |||
5741 | self.create = False |
|
5585 | self.create = False | |
5742 | self.server = None |
|
5586 | self.server = None | |
5743 | self.remotefolder = None |
|
5587 | self.remotefolder = None | |
5744 | self.username = None |
|
5588 | self.username = None | |
5745 | self.password = None |
|
5589 | self.password = None | |
5746 | self.ftp_wei = None |
|
5590 | self.ftp_wei = None | |
5747 | self.exp_code = None |
|
5591 | self.exp_code = None | |
5748 | self.sub_exp_code = None |
|
5592 | self.sub_exp_code = None | |
5749 | self.plot_pos = None |
|
5593 | self.plot_pos = None | |
5750 | # self.create = False |
|
5594 | # self.create = False | |
5751 | self.localfolder = None |
|
5595 | self.localfolder = None | |
5752 | self.extension = None |
|
5596 | self.extension = None | |
5753 | self.period = None |
|
5597 | self.period = None | |
5754 | self.protocol = None |
|
5598 | self.protocol = None | |
5755 |
|
5599 | |||
5756 | def setwithoutconfiguration(self): |
|
5600 | def setwithoutconfiguration(self): | |
5757 |
|
5601 | |||
5758 | self.create = False |
|
5602 | self.create = False | |
5759 | self.server = "jro-app.igp.gob.pe" |
|
5603 | self.server = "jro-app.igp.gob.pe" | |
5760 | self.remotefolder = "/home/wmaster/graficos" |
|
5604 | self.remotefolder = "/home/wmaster/graficos" | |
5761 | self.username = "wmaster" |
|
5605 | self.username = "wmaster" | |
5762 | self.password = "mst2010vhf" |
|
5606 | self.password = "mst2010vhf" | |
5763 | self.withoutconfig = True |
|
5607 | self.withoutconfig = True | |
5764 | self.localfolder = './' |
|
5608 | self.localfolder = './' | |
5765 | self.extension = '.png' |
|
5609 | self.extension = '.png' | |
5766 |
self.period = |
|
5610 | self.period = 60 | |
5767 | self.protocol = 'ftp' |
|
5611 | self.protocol = 'ftp' | |
5768 | self.createforView = True |
|
5612 | self.createforView = True | |
5769 |
|
5613 | |||
5770 | if not self.ftp_wei: |
|
5614 | if not self.ftp_wei: | |
5771 |
self.ftp_wei = |
|
5615 | self.ftp_wei = 0 | |
5772 |
|
5616 | |||
5773 | if not self.exp_code: |
|
5617 | if not self.exp_code: | |
5774 |
self.exp_code = |
|
5618 | self.exp_code = 0 | |
5775 |
|
5619 | |||
5776 | if not self.sub_exp_code: |
|
5620 | if not self.sub_exp_code: | |
5777 |
self.sub_exp_code = |
|
5621 | self.sub_exp_code = 0 | |
5778 |
|
5622 | |||
5779 | if not self.plot_pos: |
|
5623 | if not self.plot_pos: | |
5780 |
self.plot_pos = |
|
5624 | self.plot_pos = 0 | |
5781 |
|
5625 | |||
5782 |
def save(self, server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos, localfolder='./', extension='.png', period= |
|
5626 | def save(self, server, remotefolder, username, password, ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, localfolder='./', extension='.png', period=60, protocol='ftp'): | |
5783 |
|
5627 | |||
5784 | self.server = server |
|
5628 | self.server = server | |
5785 | self.remotefolder = remotefolder |
|
5629 | self.remotefolder = remotefolder | |
5786 | self.username = username |
|
5630 | self.username = username | |
5787 | self.password = password |
|
5631 | self.password = password | |
5788 | self.ftp_wei = ftp_wei |
|
5632 | self.ftp_wei = ftp_wei | |
5789 | self.exp_code = exp_code |
|
5633 | self.exp_code = exp_code | |
5790 | self.sub_exp_code = sub_exp_code |
|
5634 | self.sub_exp_code = sub_exp_code | |
5791 | self.plot_pos = plot_pos |
|
5635 | self.plot_pos = plot_pos | |
5792 | self.create = True |
|
5636 | self.create = True | |
5793 | self.withoutconfig = False |
|
5637 | self.withoutconfig = False | |
5794 | self.createforView = True |
|
5638 | self.createforView = True | |
5795 | self.localfolder = localfolder |
|
5639 | self.localfolder = localfolder | |
5796 | self.extension = extension |
|
5640 | self.extension = extension | |
5797 | self.period = period |
|
5641 | self.period = period | |
5798 | self.protocol = protocol |
|
5642 | self.protocol = protocol | |
5799 |
|
5643 | |||
5800 | def recover(self): |
|
5644 | def recover(self): | |
5801 |
|
5645 | |||
5802 | return self.server, self.remotefolder, self.username, self.password, self.ftp_wei, self.exp_code, self.sub_exp_code, self.plot_pos, self.extension, self.period, self.protocol |
|
5646 | return self.server, self.remotefolder, self.username, self.password, self.ftp_wei, self.exp_code, self.sub_exp_code, self.plot_pos, self.extension, self.period, self.protocol | |
5803 |
|
5647 | |||
5804 | class ShowMeConsole(QtCore.QObject): |
|
5648 | class ShowMeConsole(QtCore.QObject): | |
5805 | textWritten = QtCore.pyqtSignal(str) |
|
5649 | textWritten = QtCore.pyqtSignal(str) | |
5806 | def write (self, text): |
|
5650 | def write (self, text): | |
5807 | self.textWritten.emit(str(text)) |
|
5651 | self.textWritten.emit(str(text)) | |
5808 |
|
5652 | |||
5809 | class PlotManager(): |
|
5653 | class PlotManager(): | |
5810 | def __init__(self, queue): |
|
5654 | def __init__(self, queue): | |
5811 | self.queue = queue |
|
5655 | self.queue = queue | |
5812 | self.objPlotDict = {} |
|
5656 | self.objPlotDict = {} | |
5813 |
|
5657 | |||
5814 | def processIncoming(self): |
|
5658 | def processIncoming(self): | |
5815 | while self.queue.qsize(): |
|
5659 | while self.queue.qsize(): | |
5816 | try: |
|
5660 | try: | |
5817 | dataFromQueue = self.queue.get(True) |
|
5661 | dataFromQueue = self.queue.get(True) | |
5818 | if dataFromQueue == None: |
|
5662 | if dataFromQueue == None: | |
5819 | continue |
|
5663 | continue | |
5820 |
|
5664 | |||
5821 | dataPlot = dataFromQueue['data'] |
|
5665 | dataPlot = dataFromQueue['data'] | |
5822 | kwargs = dataFromQueue['kwargs'] |
|
5666 | kwargs = dataFromQueue['kwargs'] | |
5823 | id = kwargs['id'] |
|
5667 | id = kwargs['id'] | |
5824 | if 'channelList' in kwargs.keys(): |
|
5668 | if 'channelList' in kwargs.keys(): | |
5825 | channelList = kwargs['channelList'] |
|
5669 | channelList = kwargs['channelList'] | |
5826 | else: |
|
5670 | else: | |
5827 | channelList = None |
|
5671 | channelList = None | |
5828 | plotname = kwargs.pop('type') |
|
5672 | plotname = kwargs.pop('type') | |
5829 |
|
5673 | |||
5830 | if not(id in self.objPlotDict.keys()): |
|
5674 | if not(id in self.objPlotDict.keys()): | |
5831 | className = eval(plotname) |
|
5675 | className = eval(plotname) | |
5832 | self.objPlotDict[id] = className(id, channelList, dataPlot) |
|
5676 | self.objPlotDict[id] = className(id, channelList, dataPlot) | |
5833 | self.objPlotDict[id].show() |
|
5677 | self.objPlotDict[id].show() | |
5834 |
|
5678 | |||
5835 | self.objPlotDict[id].run(dataPlot , **kwargs) |
|
5679 | self.objPlotDict[id].run(dataPlot , **kwargs) | |
5836 |
|
5680 | |||
5837 | except Queue.Empty: |
|
5681 | except Queue.Empty: | |
5838 | pass |
|
5682 | pass | |
5839 |
|
5683 | |||
5840 |
|
5684 |
@@ -1,1451 +1,1465 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Jul 2, 2014 |
|
2 | Created on Jul 2, 2014 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author: roj-idl71 | |
5 | ''' |
|
5 | ''' | |
6 | import os |
|
6 | import os | |
7 | import sys |
|
7 | import sys | |
8 | import glob |
|
8 | import glob | |
9 | import time |
|
9 | import time | |
10 | import numpy |
|
10 | import numpy | |
11 | import fnmatch |
|
11 | import fnmatch | |
12 | import time, datetime |
|
12 | import time, datetime | |
13 | #import h5py |
|
13 | #import h5py | |
14 | import traceback |
|
14 | import traceback | |
15 |
|
15 | |||
16 | try: |
|
16 | try: | |
17 | from gevent import sleep |
|
17 | from gevent import sleep | |
18 | except: |
|
18 | except: | |
19 | from time import sleep |
|
19 | from time import sleep | |
20 |
|
20 | |||
21 | from schainpy.model.data.jroheaderIO import PROCFLAG, BasicHeader, SystemHeader, RadarControllerHeader, ProcessingHeader |
|
21 | from schainpy.model.data.jroheaderIO import PROCFLAG, BasicHeader, SystemHeader, RadarControllerHeader, ProcessingHeader | |
22 |
|
22 | |||
23 | LOCALTIME = True |
|
23 | LOCALTIME = True | |
24 |
|
24 | |||
25 | def isNumber(cad): |
|
25 | def isNumber(cad): | |
26 | """ |
|
26 | """ | |
27 | Chequea si el conjunto de caracteres que componen un string puede ser convertidos a un numero. |
|
27 | Chequea si el conjunto de caracteres que componen un string puede ser convertidos a un numero. | |
28 |
|
28 | |||
29 | Excepciones: |
|
29 | Excepciones: | |
30 | Si un determinado string no puede ser convertido a numero |
|
30 | Si un determinado string no puede ser convertido a numero | |
31 | Input: |
|
31 | Input: | |
32 | str, string al cual se le analiza para determinar si convertible a un numero o no |
|
32 | str, string al cual se le analiza para determinar si convertible a un numero o no | |
33 |
|
33 | |||
34 | Return: |
|
34 | Return: | |
35 | True : si el string es uno numerico |
|
35 | True : si el string es uno numerico | |
36 | False : no es un string numerico |
|
36 | False : no es un string numerico | |
37 | """ |
|
37 | """ | |
38 | try: |
|
38 | try: | |
39 | float( cad ) |
|
39 | float( cad ) | |
40 | return True |
|
40 | return True | |
41 | except: |
|
41 | except: | |
42 | return False |
|
42 | return False | |
43 |
|
43 | |||
44 | def isThisFileinRange(filename, startUTSeconds, endUTSeconds): |
|
44 | def isThisFileinRange(filename, startUTSeconds, endUTSeconds): | |
45 | """ |
|
45 | """ | |
46 | Esta funcion determina si un archivo de datos se encuentra o no dentro del rango de fecha especificado. |
|
46 | Esta funcion determina si un archivo de datos se encuentra o no dentro del rango de fecha especificado. | |
47 |
|
47 | |||
48 | Inputs: |
|
48 | Inputs: | |
49 | filename : nombre completo del archivo de datos en formato Jicamarca (.r) |
|
49 | filename : nombre completo del archivo de datos en formato Jicamarca (.r) | |
50 |
|
50 | |||
51 | startUTSeconds : fecha inicial del rango seleccionado. La fecha esta dada en |
|
51 | startUTSeconds : fecha inicial del rango seleccionado. La fecha esta dada en | |
52 | segundos contados desde 01/01/1970. |
|
52 | segundos contados desde 01/01/1970. | |
53 | endUTSeconds : fecha final del rango seleccionado. La fecha esta dada en |
|
53 | endUTSeconds : fecha final del rango seleccionado. La fecha esta dada en | |
54 | segundos contados desde 01/01/1970. |
|
54 | segundos contados desde 01/01/1970. | |
55 |
|
55 | |||
56 | Return: |
|
56 | Return: | |
57 | Boolean : Retorna True si el archivo de datos contiene datos en el rango de |
|
57 | Boolean : Retorna True si el archivo de datos contiene datos en el rango de | |
58 | fecha especificado, de lo contrario retorna False. |
|
58 | fecha especificado, de lo contrario retorna False. | |
59 |
|
59 | |||
60 | Excepciones: |
|
60 | Excepciones: | |
61 | Si el archivo no existe o no puede ser abierto |
|
61 | Si el archivo no existe o no puede ser abierto | |
62 | Si la cabecera no puede ser leida. |
|
62 | Si la cabecera no puede ser leida. | |
63 |
|
63 | |||
64 | """ |
|
64 | """ | |
65 | basicHeaderObj = BasicHeader(LOCALTIME) |
|
65 | basicHeaderObj = BasicHeader(LOCALTIME) | |
66 |
|
66 | |||
67 | try: |
|
67 | try: | |
68 | fp = open(filename,'rb') |
|
68 | fp = open(filename,'rb') | |
69 | except IOError: |
|
69 | except IOError: | |
70 | traceback.print_exc() |
|
70 | traceback.print_exc() | |
71 | raise IOError, "The file %s can't be opened" %(filename) |
|
71 | raise IOError, "The file %s can't be opened" %(filename) | |
72 |
|
72 | |||
73 | sts = basicHeaderObj.read(fp) |
|
73 | sts = basicHeaderObj.read(fp) | |
74 | fp.close() |
|
74 | fp.close() | |
75 |
|
75 | |||
76 | if not(sts): |
|
76 | if not(sts): | |
77 | print "Skipping the file %s because it has not a valid header" %(filename) |
|
77 | print "Skipping the file %s because it has not a valid header" %(filename) | |
78 | return 0 |
|
78 | return 0 | |
79 |
|
79 | |||
80 | if not ((startUTSeconds <= basicHeaderObj.utc) and (endUTSeconds > basicHeaderObj.utc)): |
|
80 | if not ((startUTSeconds <= basicHeaderObj.utc) and (endUTSeconds > basicHeaderObj.utc)): | |
81 | return 0 |
|
81 | return 0 | |
82 |
|
82 | |||
83 | return 1 |
|
83 | return 1 | |
84 |
|
84 | |||
85 | def isFileinThisTime(filename, startTime, endTime): |
|
85 | def isFileinThisTime(filename, startTime, endTime): | |
86 | """ |
|
86 | """ | |
87 | Retorna 1 si el archivo de datos se encuentra dentro del rango de horas especificado. |
|
87 | Retorna 1 si el archivo de datos se encuentra dentro del rango de horas especificado. | |
88 |
|
88 | |||
89 | Inputs: |
|
89 | Inputs: | |
90 | filename : nombre completo del archivo de datos en formato Jicamarca (.r) |
|
90 | filename : nombre completo del archivo de datos en formato Jicamarca (.r) | |
91 |
|
91 | |||
92 | startTime : tiempo inicial del rango seleccionado en formato datetime.time |
|
92 | startTime : tiempo inicial del rango seleccionado en formato datetime.time | |
93 |
|
93 | |||
94 | endTime : tiempo final del rango seleccionado en formato datetime.time |
|
94 | endTime : tiempo final del rango seleccionado en formato datetime.time | |
95 |
|
95 | |||
96 | Return: |
|
96 | Return: | |
97 | Boolean : Retorna True si el archivo de datos contiene datos en el rango de |
|
97 | Boolean : Retorna True si el archivo de datos contiene datos en el rango de | |
98 | fecha especificado, de lo contrario retorna False. |
|
98 | fecha especificado, de lo contrario retorna False. | |
99 |
|
99 | |||
100 | Excepciones: |
|
100 | Excepciones: | |
101 | Si el archivo no existe o no puede ser abierto |
|
101 | Si el archivo no existe o no puede ser abierto | |
102 | Si la cabecera no puede ser leida. |
|
102 | Si la cabecera no puede ser leida. | |
103 |
|
103 | |||
104 | """ |
|
104 | """ | |
105 |
|
105 | |||
106 |
|
106 | |||
107 | try: |
|
107 | try: | |
108 | fp = open(filename,'rb') |
|
108 | fp = open(filename,'rb') | |
109 | except IOError: |
|
109 | except IOError: | |
110 | traceback.print_exc() |
|
110 | traceback.print_exc() | |
111 | raise IOError, "The file %s can't be opened" %(filename) |
|
111 | raise IOError, "The file %s can't be opened" %(filename) | |
112 |
|
112 | |||
113 | basicHeaderObj = BasicHeader(LOCALTIME) |
|
113 | basicHeaderObj = BasicHeader(LOCALTIME) | |
114 | sts = basicHeaderObj.read(fp) |
|
114 | sts = basicHeaderObj.read(fp) | |
115 | fp.close() |
|
115 | fp.close() | |
116 |
|
116 | |||
117 | thisDatetime = basicHeaderObj.datatime |
|
117 | thisDatetime = basicHeaderObj.datatime | |
118 | thisTime = thisDatetime.time() |
|
118 | thisTime = thisDatetime.time() | |
119 |
|
119 | |||
120 | if not(sts): |
|
120 | if not(sts): | |
121 | print "Skipping the file %s because it has not a valid header" %(filename) |
|
121 | print "Skipping the file %s because it has not a valid header" %(filename) | |
122 | return None |
|
122 | return None | |
123 |
|
123 | |||
124 | if not ((startTime <= thisTime) and (endTime > thisTime)): |
|
124 | if not ((startTime <= thisTime) and (endTime > thisTime)): | |
125 | return None |
|
125 | return None | |
126 |
|
126 | |||
127 | return thisDatetime |
|
127 | return thisDatetime | |
128 |
|
128 | |||
129 | def getFileFromSet(path, ext, set): |
|
129 | def getFileFromSet(path, ext, set): | |
130 | validFilelist = [] |
|
130 | validFilelist = [] | |
131 | fileList = os.listdir(path) |
|
131 | fileList = os.listdir(path) | |
132 |
|
132 | |||
133 | # 0 1234 567 89A BCDE |
|
133 | # 0 1234 567 89A BCDE | |
134 | # H YYYY DDD SSS .ext |
|
134 | # H YYYY DDD SSS .ext | |
135 |
|
135 | |||
136 | for thisFile in fileList: |
|
136 | for thisFile in fileList: | |
137 | try: |
|
137 | try: | |
138 | year = int(thisFile[1:5]) |
|
138 | year = int(thisFile[1:5]) | |
139 | doy = int(thisFile[5:8]) |
|
139 | doy = int(thisFile[5:8]) | |
140 | except: |
|
140 | except: | |
141 | continue |
|
141 | continue | |
142 |
|
142 | |||
143 | if (os.path.splitext(thisFile)[-1].lower() != ext.lower()): |
|
143 | if (os.path.splitext(thisFile)[-1].lower() != ext.lower()): | |
144 | continue |
|
144 | continue | |
145 |
|
145 | |||
146 | validFilelist.append(thisFile) |
|
146 | validFilelist.append(thisFile) | |
147 |
|
147 | |||
148 | myfile = fnmatch.filter(validFilelist,'*%4.4d%3.3d%3.3d*'%(year,doy,set)) |
|
148 | myfile = fnmatch.filter(validFilelist,'*%4.4d%3.3d%3.3d*'%(year,doy,set)) | |
149 |
|
149 | |||
150 | if len(myfile)!= 0: |
|
150 | if len(myfile)!= 0: | |
151 | return myfile[0] |
|
151 | return myfile[0] | |
152 | else: |
|
152 | else: | |
153 | filename = '*%4.4d%3.3d%3.3d%s'%(year,doy,set,ext.lower()) |
|
153 | filename = '*%4.4d%3.3d%3.3d%s'%(year,doy,set,ext.lower()) | |
154 | print 'the filename %s does not exist'%filename |
|
154 | print 'the filename %s does not exist'%filename | |
155 | print '...going to the last file: ' |
|
155 | print '...going to the last file: ' | |
156 |
|
156 | |||
157 | if validFilelist: |
|
157 | if validFilelist: | |
158 | validFilelist = sorted( validFilelist, key=str.lower ) |
|
158 | validFilelist = sorted( validFilelist, key=str.lower ) | |
159 | return validFilelist[-1] |
|
159 | return validFilelist[-1] | |
160 |
|
160 | |||
161 | return None |
|
161 | return None | |
162 |
|
162 | |||
163 | def getlastFileFromPath(path, ext): |
|
163 | def getlastFileFromPath(path, ext): | |
164 | """ |
|
164 | """ | |
165 | Depura el fileList dejando solo los que cumplan el formato de "PYYYYDDDSSS.ext" |
|
165 | Depura el fileList dejando solo los que cumplan el formato de "PYYYYDDDSSS.ext" | |
166 | al final de la depuracion devuelve el ultimo file de la lista que quedo. |
|
166 | al final de la depuracion devuelve el ultimo file de la lista que quedo. | |
167 |
|
167 | |||
168 | Input: |
|
168 | Input: | |
169 | fileList : lista conteniendo todos los files (sin path) que componen una determinada carpeta |
|
169 | fileList : lista conteniendo todos los files (sin path) que componen una determinada carpeta | |
170 | ext : extension de los files contenidos en una carpeta |
|
170 | ext : extension de los files contenidos en una carpeta | |
171 |
|
171 | |||
172 | Return: |
|
172 | Return: | |
173 | El ultimo file de una determinada carpeta, no se considera el path. |
|
173 | El ultimo file de una determinada carpeta, no se considera el path. | |
174 | """ |
|
174 | """ | |
175 | validFilelist = [] |
|
175 | validFilelist = [] | |
176 | fileList = os.listdir(path) |
|
176 | fileList = os.listdir(path) | |
177 |
|
177 | |||
178 | # 0 1234 567 89A BCDE |
|
178 | # 0 1234 567 89A BCDE | |
179 | # H YYYY DDD SSS .ext |
|
179 | # H YYYY DDD SSS .ext | |
180 |
|
180 | |||
181 | for thisFile in fileList: |
|
181 | for thisFile in fileList: | |
182 |
|
182 | |||
183 | year = thisFile[1:5] |
|
183 | year = thisFile[1:5] | |
184 | if not isNumber(year): |
|
184 | if not isNumber(year): | |
185 | continue |
|
185 | continue | |
186 |
|
186 | |||
187 | doy = thisFile[5:8] |
|
187 | doy = thisFile[5:8] | |
188 | if not isNumber(doy): |
|
188 | if not isNumber(doy): | |
189 | continue |
|
189 | continue | |
190 |
|
190 | |||
191 | year = int(year) |
|
191 | year = int(year) | |
192 | doy = int(doy) |
|
192 | doy = int(doy) | |
193 |
|
193 | |||
194 | if (os.path.splitext(thisFile)[-1].lower() != ext.lower()): |
|
194 | if (os.path.splitext(thisFile)[-1].lower() != ext.lower()): | |
195 | continue |
|
195 | continue | |
196 |
|
196 | |||
197 | validFilelist.append(thisFile) |
|
197 | validFilelist.append(thisFile) | |
198 |
|
198 | |||
199 | if validFilelist: |
|
199 | if validFilelist: | |
200 | validFilelist = sorted( validFilelist, key=str.lower ) |
|
200 | validFilelist = sorted( validFilelist, key=str.lower ) | |
201 | return validFilelist[-1] |
|
201 | return validFilelist[-1] | |
202 |
|
202 | |||
203 | return None |
|
203 | return None | |
204 |
|
204 | |||
205 | def checkForRealPath(path, foldercounter, year, doy, set, ext): |
|
205 | def checkForRealPath(path, foldercounter, year, doy, set, ext): | |
206 | """ |
|
206 | """ | |
207 | Por ser Linux Case Sensitive entonces checkForRealPath encuentra el nombre correcto de un path, |
|
207 | Por ser Linux Case Sensitive entonces checkForRealPath encuentra el nombre correcto de un path, | |
208 | Prueba por varias combinaciones de nombres entre mayusculas y minusculas para determinar |
|
208 | Prueba por varias combinaciones de nombres entre mayusculas y minusculas para determinar | |
209 | el path exacto de un determinado file. |
|
209 | el path exacto de un determinado file. | |
210 |
|
210 | |||
211 | Example : |
|
211 | Example : | |
212 | nombre correcto del file es .../.../D2009307/P2009307367.ext |
|
212 | nombre correcto del file es .../.../D2009307/P2009307367.ext | |
213 |
|
213 | |||
214 | Entonces la funcion prueba con las siguientes combinaciones |
|
214 | Entonces la funcion prueba con las siguientes combinaciones | |
215 | .../.../y2009307367.ext |
|
215 | .../.../y2009307367.ext | |
216 | .../.../Y2009307367.ext |
|
216 | .../.../Y2009307367.ext | |
217 | .../.../x2009307/y2009307367.ext |
|
217 | .../.../x2009307/y2009307367.ext | |
218 | .../.../x2009307/Y2009307367.ext |
|
218 | .../.../x2009307/Y2009307367.ext | |
219 | .../.../X2009307/y2009307367.ext |
|
219 | .../.../X2009307/y2009307367.ext | |
220 | .../.../X2009307/Y2009307367.ext |
|
220 | .../.../X2009307/Y2009307367.ext | |
221 | siendo para este caso, la ultima combinacion de letras, identica al file buscado |
|
221 | siendo para este caso, la ultima combinacion de letras, identica al file buscado | |
222 |
|
222 | |||
223 | Return: |
|
223 | Return: | |
224 | Si encuentra la cobinacion adecuada devuelve el path completo y el nombre del file |
|
224 | Si encuentra la cobinacion adecuada devuelve el path completo y el nombre del file | |
225 | caso contrario devuelve None como path y el la ultima combinacion de nombre en mayusculas |
|
225 | caso contrario devuelve None como path y el la ultima combinacion de nombre en mayusculas | |
226 | para el filename |
|
226 | para el filename | |
227 | """ |
|
227 | """ | |
228 | fullfilename = None |
|
228 | fullfilename = None | |
229 | find_flag = False |
|
229 | find_flag = False | |
230 | filename = None |
|
230 | filename = None | |
231 |
|
231 | |||
232 | prefixDirList = [None,'d','D'] |
|
232 | prefixDirList = [None,'d','D'] | |
233 | if ext.lower() == ".r": #voltage |
|
233 | if ext.lower() == ".r": #voltage | |
234 | prefixFileList = ['d','D'] |
|
234 | prefixFileList = ['d','D'] | |
235 | elif ext.lower() == ".pdata": #spectra |
|
235 | elif ext.lower() == ".pdata": #spectra | |
236 | prefixFileList = ['p','P'] |
|
236 | prefixFileList = ['p','P'] | |
237 | else: |
|
237 | else: | |
238 | return None, filename |
|
238 | return None, filename | |
239 |
|
239 | |||
240 | #barrido por las combinaciones posibles |
|
240 | #barrido por las combinaciones posibles | |
241 | for prefixDir in prefixDirList: |
|
241 | for prefixDir in prefixDirList: | |
242 | thispath = path |
|
242 | thispath = path | |
243 | if prefixDir != None: |
|
243 | if prefixDir != None: | |
244 | #formo el nombre del directorio xYYYYDDD (x=d o x=D) |
|
244 | #formo el nombre del directorio xYYYYDDD (x=d o x=D) | |
245 | if foldercounter == 0: |
|
245 | if foldercounter == 0: | |
246 | thispath = os.path.join(path, "%s%04d%03d" % ( prefixDir, year, doy )) |
|
246 | thispath = os.path.join(path, "%s%04d%03d" % ( prefixDir, year, doy )) | |
247 | else: |
|
247 | else: | |
248 | thispath = os.path.join(path, "%s%04d%03d_%02d" % ( prefixDir, year, doy , foldercounter)) |
|
248 | thispath = os.path.join(path, "%s%04d%03d_%02d" % ( prefixDir, year, doy , foldercounter)) | |
249 | for prefixFile in prefixFileList: #barrido por las dos combinaciones posibles de "D" |
|
249 | for prefixFile in prefixFileList: #barrido por las dos combinaciones posibles de "D" | |
250 | filename = "%s%04d%03d%03d%s" % ( prefixFile, year, doy, set, ext ) #formo el nombre del file xYYYYDDDSSS.ext |
|
250 | filename = "%s%04d%03d%03d%s" % ( prefixFile, year, doy, set, ext ) #formo el nombre del file xYYYYDDDSSS.ext | |
251 | fullfilename = os.path.join( thispath, filename ) #formo el path completo |
|
251 | fullfilename = os.path.join( thispath, filename ) #formo el path completo | |
252 |
|
252 | |||
253 | if os.path.exists( fullfilename ): #verifico que exista |
|
253 | if os.path.exists( fullfilename ): #verifico que exista | |
254 | find_flag = True |
|
254 | find_flag = True | |
255 | break |
|
255 | break | |
256 | if find_flag: |
|
256 | if find_flag: | |
257 | break |
|
257 | break | |
258 |
|
258 | |||
259 | if not(find_flag): |
|
259 | if not(find_flag): | |
260 | return None, filename |
|
260 | return None, filename | |
261 |
|
261 | |||
262 | return fullfilename, filename |
|
262 | return fullfilename, filename | |
263 |
|
263 | |||
264 | def isRadarFolder(folder): |
|
264 | def isRadarFolder(folder): | |
265 | try: |
|
265 | try: | |
266 | year = int(folder[1:5]) |
|
266 | year = int(folder[1:5]) | |
267 | doy = int(folder[5:8]) |
|
267 | doy = int(folder[5:8]) | |
268 | except: |
|
268 | except: | |
269 | return 0 |
|
269 | return 0 | |
270 |
|
270 | |||
271 | return 1 |
|
271 | return 1 | |
272 |
|
272 | |||
273 | def isRadarFile(file): |
|
273 | def isRadarFile(file): | |
274 | try: |
|
274 | try: | |
275 | year = int(file[1:5]) |
|
275 | year = int(file[1:5]) | |
276 | doy = int(file[5:8]) |
|
276 | doy = int(file[5:8]) | |
277 | set = int(file[8:11]) |
|
277 | set = int(file[8:11]) | |
278 | except: |
|
278 | except: | |
279 | return 0 |
|
279 | return 0 | |
280 |
|
280 | |||
281 | return 1 |
|
281 | return 1 | |
282 |
|
282 | |||
283 | def getDateFromRadarFile(file): |
|
283 | def getDateFromRadarFile(file): | |
284 | try: |
|
284 | try: | |
285 | year = int(file[1:5]) |
|
285 | year = int(file[1:5]) | |
286 | doy = int(file[5:8]) |
|
286 | doy = int(file[5:8]) | |
287 | set = int(file[8:11]) |
|
287 | set = int(file[8:11]) | |
288 | except: |
|
288 | except: | |
289 | return None |
|
289 | return None | |
290 |
|
290 | |||
291 | thisDate = datetime.date(year, 1, 1) + datetime.timedelta(doy-1) |
|
291 | thisDate = datetime.date(year, 1, 1) + datetime.timedelta(doy-1) | |
292 | return thisDate |
|
292 | return thisDate | |
293 |
|
293 | |||
294 | class JRODataIO: |
|
294 | class JRODataIO: | |
295 |
|
295 | |||
296 | c = 3E8 |
|
296 | c = 3E8 | |
297 |
|
297 | |||
298 | isConfig = False |
|
298 | isConfig = False | |
299 |
|
299 | |||
300 | basicHeaderObj = None |
|
300 | basicHeaderObj = None | |
301 |
|
301 | |||
302 | systemHeaderObj = None |
|
302 | systemHeaderObj = None | |
303 |
|
303 | |||
304 | radarControllerHeaderObj = None |
|
304 | radarControllerHeaderObj = None | |
305 |
|
305 | |||
306 | processingHeaderObj = None |
|
306 | processingHeaderObj = None | |
307 |
|
307 | |||
308 | online = 0 |
|
308 | online = 0 | |
309 |
|
309 | |||
310 | dtype = None |
|
310 | dtype = None | |
311 |
|
311 | |||
312 | pathList = [] |
|
312 | pathList = [] | |
313 |
|
313 | |||
314 | filenameList = [] |
|
314 | filenameList = [] | |
315 |
|
315 | |||
316 | filename = None |
|
316 | filename = None | |
317 |
|
317 | |||
318 | ext = None |
|
318 | ext = None | |
319 |
|
319 | |||
320 | flagIsNewFile = 1 |
|
320 | flagIsNewFile = 1 | |
321 |
|
321 | |||
322 | flagDiscontinuousBlock = 0 |
|
322 | flagDiscontinuousBlock = 0 | |
323 |
|
323 | |||
324 | flagIsNewBlock = 0 |
|
324 | flagIsNewBlock = 0 | |
325 |
|
325 | |||
326 | fp = None |
|
326 | fp = None | |
327 |
|
327 | |||
328 | firstHeaderSize = 0 |
|
328 | firstHeaderSize = 0 | |
329 |
|
329 | |||
330 | basicHeaderSize = 24 |
|
330 | basicHeaderSize = 24 | |
331 |
|
331 | |||
332 | versionFile = 1103 |
|
332 | versionFile = 1103 | |
333 |
|
333 | |||
334 | fileSize = None |
|
334 | fileSize = None | |
335 |
|
335 | |||
336 | # ippSeconds = None |
|
336 | # ippSeconds = None | |
337 |
|
337 | |||
338 | fileSizeByHeader = None |
|
338 | fileSizeByHeader = None | |
339 |
|
339 | |||
340 | fileIndex = None |
|
340 | fileIndex = None | |
341 |
|
341 | |||
342 | profileIndex = None |
|
342 | profileIndex = None | |
343 |
|
343 | |||
344 | blockIndex = None |
|
344 | blockIndex = None | |
345 |
|
345 | |||
346 | nTotalBlocks = None |
|
346 | nTotalBlocks = None | |
347 |
|
347 | |||
348 | maxTimeStep = 30 |
|
348 | maxTimeStep = 30 | |
349 |
|
349 | |||
350 | lastUTTime = None |
|
350 | lastUTTime = None | |
351 |
|
351 | |||
352 | datablock = None |
|
352 | datablock = None | |
353 |
|
353 | |||
354 | dataOut = None |
|
354 | dataOut = None | |
355 |
|
355 | |||
356 | blocksize = None |
|
356 | blocksize = None | |
357 |
|
357 | |||
358 | getByBlock = False |
|
358 | getByBlock = False | |
359 |
|
359 | |||
360 | def __init__(self): |
|
360 | def __init__(self): | |
361 |
|
361 | |||
362 | raise ValueError, "Not implemented" |
|
362 | raise ValueError, "Not implemented" | |
363 |
|
363 | |||
364 | def run(self): |
|
364 | def run(self): | |
365 |
|
365 | |||
366 | raise ValueError, "Not implemented" |
|
366 | raise ValueError, "Not implemented" | |
367 |
|
367 | |||
368 | class JRODataReader(JRODataIO): |
|
368 | class JRODataReader(JRODataIO): | |
369 |
|
369 | |||
370 | nReadBlocks = 0 |
|
370 | nReadBlocks = 0 | |
371 |
|
371 | |||
372 | delay = 10 #number of seconds waiting a new file |
|
372 | delay = 10 #number of seconds waiting a new file | |
373 |
|
373 | |||
374 | nTries = 3 #quantity tries |
|
374 | nTries = 3 #quantity tries | |
375 |
|
375 | |||
376 | nFiles = 3 #number of files for searching |
|
376 | nFiles = 3 #number of files for searching | |
377 |
|
377 | |||
378 | path = None |
|
378 | path = None | |
379 |
|
379 | |||
380 | foldercounter = 0 |
|
380 | foldercounter = 0 | |
381 |
|
381 | |||
382 | flagNoMoreFiles = 0 |
|
382 | flagNoMoreFiles = 0 | |
383 |
|
383 | |||
384 | datetimeList = [] |
|
384 | datetimeList = [] | |
385 |
|
385 | |||
386 | __isFirstTimeOnline = 1 |
|
386 | __isFirstTimeOnline = 1 | |
387 |
|
387 | |||
388 | __printInfo = True |
|
388 | __printInfo = True | |
389 |
|
389 | |||
390 | profileIndex = None |
|
390 | profileIndex = None | |
391 |
|
391 | |||
392 | nTxs = 1 |
|
392 | nTxs = 1 | |
393 |
|
393 | |||
394 | txIndex = None |
|
394 | txIndex = None | |
395 |
|
395 | |||
396 | def __init__(self): |
|
396 | def __init__(self): | |
397 |
|
397 | |||
398 | """ |
|
398 | """ | |
399 |
|
399 | |||
400 | """ |
|
400 | """ | |
401 |
|
401 | |||
402 | # raise NotImplementedError, "This method has not been implemented" |
|
402 | # raise NotImplementedError, "This method has not been implemented" | |
403 |
|
403 | |||
404 |
|
404 | |||
405 | def createObjByDefault(self): |
|
405 | def createObjByDefault(self): | |
406 | """ |
|
406 | """ | |
407 |
|
407 | |||
408 | """ |
|
408 | """ | |
409 | raise NotImplementedError, "This method has not been implemented" |
|
409 | raise NotImplementedError, "This method has not been implemented" | |
410 |
|
410 | |||
411 | def getBlockDimension(self): |
|
411 | def getBlockDimension(self): | |
412 |
|
412 | |||
413 | raise NotImplementedError, "No implemented" |
|
413 | raise NotImplementedError, "No implemented" | |
414 |
|
414 | |||
415 | def __searchFilesOffLine(self, |
|
415 | def __searchFilesOffLine(self, | |
416 | path, |
|
416 | path, | |
417 | startDate=None, |
|
417 | startDate=None, | |
418 | endDate=None, |
|
418 | endDate=None, | |
419 | startTime=datetime.time(0,0,0), |
|
419 | startTime=datetime.time(0,0,0), | |
420 | endTime=datetime.time(23,59,59), |
|
420 | endTime=datetime.time(23,59,59), | |
421 | set=None, |
|
421 | set=None, | |
422 | expLabel='', |
|
422 | expLabel='', | |
423 | ext='.r', |
|
423 | ext='.r', | |
424 | walk=True): |
|
424 | walk=True): | |
425 |
|
425 | |||
426 | self.filenameList = [] |
|
426 | self.filenameList = [] | |
427 | self.datetimeList = [] |
|
427 | self.datetimeList = [] | |
428 |
|
428 | |||
429 | pathList = [] |
|
429 | pathList = [] | |
430 |
|
430 | |||
431 | if not walk: |
|
431 | if not walk: | |
432 | #pathList.append(path) |
|
432 | #pathList.append(path) | |
433 | multi_path = path.split(',') |
|
433 | multi_path = path.split(',') | |
434 | for single_path in multi_path: |
|
434 | for single_path in multi_path: | |
|
435 | ||||
|
436 | if not os.path.isdir(single_path): | |||
|
437 | continue | |||
|
438 | ||||
435 | pathList.append(single_path) |
|
439 | pathList.append(single_path) | |
436 |
|
440 | |||
437 | else: |
|
441 | else: | |
438 | #dirList = [] |
|
442 | #dirList = [] | |
439 | multi_path = path.split(',') |
|
443 | multi_path = path.split(',') | |
440 | for single_path in multi_path: |
|
444 | for single_path in multi_path: | |
|
445 | ||||
|
446 | if not os.path.isdir(single_path): | |||
|
447 | continue | |||
|
448 | ||||
441 | dirList = [] |
|
449 | dirList = [] | |
442 | for thisPath in os.listdir(single_path): |
|
450 | for thisPath in os.listdir(single_path): | |
443 | if not os.path.isdir(os.path.join(single_path,thisPath)): |
|
451 | if not os.path.isdir(os.path.join(single_path,thisPath)): | |
444 | continue |
|
452 | continue | |
445 | if not isRadarFolder(thisPath): |
|
453 | if not isRadarFolder(thisPath): | |
446 | continue |
|
454 | continue | |
447 |
|
455 | |||
448 | dirList.append(thisPath) |
|
456 | dirList.append(thisPath) | |
449 |
|
457 | |||
450 | if not(dirList): |
|
458 | if not(dirList): | |
451 | return None, None |
|
459 | return None, None | |
452 |
|
460 | |||
453 | if startDate and endDate: |
|
461 | if startDate and endDate: | |
454 | thisDate = startDate |
|
462 | thisDate = startDate | |
455 |
|
463 | |||
456 | while(thisDate <= endDate): |
|
464 | while(thisDate <= endDate): | |
457 | year = thisDate.timetuple().tm_year |
|
465 | year = thisDate.timetuple().tm_year | |
458 | doy = thisDate.timetuple().tm_yday |
|
466 | doy = thisDate.timetuple().tm_yday | |
459 |
|
467 | |||
460 | matchlist = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy) + '*') |
|
468 | matchlist = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy) + '*') | |
461 | if len(matchlist) == 0: |
|
469 | if len(matchlist) == 0: | |
462 | thisDate += datetime.timedelta(1) |
|
470 | thisDate += datetime.timedelta(1) | |
463 | continue |
|
471 | continue | |
464 | for match in matchlist: |
|
472 | for match in matchlist: | |
465 | pathList.append(os.path.join(single_path,match,expLabel)) |
|
473 | pathList.append(os.path.join(single_path,match,expLabel)) | |
466 |
|
474 | |||
467 | thisDate += datetime.timedelta(1) |
|
475 | thisDate += datetime.timedelta(1) | |
468 | else: |
|
476 | else: | |
469 | for thiDir in dirList: |
|
477 | for thiDir in dirList: | |
470 | pathList.append(os.path.join(single_path,thiDir,expLabel)) |
|
478 | pathList.append(os.path.join(single_path,thiDir,expLabel)) | |
471 |
|
479 | |||
472 | if pathList == []: |
|
480 | if pathList == []: | |
473 | print "Any folder was found for the date range: %s-%s" %(startDate, endDate) |
|
481 | print "Any folder was found for the date range: %s-%s" %(startDate, endDate) | |
474 | return None, None |
|
482 | return None, None | |
475 |
|
483 | |||
476 | print "%d folder(s) was(were) found for the date range: %s - %s" %(len(pathList), startDate, endDate) |
|
484 | print "%d folder(s) was(were) found for the date range: %s - %s" %(len(pathList), startDate, endDate) | |
477 |
|
485 | |||
478 | filenameList = [] |
|
486 | filenameList = [] | |
479 | datetimeList = [] |
|
487 | datetimeList = [] | |
480 | pathDict = {} |
|
488 | pathDict = {} | |
481 | filenameList_to_sort = [] |
|
489 | filenameList_to_sort = [] | |
482 |
|
490 | |||
483 | for i in range(len(pathList)): |
|
491 | for i in range(len(pathList)): | |
484 |
|
492 | |||
485 | thisPath = pathList[i] |
|
493 | thisPath = pathList[i] | |
486 |
|
494 | |||
487 | fileList = glob.glob1(thisPath, "*%s" %ext) |
|
495 | fileList = glob.glob1(thisPath, "*%s" %ext) | |
488 | if len(fileList) < 1: |
|
496 | if len(fileList) < 1: | |
489 | continue |
|
497 | continue | |
490 | fileList.sort() |
|
498 | fileList.sort() | |
491 | pathDict.setdefault(fileList[0]) |
|
499 | pathDict.setdefault(fileList[0]) | |
492 | pathDict[fileList[0]] = i |
|
500 | pathDict[fileList[0]] = i | |
493 | filenameList_to_sort.append(fileList[0]) |
|
501 | filenameList_to_sort.append(fileList[0]) | |
494 |
|
502 | |||
495 | filenameList_to_sort.sort() |
|
503 | filenameList_to_sort.sort() | |
496 |
|
504 | |||
497 | for file in filenameList_to_sort: |
|
505 | for file in filenameList_to_sort: | |
498 | thisPath = pathList[pathDict[file]] |
|
506 | thisPath = pathList[pathDict[file]] | |
499 |
|
507 | |||
500 | fileList = glob.glob1(thisPath, "*%s" %ext) |
|
508 | fileList = glob.glob1(thisPath, "*%s" %ext) | |
501 | fileList.sort() |
|
509 | fileList.sort() | |
502 |
|
510 | |||
503 | for file in fileList: |
|
511 | for file in fileList: | |
504 |
|
512 | |||
505 | filename = os.path.join(thisPath,file) |
|
513 | filename = os.path.join(thisPath,file) | |
506 | thisDatetime = isFileinThisTime(filename, startTime, endTime) |
|
514 | thisDatetime = isFileinThisTime(filename, startTime, endTime) | |
507 |
|
515 | |||
508 | if not(thisDatetime): |
|
516 | if not(thisDatetime): | |
509 | continue |
|
517 | continue | |
510 |
|
518 | |||
511 | filenameList.append(filename) |
|
519 | filenameList.append(filename) | |
512 | datetimeList.append(thisDatetime) |
|
520 | datetimeList.append(thisDatetime) | |
513 |
|
521 | |||
514 | if not(filenameList): |
|
522 | if not(filenameList): | |
515 | print "Any file was found for the time range %s - %s" %(startTime, endTime) |
|
523 | print "Any file was found for the time range %s - %s" %(startTime, endTime) | |
516 | return None, None |
|
524 | return None, None | |
517 |
|
525 | |||
518 | print "%d file(s) was(were) found for the time range: %s - %s" %(len(filenameList), startTime, endTime) |
|
526 | print "%d file(s) was(were) found for the time range: %s - %s" %(len(filenameList), startTime, endTime) | |
519 |
|
527 | |||
520 |
|
528 | |||
521 | for i in range(len(filenameList)): |
|
529 | for i in range(len(filenameList)): | |
522 | print "%s -> [%s]" %(filenameList[i], datetimeList[i].ctime()) |
|
530 | print "%s -> [%s]" %(filenameList[i], datetimeList[i].ctime()) | |
523 |
|
531 | |||
524 | self.filenameList = filenameList |
|
532 | self.filenameList = filenameList | |
525 | self.datetimeList = datetimeList |
|
533 | self.datetimeList = datetimeList | |
526 |
|
534 | |||
527 | return pathList, filenameList |
|
535 | return pathList, filenameList | |
528 |
|
536 | |||
529 | def __searchFilesOnLine(self, path, expLabel = "", ext = None, walk=True, set=None): |
|
537 | def __searchFilesOnLine(self, path, expLabel = "", ext = None, walk=True, set=None): | |
530 |
|
538 | |||
531 | """ |
|
539 | """ | |
532 | Busca el ultimo archivo de la ultima carpeta (determinada o no por startDateTime) y |
|
540 | Busca el ultimo archivo de la ultima carpeta (determinada o no por startDateTime) y | |
533 | devuelve el archivo encontrado ademas de otros datos. |
|
541 | devuelve el archivo encontrado ademas de otros datos. | |
534 |
|
542 | |||
535 | Input: |
|
543 | Input: | |
536 | path : carpeta donde estan contenidos los files que contiene data |
|
544 | path : carpeta donde estan contenidos los files que contiene data | |
537 |
|
545 | |||
538 | expLabel : Nombre del subexperimento (subfolder) |
|
546 | expLabel : Nombre del subexperimento (subfolder) | |
539 |
|
547 | |||
540 | ext : extension de los files |
|
548 | ext : extension de los files | |
541 |
|
549 | |||
542 | walk : Si es habilitado no realiza busquedas dentro de los ubdirectorios (doypath) |
|
550 | walk : Si es habilitado no realiza busquedas dentro de los ubdirectorios (doypath) | |
543 |
|
551 | |||
544 | Return: |
|
552 | Return: | |
545 | directory : eL directorio donde esta el file encontrado |
|
553 | directory : eL directorio donde esta el file encontrado | |
546 | filename : el ultimo file de una determinada carpeta |
|
554 | filename : el ultimo file de una determinada carpeta | |
547 | year : el anho |
|
555 | year : el anho | |
548 | doy : el numero de dia del anho |
|
556 | doy : el numero de dia del anho | |
549 | set : el set del archivo |
|
557 | set : el set del archivo | |
550 |
|
558 | |||
551 |
|
559 | |||
552 | """ |
|
560 | """ | |
553 | dirList = [] |
|
561 | dirList = [] | |
554 |
|
562 | |||
555 | if not walk: |
|
563 | if not walk: | |
556 | fullpath = path |
|
564 | fullpath = path | |
557 | foldercounter = 0 |
|
565 | foldercounter = 0 | |
558 | else: |
|
566 | else: | |
559 | #Filtra solo los directorios |
|
567 | #Filtra solo los directorios | |
560 | for thisPath in os.listdir(path): |
|
568 | for thisPath in os.listdir(path): | |
561 | if not os.path.isdir(os.path.join(path,thisPath)): |
|
569 | if not os.path.isdir(os.path.join(path,thisPath)): | |
562 | continue |
|
570 | continue | |
563 | if not isRadarFolder(thisPath): |
|
571 | if not isRadarFolder(thisPath): | |
564 | continue |
|
572 | continue | |
565 |
|
573 | |||
566 | dirList.append(thisPath) |
|
574 | dirList.append(thisPath) | |
567 |
|
575 | |||
568 | if not(dirList): |
|
576 | if not(dirList): | |
569 | return None, None, None, None, None, None |
|
577 | return None, None, None, None, None, None | |
570 |
|
578 | |||
571 | dirList = sorted( dirList, key=str.lower ) |
|
579 | dirList = sorted( dirList, key=str.lower ) | |
572 |
|
580 | |||
573 | doypath = dirList[-1] |
|
581 | doypath = dirList[-1] | |
574 | foldercounter = int(doypath.split('_')[1]) if len(doypath.split('_'))>1 else 0 |
|
582 | foldercounter = int(doypath.split('_')[1]) if len(doypath.split('_'))>1 else 0 | |
575 | fullpath = os.path.join(path, doypath, expLabel) |
|
583 | fullpath = os.path.join(path, doypath, expLabel) | |
576 |
|
584 | |||
577 |
|
585 | |||
578 | print "%s folder was found: " %(fullpath ) |
|
586 | print "%s folder was found: " %(fullpath ) | |
579 |
|
587 | |||
580 | if set == None: |
|
588 | if set == None: | |
581 | filename = getlastFileFromPath(fullpath, ext) |
|
589 | filename = getlastFileFromPath(fullpath, ext) | |
582 | else: |
|
590 | else: | |
583 | filename = getFileFromSet(fullpath, ext, set) |
|
591 | filename = getFileFromSet(fullpath, ext, set) | |
584 |
|
592 | |||
585 | if not(filename): |
|
593 | if not(filename): | |
586 | return None, None, None, None, None, None |
|
594 | return None, None, None, None, None, None | |
587 |
|
595 | |||
588 | print "%s file was found" %(filename) |
|
596 | print "%s file was found" %(filename) | |
589 |
|
597 | |||
590 | if not(self.__verifyFile(os.path.join(fullpath, filename))): |
|
598 | if not(self.__verifyFile(os.path.join(fullpath, filename))): | |
591 | return None, None, None, None, None, None |
|
599 | return None, None, None, None, None, None | |
592 |
|
600 | |||
593 | year = int( filename[1:5] ) |
|
601 | year = int( filename[1:5] ) | |
594 | doy = int( filename[5:8] ) |
|
602 | doy = int( filename[5:8] ) | |
595 | set = int( filename[8:11] ) |
|
603 | set = int( filename[8:11] ) | |
596 |
|
604 | |||
597 | return fullpath, foldercounter, filename, year, doy, set |
|
605 | return fullpath, foldercounter, filename, year, doy, set | |
598 |
|
606 | |||
599 | def __setNextFileOffline(self): |
|
607 | def __setNextFileOffline(self): | |
600 |
|
608 | |||
601 | idFile = self.fileIndex |
|
609 | idFile = self.fileIndex | |
602 |
|
610 | |||
603 | while (True): |
|
611 | while (True): | |
604 | idFile += 1 |
|
612 | idFile += 1 | |
605 | if not(idFile < len(self.filenameList)): |
|
613 | if not(idFile < len(self.filenameList)): | |
606 | self.flagNoMoreFiles = 1 |
|
614 | self.flagNoMoreFiles = 1 | |
607 | # print "[Reading] No more Files" |
|
615 | # print "[Reading] No more Files" | |
608 | return 0 |
|
616 | return 0 | |
609 |
|
617 | |||
610 | filename = self.filenameList[idFile] |
|
618 | filename = self.filenameList[idFile] | |
611 |
|
619 | |||
612 | if not(self.__verifyFile(filename)): |
|
620 | if not(self.__verifyFile(filename)): | |
613 | continue |
|
621 | continue | |
614 |
|
622 | |||
615 | fileSize = os.path.getsize(filename) |
|
623 | fileSize = os.path.getsize(filename) | |
616 | fp = open(filename,'rb') |
|
624 | fp = open(filename,'rb') | |
617 | break |
|
625 | break | |
618 |
|
626 | |||
619 | self.flagIsNewFile = 1 |
|
627 | self.flagIsNewFile = 1 | |
620 | self.fileIndex = idFile |
|
628 | self.fileIndex = idFile | |
621 | self.filename = filename |
|
629 | self.filename = filename | |
622 | self.fileSize = fileSize |
|
630 | self.fileSize = fileSize | |
623 | self.fp = fp |
|
631 | self.fp = fp | |
624 |
|
632 | |||
625 | # print "[Reading] Setting the file: %s"%self.filename |
|
633 | # print "[Reading] Setting the file: %s"%self.filename | |
626 |
|
634 | |||
627 | return 1 |
|
635 | return 1 | |
628 |
|
636 | |||
629 | def __setNextFileOnline(self): |
|
637 | def __setNextFileOnline(self): | |
630 | """ |
|
638 | """ | |
631 | Busca el siguiente file que tenga suficiente data para ser leida, dentro de un folder especifico, si |
|
639 | Busca el siguiente file que tenga suficiente data para ser leida, dentro de un folder especifico, si | |
632 | no encuentra un file valido espera un tiempo determinado y luego busca en los posibles n files |
|
640 | no encuentra un file valido espera un tiempo determinado y luego busca en los posibles n files | |
633 | siguientes. |
|
641 | siguientes. | |
634 |
|
642 | |||
635 | Affected: |
|
643 | Affected: | |
636 | self.flagIsNewFile |
|
644 | self.flagIsNewFile | |
637 | self.filename |
|
645 | self.filename | |
638 | self.fileSize |
|
646 | self.fileSize | |
639 | self.fp |
|
647 | self.fp | |
640 | self.set |
|
648 | self.set | |
641 | self.flagNoMoreFiles |
|
649 | self.flagNoMoreFiles | |
642 |
|
650 | |||
643 | Return: |
|
651 | Return: | |
644 | 0 : si luego de una busqueda del siguiente file valido este no pudo ser encontrado |
|
652 | 0 : si luego de una busqueda del siguiente file valido este no pudo ser encontrado | |
645 | 1 : si el file fue abierto con exito y esta listo a ser leido |
|
653 | 1 : si el file fue abierto con exito y esta listo a ser leido | |
646 |
|
654 | |||
647 | Excepciones: |
|
655 | Excepciones: | |
648 | Si un determinado file no puede ser abierto |
|
656 | Si un determinado file no puede ser abierto | |
649 | """ |
|
657 | """ | |
650 | nFiles = 0 |
|
658 | nFiles = 0 | |
651 | fileOk_flag = False |
|
659 | fileOk_flag = False | |
652 | firstTime_flag = True |
|
660 | firstTime_flag = True | |
653 |
|
661 | |||
654 | self.set += 1 |
|
662 | self.set += 1 | |
655 |
|
663 | |||
656 | if self.set > 999: |
|
664 | if self.set > 999: | |
657 | self.set = 0 |
|
665 | self.set = 0 | |
658 | self.foldercounter += 1 |
|
666 | self.foldercounter += 1 | |
659 |
|
667 | |||
660 | #busca el 1er file disponible |
|
668 | #busca el 1er file disponible | |
661 | fullfilename, filename = checkForRealPath( self.path, self.foldercounter, self.year, self.doy, self.set, self.ext ) |
|
669 | fullfilename, filename = checkForRealPath( self.path, self.foldercounter, self.year, self.doy, self.set, self.ext ) | |
662 | if fullfilename: |
|
670 | if fullfilename: | |
663 | if self.__verifyFile(fullfilename, False): |
|
671 | if self.__verifyFile(fullfilename, False): | |
664 | fileOk_flag = True |
|
672 | fileOk_flag = True | |
665 |
|
673 | |||
666 | #si no encuentra un file entonces espera y vuelve a buscar |
|
674 | #si no encuentra un file entonces espera y vuelve a buscar | |
667 | if not(fileOk_flag): |
|
675 | if not(fileOk_flag): | |
668 | for nFiles in range(self.nFiles+1): #busco en los siguientes self.nFiles+1 files posibles |
|
676 | for nFiles in range(self.nFiles+1): #busco en los siguientes self.nFiles+1 files posibles | |
669 |
|
677 | |||
670 | if firstTime_flag: #si es la 1era vez entonces hace el for self.nTries veces |
|
678 | if firstTime_flag: #si es la 1era vez entonces hace el for self.nTries veces | |
671 | tries = self.nTries |
|
679 | tries = self.nTries | |
672 | else: |
|
680 | else: | |
673 | tries = 1 #si no es la 1era vez entonces solo lo hace una vez |
|
681 | tries = 1 #si no es la 1era vez entonces solo lo hace una vez | |
674 |
|
682 | |||
675 | for nTries in range( tries ): |
|
683 | for nTries in range( tries ): | |
676 | if firstTime_flag: |
|
684 | if firstTime_flag: | |
677 | print "\t[Reading] Waiting %0.2f sec for the file \"%s\" , try %03d ..." % ( self.delay, filename, nTries+1 ) |
|
685 | print "\t[Reading] Waiting %0.2f sec for the file \"%s\" , try %03d ..." % ( self.delay, filename, nTries+1 ) | |
678 | sleep( self.delay ) |
|
686 | sleep( self.delay ) | |
679 | else: |
|
687 | else: | |
680 | print "\t[Reading] Searching the next \"%s%04d%03d%03d%s\" file ..." % (self.optchar, self.year, self.doy, self.set, self.ext) |
|
688 | print "\t[Reading] Searching the next \"%s%04d%03d%03d%s\" file ..." % (self.optchar, self.year, self.doy, self.set, self.ext) | |
681 |
|
689 | |||
682 | fullfilename, filename = checkForRealPath( self.path, self.foldercounter, self.year, self.doy, self.set, self.ext ) |
|
690 | fullfilename, filename = checkForRealPath( self.path, self.foldercounter, self.year, self.doy, self.set, self.ext ) | |
683 | if fullfilename: |
|
691 | if fullfilename: | |
684 | if self.__verifyFile(fullfilename): |
|
692 | if self.__verifyFile(fullfilename): | |
685 | fileOk_flag = True |
|
693 | fileOk_flag = True | |
686 | break |
|
694 | break | |
687 |
|
695 | |||
688 | if fileOk_flag: |
|
696 | if fileOk_flag: | |
689 | break |
|
697 | break | |
690 |
|
698 | |||
691 | firstTime_flag = False |
|
699 | firstTime_flag = False | |
692 |
|
700 | |||
693 | print "\t[Reading] Skipping the file \"%s\" due to this file doesn't exist" % filename |
|
701 | print "\t[Reading] Skipping the file \"%s\" due to this file doesn't exist" % filename | |
694 | self.set += 1 |
|
702 | self.set += 1 | |
695 |
|
703 | |||
696 | if nFiles == (self.nFiles-1): #si no encuentro el file buscado cambio de carpeta y busco en la siguiente carpeta |
|
704 | if nFiles == (self.nFiles-1): #si no encuentro el file buscado cambio de carpeta y busco en la siguiente carpeta | |
697 | self.set = 0 |
|
705 | self.set = 0 | |
698 | self.doy += 1 |
|
706 | self.doy += 1 | |
699 | self.foldercounter = 0 |
|
707 | self.foldercounter = 0 | |
700 |
|
708 | |||
701 | if fileOk_flag: |
|
709 | if fileOk_flag: | |
702 | self.fileSize = os.path.getsize( fullfilename ) |
|
710 | self.fileSize = os.path.getsize( fullfilename ) | |
703 | self.filename = fullfilename |
|
711 | self.filename = fullfilename | |
704 | self.flagIsNewFile = 1 |
|
712 | self.flagIsNewFile = 1 | |
705 | if self.fp != None: self.fp.close() |
|
713 | if self.fp != None: self.fp.close() | |
706 | self.fp = open(fullfilename, 'rb') |
|
714 | self.fp = open(fullfilename, 'rb') | |
707 | self.flagNoMoreFiles = 0 |
|
715 | self.flagNoMoreFiles = 0 | |
708 | # print '[Reading] Setting the file: %s' % fullfilename |
|
716 | # print '[Reading] Setting the file: %s' % fullfilename | |
709 | else: |
|
717 | else: | |
710 | self.fileSize = 0 |
|
718 | self.fileSize = 0 | |
711 | self.filename = None |
|
719 | self.filename = None | |
712 | self.flagIsNewFile = 0 |
|
720 | self.flagIsNewFile = 0 | |
713 | self.fp = None |
|
721 | self.fp = None | |
714 | self.flagNoMoreFiles = 1 |
|
722 | self.flagNoMoreFiles = 1 | |
715 | # print '[Reading] No more files to read' |
|
723 | # print '[Reading] No more files to read' | |
716 |
|
724 | |||
717 | return fileOk_flag |
|
725 | return fileOk_flag | |
718 |
|
726 | |||
719 | def setNextFile(self): |
|
727 | def setNextFile(self): | |
720 | if self.fp != None: |
|
728 | if self.fp != None: | |
721 | self.fp.close() |
|
729 | self.fp.close() | |
722 |
|
730 | |||
723 | if self.online: |
|
731 | if self.online: | |
724 | newFile = self.__setNextFileOnline() |
|
732 | newFile = self.__setNextFileOnline() | |
725 | else: |
|
733 | else: | |
726 | newFile = self.__setNextFileOffline() |
|
734 | newFile = self.__setNextFileOffline() | |
727 |
|
735 | |||
728 | if not(newFile): |
|
736 | if not(newFile): | |
729 | print '[Reading] No more files to read' |
|
737 | print '[Reading] No more files to read' | |
730 | return 0 |
|
738 | return 0 | |
731 |
|
739 | |||
732 | print '[Reading] Setting the file: %s' % self.filename |
|
740 | print '[Reading] Setting the file: %s' % self.filename | |
733 |
|
741 | |||
734 | self.__readFirstHeader() |
|
742 | self.__readFirstHeader() | |
735 | self.nReadBlocks = 0 |
|
743 | self.nReadBlocks = 0 | |
736 | return 1 |
|
744 | return 1 | |
737 |
|
745 | |||
738 | def __waitNewBlock(self): |
|
746 | def __waitNewBlock(self): | |
739 | """ |
|
747 | """ | |
740 | Return 1 si se encontro un nuevo bloque de datos, 0 de otra forma. |
|
748 | Return 1 si se encontro un nuevo bloque de datos, 0 de otra forma. | |
741 |
|
749 | |||
742 | Si el modo de lectura es OffLine siempre retorn 0 |
|
750 | Si el modo de lectura es OffLine siempre retorn 0 | |
743 | """ |
|
751 | """ | |
744 | if not self.online: |
|
752 | if not self.online: | |
745 | return 0 |
|
753 | return 0 | |
746 |
|
754 | |||
747 | if (self.nReadBlocks >= self.processingHeaderObj.dataBlocksPerFile): |
|
755 | if (self.nReadBlocks >= self.processingHeaderObj.dataBlocksPerFile): | |
748 | return 0 |
|
756 | return 0 | |
749 |
|
757 | |||
750 | currentPointer = self.fp.tell() |
|
758 | currentPointer = self.fp.tell() | |
751 |
|
759 | |||
752 | neededSize = self.processingHeaderObj.blockSize + self.basicHeaderSize |
|
760 | neededSize = self.processingHeaderObj.blockSize + self.basicHeaderSize | |
753 |
|
761 | |||
754 | for nTries in range( self.nTries ): |
|
762 | for nTries in range( self.nTries ): | |
755 |
|
763 | |||
756 | self.fp.close() |
|
764 | self.fp.close() | |
757 | self.fp = open( self.filename, 'rb' ) |
|
765 | self.fp = open( self.filename, 'rb' ) | |
758 | self.fp.seek( currentPointer ) |
|
766 | self.fp.seek( currentPointer ) | |
759 |
|
767 | |||
760 | self.fileSize = os.path.getsize( self.filename ) |
|
768 | self.fileSize = os.path.getsize( self.filename ) | |
761 | currentSize = self.fileSize - currentPointer |
|
769 | currentSize = self.fileSize - currentPointer | |
762 |
|
770 | |||
763 | if ( currentSize >= neededSize ): |
|
771 | if ( currentSize >= neededSize ): | |
764 | self.basicHeaderObj.read(self.fp) |
|
772 | self.basicHeaderObj.read(self.fp) | |
765 | return 1 |
|
773 | return 1 | |
766 |
|
774 | |||
767 | if self.fileSize == self.fileSizeByHeader: |
|
775 | if self.fileSize == self.fileSizeByHeader: | |
768 | # self.flagEoF = True |
|
776 | # self.flagEoF = True | |
769 | return 0 |
|
777 | return 0 | |
770 |
|
778 | |||
771 | print "[Reading] Waiting %0.2f seconds for the next block, try %03d ..." % (self.delay, nTries+1) |
|
779 | print "[Reading] Waiting %0.2f seconds for the next block, try %03d ..." % (self.delay, nTries+1) | |
772 | sleep( self.delay ) |
|
780 | sleep( self.delay ) | |
773 |
|
781 | |||
774 |
|
782 | |||
775 | return 0 |
|
783 | return 0 | |
776 |
|
784 | |||
777 | def waitDataBlock(self,pointer_location): |
|
785 | def waitDataBlock(self,pointer_location): | |
778 |
|
786 | |||
779 | currentPointer = pointer_location |
|
787 | currentPointer = pointer_location | |
780 |
|
788 | |||
781 | neededSize = self.processingHeaderObj.blockSize #+ self.basicHeaderSize |
|
789 | neededSize = self.processingHeaderObj.blockSize #+ self.basicHeaderSize | |
782 |
|
790 | |||
783 | for nTries in range( self.nTries ): |
|
791 | for nTries in range( self.nTries ): | |
784 | self.fp.close() |
|
792 | self.fp.close() | |
785 | self.fp = open( self.filename, 'rb' ) |
|
793 | self.fp = open( self.filename, 'rb' ) | |
786 | self.fp.seek( currentPointer ) |
|
794 | self.fp.seek( currentPointer ) | |
787 |
|
795 | |||
788 | self.fileSize = os.path.getsize( self.filename ) |
|
796 | self.fileSize = os.path.getsize( self.filename ) | |
789 | currentSize = self.fileSize - currentPointer |
|
797 | currentSize = self.fileSize - currentPointer | |
790 |
|
798 | |||
791 | if ( currentSize >= neededSize ): |
|
799 | if ( currentSize >= neededSize ): | |
792 | return 1 |
|
800 | return 1 | |
793 |
|
801 | |||
794 | print "[Reading] Waiting %0.2f seconds for the next block, try %03d ..." % (self.delay, nTries+1) |
|
802 | print "[Reading] Waiting %0.2f seconds for the next block, try %03d ..." % (self.delay, nTries+1) | |
795 | sleep( self.delay ) |
|
803 | sleep( self.delay ) | |
796 |
|
804 | |||
797 | return 0 |
|
805 | return 0 | |
798 |
|
806 | |||
799 | def __jumpToLastBlock(self): |
|
807 | def __jumpToLastBlock(self): | |
800 |
|
808 | |||
801 | if not(self.__isFirstTimeOnline): |
|
809 | if not(self.__isFirstTimeOnline): | |
802 | return |
|
810 | return | |
803 |
|
811 | |||
804 | csize = self.fileSize - self.fp.tell() |
|
812 | csize = self.fileSize - self.fp.tell() | |
805 | blocksize = self.processingHeaderObj.blockSize |
|
813 | blocksize = self.processingHeaderObj.blockSize | |
806 |
|
814 | |||
807 | #salta el primer bloque de datos |
|
815 | #salta el primer bloque de datos | |
808 | if csize > self.processingHeaderObj.blockSize: |
|
816 | if csize > self.processingHeaderObj.blockSize: | |
809 | self.fp.seek(self.fp.tell() + blocksize) |
|
817 | self.fp.seek(self.fp.tell() + blocksize) | |
810 | else: |
|
818 | else: | |
811 | return |
|
819 | return | |
812 |
|
820 | |||
813 | csize = self.fileSize - self.fp.tell() |
|
821 | csize = self.fileSize - self.fp.tell() | |
814 | neededsize = self.processingHeaderObj.blockSize + self.basicHeaderSize |
|
822 | neededsize = self.processingHeaderObj.blockSize + self.basicHeaderSize | |
815 | while True: |
|
823 | while True: | |
816 |
|
824 | |||
817 | if self.fp.tell()<self.fileSize: |
|
825 | if self.fp.tell()<self.fileSize: | |
818 | self.fp.seek(self.fp.tell() + neededsize) |
|
826 | self.fp.seek(self.fp.tell() + neededsize) | |
819 | else: |
|
827 | else: | |
820 | self.fp.seek(self.fp.tell() - neededsize) |
|
828 | self.fp.seek(self.fp.tell() - neededsize) | |
821 | break |
|
829 | break | |
822 |
|
830 | |||
823 | # csize = self.fileSize - self.fp.tell() |
|
831 | # csize = self.fileSize - self.fp.tell() | |
824 | # neededsize = self.processingHeaderObj.blockSize + self.basicHeaderSize |
|
832 | # neededsize = self.processingHeaderObj.blockSize + self.basicHeaderSize | |
825 | # factor = int(csize/neededsize) |
|
833 | # factor = int(csize/neededsize) | |
826 | # if factor > 0: |
|
834 | # if factor > 0: | |
827 | # self.fp.seek(self.fp.tell() + factor*neededsize) |
|
835 | # self.fp.seek(self.fp.tell() + factor*neededsize) | |
828 |
|
836 | |||
829 | self.flagIsNewFile = 0 |
|
837 | self.flagIsNewFile = 0 | |
830 | self.__isFirstTimeOnline = 0 |
|
838 | self.__isFirstTimeOnline = 0 | |
831 |
|
839 | |||
832 | def __setNewBlock(self): |
|
840 | def __setNewBlock(self): | |
833 |
|
841 | |||
834 | if self.fp == None: |
|
842 | if self.fp == None: | |
835 | return 0 |
|
843 | return 0 | |
836 |
|
844 | |||
837 | if self.online: |
|
845 | if self.online: | |
838 | self.__jumpToLastBlock() |
|
846 | self.__jumpToLastBlock() | |
839 |
|
847 | |||
840 | if self.flagIsNewFile: |
|
848 | if self.flagIsNewFile: | |
841 | return 1 |
|
849 | return 1 | |
842 |
|
850 | |||
843 | self.lastUTTime = self.basicHeaderObj.utc |
|
851 | self.lastUTTime = self.basicHeaderObj.utc | |
844 | currentSize = self.fileSize - self.fp.tell() |
|
852 | currentSize = self.fileSize - self.fp.tell() | |
845 | neededSize = self.processingHeaderObj.blockSize + self.basicHeaderSize |
|
853 | neededSize = self.processingHeaderObj.blockSize + self.basicHeaderSize | |
846 |
|
854 | |||
847 | if (currentSize >= neededSize): |
|
855 | if (currentSize >= neededSize): | |
848 | self.basicHeaderObj.read(self.fp) |
|
856 | self.basicHeaderObj.read(self.fp) | |
849 | return 1 |
|
857 | return 1 | |
850 |
|
858 | |||
851 | if self.__waitNewBlock(): |
|
859 | if self.__waitNewBlock(): | |
852 | return 1 |
|
860 | return 1 | |
853 |
|
861 | |||
854 | if not(self.setNextFile()): |
|
862 | if not(self.setNextFile()): | |
855 | return 0 |
|
863 | return 0 | |
856 |
|
864 | |||
857 | deltaTime = self.basicHeaderObj.utc - self.lastUTTime # |
|
865 | deltaTime = self.basicHeaderObj.utc - self.lastUTTime # | |
858 |
|
866 | |||
859 | self.flagDiscontinuousBlock = 0 |
|
867 | self.flagDiscontinuousBlock = 0 | |
860 |
|
868 | |||
861 | if deltaTime > self.maxTimeStep: |
|
869 | if deltaTime > self.maxTimeStep: | |
862 | self.flagDiscontinuousBlock = 1 |
|
870 | self.flagDiscontinuousBlock = 1 | |
863 |
|
871 | |||
864 | return 1 |
|
872 | return 1 | |
865 |
|
873 | |||
866 | def readNextBlock(self): |
|
874 | def readNextBlock(self): | |
867 | if not(self.__setNewBlock()): |
|
875 | if not(self.__setNewBlock()): | |
868 | return 0 |
|
876 | return 0 | |
869 |
|
877 | |||
870 | if not(self.readBlock()): |
|
878 | if not(self.readBlock()): | |
871 | return 0 |
|
879 | return 0 | |
872 |
|
880 | |||
873 | return 1 |
|
881 | return 1 | |
874 |
|
882 | |||
875 | def __readFirstHeader(self): |
|
883 | def __readFirstHeader(self): | |
876 |
|
884 | |||
877 | self.basicHeaderObj.read(self.fp) |
|
885 | self.basicHeaderObj.read(self.fp) | |
878 | self.systemHeaderObj.read(self.fp) |
|
886 | self.systemHeaderObj.read(self.fp) | |
879 | self.radarControllerHeaderObj.read(self.fp) |
|
887 | self.radarControllerHeaderObj.read(self.fp) | |
880 | self.processingHeaderObj.read(self.fp) |
|
888 | self.processingHeaderObj.read(self.fp) | |
881 |
|
889 | |||
882 | self.firstHeaderSize = self.basicHeaderObj.size |
|
890 | self.firstHeaderSize = self.basicHeaderObj.size | |
883 |
|
891 | |||
884 | datatype = int(numpy.log2((self.processingHeaderObj.processFlags & PROCFLAG.DATATYPE_MASK))-numpy.log2(PROCFLAG.DATATYPE_CHAR)) |
|
892 | datatype = int(numpy.log2((self.processingHeaderObj.processFlags & PROCFLAG.DATATYPE_MASK))-numpy.log2(PROCFLAG.DATATYPE_CHAR)) | |
885 | if datatype == 0: |
|
893 | if datatype == 0: | |
886 | datatype_str = numpy.dtype([('real','<i1'),('imag','<i1')]) |
|
894 | datatype_str = numpy.dtype([('real','<i1'),('imag','<i1')]) | |
887 | elif datatype == 1: |
|
895 | elif datatype == 1: | |
888 | datatype_str = numpy.dtype([('real','<i2'),('imag','<i2')]) |
|
896 | datatype_str = numpy.dtype([('real','<i2'),('imag','<i2')]) | |
889 | elif datatype == 2: |
|
897 | elif datatype == 2: | |
890 | datatype_str = numpy.dtype([('real','<i4'),('imag','<i4')]) |
|
898 | datatype_str = numpy.dtype([('real','<i4'),('imag','<i4')]) | |
891 | elif datatype == 3: |
|
899 | elif datatype == 3: | |
892 | datatype_str = numpy.dtype([('real','<i8'),('imag','<i8')]) |
|
900 | datatype_str = numpy.dtype([('real','<i8'),('imag','<i8')]) | |
893 | elif datatype == 4: |
|
901 | elif datatype == 4: | |
894 | datatype_str = numpy.dtype([('real','<f4'),('imag','<f4')]) |
|
902 | datatype_str = numpy.dtype([('real','<f4'),('imag','<f4')]) | |
895 | elif datatype == 5: |
|
903 | elif datatype == 5: | |
896 | datatype_str = numpy.dtype([('real','<f8'),('imag','<f8')]) |
|
904 | datatype_str = numpy.dtype([('real','<f8'),('imag','<f8')]) | |
897 | else: |
|
905 | else: | |
898 | raise ValueError, 'Data type was not defined' |
|
906 | raise ValueError, 'Data type was not defined' | |
899 |
|
907 | |||
900 | self.dtype = datatype_str |
|
908 | self.dtype = datatype_str | |
901 | #self.ippSeconds = 2 * 1000 * self.radarControllerHeaderObj.ipp / self.c |
|
909 | #self.ippSeconds = 2 * 1000 * self.radarControllerHeaderObj.ipp / self.c | |
902 | self.fileSizeByHeader = self.processingHeaderObj.dataBlocksPerFile * self.processingHeaderObj.blockSize + self.firstHeaderSize + self.basicHeaderSize*(self.processingHeaderObj.dataBlocksPerFile - 1) |
|
910 | self.fileSizeByHeader = self.processingHeaderObj.dataBlocksPerFile * self.processingHeaderObj.blockSize + self.firstHeaderSize + self.basicHeaderSize*(self.processingHeaderObj.dataBlocksPerFile - 1) | |
903 | # self.dataOut.channelList = numpy.arange(self.systemHeaderObj.numChannels) |
|
911 | # self.dataOut.channelList = numpy.arange(self.systemHeaderObj.numChannels) | |
904 | # self.dataOut.channelIndexList = numpy.arange(self.systemHeaderObj.numChannels) |
|
912 | # self.dataOut.channelIndexList = numpy.arange(self.systemHeaderObj.numChannels) | |
905 | self.getBlockDimension() |
|
913 | self.getBlockDimension() | |
906 |
|
914 | |||
907 | def __verifyFile(self, filename, msgFlag=True): |
|
915 | def __verifyFile(self, filename, msgFlag=True): | |
908 | msg = None |
|
916 | msg = None | |
909 | try: |
|
917 | try: | |
910 | fp = open(filename, 'rb') |
|
918 | fp = open(filename, 'rb') | |
911 | currentPosition = fp.tell() |
|
919 | currentPosition = fp.tell() | |
912 | except IOError: |
|
920 | except IOError: | |
913 | traceback.print_exc() |
|
921 | traceback.print_exc() | |
914 | if msgFlag: |
|
922 | if msgFlag: | |
915 | print "[Reading] The file %s can't be opened" % (filename) |
|
923 | print "[Reading] The file %s can't be opened" % (filename) | |
916 | return False |
|
924 | return False | |
917 |
|
925 | |||
918 | neededSize = self.processingHeaderObj.blockSize + self.firstHeaderSize |
|
926 | neededSize = self.processingHeaderObj.blockSize + self.firstHeaderSize | |
919 |
|
927 | |||
920 | if neededSize == 0: |
|
928 | if neededSize == 0: | |
921 | basicHeaderObj = BasicHeader(LOCALTIME) |
|
929 | basicHeaderObj = BasicHeader(LOCALTIME) | |
922 | systemHeaderObj = SystemHeader() |
|
930 | systemHeaderObj = SystemHeader() | |
923 | radarControllerHeaderObj = RadarControllerHeader() |
|
931 | radarControllerHeaderObj = RadarControllerHeader() | |
924 | processingHeaderObj = ProcessingHeader() |
|
932 | processingHeaderObj = ProcessingHeader() | |
925 |
|
933 | |||
926 | try: |
|
934 | try: | |
927 | if not( basicHeaderObj.read(fp) ): raise IOError |
|
935 | if not( basicHeaderObj.read(fp) ): raise IOError | |
928 | if not( systemHeaderObj.read(fp) ): raise IOError |
|
936 | if not( systemHeaderObj.read(fp) ): raise IOError | |
929 | if not( radarControllerHeaderObj.read(fp) ): raise IOError |
|
937 | if not( radarControllerHeaderObj.read(fp) ): raise IOError | |
930 | if not( processingHeaderObj.read(fp) ): raise IOError |
|
938 | if not( processingHeaderObj.read(fp) ): raise IOError | |
931 | # data_type = int(numpy.log2((processingHeaderObj.processFlags & PROCFLAG.DATATYPE_MASK))-numpy.log2(PROCFLAG.DATATYPE_CHAR)) |
|
939 | # data_type = int(numpy.log2((processingHeaderObj.processFlags & PROCFLAG.DATATYPE_MASK))-numpy.log2(PROCFLAG.DATATYPE_CHAR)) | |
932 |
|
940 | |||
933 | neededSize = processingHeaderObj.blockSize + basicHeaderObj.size |
|
941 | neededSize = processingHeaderObj.blockSize + basicHeaderObj.size | |
934 |
|
942 | |||
935 | except IOError: |
|
943 | except IOError: | |
936 | traceback.print_exc() |
|
944 | traceback.print_exc() | |
937 | if msgFlag: |
|
945 | if msgFlag: | |
938 | print "[Reading] The file %s is empty or it hasn't enough data" % filename |
|
946 | print "[Reading] The file %s is empty or it hasn't enough data" % filename | |
939 |
|
947 | |||
940 | fp.close() |
|
948 | fp.close() | |
941 | return False |
|
949 | return False | |
942 | else: |
|
950 | else: | |
943 | msg = "[Reading] Skipping the file %s due to it hasn't enough data" %filename |
|
951 | msg = "[Reading] Skipping the file %s due to it hasn't enough data" %filename | |
944 |
|
952 | |||
945 | fp.close() |
|
953 | fp.close() | |
946 | fileSize = os.path.getsize(filename) |
|
954 | fileSize = os.path.getsize(filename) | |
947 | currentSize = fileSize - currentPosition |
|
955 | currentSize = fileSize - currentPosition | |
948 | if currentSize < neededSize: |
|
956 | if currentSize < neededSize: | |
949 | if msgFlag and (msg != None): |
|
957 | if msgFlag and (msg != None): | |
950 | print msg #print"\tSkipping the file %s due to it hasn't enough data" %filename |
|
958 | print msg #print"\tSkipping the file %s due to it hasn't enough data" %filename | |
951 | return False |
|
959 | return False | |
952 |
|
960 | |||
953 | return True |
|
961 | return True | |
954 |
|
962 | |||
955 | def findDatafiles(self, path, startDate=None, endDate=None, expLabel='', ext='.r', walk=True): |
|
963 | def findDatafiles(self, path, startDate=None, endDate=None, expLabel='', ext='.r', walk=True): | |
956 |
|
964 | |||
957 | dateList = [] |
|
965 | dateList = [] | |
958 | pathList = [] |
|
966 | pathList = [] | |
959 |
|
967 | |||
960 | if not walk: |
|
968 | if not walk: | |
961 | #pathList.append(path) |
|
969 | #pathList.append(path) | |
962 | multi_path = path.split(',') |
|
970 | multi_path = path.split(',') | |
963 | for single_path in multi_path: |
|
971 | for single_path in multi_path: | |
964 |
|
972 | |||
|
973 | if not os.path.isdir(single_path): | |||
|
974 | continue | |||
|
975 | ||||
965 | ok = False |
|
976 | ok = False | |
966 | fileList = glob.glob1(single_path, "*"+ext) |
|
977 | fileList = glob.glob1(single_path, "*"+ext) | |
967 |
|
978 | |||
968 | for thisFile in fileList: |
|
979 | for thisFile in fileList: | |
969 |
|
980 | |||
970 | if not os.path.isfile(os.path.join(single_path, thisFile)): |
|
981 | if not os.path.isfile(os.path.join(single_path, thisFile)): | |
971 | continue |
|
982 | continue | |
972 |
|
983 | |||
973 | if not isRadarFile(thisFile): |
|
984 | if not isRadarFile(thisFile): | |
974 | continue |
|
985 | continue | |
975 |
|
986 | |||
976 | ok = True |
|
987 | ok = True | |
977 | thisDate = getDateFromRadarFile(thisFile) |
|
988 | thisDate = getDateFromRadarFile(thisFile) | |
978 |
|
989 | |||
979 | if thisDate not in dateList: |
|
990 | if thisDate not in dateList: | |
980 | dateList.append(thisDate) |
|
991 | dateList.append(thisDate) | |
981 |
|
992 | |||
982 | if ok: |
|
993 | if ok: | |
983 | pathList.append(single_path) |
|
994 | pathList.append(single_path) | |
984 |
|
995 | |||
985 | return dateList |
|
996 | return dateList | |
986 |
|
997 | |||
987 | multi_path = path.split(',') |
|
998 | multi_path = path.split(',') | |
988 | for single_path in multi_path: |
|
999 | for single_path in multi_path: | |
989 |
|
1000 | |||
|
1001 | if not os.path.isdir(single_path): | |||
|
1002 | continue | |||
|
1003 | ||||
990 | dirList = [] |
|
1004 | dirList = [] | |
991 |
|
1005 | |||
992 | for thisPath in os.listdir(single_path): |
|
1006 | for thisPath in os.listdir(single_path): | |
993 |
|
1007 | |||
994 | if not os.path.isdir(os.path.join(single_path,thisPath)): |
|
1008 | if not os.path.isdir(os.path.join(single_path,thisPath)): | |
995 | continue |
|
1009 | continue | |
996 |
|
1010 | |||
997 | if not isRadarFolder(thisPath): |
|
1011 | if not isRadarFolder(thisPath): | |
998 | continue |
|
1012 | continue | |
999 |
|
1013 | |||
1000 | dirList.append(thisPath) |
|
1014 | dirList.append(thisPath) | |
1001 |
|
1015 | |||
1002 | if not dirList: |
|
1016 | if not dirList: | |
1003 | return dateList |
|
1017 | return dateList | |
1004 |
|
1018 | |||
1005 | if startDate and endDate: |
|
1019 | if startDate and endDate: | |
1006 | thisDate = startDate |
|
1020 | thisDate = startDate | |
1007 |
|
1021 | |||
1008 | while(thisDate <= endDate): |
|
1022 | while(thisDate <= endDate): | |
1009 | year = thisDate.timetuple().tm_year |
|
1023 | year = thisDate.timetuple().tm_year | |
1010 | doy = thisDate.timetuple().tm_yday |
|
1024 | doy = thisDate.timetuple().tm_yday | |
1011 |
|
1025 | |||
1012 | matchlist = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy) + '*') |
|
1026 | matchlist = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy) + '*') | |
1013 | if len(matchlist) == 0: |
|
1027 | if len(matchlist) == 0: | |
1014 | thisDate += datetime.timedelta(1) |
|
1028 | thisDate += datetime.timedelta(1) | |
1015 | continue |
|
1029 | continue | |
1016 |
|
1030 | |||
1017 | for match in matchlist: |
|
1031 | for match in matchlist: | |
1018 | pathList.append(os.path.join(single_path,match,expLabel)) |
|
1032 | pathList.append(os.path.join(single_path,match,expLabel)) | |
1019 | dateList.append(thisDate) |
|
1033 | dateList.append(thisDate) | |
1020 |
|
1034 | |||
1021 | thisDate += datetime.timedelta(1) |
|
1035 | thisDate += datetime.timedelta(1) | |
1022 | else: |
|
1036 | else: | |
1023 | for thisDir in dirList: |
|
1037 | for thisDir in dirList: | |
1024 | year = int(thisDir[1:5]) |
|
1038 | year = int(thisDir[1:5]) | |
1025 | doy = int(thisDir[5:8]) |
|
1039 | doy = int(thisDir[5:8]) | |
1026 | thisDate = datetime.date(year,1,1) + datetime.timedelta(doy-1) |
|
1040 | thisDate = datetime.date(year,1,1) + datetime.timedelta(doy-1) | |
1027 |
|
1041 | |||
1028 | pathList.append(os.path.join(single_path,thisDir,expLabel)) |
|
1042 | pathList.append(os.path.join(single_path,thisDir,expLabel)) | |
1029 | dateList.append(thisDate) |
|
1043 | dateList.append(thisDate) | |
1030 |
|
1044 | |||
1031 | return dateList |
|
1045 | return dateList | |
1032 |
|
1046 | |||
1033 |
|
1047 | |||
1034 | def setup(self, |
|
1048 | def setup(self, | |
1035 | path=None, |
|
1049 | path=None, | |
1036 | startDate=None, |
|
1050 | startDate=None, | |
1037 | endDate=None, |
|
1051 | endDate=None, | |
1038 | startTime=datetime.time(0,0,0), |
|
1052 | startTime=datetime.time(0,0,0), | |
1039 | endTime=datetime.time(23,59,59), |
|
1053 | endTime=datetime.time(23,59,59), | |
1040 | set=None, |
|
1054 | set=None, | |
1041 | expLabel = "", |
|
1055 | expLabel = "", | |
1042 | ext = None, |
|
1056 | ext = None, | |
1043 | online = False, |
|
1057 | online = False, | |
1044 | delay = 60, |
|
1058 | delay = 60, | |
1045 | walk = True, |
|
1059 | walk = True, | |
1046 | getblock = False, |
|
1060 | getblock = False, | |
1047 | nTxs = 1): |
|
1061 | nTxs = 1): | |
1048 |
|
1062 | |||
1049 | if path == None: |
|
1063 | if path == None: | |
1050 | raise ValueError, "[Reading] The path is not valid" |
|
1064 | raise ValueError, "[Reading] The path is not valid" | |
1051 |
|
1065 | |||
1052 | if ext == None: |
|
1066 | if ext == None: | |
1053 | ext = self.ext |
|
1067 | ext = self.ext | |
1054 |
|
1068 | |||
1055 | if online: |
|
1069 | if online: | |
1056 | print "[Reading] Searching files in online mode..." |
|
1070 | print "[Reading] Searching files in online mode..." | |
1057 |
|
1071 | |||
1058 | for nTries in range( self.nTries ): |
|
1072 | for nTries in range( self.nTries ): | |
1059 | fullpath, foldercounter, file, year, doy, set = self.__searchFilesOnLine(path=path, expLabel=expLabel, ext=ext, walk=walk, set=set) |
|
1073 | fullpath, foldercounter, file, year, doy, set = self.__searchFilesOnLine(path=path, expLabel=expLabel, ext=ext, walk=walk, set=set) | |
1060 |
|
1074 | |||
1061 | if fullpath: |
|
1075 | if fullpath: | |
1062 | break |
|
1076 | break | |
1063 |
|
1077 | |||
1064 | print '[Reading] Waiting %0.2f sec for an valid file in %s: try %02d ...' % (self.delay, path, nTries+1) |
|
1078 | print '[Reading] Waiting %0.2f sec for an valid file in %s: try %02d ...' % (self.delay, path, nTries+1) | |
1065 | sleep( self.delay ) |
|
1079 | sleep( self.delay ) | |
1066 |
|
1080 | |||
1067 | if not(fullpath): |
|
1081 | if not(fullpath): | |
1068 | print "[Reading] There 'isn't any valid file in %s" % path |
|
1082 | print "[Reading] There 'isn't any valid file in %s" % path | |
1069 | return None |
|
1083 | return None | |
1070 |
|
1084 | |||
1071 | self.year = year |
|
1085 | self.year = year | |
1072 | self.doy = doy |
|
1086 | self.doy = doy | |
1073 | self.set = set - 1 |
|
1087 | self.set = set - 1 | |
1074 | self.path = path |
|
1088 | self.path = path | |
1075 | self.foldercounter = foldercounter |
|
1089 | self.foldercounter = foldercounter | |
1076 | last_set = None |
|
1090 | last_set = None | |
1077 |
|
1091 | |||
1078 | else: |
|
1092 | else: | |
1079 | print "[Reading] Searching files in offline mode ..." |
|
1093 | print "[Reading] Searching files in offline mode ..." | |
1080 | pathList, filenameList = self.__searchFilesOffLine(path, startDate=startDate, endDate=endDate, |
|
1094 | pathList, filenameList = self.__searchFilesOffLine(path, startDate=startDate, endDate=endDate, | |
1081 | startTime=startTime, endTime=endTime, |
|
1095 | startTime=startTime, endTime=endTime, | |
1082 | set=set, expLabel=expLabel, ext=ext, |
|
1096 | set=set, expLabel=expLabel, ext=ext, | |
1083 | walk=walk) |
|
1097 | walk=walk) | |
1084 |
|
1098 | |||
1085 | if not(pathList): |
|
1099 | if not(pathList): | |
1086 | print "[Reading] No *%s files into the folder %s \nfor the range: %s - %s"%(ext, path, |
|
1100 | print "[Reading] No *%s files into the folder %s \nfor the range: %s - %s"%(ext, path, | |
1087 | datetime.datetime.combine(startDate,startTime).ctime(), |
|
1101 | datetime.datetime.combine(startDate,startTime).ctime(), | |
1088 | datetime.datetime.combine(endDate,endTime).ctime()) |
|
1102 | datetime.datetime.combine(endDate,endTime).ctime()) | |
1089 |
|
1103 | |||
1090 | sys.exit(-1) |
|
1104 | sys.exit(-1) | |
1091 |
|
1105 | |||
1092 |
|
1106 | |||
1093 | self.fileIndex = -1 |
|
1107 | self.fileIndex = -1 | |
1094 | self.pathList = pathList |
|
1108 | self.pathList = pathList | |
1095 | self.filenameList = filenameList |
|
1109 | self.filenameList = filenameList | |
1096 | file_name = os.path.basename(filenameList[-1]) |
|
1110 | file_name = os.path.basename(filenameList[-1]) | |
1097 | basename, ext = os.path.splitext(file_name) |
|
1111 | basename, ext = os.path.splitext(file_name) | |
1098 | last_set = int(basename[-3:]) |
|
1112 | last_set = int(basename[-3:]) | |
1099 |
|
1113 | |||
1100 | self.online = online |
|
1114 | self.online = online | |
1101 | self.delay = delay |
|
1115 | self.delay = delay | |
1102 | ext = ext.lower() |
|
1116 | ext = ext.lower() | |
1103 | self.ext = ext |
|
1117 | self.ext = ext | |
1104 | self.getByBlock = getblock |
|
1118 | self.getByBlock = getblock | |
1105 | self.nTxs = int(nTxs) |
|
1119 | self.nTxs = int(nTxs) | |
1106 |
|
1120 | |||
1107 | if not(self.setNextFile()): |
|
1121 | if not(self.setNextFile()): | |
1108 | if (startDate!=None) and (endDate!=None): |
|
1122 | if (startDate!=None) and (endDate!=None): | |
1109 | print "[Reading] No files in range: %s - %s" %(datetime.datetime.combine(startDate,startTime).ctime(), datetime.datetime.combine(endDate,endTime).ctime()) |
|
1123 | print "[Reading] No files in range: %s - %s" %(datetime.datetime.combine(startDate,startTime).ctime(), datetime.datetime.combine(endDate,endTime).ctime()) | |
1110 | elif startDate != None: |
|
1124 | elif startDate != None: | |
1111 | print "[Reading] No files in range: %s" %(datetime.datetime.combine(startDate,startTime).ctime()) |
|
1125 | print "[Reading] No files in range: %s" %(datetime.datetime.combine(startDate,startTime).ctime()) | |
1112 | else: |
|
1126 | else: | |
1113 | print "[Reading] No files" |
|
1127 | print "[Reading] No files" | |
1114 |
|
1128 | |||
1115 | sys.exit(-1) |
|
1129 | sys.exit(-1) | |
1116 |
|
1130 | |||
1117 | # self.updateDataHeader() |
|
1131 | # self.updateDataHeader() | |
1118 | if last_set != None: |
|
1132 | if last_set != None: | |
1119 | self.dataOut.last_block = last_set * self.processingHeaderObj.dataBlocksPerFile + self.basicHeaderObj.dataBlock |
|
1133 | self.dataOut.last_block = last_set * self.processingHeaderObj.dataBlocksPerFile + self.basicHeaderObj.dataBlock | |
1120 | return |
|
1134 | return | |
1121 |
|
1135 | |||
1122 | def getBasicHeader(self): |
|
1136 | def getBasicHeader(self): | |
1123 |
|
1137 | |||
1124 | self.dataOut.utctime = self.basicHeaderObj.utc + self.basicHeaderObj.miliSecond/1000. + self.profileIndex * self.radarControllerHeaderObj.ippSeconds |
|
1138 | self.dataOut.utctime = self.basicHeaderObj.utc + self.basicHeaderObj.miliSecond/1000. + self.profileIndex * self.radarControllerHeaderObj.ippSeconds | |
1125 |
|
1139 | |||
1126 | self.dataOut.flagDiscontinuousBlock = self.flagDiscontinuousBlock |
|
1140 | self.dataOut.flagDiscontinuousBlock = self.flagDiscontinuousBlock | |
1127 |
|
1141 | |||
1128 | self.dataOut.timeZone = self.basicHeaderObj.timeZone |
|
1142 | self.dataOut.timeZone = self.basicHeaderObj.timeZone | |
1129 |
|
1143 | |||
1130 | self.dataOut.dstFlag = self.basicHeaderObj.dstFlag |
|
1144 | self.dataOut.dstFlag = self.basicHeaderObj.dstFlag | |
1131 |
|
1145 | |||
1132 | self.dataOut.errorCount = self.basicHeaderObj.errorCount |
|
1146 | self.dataOut.errorCount = self.basicHeaderObj.errorCount | |
1133 |
|
1147 | |||
1134 | self.dataOut.useLocalTime = self.basicHeaderObj.useLocalTime |
|
1148 | self.dataOut.useLocalTime = self.basicHeaderObj.useLocalTime | |
1135 |
|
1149 | |||
1136 | self.dataOut.ippSeconds = self.radarControllerHeaderObj.ippSeconds/self.nTxs |
|
1150 | self.dataOut.ippSeconds = self.radarControllerHeaderObj.ippSeconds/self.nTxs | |
1137 |
|
1151 | |||
1138 | self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock*self.nTxs |
|
1152 | self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock*self.nTxs | |
1139 |
|
1153 | |||
1140 |
|
1154 | |||
1141 | def getFirstHeader(self): |
|
1155 | def getFirstHeader(self): | |
1142 |
|
1156 | |||
1143 | raise ValueError, "This method has not been implemented" |
|
1157 | raise ValueError, "This method has not been implemented" | |
1144 |
|
1158 | |||
1145 | def getData(self): |
|
1159 | def getData(self): | |
1146 |
|
1160 | |||
1147 | raise ValueError, "This method has not been implemented" |
|
1161 | raise ValueError, "This method has not been implemented" | |
1148 |
|
1162 | |||
1149 | def hasNotDataInBuffer(self): |
|
1163 | def hasNotDataInBuffer(self): | |
1150 |
|
1164 | |||
1151 | raise ValueError, "This method has not been implemented" |
|
1165 | raise ValueError, "This method has not been implemented" | |
1152 |
|
1166 | |||
1153 | def readBlock(self): |
|
1167 | def readBlock(self): | |
1154 |
|
1168 | |||
1155 | raise ValueError, "This method has not been implemented" |
|
1169 | raise ValueError, "This method has not been implemented" | |
1156 |
|
1170 | |||
1157 | def isEndProcess(self): |
|
1171 | def isEndProcess(self): | |
1158 |
|
1172 | |||
1159 | return self.flagNoMoreFiles |
|
1173 | return self.flagNoMoreFiles | |
1160 |
|
1174 | |||
1161 | def printReadBlocks(self): |
|
1175 | def printReadBlocks(self): | |
1162 |
|
1176 | |||
1163 | print "[Reading] Number of read blocks per file %04d" %self.nReadBlocks |
|
1177 | print "[Reading] Number of read blocks per file %04d" %self.nReadBlocks | |
1164 |
|
1178 | |||
1165 | def printTotalBlocks(self): |
|
1179 | def printTotalBlocks(self): | |
1166 |
|
1180 | |||
1167 | print "[Reading] Number of read blocks %04d" %self.nTotalBlocks |
|
1181 | print "[Reading] Number of read blocks %04d" %self.nTotalBlocks | |
1168 |
|
1182 | |||
1169 | def printNumberOfBlock(self): |
|
1183 | def printNumberOfBlock(self): | |
1170 |
|
1184 | |||
1171 | if self.flagIsNewBlock: |
|
1185 | if self.flagIsNewBlock: | |
1172 | print "[Reading] Block No. %04d, Total blocks %04d -> %s" %(self.basicHeaderObj.dataBlock, self.nTotalBlocks, self.dataOut.datatime.ctime()) |
|
1186 | print "[Reading] Block No. %04d, Total blocks %04d -> %s" %(self.basicHeaderObj.dataBlock, self.nTotalBlocks, self.dataOut.datatime.ctime()) | |
1173 | self.dataOut.blocknow = self.basicHeaderObj.dataBlock |
|
1187 | self.dataOut.blocknow = self.basicHeaderObj.dataBlock | |
1174 |
|
1188 | |||
1175 | def printInfo(self): |
|
1189 | def printInfo(self): | |
1176 |
|
1190 | |||
1177 | if self.__printInfo == False: |
|
1191 | if self.__printInfo == False: | |
1178 | return |
|
1192 | return | |
1179 |
|
1193 | |||
1180 | self.basicHeaderObj.printInfo() |
|
1194 | self.basicHeaderObj.printInfo() | |
1181 | self.systemHeaderObj.printInfo() |
|
1195 | self.systemHeaderObj.printInfo() | |
1182 | self.radarControllerHeaderObj.printInfo() |
|
1196 | self.radarControllerHeaderObj.printInfo() | |
1183 | self.processingHeaderObj.printInfo() |
|
1197 | self.processingHeaderObj.printInfo() | |
1184 |
|
1198 | |||
1185 | self.__printInfo = False |
|
1199 | self.__printInfo = False | |
1186 |
|
1200 | |||
1187 |
|
1201 | |||
1188 | def run(self, **kwargs): |
|
1202 | def run(self, **kwargs): | |
1189 |
|
1203 | |||
1190 | if not(self.isConfig): |
|
1204 | if not(self.isConfig): | |
1191 |
|
1205 | |||
1192 | # self.dataOut = dataOut |
|
1206 | # self.dataOut = dataOut | |
1193 | self.setup(**kwargs) |
|
1207 | self.setup(**kwargs) | |
1194 | self.isConfig = True |
|
1208 | self.isConfig = True | |
1195 |
|
1209 | |||
1196 | self.getData() |
|
1210 | self.getData() | |
1197 |
|
1211 | |||
1198 | class JRODataWriter(JRODataIO): |
|
1212 | class JRODataWriter(JRODataIO): | |
1199 |
|
1213 | |||
1200 | """ |
|
1214 | """ | |
1201 | Esta clase permite escribir datos a archivos procesados (.r o ,pdata). La escritura |
|
1215 | Esta clase permite escribir datos a archivos procesados (.r o ,pdata). La escritura | |
1202 | de los datos siempre se realiza por bloques. |
|
1216 | de los datos siempre se realiza por bloques. | |
1203 | """ |
|
1217 | """ | |
1204 |
|
1218 | |||
1205 | blockIndex = 0 |
|
1219 | blockIndex = 0 | |
1206 |
|
1220 | |||
1207 | path = None |
|
1221 | path = None | |
1208 |
|
1222 | |||
1209 | setFile = None |
|
1223 | setFile = None | |
1210 |
|
1224 | |||
1211 | profilesPerBlock = None |
|
1225 | profilesPerBlock = None | |
1212 |
|
1226 | |||
1213 | blocksPerFile = None |
|
1227 | blocksPerFile = None | |
1214 |
|
1228 | |||
1215 | nWriteBlocks = 0 |
|
1229 | nWriteBlocks = 0 | |
1216 |
|
1230 | |||
1217 | def __init__(self, dataOut=None): |
|
1231 | def __init__(self, dataOut=None): | |
1218 | raise ValueError, "Not implemented" |
|
1232 | raise ValueError, "Not implemented" | |
1219 |
|
1233 | |||
1220 |
|
1234 | |||
1221 | def hasAllDataInBuffer(self): |
|
1235 | def hasAllDataInBuffer(self): | |
1222 | raise ValueError, "Not implemented" |
|
1236 | raise ValueError, "Not implemented" | |
1223 |
|
1237 | |||
1224 |
|
1238 | |||
1225 | def setBlockDimension(self): |
|
1239 | def setBlockDimension(self): | |
1226 | raise ValueError, "Not implemented" |
|
1240 | raise ValueError, "Not implemented" | |
1227 |
|
1241 | |||
1228 |
|
1242 | |||
1229 | def writeBlock(self): |
|
1243 | def writeBlock(self): | |
1230 | raise ValueError, "No implemented" |
|
1244 | raise ValueError, "No implemented" | |
1231 |
|
1245 | |||
1232 |
|
1246 | |||
1233 | def putData(self): |
|
1247 | def putData(self): | |
1234 | raise ValueError, "No implemented" |
|
1248 | raise ValueError, "No implemented" | |
1235 |
|
1249 | |||
1236 |
|
1250 | |||
1237 | def setBasicHeader(self): |
|
1251 | def setBasicHeader(self): | |
1238 |
|
1252 | |||
1239 | self.basicHeaderObj.size = self.basicHeaderSize #bytes |
|
1253 | self.basicHeaderObj.size = self.basicHeaderSize #bytes | |
1240 | self.basicHeaderObj.version = self.versionFile |
|
1254 | self.basicHeaderObj.version = self.versionFile | |
1241 | self.basicHeaderObj.dataBlock = self.nTotalBlocks |
|
1255 | self.basicHeaderObj.dataBlock = self.nTotalBlocks | |
1242 |
|
1256 | |||
1243 | utc = numpy.floor(self.dataOut.utctime) |
|
1257 | utc = numpy.floor(self.dataOut.utctime) | |
1244 | milisecond = (self.dataOut.utctime - utc)* 1000.0 |
|
1258 | milisecond = (self.dataOut.utctime - utc)* 1000.0 | |
1245 |
|
1259 | |||
1246 | self.basicHeaderObj.utc = utc |
|
1260 | self.basicHeaderObj.utc = utc | |
1247 | self.basicHeaderObj.miliSecond = milisecond |
|
1261 | self.basicHeaderObj.miliSecond = milisecond | |
1248 | self.basicHeaderObj.timeZone = self.dataOut.timeZone |
|
1262 | self.basicHeaderObj.timeZone = self.dataOut.timeZone | |
1249 | self.basicHeaderObj.dstFlag = self.dataOut.dstFlag |
|
1263 | self.basicHeaderObj.dstFlag = self.dataOut.dstFlag | |
1250 | self.basicHeaderObj.errorCount = self.dataOut.errorCount |
|
1264 | self.basicHeaderObj.errorCount = self.dataOut.errorCount | |
1251 |
|
1265 | |||
1252 | def setFirstHeader(self): |
|
1266 | def setFirstHeader(self): | |
1253 | """ |
|
1267 | """ | |
1254 | Obtiene una copia del First Header |
|
1268 | Obtiene una copia del First Header | |
1255 |
|
1269 | |||
1256 | Affected: |
|
1270 | Affected: | |
1257 |
|
1271 | |||
1258 | self.basicHeaderObj |
|
1272 | self.basicHeaderObj | |
1259 | self.systemHeaderObj |
|
1273 | self.systemHeaderObj | |
1260 | self.radarControllerHeaderObj |
|
1274 | self.radarControllerHeaderObj | |
1261 | self.processingHeaderObj self. |
|
1275 | self.processingHeaderObj self. | |
1262 |
|
1276 | |||
1263 | Return: |
|
1277 | Return: | |
1264 | None |
|
1278 | None | |
1265 | """ |
|
1279 | """ | |
1266 |
|
1280 | |||
1267 | raise ValueError, "No implemented" |
|
1281 | raise ValueError, "No implemented" | |
1268 |
|
1282 | |||
1269 | def __writeFirstHeader(self): |
|
1283 | def __writeFirstHeader(self): | |
1270 | """ |
|
1284 | """ | |
1271 | Escribe el primer header del file es decir el Basic header y el Long header (SystemHeader, RadarControllerHeader, ProcessingHeader) |
|
1285 | Escribe el primer header del file es decir el Basic header y el Long header (SystemHeader, RadarControllerHeader, ProcessingHeader) | |
1272 |
|
1286 | |||
1273 | Affected: |
|
1287 | Affected: | |
1274 | __dataType |
|
1288 | __dataType | |
1275 |
|
1289 | |||
1276 | Return: |
|
1290 | Return: | |
1277 | None |
|
1291 | None | |
1278 | """ |
|
1292 | """ | |
1279 |
|
1293 | |||
1280 | # CALCULAR PARAMETROS |
|
1294 | # CALCULAR PARAMETROS | |
1281 |
|
1295 | |||
1282 | sizeLongHeader = self.systemHeaderObj.size + self.radarControllerHeaderObj.size + self.processingHeaderObj.size |
|
1296 | sizeLongHeader = self.systemHeaderObj.size + self.radarControllerHeaderObj.size + self.processingHeaderObj.size | |
1283 | self.basicHeaderObj.size = self.basicHeaderSize + sizeLongHeader |
|
1297 | self.basicHeaderObj.size = self.basicHeaderSize + sizeLongHeader | |
1284 |
|
1298 | |||
1285 | self.basicHeaderObj.write(self.fp) |
|
1299 | self.basicHeaderObj.write(self.fp) | |
1286 | self.systemHeaderObj.write(self.fp) |
|
1300 | self.systemHeaderObj.write(self.fp) | |
1287 | self.radarControllerHeaderObj.write(self.fp) |
|
1301 | self.radarControllerHeaderObj.write(self.fp) | |
1288 | self.processingHeaderObj.write(self.fp) |
|
1302 | self.processingHeaderObj.write(self.fp) | |
1289 |
|
1303 | |||
1290 | self.dtype = self.dataOut.dtype |
|
1304 | self.dtype = self.dataOut.dtype | |
1291 |
|
1305 | |||
1292 | def __setNewBlock(self): |
|
1306 | def __setNewBlock(self): | |
1293 | """ |
|
1307 | """ | |
1294 | Si es un nuevo file escribe el First Header caso contrario escribe solo el Basic Header |
|
1308 | Si es un nuevo file escribe el First Header caso contrario escribe solo el Basic Header | |
1295 |
|
1309 | |||
1296 | Return: |
|
1310 | Return: | |
1297 | 0 : si no pudo escribir nada |
|
1311 | 0 : si no pudo escribir nada | |
1298 | 1 : Si escribio el Basic el First Header |
|
1312 | 1 : Si escribio el Basic el First Header | |
1299 | """ |
|
1313 | """ | |
1300 | if self.fp == None: |
|
1314 | if self.fp == None: | |
1301 | self.setNextFile() |
|
1315 | self.setNextFile() | |
1302 |
|
1316 | |||
1303 | if self.flagIsNewFile: |
|
1317 | if self.flagIsNewFile: | |
1304 | return 1 |
|
1318 | return 1 | |
1305 |
|
1319 | |||
1306 | if self.blockIndex < self.processingHeaderObj.dataBlocksPerFile: |
|
1320 | if self.blockIndex < self.processingHeaderObj.dataBlocksPerFile: | |
1307 | self.basicHeaderObj.write(self.fp) |
|
1321 | self.basicHeaderObj.write(self.fp) | |
1308 | return 1 |
|
1322 | return 1 | |
1309 |
|
1323 | |||
1310 | if not( self.setNextFile() ): |
|
1324 | if not( self.setNextFile() ): | |
1311 | return 0 |
|
1325 | return 0 | |
1312 |
|
1326 | |||
1313 | return 1 |
|
1327 | return 1 | |
1314 |
|
1328 | |||
1315 |
|
1329 | |||
1316 | def writeNextBlock(self): |
|
1330 | def writeNextBlock(self): | |
1317 | """ |
|
1331 | """ | |
1318 | Selecciona el bloque siguiente de datos y los escribe en un file |
|
1332 | Selecciona el bloque siguiente de datos y los escribe en un file | |
1319 |
|
1333 | |||
1320 | Return: |
|
1334 | Return: | |
1321 | 0 : Si no hizo pudo escribir el bloque de datos |
|
1335 | 0 : Si no hizo pudo escribir el bloque de datos | |
1322 | 1 : Si no pudo escribir el bloque de datos |
|
1336 | 1 : Si no pudo escribir el bloque de datos | |
1323 | """ |
|
1337 | """ | |
1324 | if not( self.__setNewBlock() ): |
|
1338 | if not( self.__setNewBlock() ): | |
1325 | return 0 |
|
1339 | return 0 | |
1326 |
|
1340 | |||
1327 | self.writeBlock() |
|
1341 | self.writeBlock() | |
1328 |
|
1342 | |||
1329 | return 1 |
|
1343 | return 1 | |
1330 |
|
1344 | |||
1331 | def setNextFile(self): |
|
1345 | def setNextFile(self): | |
1332 | """ |
|
1346 | """ | |
1333 | Determina el siguiente file que sera escrito |
|
1347 | Determina el siguiente file que sera escrito | |
1334 |
|
1348 | |||
1335 | Affected: |
|
1349 | Affected: | |
1336 | self.filename |
|
1350 | self.filename | |
1337 | self.subfolder |
|
1351 | self.subfolder | |
1338 | self.fp |
|
1352 | self.fp | |
1339 | self.setFile |
|
1353 | self.setFile | |
1340 | self.flagIsNewFile |
|
1354 | self.flagIsNewFile | |
1341 |
|
1355 | |||
1342 | Return: |
|
1356 | Return: | |
1343 | 0 : Si el archivo no puede ser escrito |
|
1357 | 0 : Si el archivo no puede ser escrito | |
1344 | 1 : Si el archivo esta listo para ser escrito |
|
1358 | 1 : Si el archivo esta listo para ser escrito | |
1345 | """ |
|
1359 | """ | |
1346 | ext = self.ext |
|
1360 | ext = self.ext | |
1347 | path = self.path |
|
1361 | path = self.path | |
1348 |
|
1362 | |||
1349 | if self.fp != None: |
|
1363 | if self.fp != None: | |
1350 | self.fp.close() |
|
1364 | self.fp.close() | |
1351 |
|
1365 | |||
1352 | timeTuple = time.localtime( self.dataOut.utctime) |
|
1366 | timeTuple = time.localtime( self.dataOut.utctime) | |
1353 | subfolder = 'd%4.4d%3.3d' % (timeTuple.tm_year,timeTuple.tm_yday) |
|
1367 | subfolder = 'd%4.4d%3.3d' % (timeTuple.tm_year,timeTuple.tm_yday) | |
1354 |
|
1368 | |||
1355 | fullpath = os.path.join( path, subfolder ) |
|
1369 | fullpath = os.path.join( path, subfolder ) | |
1356 | if not( os.path.exists(fullpath) ): |
|
1370 | if not( os.path.exists(fullpath) ): | |
1357 | os.mkdir(fullpath) |
|
1371 | os.mkdir(fullpath) | |
1358 | self.setFile = -1 #inicializo mi contador de seteo |
|
1372 | self.setFile = -1 #inicializo mi contador de seteo | |
1359 | else: |
|
1373 | else: | |
1360 | filesList = os.listdir( fullpath ) |
|
1374 | filesList = os.listdir( fullpath ) | |
1361 | if len( filesList ) > 0: |
|
1375 | if len( filesList ) > 0: | |
1362 | filesList = sorted( filesList, key=str.lower ) |
|
1376 | filesList = sorted( filesList, key=str.lower ) | |
1363 | filen = filesList[-1] |
|
1377 | filen = filesList[-1] | |
1364 | # el filename debera tener el siguiente formato |
|
1378 | # el filename debera tener el siguiente formato | |
1365 | # 0 1234 567 89A BCDE (hex) |
|
1379 | # 0 1234 567 89A BCDE (hex) | |
1366 | # x YYYY DDD SSS .ext |
|
1380 | # x YYYY DDD SSS .ext | |
1367 | if isNumber( filen[8:11] ): |
|
1381 | if isNumber( filen[8:11] ): | |
1368 | self.setFile = int( filen[8:11] ) #inicializo mi contador de seteo al seteo del ultimo file |
|
1382 | self.setFile = int( filen[8:11] ) #inicializo mi contador de seteo al seteo del ultimo file | |
1369 | else: |
|
1383 | else: | |
1370 | self.setFile = -1 |
|
1384 | self.setFile = -1 | |
1371 | else: |
|
1385 | else: | |
1372 | self.setFile = -1 #inicializo mi contador de seteo |
|
1386 | self.setFile = -1 #inicializo mi contador de seteo | |
1373 |
|
1387 | |||
1374 | setFile = self.setFile |
|
1388 | setFile = self.setFile | |
1375 | setFile += 1 |
|
1389 | setFile += 1 | |
1376 |
|
1390 | |||
1377 | filen = '%s%4.4d%3.3d%3.3d%s' % (self.optchar, |
|
1391 | filen = '%s%4.4d%3.3d%3.3d%s' % (self.optchar, | |
1378 | timeTuple.tm_year, |
|
1392 | timeTuple.tm_year, | |
1379 | timeTuple.tm_yday, |
|
1393 | timeTuple.tm_yday, | |
1380 | setFile, |
|
1394 | setFile, | |
1381 | ext ) |
|
1395 | ext ) | |
1382 |
|
1396 | |||
1383 | filename = os.path.join( path, subfolder, filen ) |
|
1397 | filename = os.path.join( path, subfolder, filen ) | |
1384 |
|
1398 | |||
1385 | fp = open( filename,'wb' ) |
|
1399 | fp = open( filename,'wb' ) | |
1386 |
|
1400 | |||
1387 | self.blockIndex = 0 |
|
1401 | self.blockIndex = 0 | |
1388 |
|
1402 | |||
1389 | #guardando atributos |
|
1403 | #guardando atributos | |
1390 | self.filename = filename |
|
1404 | self.filename = filename | |
1391 | self.subfolder = subfolder |
|
1405 | self.subfolder = subfolder | |
1392 | self.fp = fp |
|
1406 | self.fp = fp | |
1393 | self.setFile = setFile |
|
1407 | self.setFile = setFile | |
1394 | self.flagIsNewFile = 1 |
|
1408 | self.flagIsNewFile = 1 | |
1395 |
|
1409 | |||
1396 | self.setFirstHeader() |
|
1410 | self.setFirstHeader() | |
1397 |
|
1411 | |||
1398 | print '[Writing] file: %s'%self.filename |
|
1412 | print '[Writing] file: %s'%self.filename | |
1399 |
|
1413 | |||
1400 | self.__writeFirstHeader() |
|
1414 | self.__writeFirstHeader() | |
1401 |
|
1415 | |||
1402 | return 1 |
|
1416 | return 1 | |
1403 |
|
1417 | |||
1404 | def setup(self, dataOut, path, blocksPerFile, profilesPerBlock=64, set=0, ext=None): |
|
1418 | def setup(self, dataOut, path, blocksPerFile, profilesPerBlock=64, set=0, ext=None): | |
1405 | """ |
|
1419 | """ | |
1406 | Setea el tipo de formato en la cual sera guardada la data y escribe el First Header |
|
1420 | Setea el tipo de formato en la cual sera guardada la data y escribe el First Header | |
1407 |
|
1421 | |||
1408 | Inputs: |
|
1422 | Inputs: | |
1409 | path : el path destino en el cual se escribiran los files a crear |
|
1423 | path : el path destino en el cual se escribiran los files a crear | |
1410 | format : formato en el cual sera salvado un file |
|
1424 | format : formato en el cual sera salvado un file | |
1411 | set : el setebo del file |
|
1425 | set : el setebo del file | |
1412 |
|
1426 | |||
1413 | Return: |
|
1427 | Return: | |
1414 | 0 : Si no realizo un buen seteo |
|
1428 | 0 : Si no realizo un buen seteo | |
1415 | 1 : Si realizo un buen seteo |
|
1429 | 1 : Si realizo un buen seteo | |
1416 | """ |
|
1430 | """ | |
1417 |
|
1431 | |||
1418 | if ext == None: |
|
1432 | if ext == None: | |
1419 | ext = self.ext |
|
1433 | ext = self.ext | |
1420 |
|
1434 | |||
1421 | ext = ext.lower() |
|
1435 | ext = ext.lower() | |
1422 |
|
1436 | |||
1423 | self.ext = ext |
|
1437 | self.ext = ext | |
1424 |
|
1438 | |||
1425 | self.path = path |
|
1439 | self.path = path | |
1426 |
|
1440 | |||
1427 | self.setFile = set - 1 |
|
1441 | self.setFile = set - 1 | |
1428 |
|
1442 | |||
1429 | self.blocksPerFile = blocksPerFile |
|
1443 | self.blocksPerFile = blocksPerFile | |
1430 |
|
1444 | |||
1431 | self.profilesPerBlock = profilesPerBlock |
|
1445 | self.profilesPerBlock = profilesPerBlock | |
1432 |
|
1446 | |||
1433 | self.dataOut = dataOut |
|
1447 | self.dataOut = dataOut | |
1434 |
|
1448 | |||
1435 | if not(self.setNextFile()): |
|
1449 | if not(self.setNextFile()): | |
1436 | print "[Writing] There isn't a next file" |
|
1450 | print "[Writing] There isn't a next file" | |
1437 | return 0 |
|
1451 | return 0 | |
1438 |
|
1452 | |||
1439 | self.setBlockDimension() |
|
1453 | self.setBlockDimension() | |
1440 |
|
1454 | |||
1441 | return 1 |
|
1455 | return 1 | |
1442 |
|
1456 | |||
1443 | def run(self, dataOut, **kwargs): |
|
1457 | def run(self, dataOut, **kwargs): | |
1444 |
|
1458 | |||
1445 | if not(self.isConfig): |
|
1459 | if not(self.isConfig): | |
1446 |
|
1460 | |||
1447 | self.setup(dataOut, **kwargs) |
|
1461 | self.setup(dataOut, **kwargs) | |
1448 | self.isConfig = True |
|
1462 | self.isConfig = True | |
1449 |
|
1463 | |||
1450 | self.putData() |
|
1464 | self.putData() | |
1451 |
|
1465 |
@@ -1,583 +1,590 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Jul 3, 2014 |
|
2 | Created on Jul 3, 2014 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author: roj-idl71 | |
5 | ''' |
|
5 | ''' | |
|
6 | import os | |||
6 | import datetime |
|
7 | import datetime | |
7 | import numpy |
|
8 | import numpy | |
8 |
|
9 | |||
9 | try: |
|
10 | try: | |
10 | from gevent import sleep |
|
11 | from gevent import sleep | |
11 | except: |
|
12 | except: | |
12 | from time import sleep |
|
13 | from time import sleep | |
13 |
|
14 | |||
14 | from schainpy.model.data.jroheaderIO import RadarControllerHeader, SystemHeader |
|
15 | from schainpy.model.data.jroheaderIO import RadarControllerHeader, SystemHeader | |
15 | from schainpy.model.data.jrodata import Voltage |
|
16 | from schainpy.model.data.jrodata import Voltage | |
16 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation |
|
17 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation | |
17 |
|
18 | |||
18 | try: |
|
19 | try: | |
19 | import digital_rf_hdf5 |
|
20 | import digital_rf_hdf5 | |
20 | except: |
|
21 | except: | |
21 | print 'You should install "digital_rf_hdf5" module if you want to read USRP data' |
|
22 | print 'You should install "digital_rf_hdf5" module if you want to read USRP data' | |
22 |
|
23 | |||
23 | class USRPReader(ProcessingUnit): |
|
24 | class USRPReader(ProcessingUnit): | |
24 | ''' |
|
25 | ''' | |
25 | classdocs |
|
26 | classdocs | |
26 | ''' |
|
27 | ''' | |
27 |
|
28 | |||
28 | def __init__(self): |
|
29 | def __init__(self): | |
29 | ''' |
|
30 | ''' | |
30 | Constructor |
|
31 | Constructor | |
31 | ''' |
|
32 | ''' | |
32 |
|
33 | |||
33 | ProcessingUnit.__init__(self) |
|
34 | ProcessingUnit.__init__(self) | |
34 |
|
35 | |||
35 | self.dataOut = Voltage() |
|
36 | self.dataOut = Voltage() | |
36 | self.__printInfo = True |
|
37 | self.__printInfo = True | |
37 | self.__flagDiscontinuousBlock = False |
|
38 | self.__flagDiscontinuousBlock = False | |
38 | self.__bufferIndex = 9999999 |
|
39 | self.__bufferIndex = 9999999 | |
39 |
|
40 | |||
40 | self.__ippKm = None |
|
41 | self.__ippKm = None | |
41 | self.__codeType = 0 |
|
42 | self.__codeType = 0 | |
42 | self.__nCode = None |
|
43 | self.__nCode = None | |
43 | self.__nBaud = None |
|
44 | self.__nBaud = None | |
44 | self.__code = None |
|
45 | self.__code = None | |
45 |
|
46 | |||
46 | def __getCurrentSecond(self): |
|
47 | def __getCurrentSecond(self): | |
47 |
|
48 | |||
48 | return self.__thisUnixSample/self.__sample_rate |
|
49 | return self.__thisUnixSample/self.__sample_rate | |
49 |
|
50 | |||
50 | thisSecond = property(__getCurrentSecond, "I'm the 'thisSecond' property.") |
|
51 | thisSecond = property(__getCurrentSecond, "I'm the 'thisSecond' property.") | |
51 |
|
52 | |||
52 | def __setFileHeader(self): |
|
53 | def __setFileHeader(self): | |
53 | ''' |
|
54 | ''' | |
54 | In this method will be initialized every parameter of dataOut object (header, no data) |
|
55 | In this method will be initialized every parameter of dataOut object (header, no data) | |
55 | ''' |
|
56 | ''' | |
56 | nProfiles = self.__sample_rate #Number of profiles by second |
|
57 | nProfiles = self.__sample_rate #Number of profiles by second | |
57 |
|
58 | |||
58 | self.dataOut.radarControllerHeaderObj = RadarControllerHeader(ippKm=self.__ippKm, |
|
59 | self.dataOut.radarControllerHeaderObj = RadarControllerHeader(ippKm=self.__ippKm, | |
59 | txA=0, |
|
60 | txA=0, | |
60 | txB=0, |
|
61 | txB=0, | |
61 | nWindows=1, |
|
62 | nWindows=1, | |
62 | nHeights=self.__nSamples, |
|
63 | nHeights=self.__nSamples, | |
63 | firstHeight=self.__firstHeigth, |
|
64 | firstHeight=self.__firstHeigth, | |
64 | deltaHeight=self.__deltaHeigth, |
|
65 | deltaHeight=self.__deltaHeigth, | |
65 | codeType=self.__codeType, |
|
66 | codeType=self.__codeType, | |
66 | nCode=self.__nCode, nBaud=self.__nBaud, |
|
67 | nCode=self.__nCode, nBaud=self.__nBaud, | |
67 | code = self.__code) |
|
68 | code = self.__code) | |
68 |
|
69 | |||
69 | self.dataOut.systemHeaderObj = SystemHeader(nSamples=self.__nSamples, |
|
70 | self.dataOut.systemHeaderObj = SystemHeader(nSamples=self.__nSamples, | |
70 | nProfiles=nProfiles, |
|
71 | nProfiles=nProfiles, | |
71 | nChannels=len(self.__channelList), |
|
72 | nChannels=len(self.__channelList), | |
72 | adcResolution=14) |
|
73 | adcResolution=14) | |
73 |
|
74 | |||
74 | self.dataOut.type = "Voltage" |
|
75 | self.dataOut.type = "Voltage" | |
75 |
|
76 | |||
76 | self.dataOut.data = None |
|
77 | self.dataOut.data = None | |
77 |
|
78 | |||
78 | self.dataOut.dtype = numpy.dtype([('real','<i8'),('imag','<i8')]) |
|
79 | self.dataOut.dtype = numpy.dtype([('real','<i8'),('imag','<i8')]) | |
79 |
|
80 | |||
80 | # self.dataOut.nChannels = 0 |
|
81 | # self.dataOut.nChannels = 0 | |
81 |
|
82 | |||
82 | # self.dataOut.nHeights = 0 |
|
83 | # self.dataOut.nHeights = 0 | |
83 |
|
84 | |||
84 | self.dataOut.nProfiles = nProfiles |
|
85 | self.dataOut.nProfiles = nProfiles | |
85 |
|
86 | |||
86 | self.dataOut.heightList = self.__firstHeigth + numpy.arange(self.__nSamples, dtype = numpy.float)*self.__deltaHeigth |
|
87 | self.dataOut.heightList = self.__firstHeigth + numpy.arange(self.__nSamples, dtype = numpy.float)*self.__deltaHeigth | |
87 |
|
88 | |||
88 | self.dataOut.channelList = self.__channelList |
|
89 | self.dataOut.channelList = self.__channelList | |
89 |
|
90 | |||
90 | self.dataOut.blocksize = self.dataOut.getNChannels() * self.dataOut.getNHeights() |
|
91 | self.dataOut.blocksize = self.dataOut.getNChannels() * self.dataOut.getNHeights() | |
91 |
|
92 | |||
92 | # self.dataOut.channelIndexList = None |
|
93 | # self.dataOut.channelIndexList = None | |
93 |
|
94 | |||
94 | self.dataOut.flagNoData = True |
|
95 | self.dataOut.flagNoData = True | |
95 |
|
96 | |||
96 | #Set to TRUE if the data is discontinuous |
|
97 | #Set to TRUE if the data is discontinuous | |
97 | self.dataOut.flagDiscontinuousBlock = False |
|
98 | self.dataOut.flagDiscontinuousBlock = False | |
98 |
|
99 | |||
99 | self.dataOut.utctime = None |
|
100 | self.dataOut.utctime = None | |
100 |
|
101 | |||
101 | self.dataOut.timeZone = self.__timezone/60 #timezone like jroheader, difference in minutes between UTC and localtime |
|
102 | self.dataOut.timeZone = self.__timezone/60 #timezone like jroheader, difference in minutes between UTC and localtime | |
102 |
|
103 | |||
103 | self.dataOut.dstFlag = 0 |
|
104 | self.dataOut.dstFlag = 0 | |
104 |
|
105 | |||
105 | self.dataOut.errorCount = 0 |
|
106 | self.dataOut.errorCount = 0 | |
106 |
|
107 | |||
107 | self.dataOut.nCohInt = 1 |
|
108 | self.dataOut.nCohInt = 1 | |
108 |
|
109 | |||
109 | self.dataOut.flagDecodeData = False #asumo que la data esta decodificada |
|
110 | self.dataOut.flagDecodeData = False #asumo que la data esta decodificada | |
110 |
|
111 | |||
111 | self.dataOut.flagDeflipData = False #asumo que la data esta sin flip |
|
112 | self.dataOut.flagDeflipData = False #asumo que la data esta sin flip | |
112 |
|
113 | |||
113 | self.dataOut.flagShiftFFT = False |
|
114 | self.dataOut.flagShiftFFT = False | |
114 |
|
115 | |||
115 | self.dataOut.ippSeconds = 1.0*self.__nSamples/self.__sample_rate |
|
116 | self.dataOut.ippSeconds = 1.0*self.__nSamples/self.__sample_rate | |
116 |
|
117 | |||
117 | #Time interval between profiles |
|
118 | #Time interval between profiles | |
118 | #self.dataOut.timeInterval = self.dataOut.ippSeconds * self.dataOut.nCohInt |
|
119 | #self.dataOut.timeInterval = self.dataOut.ippSeconds * self.dataOut.nCohInt | |
119 |
|
120 | |||
120 | self.dataOut.frequency = self.__frequency |
|
121 | self.dataOut.frequency = self.__frequency | |
121 |
|
122 | |||
122 | self.dataOut.realtime = self.__online |
|
123 | self.dataOut.realtime = self.__online | |
123 |
|
124 | |||
124 | def findDatafiles(self, path, startDate=None, endDate=None): |
|
125 | def findDatafiles(self, path, startDate=None, endDate=None): | |
125 |
|
126 | |||
|
127 | if not os.path.isdir(path): | |||
|
128 | return [] | |||
|
129 | ||||
126 | try: |
|
130 | try: | |
127 | digitalReadObj = digital_rf_hdf5.read_hdf5(path, load_all_metadata=True) |
|
131 | digitalReadObj = digital_rf_hdf5.read_hdf5(path, load_all_metadata=True) | |
128 | except: |
|
132 | except: | |
129 | digitalReadObj = digital_rf_hdf5.read_hdf5(path) |
|
133 | digitalReadObj = digital_rf_hdf5.read_hdf5(path) | |
130 |
|
134 | |||
131 | channelNameList = digitalReadObj.get_channels() |
|
135 | channelNameList = digitalReadObj.get_channels() | |
132 |
|
136 | |||
133 | if not channelNameList: |
|
137 | if not channelNameList: | |
134 | return [] |
|
138 | return [] | |
135 |
|
139 | |||
136 | metadata_dict = digitalReadObj.get_rf_file_metadata(channelNameList[0]) |
|
140 | metadata_dict = digitalReadObj.get_rf_file_metadata(channelNameList[0]) | |
137 |
|
141 | |||
138 | sample_rate = metadata_dict['sample_rate'][0] |
|
142 | sample_rate = metadata_dict['sample_rate'][0] | |
139 |
|
143 | |||
140 | this_metadata_file = digitalReadObj.get_metadata(channelNameList[0]) |
|
144 | this_metadata_file = digitalReadObj.get_metadata(channelNameList[0]) | |
141 |
|
145 | |||
142 | try: |
|
146 | try: | |
143 | timezone = this_metadata_file['timezone'].value |
|
147 | timezone = this_metadata_file['timezone'].value | |
144 | except: |
|
148 | except: | |
145 | timezone = 0 |
|
149 | timezone = 0 | |
146 |
|
150 | |||
147 | startUTCSecond, endUTCSecond = digitalReadObj.get_bounds(channelNameList[0])/sample_rate - timezone |
|
151 | startUTCSecond, endUTCSecond = digitalReadObj.get_bounds(channelNameList[0])/sample_rate - timezone | |
148 |
|
152 | |||
149 | startDatetime = datetime.datetime.utcfromtimestamp(startUTCSecond) |
|
153 | startDatetime = datetime.datetime.utcfromtimestamp(startUTCSecond) | |
150 | endDatatime = datetime.datetime.utcfromtimestamp(endUTCSecond) |
|
154 | endDatatime = datetime.datetime.utcfromtimestamp(endUTCSecond) | |
151 |
|
155 | |||
152 | if not startDate: |
|
156 | if not startDate: | |
153 | startDate = startDatetime.date() |
|
157 | startDate = startDatetime.date() | |
154 |
|
158 | |||
155 | if not endDate: |
|
159 | if not endDate: | |
156 | endDate = endDatatime.date() |
|
160 | endDate = endDatatime.date() | |
157 |
|
161 | |||
158 | dateList = [] |
|
162 | dateList = [] | |
159 |
|
163 | |||
160 | thisDatetime = startDatetime |
|
164 | thisDatetime = startDatetime | |
161 |
|
165 | |||
162 | while(thisDatetime<=endDatatime): |
|
166 | while(thisDatetime<=endDatatime): | |
163 |
|
167 | |||
164 | thisDate = thisDatetime.date() |
|
168 | thisDate = thisDatetime.date() | |
165 |
|
169 | |||
166 | if thisDate < startDate: |
|
170 | if thisDate < startDate: | |
167 | continue |
|
171 | continue | |
168 |
|
172 | |||
169 | if thisDate > endDate: |
|
173 | if thisDate > endDate: | |
170 | break |
|
174 | break | |
171 |
|
175 | |||
172 | dateList.append(thisDate) |
|
176 | dateList.append(thisDate) | |
173 | thisDatetime += datetime.timedelta(1) |
|
177 | thisDatetime += datetime.timedelta(1) | |
174 |
|
178 | |||
175 | return dateList |
|
179 | return dateList | |
176 |
|
180 | |||
177 | def setup(self, path = None, |
|
181 | def setup(self, path = None, | |
178 | startDate = None, |
|
182 | startDate = None, | |
179 | endDate = None, |
|
183 | endDate = None, | |
180 | startTime = datetime.time(0,0,0), |
|
184 | startTime = datetime.time(0,0,0), | |
181 | endTime = datetime.time(23,59,59), |
|
185 | endTime = datetime.time(23,59,59), | |
182 | channelList = None, |
|
186 | channelList = None, | |
183 | nSamples = None, |
|
187 | nSamples = None, | |
184 | ippKm = 60, |
|
188 | ippKm = 60, | |
185 | online = False, |
|
189 | online = False, | |
186 | delay = 60, |
|
190 | delay = 60, | |
187 | buffer_size = None, |
|
191 | buffer_size = None, | |
188 | nbuffer = 1024, |
|
192 | nbuffer = 1024, | |
189 | **kwargs): |
|
193 | **kwargs): | |
190 | ''' |
|
194 | ''' | |
191 | In this method we should set all initial parameters. |
|
195 | In this method we should set all initial parameters. | |
192 |
|
196 | |||
193 | Inputs: |
|
197 | Inputs: | |
194 | path |
|
198 | path | |
195 | startDate |
|
199 | startDate | |
196 | endDate |
|
200 | endDate | |
197 | startTime |
|
201 | startTime | |
198 | endTime |
|
202 | endTime | |
199 | set |
|
203 | set | |
200 | expLabel |
|
204 | expLabel | |
201 | ext |
|
205 | ext | |
202 | online |
|
206 | online | |
203 | delay |
|
207 | delay | |
204 | ''' |
|
208 | ''' | |
205 |
|
209 | |||
206 | if not buffer_size: |
|
210 | if not buffer_size: | |
207 | buffer_size = nbuffer |
|
211 | buffer_size = nbuffer | |
208 |
|
|
212 | ||
|
213 | if not os.path.isdir(path): | |||
|
214 | raise ValueError, "[Reading] This path %s does not exist" %path | |||
|
215 | ||||
209 | try: |
|
216 | try: | |
210 | self.digitalReadObj = digital_rf_hdf5.read_hdf5(path, load_all_metadata=True) |
|
217 | self.digitalReadObj = digital_rf_hdf5.read_hdf5(path, load_all_metadata=True) | |
211 | except: |
|
218 | except: | |
212 | self.digitalReadObj = digital_rf_hdf5.read_hdf5(path) |
|
219 | self.digitalReadObj = digital_rf_hdf5.read_hdf5(path) | |
213 |
|
220 | |||
214 | channelNameList = self.digitalReadObj.get_channels() |
|
221 | channelNameList = self.digitalReadObj.get_channels() | |
215 |
|
222 | |||
216 | if not channelNameList: |
|
223 | if not channelNameList: | |
217 | raise IOError, "[Reading] The path doesn,t have any files .. " |
|
224 | raise IOError, "[Reading] The path doesn,t have any files .. " | |
218 |
|
225 | |||
219 | if not channelList: |
|
226 | if not channelList: | |
220 | channelList = range(len(channelNameList)) |
|
227 | channelList = range(len(channelNameList)) | |
221 |
|
228 | |||
222 | ########## Reading metadata ###################### |
|
229 | ########## Reading metadata ###################### | |
223 |
|
230 | |||
224 | metadata_dict = self.digitalReadObj.get_rf_file_metadata(channelNameList[channelList[0]]) |
|
231 | metadata_dict = self.digitalReadObj.get_rf_file_metadata(channelNameList[channelList[0]]) | |
225 |
|
232 | |||
226 | self.__sample_rate = metadata_dict['sample_rate'][0] |
|
233 | self.__sample_rate = metadata_dict['sample_rate'][0] | |
227 | self.__samples_per_file = metadata_dict['samples_per_file'][0] |
|
234 | self.__samples_per_file = metadata_dict['samples_per_file'][0] | |
228 | self.__deltaHeigth = 1e6*0.15/self.__sample_rate |
|
235 | self.__deltaHeigth = 1e6*0.15/self.__sample_rate | |
229 |
|
236 | |||
230 | this_metadata_file = self.digitalReadObj.get_metadata(channelNameList[channelList[0]]) |
|
237 | this_metadata_file = self.digitalReadObj.get_metadata(channelNameList[channelList[0]]) | |
231 |
|
238 | |||
232 | self.__frequency = this_metadata_file['center_frequencies'].value |
|
239 | self.__frequency = this_metadata_file['center_frequencies'].value | |
233 | try: |
|
240 | try: | |
234 | self.__timezone = this_metadata_file['timezone'].value |
|
241 | self.__timezone = this_metadata_file['timezone'].value | |
235 | except: |
|
242 | except: | |
236 | self.__timezone = 0 |
|
243 | self.__timezone = 0 | |
237 |
|
244 | |||
238 | self.__firstHeigth = 0 |
|
245 | self.__firstHeigth = 0 | |
239 |
|
246 | |||
240 | try: |
|
247 | try: | |
241 | codeType = this_metadata_file['codeType'].value |
|
248 | codeType = this_metadata_file['codeType'].value | |
242 | except: |
|
249 | except: | |
243 | codeType = 0 |
|
250 | codeType = 0 | |
244 |
|
251 | |||
245 | nCode = 0 |
|
252 | nCode = 0 | |
246 | nBaud = 0 |
|
253 | nBaud = 0 | |
247 | code = None |
|
254 | code = None | |
248 |
|
255 | |||
249 | if codeType: |
|
256 | if codeType: | |
250 | nCode = this_metadata_file['nCode'].value |
|
257 | nCode = this_metadata_file['nCode'].value | |
251 | nBaud = this_metadata_file['nBaud'].value |
|
258 | nBaud = this_metadata_file['nBaud'].value | |
252 | code = this_metadata_file['code'].value |
|
259 | code = this_metadata_file['code'].value | |
253 |
|
260 | |||
254 | if not ippKm: |
|
261 | if not ippKm: | |
255 | try: |
|
262 | try: | |
256 | #seconds to km |
|
263 | #seconds to km | |
257 | ippKm = 1e6*0.15*this_metadata_file['ipp'].value |
|
264 | ippKm = 1e6*0.15*this_metadata_file['ipp'].value | |
258 | except: |
|
265 | except: | |
259 | ippKm = None |
|
266 | ippKm = None | |
260 |
|
267 | |||
261 | #################################################### |
|
268 | #################################################### | |
262 | startUTCSecond = None |
|
269 | startUTCSecond = None | |
263 | endUTCSecond = None |
|
270 | endUTCSecond = None | |
264 |
|
271 | |||
265 | if startDate: |
|
272 | if startDate: | |
266 | startDatetime = datetime.datetime.combine(startDate, startTime) |
|
273 | startDatetime = datetime.datetime.combine(startDate, startTime) | |
267 | startUTCSecond = (startDatetime-datetime.datetime(1970,1,1)).total_seconds() + self.__timezone |
|
274 | startUTCSecond = (startDatetime-datetime.datetime(1970,1,1)).total_seconds() + self.__timezone | |
268 |
|
275 | |||
269 | if endDate: |
|
276 | if endDate: | |
270 | endDatetime = datetime.datetime.combine(endDate, endTime) |
|
277 | endDatetime = datetime.datetime.combine(endDate, endTime) | |
271 | endUTCSecond = (endDatetime-datetime.datetime(1970,1,1)).total_seconds() + self.__timezone |
|
278 | endUTCSecond = (endDatetime-datetime.datetime(1970,1,1)).total_seconds() + self.__timezone | |
272 |
|
279 | |||
273 | start_index, end_index = self.digitalReadObj.get_bounds(channelNameList[channelList[0]]) |
|
280 | start_index, end_index = self.digitalReadObj.get_bounds(channelNameList[channelList[0]]) | |
274 |
|
281 | |||
275 | if not startUTCSecond: |
|
282 | if not startUTCSecond: | |
276 | startUTCSecond = start_index/self.__sample_rate |
|
283 | startUTCSecond = start_index/self.__sample_rate | |
277 |
|
284 | |||
278 | if start_index > startUTCSecond*self.__sample_rate: |
|
285 | if start_index > startUTCSecond*self.__sample_rate: | |
279 | startUTCSecond = start_index/self.__sample_rate |
|
286 | startUTCSecond = start_index/self.__sample_rate | |
280 |
|
287 | |||
281 | if not endUTCSecond: |
|
288 | if not endUTCSecond: | |
282 | endUTCSecond = end_index/self.__sample_rate |
|
289 | endUTCSecond = end_index/self.__sample_rate | |
283 |
|
290 | |||
284 | if end_index < endUTCSecond*self.__sample_rate: |
|
291 | if end_index < endUTCSecond*self.__sample_rate: | |
285 | endUTCSecond = end_index/self.__sample_rate |
|
292 | endUTCSecond = end_index/self.__sample_rate | |
286 |
|
293 | |||
287 | if not nSamples: |
|
294 | if not nSamples: | |
288 | if not ippKm: |
|
295 | if not ippKm: | |
289 | raise ValueError, "[Reading] nSamples or ippKm should be defined" |
|
296 | raise ValueError, "[Reading] nSamples or ippKm should be defined" | |
290 |
|
297 | |||
291 | nSamples = ippKm / (1e6*0.15/self.__sample_rate) |
|
298 | nSamples = ippKm / (1e6*0.15/self.__sample_rate) | |
292 |
|
299 | |||
293 | channelBoundList = [] |
|
300 | channelBoundList = [] | |
294 | channelNameListFiltered = [] |
|
301 | channelNameListFiltered = [] | |
295 |
|
302 | |||
296 | for thisIndexChannel in channelList: |
|
303 | for thisIndexChannel in channelList: | |
297 | thisChannelName = channelNameList[thisIndexChannel] |
|
304 | thisChannelName = channelNameList[thisIndexChannel] | |
298 | start_index, end_index = self.digitalReadObj.get_bounds(thisChannelName) |
|
305 | start_index, end_index = self.digitalReadObj.get_bounds(thisChannelName) | |
299 | channelBoundList.append((start_index, end_index)) |
|
306 | channelBoundList.append((start_index, end_index)) | |
300 | channelNameListFiltered.append(thisChannelName) |
|
307 | channelNameListFiltered.append(thisChannelName) | |
301 |
|
308 | |||
302 | self.profileIndex = 0 |
|
309 | self.profileIndex = 0 | |
303 |
|
310 | |||
304 | self.__delay = delay |
|
311 | self.__delay = delay | |
305 | self.__ippKm = ippKm |
|
312 | self.__ippKm = ippKm | |
306 | self.__codeType = codeType |
|
313 | self.__codeType = codeType | |
307 | self.__nCode = nCode |
|
314 | self.__nCode = nCode | |
308 | self.__nBaud = nBaud |
|
315 | self.__nBaud = nBaud | |
309 | self.__code = code |
|
316 | self.__code = code | |
310 |
|
317 | |||
311 | self.__datapath = path |
|
318 | self.__datapath = path | |
312 | self.__online = online |
|
319 | self.__online = online | |
313 | self.__channelList = channelList |
|
320 | self.__channelList = channelList | |
314 | self.__channelNameList = channelNameListFiltered |
|
321 | self.__channelNameList = channelNameListFiltered | |
315 | self.__channelBoundList = channelBoundList |
|
322 | self.__channelBoundList = channelBoundList | |
316 | self.__nSamples = nSamples |
|
323 | self.__nSamples = nSamples | |
317 | self.__samples_to_read = buffer_size*nSamples |
|
324 | self.__samples_to_read = buffer_size*nSamples | |
318 | self.__nChannels = len(self.__channelList) |
|
325 | self.__nChannels = len(self.__channelList) | |
319 |
|
326 | |||
320 | self.__startUTCSecond = startUTCSecond |
|
327 | self.__startUTCSecond = startUTCSecond | |
321 | self.__endUTCSecond = endUTCSecond |
|
328 | self.__endUTCSecond = endUTCSecond | |
322 |
|
329 | |||
323 | self.__timeInterval = 1.0 * self.__samples_to_read/self.__sample_rate #Time interval |
|
330 | self.__timeInterval = 1.0 * self.__samples_to_read/self.__sample_rate #Time interval | |
324 |
|
331 | |||
325 | if online: |
|
332 | if online: | |
326 | # self.__thisUnixSample = int(endUTCSecond*self.__sample_rate - 4*self.__samples_to_read) |
|
333 | # self.__thisUnixSample = int(endUTCSecond*self.__sample_rate - 4*self.__samples_to_read) | |
327 | startUTCSecond = numpy.floor(endUTCSecond) |
|
334 | startUTCSecond = numpy.floor(endUTCSecond) | |
328 |
|
335 | |||
329 | self.__thisUnixSample = int(startUTCSecond*self.__sample_rate) - self.__samples_to_read |
|
336 | self.__thisUnixSample = int(startUTCSecond*self.__sample_rate) - self.__samples_to_read | |
330 |
|
337 | |||
331 | self.__data_buffer = numpy.zeros((self.__nChannels, self.__samples_to_read), dtype = numpy.complex) |
|
338 | self.__data_buffer = numpy.zeros((self.__nChannels, self.__samples_to_read), dtype = numpy.complex) | |
332 |
|
339 | |||
333 | self.__setFileHeader() |
|
340 | self.__setFileHeader() | |
334 | self.isConfig = True |
|
341 | self.isConfig = True | |
335 |
|
342 | |||
336 | print "[Reading] USRP Data was found from %s to %s " %( |
|
343 | print "[Reading] USRP Data was found from %s to %s " %( | |
337 | datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), |
|
344 | datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), | |
338 | datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) |
|
345 | datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) | |
339 | ) |
|
346 | ) | |
340 |
|
347 | |||
341 | print "[Reading] Starting process from %s to %s" %(datetime.datetime.utcfromtimestamp(startUTCSecond - self.__timezone), |
|
348 | print "[Reading] Starting process from %s to %s" %(datetime.datetime.utcfromtimestamp(startUTCSecond - self.__timezone), | |
342 | datetime.datetime.utcfromtimestamp(endUTCSecond - self.__timezone) |
|
349 | datetime.datetime.utcfromtimestamp(endUTCSecond - self.__timezone) | |
343 | ) |
|
350 | ) | |
344 |
|
351 | |||
345 | def __reload(self): |
|
352 | def __reload(self): | |
346 |
|
353 | |||
347 | if not self.__online: |
|
354 | if not self.__online: | |
348 | return |
|
355 | return | |
349 |
|
356 | |||
350 |
|
357 | |||
351 | # print "%s not in range [%s, %s]" %( |
|
358 | # print "%s not in range [%s, %s]" %( | |
352 | # datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), |
|
359 | # datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), | |
353 | # datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), |
|
360 | # datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), | |
354 | # datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) |
|
361 | # datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) | |
355 | # ) |
|
362 | # ) | |
356 | print "[Reading] reloading metadata ..." |
|
363 | print "[Reading] reloading metadata ..." | |
357 |
|
364 | |||
358 | try: |
|
365 | try: | |
359 | self.digitalReadObj.reload(complete_update=True) |
|
366 | self.digitalReadObj.reload(complete_update=True) | |
360 | except: |
|
367 | except: | |
361 | self.digitalReadObj.reload() |
|
368 | self.digitalReadObj.reload() | |
362 |
|
369 | |||
363 | start_index, end_index = self.digitalReadObj.get_bounds(self.__channelNameList[self.__channelList[0]]) |
|
370 | start_index, end_index = self.digitalReadObj.get_bounds(self.__channelNameList[self.__channelList[0]]) | |
364 |
|
371 | |||
365 | if start_index > self.__startUTCSecond*self.__sample_rate: |
|
372 | if start_index > self.__startUTCSecond*self.__sample_rate: | |
366 | self.__startUTCSecond = 1.0*start_index/self.__sample_rate |
|
373 | self.__startUTCSecond = 1.0*start_index/self.__sample_rate | |
367 |
|
374 | |||
368 | if end_index > self.__endUTCSecond*self.__sample_rate: |
|
375 | if end_index > self.__endUTCSecond*self.__sample_rate: | |
369 | self.__endUTCSecond = 1.0*end_index/self.__sample_rate |
|
376 | self.__endUTCSecond = 1.0*end_index/self.__sample_rate | |
370 |
|
377 | |||
371 | print "[Reading] New timerange found [%s, %s] " %( |
|
378 | print "[Reading] New timerange found [%s, %s] " %( | |
372 | datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), |
|
379 | datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), | |
373 | datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) |
|
380 | datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) | |
374 | ) |
|
381 | ) | |
375 |
|
382 | |||
376 | return True |
|
383 | return True | |
377 |
|
384 | |||
378 | return False |
|
385 | return False | |
379 |
|
386 | |||
380 | def __readNextBlock(self, seconds=30, volt_scale = 218776): |
|
387 | def __readNextBlock(self, seconds=30, volt_scale = 218776): | |
381 | ''' |
|
388 | ''' | |
382 | ''' |
|
389 | ''' | |
383 |
|
390 | |||
384 | #Set the next data |
|
391 | #Set the next data | |
385 | self.__flagDiscontinuousBlock = False |
|
392 | self.__flagDiscontinuousBlock = False | |
386 | self.__thisUnixSample += self.__samples_to_read |
|
393 | self.__thisUnixSample += self.__samples_to_read | |
387 |
|
394 | |||
388 | if self.__thisUnixSample + 2*self.__samples_to_read > self.__endUTCSecond*self.__sample_rate: |
|
395 | if self.__thisUnixSample + 2*self.__samples_to_read > self.__endUTCSecond*self.__sample_rate: | |
389 | print "[Reading] There are no more data into selected timerange" |
|
396 | print "[Reading] There are no more data into selected timerange" | |
390 |
|
397 | |||
391 | self.__reload() |
|
398 | self.__reload() | |
392 |
|
399 | |||
393 | if self.__thisUnixSample + 2*self.__samples_to_read > self.__endUTCSecond*self.__sample_rate: |
|
400 | if self.__thisUnixSample + 2*self.__samples_to_read > self.__endUTCSecond*self.__sample_rate: | |
394 | self.__thisUnixSample -= self.__samples_to_read |
|
401 | self.__thisUnixSample -= self.__samples_to_read | |
395 | return False |
|
402 | return False | |
396 |
|
403 | |||
397 | indexChannel = 0 |
|
404 | indexChannel = 0 | |
398 |
|
405 | |||
399 | dataOk = False |
|
406 | dataOk = False | |
400 |
|
407 | |||
401 | for thisChannelName in self.__channelNameList: |
|
408 | for thisChannelName in self.__channelNameList: | |
402 |
|
409 | |||
403 | try: |
|
410 | try: | |
404 | result = self.digitalReadObj.read_vector_c81d(self.__thisUnixSample, |
|
411 | result = self.digitalReadObj.read_vector_c81d(self.__thisUnixSample, | |
405 | self.__samples_to_read, |
|
412 | self.__samples_to_read, | |
406 | thisChannelName) |
|
413 | thisChannelName) | |
407 |
|
414 | |||
408 | except IOError, e: |
|
415 | except IOError, e: | |
409 | #read next profile |
|
416 | #read next profile | |
410 | self.__flagDiscontinuousBlock = True |
|
417 | self.__flagDiscontinuousBlock = True | |
411 | print e |
|
418 | print e | |
412 | break |
|
419 | break | |
413 |
|
420 | |||
414 | if result.shape[0] != self.__samples_to_read: |
|
421 | if result.shape[0] != self.__samples_to_read: | |
415 | self.__flagDiscontinuousBlock = True |
|
422 | self.__flagDiscontinuousBlock = True | |
416 | print "[Reading] %s: Too few samples were found, just %d samples" %(datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), |
|
423 | print "[Reading] %s: Too few samples were found, just %d samples" %(datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), | |
417 | result.shape[0]) |
|
424 | result.shape[0]) | |
418 | break |
|
425 | break | |
419 |
|
426 | |||
420 | self.__data_buffer[indexChannel,:] = result*volt_scale |
|
427 | self.__data_buffer[indexChannel,:] = result*volt_scale | |
421 |
|
428 | |||
422 | indexChannel += 1 |
|
429 | indexChannel += 1 | |
423 |
|
430 | |||
424 | dataOk = True |
|
431 | dataOk = True | |
425 |
|
432 | |||
426 | self.__utctime = self.__thisUnixSample/self.__sample_rate |
|
433 | self.__utctime = self.__thisUnixSample/self.__sample_rate | |
427 |
|
434 | |||
428 | if not dataOk: |
|
435 | if not dataOk: | |
429 | return False |
|
436 | return False | |
430 |
|
437 | |||
431 | print "[Reading] %s: %d samples <> %f sec" %(datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), |
|
438 | print "[Reading] %s: %d samples <> %f sec" %(datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), | |
432 | self.__samples_to_read, |
|
439 | self.__samples_to_read, | |
433 | self.__timeInterval) |
|
440 | self.__timeInterval) | |
434 |
|
441 | |||
435 | self.__bufferIndex = 0 |
|
442 | self.__bufferIndex = 0 | |
436 |
|
443 | |||
437 | return True |
|
444 | return True | |
438 |
|
445 | |||
439 | def __isBufferEmpty(self): |
|
446 | def __isBufferEmpty(self): | |
440 |
|
447 | |||
441 | if self.__bufferIndex <= self.__samples_to_read - self.__nSamples: |
|
448 | if self.__bufferIndex <= self.__samples_to_read - self.__nSamples: | |
442 | return False |
|
449 | return False | |
443 |
|
450 | |||
444 | return True |
|
451 | return True | |
445 |
|
452 | |||
446 | def getData(self, seconds=30, nTries=5): |
|
453 | def getData(self, seconds=30, nTries=5): | |
447 |
|
454 | |||
448 | ''' |
|
455 | ''' | |
449 | This method gets the data from files and put the data into the dataOut object |
|
456 | This method gets the data from files and put the data into the dataOut object | |
450 |
|
457 | |||
451 | In addition, increase el the buffer counter in one. |
|
458 | In addition, increase el the buffer counter in one. | |
452 |
|
459 | |||
453 | Return: |
|
460 | Return: | |
454 | data : retorna un perfil de voltages (alturas * canales) copiados desde el |
|
461 | data : retorna un perfil de voltages (alturas * canales) copiados desde el | |
455 | buffer. Si no hay mas archivos a leer retorna None. |
|
462 | buffer. Si no hay mas archivos a leer retorna None. | |
456 |
|
463 | |||
457 | Affected: |
|
464 | Affected: | |
458 | self.dataOut |
|
465 | self.dataOut | |
459 | self.profileIndex |
|
466 | self.profileIndex | |
460 | self.flagDiscontinuousBlock |
|
467 | self.flagDiscontinuousBlock | |
461 | self.flagIsNewBlock |
|
468 | self.flagIsNewBlock | |
462 | ''' |
|
469 | ''' | |
463 |
|
470 | |||
464 | err_counter = 0 |
|
471 | err_counter = 0 | |
465 | self.dataOut.flagNoData = True |
|
472 | self.dataOut.flagNoData = True | |
466 |
|
473 | |||
467 | if self.__isBufferEmpty(): |
|
474 | if self.__isBufferEmpty(): | |
468 |
|
475 | |||
469 | self.__flagDiscontinuousBlock = False |
|
476 | self.__flagDiscontinuousBlock = False | |
470 |
|
477 | |||
471 | while True: |
|
478 | while True: | |
472 | if self.__readNextBlock(): |
|
479 | if self.__readNextBlock(): | |
473 | break |
|
480 | break | |
474 |
|
481 | |||
475 | if self.__thisUnixSample > self.__endUTCSecond*self.__sample_rate: |
|
482 | if self.__thisUnixSample > self.__endUTCSecond*self.__sample_rate: | |
476 | return False |
|
483 | return False | |
477 |
|
484 | |||
478 | if self.__flagDiscontinuousBlock: |
|
485 | if self.__flagDiscontinuousBlock: | |
479 | print '[Reading] discontinuous block found ... continue with the next block' |
|
486 | print '[Reading] discontinuous block found ... continue with the next block' | |
480 | continue |
|
487 | continue | |
481 |
|
488 | |||
482 | if not self.__online: |
|
489 | if not self.__online: | |
483 | return False |
|
490 | return False | |
484 |
|
491 | |||
485 | err_counter += 1 |
|
492 | err_counter += 1 | |
486 | if err_counter > nTries: |
|
493 | if err_counter > nTries: | |
487 | return False |
|
494 | return False | |
488 |
|
495 | |||
489 | print '[Reading] waiting %d seconds to read a new block' %seconds |
|
496 | print '[Reading] waiting %d seconds to read a new block' %seconds | |
490 | sleep(seconds) |
|
497 | sleep(seconds) | |
491 |
|
498 | |||
492 | self.dataOut.data = self.__data_buffer[:,self.__bufferIndex:self.__bufferIndex+self.__nSamples] |
|
499 | self.dataOut.data = self.__data_buffer[:,self.__bufferIndex:self.__bufferIndex+self.__nSamples] | |
493 | self.dataOut.utctime = (self.__thisUnixSample + self.__bufferIndex)/self.__sample_rate |
|
500 | self.dataOut.utctime = (self.__thisUnixSample + self.__bufferIndex)/self.__sample_rate | |
494 | self.dataOut.flagNoData = False |
|
501 | self.dataOut.flagNoData = False | |
495 | self.dataOut.flagDiscontinuousBlock = self.__flagDiscontinuousBlock |
|
502 | self.dataOut.flagDiscontinuousBlock = self.__flagDiscontinuousBlock | |
496 |
|
503 | |||
497 | self.__bufferIndex += self.__nSamples |
|
504 | self.__bufferIndex += self.__nSamples | |
498 | self.profileIndex += 1 |
|
505 | self.profileIndex += 1 | |
499 |
|
506 | |||
500 | return True |
|
507 | return True | |
501 |
|
508 | |||
502 | def printInfo(self): |
|
509 | def printInfo(self): | |
503 | ''' |
|
510 | ''' | |
504 | ''' |
|
511 | ''' | |
505 | if self.__printInfo == False: |
|
512 | if self.__printInfo == False: | |
506 | return |
|
513 | return | |
507 |
|
514 | |||
508 | # self.systemHeaderObj.printInfo() |
|
515 | # self.systemHeaderObj.printInfo() | |
509 | # self.radarControllerHeaderObj.printInfo() |
|
516 | # self.radarControllerHeaderObj.printInfo() | |
510 |
|
517 | |||
511 | self.__printInfo = False |
|
518 | self.__printInfo = False | |
512 |
|
519 | |||
513 | def printNumberOfBlock(self): |
|
520 | def printNumberOfBlock(self): | |
514 | ''' |
|
521 | ''' | |
515 | ''' |
|
522 | ''' | |
516 |
|
523 | |||
517 | print self.profileIndex |
|
524 | print self.profileIndex | |
518 |
|
525 | |||
519 | def run(self, **kwargs): |
|
526 | def run(self, **kwargs): | |
520 | ''' |
|
527 | ''' | |
521 | This method will be called many times so here you should put all your code |
|
528 | This method will be called many times so here you should put all your code | |
522 | ''' |
|
529 | ''' | |
523 |
|
530 | |||
524 | if not self.isConfig: |
|
531 | if not self.isConfig: | |
525 | self.setup(**kwargs) |
|
532 | self.setup(**kwargs) | |
526 |
|
533 | |||
527 | self.getData(seconds=self.__delay) |
|
534 | self.getData(seconds=self.__delay) | |
528 |
|
535 | |||
529 | return |
|
536 | return | |
530 |
|
537 | |||
531 | class USRPWriter(Operation): |
|
538 | class USRPWriter(Operation): | |
532 | ''' |
|
539 | ''' | |
533 | classdocs |
|
540 | classdocs | |
534 | ''' |
|
541 | ''' | |
535 |
|
542 | |||
536 | def __init__(self): |
|
543 | def __init__(self): | |
537 | ''' |
|
544 | ''' | |
538 | Constructor |
|
545 | Constructor | |
539 | ''' |
|
546 | ''' | |
540 | self.dataOut = None |
|
547 | self.dataOut = None | |
541 |
|
548 | |||
542 | def setup(self, dataIn, path, blocksPerFile, set=0, ext=None): |
|
549 | def setup(self, dataIn, path, blocksPerFile, set=0, ext=None): | |
543 | ''' |
|
550 | ''' | |
544 | In this method we should set all initial parameters. |
|
551 | In this method we should set all initial parameters. | |
545 |
|
552 | |||
546 | Input: |
|
553 | Input: | |
547 | dataIn : Input data will also be outputa data |
|
554 | dataIn : Input data will also be outputa data | |
548 |
|
555 | |||
549 | ''' |
|
556 | ''' | |
550 | self.dataOut = dataIn |
|
557 | self.dataOut = dataIn | |
551 |
|
558 | |||
552 |
|
559 | |||
553 |
|
560 | |||
554 |
|
561 | |||
555 |
|
562 | |||
556 | self.isConfig = True |
|
563 | self.isConfig = True | |
557 |
|
564 | |||
558 | return |
|
565 | return | |
559 |
|
566 | |||
560 | def run(self, dataIn, **kwargs): |
|
567 | def run(self, dataIn, **kwargs): | |
561 | ''' |
|
568 | ''' | |
562 | This method will be called many times so here you should put all your code |
|
569 | This method will be called many times so here you should put all your code | |
563 |
|
570 | |||
564 | Inputs: |
|
571 | Inputs: | |
565 |
|
572 | |||
566 | dataIn : object with the data |
|
573 | dataIn : object with the data | |
567 |
|
574 | |||
568 | ''' |
|
575 | ''' | |
569 |
|
576 | |||
570 | if not self.isConfig: |
|
577 | if not self.isConfig: | |
571 | self.setup(dataIn, **kwargs) |
|
578 | self.setup(dataIn, **kwargs) | |
572 |
|
579 | |||
573 |
|
580 | |||
574 | if __name__ == '__main__': |
|
581 | if __name__ == '__main__': | |
575 |
|
582 | |||
576 | readObj = USRPReader() |
|
583 | readObj = USRPReader() | |
577 |
|
584 | |||
578 | while True: |
|
585 | while True: | |
579 | readObj.run(path='/Volumes/DATA/haystack/passive_radar/') |
|
586 | readObj.run(path='/Volumes/DATA/haystack/passive_radar/') | |
580 | # readObj.printInfo() |
|
587 | # readObj.printInfo() | |
581 | readObj.printNumberOfBlock() |
|
588 | readObj.printNumberOfBlock() | |
582 |
|
589 | |||
583 | No newline at end of file |
|
590 |
General Comments 0
You need to be logged in to leave comments.
Login now