@@ -1,1142 +1,1145 | |||
|
1 | 1 | ''' |
|
2 | 2 | Created on September , 2012 |
|
3 | 3 | @author: |
|
4 | 4 | ''' |
|
5 | 5 | from xml.etree.ElementTree import ElementTree, Element, SubElement, tostring |
|
6 | 6 | from xml.dom import minidom |
|
7 | 7 | |
|
8 | 8 | from model import * |
|
9 | 9 | from time import sleep |
|
10 | 10 | |
|
11 | 11 | import sys |
|
12 | 12 | import ast |
|
13 | 13 | import traceback |
|
14 | 14 | |
|
15 | 15 | SCHAIN_MAIL = "miguel.urco@jro.igp.gob.pe" |
|
16 | 16 | EMAIL_SERVER = "jro.igp.gob.pe" |
|
17 | 17 | |
|
18 | 18 | def prettify(elem): |
|
19 | 19 | """Return a pretty-printed XML string for the Element. |
|
20 | 20 | """ |
|
21 | 21 | rough_string = tostring(elem, 'utf-8') |
|
22 | 22 | reparsed = minidom.parseString(rough_string) |
|
23 | 23 | return reparsed.toprettyxml(indent=" ") |
|
24 | 24 | |
|
25 | 25 | class ParameterConf(): |
|
26 | 26 | |
|
27 | 27 | id = None |
|
28 | 28 | name = None |
|
29 | 29 | value = None |
|
30 | 30 | format = None |
|
31 | 31 | |
|
32 | 32 | __formated_value = None |
|
33 | 33 | |
|
34 | 34 | ELEMENTNAME = 'Parameter' |
|
35 | 35 | |
|
36 | 36 | def __init__(self): |
|
37 | 37 | |
|
38 | 38 | self.format = 'str' |
|
39 | 39 | |
|
40 | 40 | def getElementName(self): |
|
41 | 41 | |
|
42 | 42 | return self.ELEMENTNAME |
|
43 | 43 | |
|
44 | 44 | def getValue(self): |
|
45 | 45 | |
|
46 | 46 | value = self.value |
|
47 | 47 | format = self.format |
|
48 | 48 | |
|
49 | 49 | if self.__formated_value != None: |
|
50 | 50 | |
|
51 | 51 | return self.__formated_value |
|
52 | 52 | |
|
53 | 53 | if format == 'str': |
|
54 | 54 | self.__formated_value = str(value) |
|
55 | 55 | return self.__formated_value |
|
56 | 56 | |
|
57 | 57 | if value == '': |
|
58 | 58 | raise ValueError, "%s: This parameter value is empty" %self.name |
|
59 | ||
|
60 | if format == 'bool': | |
|
61 | value = int(value) | |
|
62 | 59 | |
|
63 | 60 | if format == 'list': |
|
64 | 61 | strList = value.split(',') |
|
65 | 62 | |
|
66 | 63 | self.__formated_value = strList |
|
67 | 64 | |
|
68 | 65 | return self.__formated_value |
|
69 | 66 | |
|
70 | 67 | if format == 'intlist': |
|
71 | 68 | """ |
|
72 | 69 | Example: |
|
73 | 70 | value = (0,1,2) |
|
74 | 71 | """ |
|
75 | 72 | value = value.replace('(', '') |
|
76 | 73 | value = value.replace(')', '') |
|
77 | 74 | |
|
78 | 75 | value = value.replace('[', '') |
|
79 | 76 | value = value.replace(']', '') |
|
80 | 77 | |
|
81 | 78 | strList = value.split(',') |
|
82 | 79 | intList = [int(float(x)) for x in strList] |
|
83 | 80 | |
|
84 | 81 | self.__formated_value = intList |
|
85 | 82 | |
|
86 | 83 | return self.__formated_value |
|
87 | 84 | |
|
88 | 85 | if format == 'floatlist': |
|
89 | 86 | """ |
|
90 | 87 | Example: |
|
91 | 88 | value = (0.5, 1.4, 2.7) |
|
92 | 89 | """ |
|
93 | 90 | |
|
94 | 91 | value = value.replace('(', '') |
|
95 | 92 | value = value.replace(')', '') |
|
96 | 93 | |
|
97 | 94 | value = value.replace('[', '') |
|
98 | 95 | value = value.replace(']', '') |
|
99 | 96 | |
|
100 | 97 | strList = value.split(',') |
|
101 | 98 | floatList = [float(x) for x in strList] |
|
102 | 99 | |
|
103 | 100 | self.__formated_value = floatList |
|
104 | 101 | |
|
105 | 102 | return self.__formated_value |
|
106 | 103 | |
|
107 | 104 | if format == 'date': |
|
108 | 105 | strList = value.split('/') |
|
109 | 106 | intList = [int(x) for x in strList] |
|
110 | 107 | date = datetime.date(intList[0], intList[1], intList[2]) |
|
111 | 108 | |
|
112 | 109 | self.__formated_value = date |
|
113 | 110 | |
|
114 | 111 | return self.__formated_value |
|
115 | 112 | |
|
116 | 113 | if format == 'time': |
|
117 | 114 | strList = value.split(':') |
|
118 | 115 | intList = [int(x) for x in strList] |
|
119 | 116 | time = datetime.time(intList[0], intList[1], intList[2]) |
|
120 | 117 | |
|
121 | 118 | self.__formated_value = time |
|
122 | 119 | |
|
123 | 120 | return self.__formated_value |
|
124 | 121 | |
|
125 | 122 | if format == 'pairslist': |
|
126 | 123 | """ |
|
127 | 124 | Example: |
|
128 | 125 | value = (0,1),(1,2) |
|
129 | 126 | """ |
|
130 | 127 | |
|
131 | 128 | value = value.replace('(', '') |
|
132 | 129 | value = value.replace(')', '') |
|
133 | 130 | |
|
134 | 131 | value = value.replace('[', '') |
|
135 | 132 | value = value.replace(']', '') |
|
136 | 133 | |
|
137 | 134 | strList = value.split(',') |
|
138 | 135 | intList = [int(item) for item in strList] |
|
139 | 136 | pairList = [] |
|
140 | 137 | for i in range(len(intList)/2): |
|
141 | 138 | pairList.append((intList[i*2], intList[i*2 + 1])) |
|
142 | 139 | |
|
143 | 140 | self.__formated_value = pairList |
|
144 | 141 | |
|
145 | 142 | return self.__formated_value |
|
146 | 143 | |
|
147 | 144 | if format == 'multilist': |
|
148 | 145 | """ |
|
149 | 146 | Example: |
|
150 | 147 | value = (0,1,2),(3,4,5) |
|
151 | 148 | """ |
|
152 | 149 | multiList = ast.literal_eval(value) |
|
153 | 150 | |
|
154 | 151 | if type(multiList[0]) == int: |
|
155 | 152 | multiList = ast.literal_eval("(" + value + ")") |
|
156 | 153 | |
|
157 | 154 | self.__formated_value = multiList |
|
158 | 155 | |
|
159 | 156 | return self.__formated_value |
|
160 | 157 | |
|
158 | if format == 'bool': | |
|
159 | value = int(value) | |
|
160 | ||
|
161 | if format == 'int': | |
|
162 | value = float(value) | |
|
163 | ||
|
161 | 164 | format_func = eval(format) |
|
162 | 165 | |
|
163 | 166 | self.__formated_value = format_func(value) |
|
164 | 167 | |
|
165 | 168 | return self.__formated_value |
|
166 | 169 | |
|
167 | 170 | def updateId(self, new_id): |
|
168 | 171 | |
|
169 | 172 | self.id = str(new_id) |
|
170 | 173 | |
|
171 | 174 | def setup(self, id, name, value, format='str'): |
|
172 | 175 | |
|
173 | 176 | self.id = str(id) |
|
174 | 177 | self.name = name |
|
175 | 178 | self.value = str(value) |
|
176 | 179 | self.format = str.lower(format) |
|
177 | 180 | |
|
178 | 181 | try: |
|
179 | 182 | self.getValue() |
|
180 | 183 | except: |
|
181 | 184 | return 0 |
|
182 | 185 | |
|
183 | 186 | return 1 |
|
184 | 187 | |
|
185 | 188 | def update(self, name, value, format='str'): |
|
186 | 189 | |
|
187 | 190 | self.name = name |
|
188 | 191 | self.value = str(value) |
|
189 | 192 | self.format = format |
|
190 | 193 | |
|
191 | 194 | def makeXml(self, opElement): |
|
192 | 195 | |
|
193 | 196 | parmElement = SubElement(opElement, self.ELEMENTNAME) |
|
194 | 197 | parmElement.set('id', str(self.id)) |
|
195 | 198 | parmElement.set('name', self.name) |
|
196 | 199 | parmElement.set('value', self.value) |
|
197 | 200 | parmElement.set('format', self.format) |
|
198 | 201 | |
|
199 | 202 | def readXml(self, parmElement): |
|
200 | 203 | |
|
201 | 204 | self.id = parmElement.get('id') |
|
202 | 205 | self.name = parmElement.get('name') |
|
203 | 206 | self.value = parmElement.get('value') |
|
204 | 207 | self.format = str.lower(parmElement.get('format')) |
|
205 | 208 | |
|
206 | 209 | #Compatible with old signal chain version |
|
207 | 210 | if self.format == 'int' and self.name == 'idfigure': |
|
208 | 211 | self.name = 'id' |
|
209 | 212 | |
|
210 | 213 | def printattr(self): |
|
211 | 214 | |
|
212 | 215 | print "Parameter[%s]: name = %s, value = %s, format = %s" %(self.id, self.name, self.value, self.format) |
|
213 | 216 | |
|
214 | 217 | class OperationConf(): |
|
215 | 218 | |
|
216 | 219 | id = None |
|
217 | 220 | name = None |
|
218 | 221 | priority = None |
|
219 | 222 | type = None |
|
220 | 223 | |
|
221 | 224 | parmConfObjList = [] |
|
222 | 225 | |
|
223 | 226 | ELEMENTNAME = 'Operation' |
|
224 | 227 | |
|
225 | 228 | def __init__(self): |
|
226 | 229 | |
|
227 | 230 | self.id = '0' |
|
228 | 231 | self.name = None |
|
229 | 232 | self.priority = None |
|
230 | 233 | self.type = 'self' |
|
231 | 234 | |
|
232 | 235 | |
|
233 | 236 | def __getNewId(self): |
|
234 | 237 | |
|
235 | 238 | return int(self.id)*10 + len(self.parmConfObjList) + 1 |
|
236 | 239 | |
|
237 | 240 | def updateId(self, new_id): |
|
238 | 241 | |
|
239 | 242 | self.id = str(new_id) |
|
240 | 243 | |
|
241 | 244 | n = 1 |
|
242 | 245 | for parmObj in self.parmConfObjList: |
|
243 | 246 | |
|
244 | 247 | idParm = str(int(new_id)*10 + n) |
|
245 | 248 | parmObj.updateId(idParm) |
|
246 | 249 | |
|
247 | 250 | n += 1 |
|
248 | 251 | |
|
249 | 252 | def getElementName(self): |
|
250 | 253 | |
|
251 | 254 | return self.ELEMENTNAME |
|
252 | 255 | |
|
253 | 256 | def getParameterObjList(self): |
|
254 | 257 | |
|
255 | 258 | return self.parmConfObjList |
|
256 | 259 | |
|
257 | 260 | def getParameterObj(self, parameterName): |
|
258 | 261 | |
|
259 | 262 | for parmConfObj in self.parmConfObjList: |
|
260 | 263 | |
|
261 | 264 | if parmConfObj.name != parameterName: |
|
262 | 265 | continue |
|
263 | 266 | |
|
264 | 267 | return parmConfObj |
|
265 | 268 | |
|
266 | 269 | return None |
|
267 | 270 | |
|
268 | 271 | def getParameterObjfromValue(self, parameterValue): |
|
269 | 272 | |
|
270 | 273 | for parmConfObj in self.parmConfObjList: |
|
271 | 274 | |
|
272 | 275 | if parmConfObj.getValue() != parameterValue: |
|
273 | 276 | continue |
|
274 | 277 | |
|
275 | 278 | return parmConfObj.getValue() |
|
276 | 279 | |
|
277 | 280 | return None |
|
278 | 281 | |
|
279 | 282 | def getParameterValue(self, parameterName): |
|
280 | 283 | |
|
281 | 284 | parameterObj = self.getParameterObj(parameterName) |
|
282 | 285 | |
|
283 | 286 | # if not parameterObj: |
|
284 | 287 | # return None |
|
285 | 288 | |
|
286 | 289 | value = parameterObj.getValue() |
|
287 | 290 | |
|
288 | 291 | return value |
|
289 | 292 | |
|
290 | 293 | def setup(self, id, name, priority, type): |
|
291 | 294 | |
|
292 | 295 | self.id = str(id) |
|
293 | 296 | self.name = name |
|
294 | 297 | self.type = type |
|
295 | 298 | self.priority = priority |
|
296 | 299 | |
|
297 | 300 | self.parmConfObjList = [] |
|
298 | 301 | |
|
299 | 302 | def removeParameters(self): |
|
300 | 303 | |
|
301 | 304 | for obj in self.parmConfObjList: |
|
302 | 305 | del obj |
|
303 | 306 | |
|
304 | 307 | self.parmConfObjList = [] |
|
305 | 308 | |
|
306 | 309 | def addParameter(self, name, value, format='str'): |
|
307 | 310 | |
|
308 | 311 | id = self.__getNewId() |
|
309 | 312 | |
|
310 | 313 | parmConfObj = ParameterConf() |
|
311 | 314 | if not parmConfObj.setup(id, name, value, format): |
|
312 | 315 | return None |
|
313 | 316 | |
|
314 | 317 | self.parmConfObjList.append(parmConfObj) |
|
315 | 318 | |
|
316 | 319 | return parmConfObj |
|
317 | 320 | |
|
318 | 321 | def changeParameter(self, name, value, format='str'): |
|
319 | 322 | |
|
320 | 323 | parmConfObj = self.getParameterObj(name) |
|
321 | 324 | parmConfObj.update(name, value, format) |
|
322 | 325 | |
|
323 | 326 | return parmConfObj |
|
324 | 327 | |
|
325 | 328 | def makeXml(self, upElement): |
|
326 | 329 | |
|
327 | 330 | opElement = SubElement(upElement, self.ELEMENTNAME) |
|
328 | 331 | opElement.set('id', str(self.id)) |
|
329 | 332 | opElement.set('name', self.name) |
|
330 | 333 | opElement.set('type', self.type) |
|
331 | 334 | opElement.set('priority', str(self.priority)) |
|
332 | 335 | |
|
333 | 336 | for parmConfObj in self.parmConfObjList: |
|
334 | 337 | parmConfObj.makeXml(opElement) |
|
335 | 338 | |
|
336 | 339 | def readXml(self, opElement): |
|
337 | 340 | |
|
338 | 341 | self.id = opElement.get('id') |
|
339 | 342 | self.name = opElement.get('name') |
|
340 | 343 | self.type = opElement.get('type') |
|
341 | 344 | self.priority = opElement.get('priority') |
|
342 | 345 | |
|
343 | 346 | #Compatible with old signal chain version |
|
344 | 347 | #Use of 'run' method instead 'init' |
|
345 | 348 | if self.type == 'self' and self.name == 'init': |
|
346 | 349 | self.name = 'run' |
|
347 | 350 | |
|
348 | 351 | self.parmConfObjList = [] |
|
349 | 352 | |
|
350 | 353 | parmElementList = opElement.getiterator(ParameterConf().getElementName()) |
|
351 | 354 | |
|
352 | 355 | for parmElement in parmElementList: |
|
353 | 356 | parmConfObj = ParameterConf() |
|
354 | 357 | parmConfObj.readXml(parmElement) |
|
355 | 358 | |
|
356 | 359 | #Compatible with old signal chain version |
|
357 | 360 | #If an 'plot' OPERATION is found, changes name operation by the value of its type PARAMETER |
|
358 | 361 | if self.type != 'self' and self.name == 'Plot': |
|
359 | 362 | if parmConfObj.format == 'str' and parmConfObj.name == 'type': |
|
360 | 363 | self.name = parmConfObj.value |
|
361 | 364 | continue |
|
362 | 365 | |
|
363 | 366 | self.parmConfObjList.append(parmConfObj) |
|
364 | 367 | |
|
365 | 368 | def printattr(self): |
|
366 | 369 | |
|
367 | 370 | print "%s[%s]: name = %s, type = %s, priority = %s" %(self.ELEMENTNAME, |
|
368 | 371 | self.id, |
|
369 | 372 | self.name, |
|
370 | 373 | self.type, |
|
371 | 374 | self.priority) |
|
372 | 375 | |
|
373 | 376 | for parmConfObj in self.parmConfObjList: |
|
374 | 377 | parmConfObj.printattr() |
|
375 | 378 | |
|
376 | 379 | def createObject(self): |
|
377 | 380 | |
|
378 | 381 | if self.type == 'self': |
|
379 | 382 | raise ValueError, "This operation type cannot be created" |
|
380 | 383 | |
|
381 | 384 | if self.type == 'external' or self.type == 'other': |
|
382 | 385 | className = eval(self.name) |
|
383 | 386 | opObj = className() |
|
384 | 387 | |
|
385 | 388 | return opObj |
|
386 | 389 | |
|
387 | 390 | class ProcUnitConf(): |
|
388 | 391 | |
|
389 | 392 | id = None |
|
390 | 393 | name = None |
|
391 | 394 | datatype = None |
|
392 | 395 | inputId = None |
|
393 | 396 | parentId = None |
|
394 | 397 | |
|
395 | 398 | opConfObjList = [] |
|
396 | 399 | |
|
397 | 400 | procUnitObj = None |
|
398 | 401 | opObjList = [] |
|
399 | 402 | |
|
400 | 403 | ELEMENTNAME = 'ProcUnit' |
|
401 | 404 | |
|
402 | 405 | def __init__(self): |
|
403 | 406 | |
|
404 | 407 | self.id = None |
|
405 | 408 | self.datatype = None |
|
406 | 409 | self.name = None |
|
407 | 410 | self.inputId = None |
|
408 | 411 | |
|
409 | 412 | self.opConfObjList = [] |
|
410 | 413 | |
|
411 | 414 | self.procUnitObj = None |
|
412 | 415 | self.opObjDict = {} |
|
413 | 416 | |
|
414 | 417 | def __getPriority(self): |
|
415 | 418 | |
|
416 | 419 | return len(self.opConfObjList)+1 |
|
417 | 420 | |
|
418 | 421 | def __getNewId(self): |
|
419 | 422 | |
|
420 | 423 | return int(self.id)*10 + len(self.opConfObjList) + 1 |
|
421 | 424 | |
|
422 | 425 | def getElementName(self): |
|
423 | 426 | |
|
424 | 427 | return self.ELEMENTNAME |
|
425 | 428 | |
|
426 | 429 | def getId(self): |
|
427 | 430 | |
|
428 | 431 | return self.id |
|
429 | 432 | |
|
430 | 433 | def updateId(self, new_id, parentId=parentId): |
|
431 | 434 | |
|
432 | 435 | |
|
433 | 436 | new_id = int(parentId)*10 + (int(self.id) % 10) |
|
434 | 437 | new_inputId = int(parentId)*10 + (int(self.inputId) % 10) |
|
435 | 438 | |
|
436 | 439 | #If this proc unit has not inputs |
|
437 | 440 | if self.inputId == '0': |
|
438 | 441 | new_inputId = 0 |
|
439 | 442 | |
|
440 | 443 | n = 1 |
|
441 | 444 | for opConfObj in self.opConfObjList: |
|
442 | 445 | |
|
443 | 446 | idOp = str(int(new_id)*10 + n) |
|
444 | 447 | opConfObj.updateId(idOp) |
|
445 | 448 | |
|
446 | 449 | n += 1 |
|
447 | 450 | |
|
448 | 451 | self.parentId = str(parentId) |
|
449 | 452 | self.id = str(new_id) |
|
450 | 453 | self.inputId = str(new_inputId) |
|
451 | 454 | |
|
452 | 455 | |
|
453 | 456 | def getInputId(self): |
|
454 | 457 | |
|
455 | 458 | return self.inputId |
|
456 | 459 | |
|
457 | 460 | def getOperationObjList(self): |
|
458 | 461 | |
|
459 | 462 | return self.opConfObjList |
|
460 | 463 | |
|
461 | 464 | def getOperationObj(self, name=None): |
|
462 | 465 | |
|
463 | 466 | for opConfObj in self.opConfObjList: |
|
464 | 467 | |
|
465 | 468 | if opConfObj.name != name: |
|
466 | 469 | continue |
|
467 | 470 | |
|
468 | 471 | return opConfObj |
|
469 | 472 | |
|
470 | 473 | return None |
|
471 | 474 | |
|
472 | 475 | def getOpObjfromParamValue(self, value=None): |
|
473 | 476 | |
|
474 | 477 | for opConfObj in self.opConfObjList: |
|
475 | 478 | if opConfObj.getParameterObjfromValue(parameterValue=value) != value: |
|
476 | 479 | continue |
|
477 | 480 | return opConfObj |
|
478 | 481 | return None |
|
479 | 482 | |
|
480 | 483 | def getProcUnitObj(self): |
|
481 | 484 | |
|
482 | 485 | return self.procUnitObj |
|
483 | 486 | |
|
484 | 487 | def setup(self, id, name, datatype, inputId, parentId=None): |
|
485 | 488 | |
|
486 | 489 | #Compatible with old signal chain version |
|
487 | 490 | if datatype==None and name==None: |
|
488 | 491 | raise ValueError, "datatype or name should be defined" |
|
489 | 492 | |
|
490 | 493 | if name==None: |
|
491 | 494 | if 'Proc' in datatype: |
|
492 | 495 | name = datatype |
|
493 | 496 | else: |
|
494 | 497 | name = '%sProc' %(datatype) |
|
495 | 498 | |
|
496 | 499 | if datatype==None: |
|
497 | 500 | datatype = name.replace('Proc','') |
|
498 | 501 | |
|
499 | 502 | self.id = str(id) |
|
500 | 503 | self.name = name |
|
501 | 504 | self.datatype = datatype |
|
502 | 505 | self.inputId = inputId |
|
503 | 506 | self.parentId = parentId |
|
504 | 507 | |
|
505 | 508 | self.opConfObjList = [] |
|
506 | 509 | |
|
507 | 510 | self.addOperation(name='run', optype='self') |
|
508 | 511 | |
|
509 | 512 | def removeOperations(self): |
|
510 | 513 | |
|
511 | 514 | for obj in self.opConfObjList: |
|
512 | 515 | del obj |
|
513 | 516 | |
|
514 | 517 | self.opConfObjList = [] |
|
515 | 518 | self.addOperation(name='run') |
|
516 | 519 | |
|
517 | 520 | def addParameter(self, **kwargs): |
|
518 | 521 | ''' |
|
519 | 522 | Add parameters to "run" operation |
|
520 | 523 | ''' |
|
521 | 524 | opObj = self.opConfObjList[0] |
|
522 | 525 | |
|
523 | 526 | opObj.addParameter(**kwargs) |
|
524 | 527 | |
|
525 | 528 | return opObj |
|
526 | 529 | |
|
527 | 530 | def addOperation(self, name, optype='self'): |
|
528 | 531 | |
|
529 | 532 | id = self.__getNewId() |
|
530 | 533 | priority = self.__getPriority() |
|
531 | 534 | |
|
532 | 535 | opConfObj = OperationConf() |
|
533 | 536 | opConfObj.setup(id, name=name, priority=priority, type=optype) |
|
534 | 537 | |
|
535 | 538 | self.opConfObjList.append(opConfObj) |
|
536 | 539 | |
|
537 | 540 | return opConfObj |
|
538 | 541 | |
|
539 | 542 | def makeXml(self, procUnitElement): |
|
540 | 543 | |
|
541 | 544 | upElement = SubElement(procUnitElement, self.ELEMENTNAME) |
|
542 | 545 | upElement.set('id', str(self.id)) |
|
543 | 546 | upElement.set('name', self.name) |
|
544 | 547 | upElement.set('datatype', self.datatype) |
|
545 | 548 | upElement.set('inputId', str(self.inputId)) |
|
546 | 549 | |
|
547 | 550 | for opConfObj in self.opConfObjList: |
|
548 | 551 | opConfObj.makeXml(upElement) |
|
549 | 552 | |
|
550 | 553 | def readXml(self, upElement): |
|
551 | 554 | |
|
552 | 555 | self.id = upElement.get('id') |
|
553 | 556 | self.name = upElement.get('name') |
|
554 | 557 | self.datatype = upElement.get('datatype') |
|
555 | 558 | self.inputId = upElement.get('inputId') |
|
556 | 559 | |
|
557 | 560 | if self.ELEMENTNAME == "ReadUnit": |
|
558 | 561 | self.datatype = self.datatype.replace("Reader", "") |
|
559 | 562 | |
|
560 | 563 | if self.ELEMENTNAME == "ProcUnit": |
|
561 | 564 | self.datatype = self.datatype.replace("Proc", "") |
|
562 | 565 | |
|
563 | 566 | if self.inputId == 'None': |
|
564 | 567 | self.inputId = '0' |
|
565 | 568 | |
|
566 | 569 | self.opConfObjList = [] |
|
567 | 570 | |
|
568 | 571 | opElementList = upElement.getiterator(OperationConf().getElementName()) |
|
569 | 572 | |
|
570 | 573 | for opElement in opElementList: |
|
571 | 574 | opConfObj = OperationConf() |
|
572 | 575 | opConfObj.readXml(opElement) |
|
573 | 576 | self.opConfObjList.append(opConfObj) |
|
574 | 577 | |
|
575 | 578 | def printattr(self): |
|
576 | 579 | |
|
577 | 580 | print "%s[%s]: name = %s, datatype = %s, inputId = %s" %(self.ELEMENTNAME, |
|
578 | 581 | self.id, |
|
579 | 582 | self.name, |
|
580 | 583 | self.datatype, |
|
581 | 584 | self.inputId) |
|
582 | 585 | |
|
583 | 586 | for opConfObj in self.opConfObjList: |
|
584 | 587 | opConfObj.printattr() |
|
585 | 588 | |
|
586 | 589 | def createObjects(self): |
|
587 | 590 | |
|
588 | 591 | className = eval(self.name) |
|
589 | 592 | procUnitObj = className() |
|
590 | 593 | |
|
591 | 594 | for opConfObj in self.opConfObjList: |
|
592 | 595 | |
|
593 | 596 | if opConfObj.type == 'self': |
|
594 | 597 | continue |
|
595 | 598 | |
|
596 | 599 | opObj = opConfObj.createObject() |
|
597 | 600 | |
|
598 | 601 | self.opObjDict[opConfObj.id] = opObj |
|
599 | 602 | procUnitObj.addOperation(opObj, opConfObj.id) |
|
600 | 603 | |
|
601 | 604 | self.procUnitObj = procUnitObj |
|
602 | 605 | |
|
603 | 606 | return procUnitObj |
|
604 | 607 | |
|
605 | 608 | def run(self): |
|
606 | 609 | |
|
607 | 610 | is_ok = False |
|
608 | 611 | |
|
609 | 612 | for opConfObj in self.opConfObjList: |
|
610 | 613 | |
|
611 | 614 | kwargs = {} |
|
612 | 615 | for parmConfObj in opConfObj.getParameterObjList(): |
|
613 | 616 | if opConfObj.name == 'run' and parmConfObj.name == 'datatype': |
|
614 | 617 | continue |
|
615 | 618 | |
|
616 | 619 | kwargs[parmConfObj.name] = parmConfObj.getValue() |
|
617 | 620 | |
|
618 | 621 | #print "\tRunning the '%s' operation with %s" %(opConfObj.name, opConfObj.id) |
|
619 | 622 | sts = self.procUnitObj.call(opType = opConfObj.type, |
|
620 | 623 | opName = opConfObj.name, |
|
621 | 624 | opId = opConfObj.id, |
|
622 | 625 | **kwargs) |
|
623 | 626 | is_ok = is_ok or sts |
|
624 | 627 | |
|
625 | 628 | return is_ok |
|
626 | 629 | |
|
627 | 630 | def close(self): |
|
628 | 631 | |
|
629 | 632 | for opConfObj in self.opConfObjList: |
|
630 | 633 | if opConfObj.type == 'self': |
|
631 | 634 | continue |
|
632 | 635 | |
|
633 | 636 | opObj = self.procUnitObj.getOperationObj(opConfObj.id) |
|
634 | 637 | opObj.close() |
|
635 | 638 | |
|
636 | 639 | self.procUnitObj.close() |
|
637 | 640 | |
|
638 | 641 | return |
|
639 | 642 | |
|
640 | 643 | class ReadUnitConf(ProcUnitConf): |
|
641 | 644 | |
|
642 | 645 | path = None |
|
643 | 646 | startDate = None |
|
644 | 647 | endDate = None |
|
645 | 648 | startTime = None |
|
646 | 649 | endTime = None |
|
647 | 650 | |
|
648 | 651 | ELEMENTNAME = 'ReadUnit' |
|
649 | 652 | |
|
650 | 653 | def __init__(self): |
|
651 | 654 | |
|
652 | 655 | self.id = None |
|
653 | 656 | self.datatype = None |
|
654 | 657 | self.name = None |
|
655 | 658 | self.inputId = None |
|
656 | 659 | |
|
657 | 660 | self.parentId = None |
|
658 | 661 | |
|
659 | 662 | self.opConfObjList = [] |
|
660 | 663 | self.opObjList = [] |
|
661 | 664 | |
|
662 | 665 | def getElementName(self): |
|
663 | 666 | |
|
664 | 667 | return self.ELEMENTNAME |
|
665 | 668 | |
|
666 | 669 | def setup(self, id, name, datatype, path, startDate="", endDate="", startTime="", endTime="", parentId=None, **kwargs): |
|
667 | 670 | |
|
668 | 671 | #Compatible with old signal chain version |
|
669 | 672 | if datatype==None and name==None: |
|
670 | 673 | raise ValueError, "datatype or name should be defined" |
|
671 | 674 | |
|
672 | 675 | if name==None: |
|
673 | 676 | if 'Reader' in datatype: |
|
674 | 677 | name = datatype |
|
675 | 678 | else: |
|
676 | 679 | name = '%sReader' %(datatype) |
|
677 | 680 | |
|
678 | 681 | if datatype==None: |
|
679 | 682 | datatype = name.replace('Reader','') |
|
680 | 683 | |
|
681 | 684 | self.id = id |
|
682 | 685 | self.name = name |
|
683 | 686 | self.datatype = datatype |
|
684 | 687 | |
|
685 | 688 | self.path = path |
|
686 | 689 | self.startDate = startDate |
|
687 | 690 | self.endDate = endDate |
|
688 | 691 | self.startTime = startTime |
|
689 | 692 | self.endTime = endTime |
|
690 | 693 | |
|
691 | 694 | self.inputId = '0' |
|
692 | 695 | self.parentId = parentId |
|
693 | 696 | |
|
694 | 697 | self.addRunOperation(**kwargs) |
|
695 | 698 | |
|
696 | 699 | def update(self, datatype, path, startDate, endDate, startTime, endTime, parentId=None, name=None, **kwargs): |
|
697 | 700 | |
|
698 | 701 | #Compatible with old signal chain version |
|
699 | 702 | if datatype==None and name==None: |
|
700 | 703 | raise ValueError, "datatype or name should be defined" |
|
701 | 704 | |
|
702 | 705 | if name==None: |
|
703 | 706 | if 'Reader' in datatype: |
|
704 | 707 | name = datatype |
|
705 | 708 | else: |
|
706 | 709 | name = '%sReader' %(datatype) |
|
707 | 710 | |
|
708 | 711 | if datatype==None: |
|
709 | 712 | datatype = name.replace('Reader','') |
|
710 | 713 | |
|
711 | 714 | self.datatype = datatype |
|
712 | 715 | self.name = name |
|
713 | 716 | self.path = path |
|
714 | 717 | self.startDate = startDate |
|
715 | 718 | self.endDate = endDate |
|
716 | 719 | self.startTime = startTime |
|
717 | 720 | self.endTime = endTime |
|
718 | 721 | |
|
719 | 722 | self.inputId = '0' |
|
720 | 723 | self.parentId = parentId |
|
721 | 724 | |
|
722 | 725 | self.updateRunOperation(**kwargs) |
|
723 | 726 | |
|
724 | 727 | def addRunOperation(self, **kwargs): |
|
725 | 728 | |
|
726 | 729 | opObj = self.addOperation(name = 'run', optype = 'self') |
|
727 | 730 | |
|
728 | 731 | opObj.addParameter(name='datatype' , value=self.datatype, format='str') |
|
729 | 732 | opObj.addParameter(name='path' , value=self.path, format='str') |
|
730 | 733 | opObj.addParameter(name='startDate' , value=self.startDate, format='date') |
|
731 | 734 | opObj.addParameter(name='endDate' , value=self.endDate, format='date') |
|
732 | 735 | opObj.addParameter(name='startTime' , value=self.startTime, format='time') |
|
733 | 736 | opObj.addParameter(name='endTime' , value=self.endTime, format='time') |
|
734 | 737 | |
|
735 | 738 | for key, value in kwargs.items(): |
|
736 | 739 | opObj.addParameter(name=key, value=value, format=type(value).__name__) |
|
737 | 740 | |
|
738 | 741 | return opObj |
|
739 | 742 | |
|
740 | 743 | def updateRunOperation(self, **kwargs): |
|
741 | 744 | |
|
742 | 745 | opObj = self.getOperationObj(name = 'run') |
|
743 | 746 | opObj.removeParameters() |
|
744 | 747 | |
|
745 | 748 | opObj.addParameter(name='datatype' , value=self.datatype, format='str') |
|
746 | 749 | opObj.addParameter(name='path' , value=self.path, format='str') |
|
747 | 750 | opObj.addParameter(name='startDate' , value=self.startDate, format='date') |
|
748 | 751 | opObj.addParameter(name='endDate' , value=self.endDate, format='date') |
|
749 | 752 | opObj.addParameter(name='startTime' , value=self.startTime, format='time') |
|
750 | 753 | opObj.addParameter(name='endTime' , value=self.endTime, format='time') |
|
751 | 754 | |
|
752 | 755 | for key, value in kwargs.items(): |
|
753 | 756 | opObj.addParameter(name=key, value=value, format=type(value).__name__) |
|
754 | 757 | |
|
755 | 758 | return opObj |
|
756 | 759 | |
|
757 | 760 | class Project(): |
|
758 | 761 | |
|
759 | 762 | id = None |
|
760 | 763 | name = None |
|
761 | 764 | description = None |
|
762 | 765 | # readUnitConfObjList = None |
|
763 | 766 | procUnitConfObjDict = None |
|
764 | 767 | |
|
765 | 768 | ELEMENTNAME = 'Project' |
|
766 | 769 | |
|
767 | 770 | def __init__(self): |
|
768 | 771 | |
|
769 | 772 | self.id = None |
|
770 | 773 | self.name = None |
|
771 | 774 | self.description = None |
|
772 | 775 | |
|
773 | 776 | self.procUnitConfObjDict = {} |
|
774 | 777 | |
|
775 | 778 | def __getNewId(self): |
|
776 | 779 | |
|
777 | 780 | id = int(self.id)*10 + len(self.procUnitConfObjDict) + 1 |
|
778 | 781 | |
|
779 | 782 | return str(id) |
|
780 | 783 | |
|
781 | 784 | def getElementName(self): |
|
782 | 785 | |
|
783 | 786 | return self.ELEMENTNAME |
|
784 | 787 | |
|
785 | 788 | def getId(self): |
|
786 | 789 | |
|
787 | 790 | return self.id |
|
788 | 791 | |
|
789 | 792 | def updateId(self, new_id): |
|
790 | 793 | |
|
791 | 794 | self.id = str(new_id) |
|
792 | 795 | |
|
793 | 796 | keyList = self.procUnitConfObjDict.keys() |
|
794 | 797 | keyList.sort() |
|
795 | 798 | |
|
796 | 799 | n = 1 |
|
797 | 800 | newProcUnitConfObjDict = {} |
|
798 | 801 | |
|
799 | 802 | for procKey in keyList: |
|
800 | 803 | |
|
801 | 804 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
802 | 805 | idProcUnit = str(int(self.id)*10 + n) |
|
803 | 806 | procUnitConfObj.updateId(idProcUnit, parentId = self.id) |
|
804 | 807 | |
|
805 | 808 | newProcUnitConfObjDict[idProcUnit] = procUnitConfObj |
|
806 | 809 | n += 1 |
|
807 | 810 | |
|
808 | 811 | self.procUnitConfObjDict = newProcUnitConfObjDict |
|
809 | 812 | |
|
810 | 813 | def setup(self, id, name, description): |
|
811 | 814 | |
|
812 | 815 | self.id = str(id) |
|
813 | 816 | self.name = name |
|
814 | 817 | self.description = description |
|
815 | 818 | |
|
816 | 819 | def update(self, name, description): |
|
817 | 820 | |
|
818 | 821 | self.name = name |
|
819 | 822 | self.description = description |
|
820 | 823 | |
|
821 | 824 | def addReadUnit(self, datatype=None, name=None, **kwargs): |
|
822 | 825 | |
|
823 | 826 | idReadUnit = self.__getNewId() |
|
824 | 827 | |
|
825 | 828 | readUnitConfObj = ReadUnitConf() |
|
826 | 829 | readUnitConfObj.setup(idReadUnit, name, datatype, parentId=self.id, **kwargs) |
|
827 | 830 | |
|
828 | 831 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
829 | 832 | |
|
830 | 833 | return readUnitConfObj |
|
831 | 834 | |
|
832 | 835 | def addProcUnit(self, inputId='0', datatype=None, name=None): |
|
833 | 836 | |
|
834 | 837 | idProcUnit = self.__getNewId() |
|
835 | 838 | |
|
836 | 839 | procUnitConfObj = ProcUnitConf() |
|
837 | 840 | procUnitConfObj.setup(idProcUnit, name, datatype, inputId, parentId=self.id) |
|
838 | 841 | |
|
839 | 842 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
840 | 843 | |
|
841 | 844 | return procUnitConfObj |
|
842 | 845 | |
|
843 | 846 | def removeProcUnit(self, id): |
|
844 | 847 | |
|
845 | 848 | if id in self.procUnitConfObjDict.keys(): |
|
846 | 849 | self.procUnitConfObjDict.pop(id) |
|
847 | 850 | |
|
848 | 851 | def getReadUnitId(self): |
|
849 | 852 | |
|
850 | 853 | readUnitConfObj = self.getReadUnitObj() |
|
851 | 854 | |
|
852 | 855 | return readUnitConfObj.id |
|
853 | 856 | |
|
854 | 857 | def getReadUnitObj(self): |
|
855 | 858 | |
|
856 | 859 | for obj in self.procUnitConfObjDict.values(): |
|
857 | 860 | if obj.getElementName() == "ReadUnit": |
|
858 | 861 | return obj |
|
859 | 862 | |
|
860 | 863 | return None |
|
861 | 864 | |
|
862 | 865 | def getProcUnitObj(self, id=None, name=None): |
|
863 | 866 | |
|
864 | 867 | if id != None: |
|
865 | 868 | return self.procUnitConfObjDict[id] |
|
866 | 869 | |
|
867 | 870 | if name != None: |
|
868 | 871 | return self.getProcUnitObjByName(name) |
|
869 | 872 | |
|
870 | 873 | return None |
|
871 | 874 | |
|
872 | 875 | def getProcUnitObjByName(self, name): |
|
873 | 876 | |
|
874 | 877 | for obj in self.procUnitConfObjDict.values(): |
|
875 | 878 | if obj.name == name: |
|
876 | 879 | return obj |
|
877 | 880 | |
|
878 | 881 | return None |
|
879 | 882 | |
|
880 | 883 | def procUnitItems(self): |
|
881 | 884 | |
|
882 | 885 | return self.procUnitConfObjDict.items() |
|
883 | 886 | |
|
884 | 887 | def makeXml(self): |
|
885 | 888 | |
|
886 | 889 | projectElement = Element('Project') |
|
887 | 890 | projectElement.set('id', str(self.id)) |
|
888 | 891 | projectElement.set('name', self.name) |
|
889 | 892 | projectElement.set('description', self.description) |
|
890 | 893 | |
|
891 | 894 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
892 | 895 | procUnitConfObj.makeXml(projectElement) |
|
893 | 896 | |
|
894 | 897 | self.projectElement = projectElement |
|
895 | 898 | |
|
896 | 899 | def writeXml(self, filename): |
|
897 | 900 | |
|
898 | 901 | self.makeXml() |
|
899 | 902 | |
|
900 | 903 | #print prettify(self.projectElement) |
|
901 | 904 | |
|
902 | 905 | ElementTree(self.projectElement).write(filename, method='xml') |
|
903 | 906 | |
|
904 | 907 | def readXml(self, filename): |
|
905 | 908 | |
|
906 | 909 | self.projectElement = None |
|
907 | 910 | self.procUnitConfObjDict = {} |
|
908 | 911 | |
|
909 | 912 | self.projectElement = ElementTree().parse(filename) |
|
910 | 913 | |
|
911 | 914 | self.project = self.projectElement.tag |
|
912 | 915 | |
|
913 | 916 | self.id = self.projectElement.get('id') |
|
914 | 917 | self.name = self.projectElement.get('name') |
|
915 | 918 | self.description = self.projectElement.get('description') |
|
916 | 919 | |
|
917 | 920 | readUnitElementList = self.projectElement.getiterator(ReadUnitConf().getElementName()) |
|
918 | 921 | |
|
919 | 922 | for readUnitElement in readUnitElementList: |
|
920 | 923 | readUnitConfObj = ReadUnitConf() |
|
921 | 924 | readUnitConfObj.readXml(readUnitElement) |
|
922 | 925 | |
|
923 | 926 | if readUnitConfObj.parentId == None: |
|
924 | 927 | readUnitConfObj.parentId = self.id |
|
925 | 928 | |
|
926 | 929 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
927 | 930 | |
|
928 | 931 | procUnitElementList = self.projectElement.getiterator(ProcUnitConf().getElementName()) |
|
929 | 932 | |
|
930 | 933 | for procUnitElement in procUnitElementList: |
|
931 | 934 | procUnitConfObj = ProcUnitConf() |
|
932 | 935 | procUnitConfObj.readXml(procUnitElement) |
|
933 | 936 | |
|
934 | 937 | if procUnitConfObj.parentId == None: |
|
935 | 938 | procUnitConfObj.parentId = self.id |
|
936 | 939 | |
|
937 | 940 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
938 | 941 | |
|
939 | 942 | def printattr(self): |
|
940 | 943 | |
|
941 | 944 | print "Project[%s]: name = %s, description = %s" %(self.id, |
|
942 | 945 | self.name, |
|
943 | 946 | self.description) |
|
944 | 947 | |
|
945 | 948 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
946 | 949 | procUnitConfObj.printattr() |
|
947 | 950 | |
|
948 | 951 | def createObjects(self): |
|
949 | 952 | |
|
950 | 953 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
951 | 954 | procUnitConfObj.createObjects() |
|
952 | 955 | |
|
953 | 956 | def __connect(self, objIN, thisObj): |
|
954 | 957 | |
|
955 | 958 | thisObj.setInput(objIN.getOutputObj()) |
|
956 | 959 | |
|
957 | 960 | def connectObjects(self): |
|
958 | 961 | |
|
959 | 962 | for thisPUConfObj in self.procUnitConfObjDict.values(): |
|
960 | 963 | |
|
961 | 964 | inputId = thisPUConfObj.getInputId() |
|
962 | 965 | |
|
963 | 966 | if int(inputId) == 0: |
|
964 | 967 | continue |
|
965 | 968 | |
|
966 | 969 | #Get input object |
|
967 | 970 | puConfINObj = self.procUnitConfObjDict[inputId] |
|
968 | 971 | puObjIN = puConfINObj.getProcUnitObj() |
|
969 | 972 | |
|
970 | 973 | #Get current object |
|
971 | 974 | thisPUObj = thisPUConfObj.getProcUnitObj() |
|
972 | 975 | |
|
973 | 976 | self.__connect(puObjIN, thisPUObj) |
|
974 | 977 | |
|
975 | 978 | def isPaused(self): |
|
976 | 979 | return 0 |
|
977 | 980 | |
|
978 | 981 | def isStopped(self): |
|
979 | 982 | return 0 |
|
980 | 983 | |
|
981 | 984 | def runController(self): |
|
982 | 985 | """ |
|
983 | 986 | returns 0 when this process has been stopped, 1 otherwise |
|
984 | 987 | """ |
|
985 | 988 | |
|
986 | 989 | if self.isPaused(): |
|
987 | 990 | print "Process suspended" |
|
988 | 991 | |
|
989 | 992 | while True: |
|
990 | 993 | sleep(0.1) |
|
991 | 994 | |
|
992 | 995 | if not self.isPaused(): |
|
993 | 996 | break |
|
994 | 997 | |
|
995 | 998 | if self.isStopped(): |
|
996 | 999 | break |
|
997 | 1000 | |
|
998 | 1001 | print "Process reinitialized" |
|
999 | 1002 | |
|
1000 | 1003 | if self.isStopped(): |
|
1001 | 1004 | print "Process stopped" |
|
1002 | 1005 | return 0 |
|
1003 | 1006 | |
|
1004 | 1007 | return 1 |
|
1005 | 1008 | |
|
1006 | 1009 | def run(self): |
|
1007 | 1010 | |
|
1008 | 1011 | |
|
1009 | 1012 | print "*"*60 |
|
1010 | 1013 | print " Starting SIGNAL CHAIN PROCESSING " |
|
1011 | 1014 | print "*"*60 |
|
1012 | 1015 | |
|
1013 | 1016 | |
|
1014 | 1017 | keyList = self.procUnitConfObjDict.keys() |
|
1015 | 1018 | keyList.sort() |
|
1016 | 1019 | |
|
1017 | 1020 | while(True): |
|
1018 | 1021 | |
|
1019 | 1022 | is_ok = False |
|
1020 | 1023 | |
|
1021 | 1024 | for procKey in keyList: |
|
1022 | 1025 | # print "Running the '%s' process with %s" %(procUnitConfObj.name, procUnitConfObj.id) |
|
1023 | 1026 | |
|
1024 | 1027 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
1025 | 1028 | |
|
1026 | 1029 | message = "" |
|
1027 | 1030 | try: |
|
1028 | 1031 | sts = procUnitConfObj.run() |
|
1029 | 1032 | is_ok = is_ok or sts |
|
1030 | 1033 | except: |
|
1031 | 1034 | sleep(1) |
|
1032 | 1035 | err = traceback.format_exception(sys.exc_info()[0], |
|
1033 | 1036 | sys.exc_info()[1], |
|
1034 | 1037 | sys.exc_info()[2]) |
|
1035 | 1038 | |
|
1036 | 1039 | for thisLine in err: |
|
1037 | 1040 | message += thisLine |
|
1038 | 1041 | |
|
1039 | 1042 | print message |
|
1040 | 1043 | # self.sendReport(message) |
|
1041 | 1044 | sleep(0.1) |
|
1042 | 1045 | is_ok = False |
|
1043 | 1046 | |
|
1044 | 1047 | break |
|
1045 | 1048 | |
|
1046 | 1049 | #If every process unit finished so end process |
|
1047 | 1050 | if not(is_ok): |
|
1048 | 1051 | print message |
|
1049 | 1052 | print "Every process unit have finished" |
|
1050 | 1053 | break |
|
1051 | 1054 | |
|
1052 | 1055 | if not self.runController(): |
|
1053 | 1056 | break |
|
1054 | 1057 | |
|
1055 | 1058 | #Closing every process |
|
1056 | 1059 | for procKey in keyList: |
|
1057 | 1060 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
1058 | 1061 | procUnitConfObj.close() |
|
1059 | 1062 | |
|
1060 | 1063 | print "Process finished" |
|
1061 | 1064 | |
|
1062 | 1065 | def start(self, filename): |
|
1063 | 1066 | |
|
1064 | 1067 | self.writeXml(filename) |
|
1065 | 1068 | self.readXml(filename) |
|
1066 | 1069 | |
|
1067 | 1070 | self.createObjects() |
|
1068 | 1071 | self.connectObjects() |
|
1069 | 1072 | self.run() |
|
1070 | 1073 | |
|
1071 | 1074 | def sendReport(self, message, subject="Error occurred in Signal Chain", email=SCHAIN_MAIL): |
|
1072 | 1075 | |
|
1073 | 1076 | import smtplib |
|
1074 | 1077 | |
|
1075 | 1078 | print subject |
|
1076 | 1079 | print "Sending report to %s ..." %email |
|
1077 | 1080 | |
|
1078 | 1081 | message = 'From: (Python Signal Chain API) ' + email + '\n' + \ |
|
1079 | 1082 | 'To: ' + email + '\n' + \ |
|
1080 | 1083 | 'Subject: ' + str(subject) + '\n' + \ |
|
1081 | 1084 | 'Content-type: text/html\n\n' + message |
|
1082 | 1085 | |
|
1083 | 1086 | server = smtplib.SMTP(EMAIL_SERVER) |
|
1084 | 1087 | server.sendmail(email.split(',')[0], |
|
1085 | 1088 | email.split(','), message) |
|
1086 | 1089 | server.quit() |
|
1087 | 1090 | |
|
1088 | 1091 | if __name__ == '__main__': |
|
1089 | 1092 | |
|
1090 | 1093 | desc = "Segundo Test" |
|
1091 | 1094 | filename = "schain.xml" |
|
1092 | 1095 | |
|
1093 | 1096 | controllerObj = Project() |
|
1094 | 1097 | |
|
1095 | 1098 | controllerObj.setup(id = '191', name='test01', description=desc) |
|
1096 | 1099 | |
|
1097 | 1100 | readUnitConfObj = controllerObj.addReadUnit(datatype='Voltage', |
|
1098 | 1101 | path='data/rawdata/', |
|
1099 | 1102 | startDate='2011/01/01', |
|
1100 | 1103 | endDate='2012/12/31', |
|
1101 | 1104 | startTime='00:00:00', |
|
1102 | 1105 | endTime='23:59:59', |
|
1103 | 1106 | online=1, |
|
1104 | 1107 | walk=1) |
|
1105 | 1108 | |
|
1106 | 1109 | procUnitConfObj0 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) |
|
1107 | 1110 | |
|
1108 | 1111 | opObj10 = procUnitConfObj0.addOperation(name='selectChannels') |
|
1109 | 1112 | opObj10.addParameter(name='channelList', value='3,4,5', format='intlist') |
|
1110 | 1113 | |
|
1111 | 1114 | opObj10 = procUnitConfObj0.addOperation(name='selectHeights') |
|
1112 | 1115 | opObj10.addParameter(name='minHei', value='90', format='float') |
|
1113 | 1116 | opObj10.addParameter(name='maxHei', value='180', format='float') |
|
1114 | 1117 | |
|
1115 | 1118 | opObj12 = procUnitConfObj0.addOperation(name='CohInt', optype='external') |
|
1116 | 1119 | opObj12.addParameter(name='n', value='10', format='int') |
|
1117 | 1120 | |
|
1118 | 1121 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj0.getId()) |
|
1119 | 1122 | procUnitConfObj1.addParameter(name='nFFTPoints', value='32', format='int') |
|
1120 | 1123 | # procUnitConfObj1.addParameter(name='pairList', value='(0,1),(0,2),(1,2)', format='') |
|
1121 | 1124 | |
|
1122 | 1125 | |
|
1123 | 1126 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external') |
|
1124 | 1127 | opObj11.addParameter(name='idfigure', value='1', format='int') |
|
1125 | 1128 | opObj11.addParameter(name='wintitle', value='SpectraPlot0', format='str') |
|
1126 | 1129 | opObj11.addParameter(name='zmin', value='40', format='int') |
|
1127 | 1130 | opObj11.addParameter(name='zmax', value='90', format='int') |
|
1128 | 1131 | opObj11.addParameter(name='showprofile', value='1', format='int') |
|
1129 | 1132 | |
|
1130 | 1133 | print "Escribiendo el archivo XML" |
|
1131 | 1134 | |
|
1132 | 1135 | controllerObj.writeXml(filename) |
|
1133 | 1136 | |
|
1134 | 1137 | print "Leyendo el archivo XML" |
|
1135 | 1138 | controllerObj.readXml(filename) |
|
1136 | 1139 | #controllerObj.printattr() |
|
1137 | 1140 | |
|
1138 | 1141 | controllerObj.createObjects() |
|
1139 | 1142 | controllerObj.connectObjects() |
|
1140 | 1143 | controllerObj.run() |
|
1141 | 1144 | |
|
1142 | 1145 | No newline at end of file |
@@ -1,5902 +1,5899 | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """ |
|
3 | 3 | Module implementing MainWindow. |
|
4 | 4 | #+++++++++++++GUI V1++++++++++++++# |
|
5 | 5 | @author: AlexanderValdezPortocarrero Γ±_Γ± |
|
6 | 6 | """ |
|
7 | 7 | import os, sys, time |
|
8 | 8 | import datetime |
|
9 | 9 | import numpy |
|
10 | 10 | import Queue |
|
11 | 11 | |
|
12 | 12 | from collections import OrderedDict |
|
13 | 13 | from os.path import expanduser |
|
14 | 14 | from time import sleep |
|
15 | 15 | # from gevent import sleep |
|
16 | 16 | |
|
17 | 17 | import ast |
|
18 | 18 | |
|
19 | 19 | from PyQt4.QtGui import QMainWindow |
|
20 | 20 | from PyQt4.QtCore import pyqtSignature |
|
21 | 21 | from PyQt4.QtCore import pyqtSignal |
|
22 | 22 | from PyQt4 import QtCore |
|
23 | 23 | from PyQt4 import QtGui |
|
24 | 24 | # from PyQt4.QtCore import QThread |
|
25 | 25 | # from PyQt4.QtCore import QObject, SIGNAL |
|
26 | 26 | |
|
27 | 27 | from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess |
|
28 | 28 | from schainpy.gui.viewer.ui_ftp import Ui_Ftp |
|
29 | 29 | from schainpy.gui.viewer.ui_mainwindow import Ui_BasicWindow |
|
30 | 30 | from schainpy.controller_api import ControllerThread |
|
31 | 31 | from schainpy.controller import Project |
|
32 | 32 | |
|
33 | 33 | from propertiesViewModel import TreeModel, PropertyBuffer |
|
34 | 34 | from parametersModel import ProjectParms |
|
35 | 35 | |
|
36 | 36 | from schainpy.gui.figures import tools |
|
37 | 37 | |
|
38 | 38 | FIGURES_PATH = tools.get_path() |
|
39 | 39 | TEMPORAL_FILE = ".temp.xml" |
|
40 | 40 | |
|
41 | 41 | def isRadarFile(file): |
|
42 | 42 | try: |
|
43 | 43 | year = int(file[1:5]) |
|
44 | 44 | doy = int(file[5:8]) |
|
45 | 45 | set = int(file[8:11]) |
|
46 | 46 | except: |
|
47 | 47 | return 0 |
|
48 | 48 | |
|
49 | 49 | return 1 |
|
50 | 50 | |
|
51 | 51 | def isRadarPath(path): |
|
52 | 52 | try: |
|
53 | 53 | year = int(path[1:5]) |
|
54 | 54 | doy = int(path[5:8]) |
|
55 | 55 | except: |
|
56 | 56 | return 0 |
|
57 | 57 | |
|
58 | 58 | return 1 |
|
59 | 59 | |
|
60 | 60 | def isInt(value): |
|
61 | 61 | |
|
62 | 62 | try: |
|
63 | 63 | int(value) |
|
64 | 64 | except: |
|
65 | 65 | return 0 |
|
66 | 66 | |
|
67 | 67 | return 1 |
|
68 | 68 | |
|
69 | 69 | def isFloat(value): |
|
70 | 70 | |
|
71 | 71 | try: |
|
72 | 72 | float(value) |
|
73 | 73 | except: |
|
74 | 74 | return 0 |
|
75 | 75 | |
|
76 | 76 | return 1 |
|
77 | 77 | |
|
78 | 78 | def isList(value): |
|
79 | 79 | |
|
80 | 80 | x = ast.literal_eval(value) |
|
81 | 81 | |
|
82 | 82 | if type(x) in (tuple, list): |
|
83 | 83 | return 1 |
|
84 | 84 | |
|
85 | 85 | return 0 |
|
86 | 86 | |
|
87 | 87 | class BasicWindow(QMainWindow, Ui_BasicWindow): |
|
88 | 88 | """ |
|
89 | 89 | """ |
|
90 | 90 | def __init__(self, parent=None): |
|
91 | 91 | """ |
|
92 | 92 | |
|
93 | 93 | """ |
|
94 | 94 | QMainWindow.__init__(self, parent) |
|
95 | 95 | self.setupUi(self) |
|
96 | 96 | self.__puObjDict = {} |
|
97 | 97 | self.__itemTreeDict = {} |
|
98 | 98 | self.readUnitConfObjList = [] |
|
99 | 99 | self.operObjList = [] |
|
100 | 100 | self.projecObjView = None |
|
101 | 101 | self.idProject = 0 |
|
102 | 102 | # self.idImag = 0 |
|
103 | 103 | |
|
104 | 104 | self.idImagscope = 0 |
|
105 | 105 | self.idImagspectra = 0 |
|
106 | 106 | self.idImagcross = 0 |
|
107 | 107 | self.idImagrti = 0 |
|
108 | 108 | self.idImagcoherence = 0 |
|
109 | 109 | self.idImagpower = 0 |
|
110 | 110 | self.idImagrtinoise = 0 |
|
111 | 111 | self.idImagspectraHeis = 0 |
|
112 | 112 | self.idImagrtiHeis = 0 |
|
113 | 113 | |
|
114 | 114 | self.dataPath = None |
|
115 | 115 | self.online = 0 |
|
116 | 116 | self.walk = 0 |
|
117 | 117 | self.create = False |
|
118 | 118 | self.selectedItemTree = None |
|
119 | 119 | self.controllerThread = None |
|
120 | 120 | # self.commCtrlPThread = None |
|
121 | 121 | # self.create_figure() |
|
122 | 122 | self.temporalFTP = ftpBuffer() |
|
123 | 123 | self.projectProperCaracteristica = [] |
|
124 | 124 | self.projectProperPrincipal = [] |
|
125 | 125 | self.projectProperDescripcion = [] |
|
126 | 126 | self.volProperCaracteristica = [] |
|
127 | 127 | self.volProperPrincipal = [] |
|
128 | 128 | self.volProperDescripcion = [] |
|
129 | 129 | self.specProperCaracteristica = [] |
|
130 | 130 | self.specProperPrincipal = [] |
|
131 | 131 | self.specProperDescripcion = [] |
|
132 | 132 | |
|
133 | 133 | self.specHeisProperCaracteristica = [] |
|
134 | 134 | self.specHeisProperPrincipal = [] |
|
135 | 135 | self.specHeisProperDescripcion = [] |
|
136 | 136 | |
|
137 | 137 | # self.pathWorkSpace = './' |
|
138 | 138 | |
|
139 | 139 | self.__projectObjDict = {} |
|
140 | 140 | self.__operationObjDict = {} |
|
141 | 141 | |
|
142 | 142 | self.__puLocalFolder2FTP = {} |
|
143 | 143 | self.threadStarted = False |
|
144 | 144 | |
|
145 | 145 | # self.create_comm() |
|
146 | 146 | self.create_updating_timer() |
|
147 | 147 | self.setGUIStatus() |
|
148 | 148 | |
|
149 | 149 | @pyqtSignature("") |
|
150 | 150 | def on_actionOpen_triggered(self): |
|
151 | 151 | """ |
|
152 | 152 | Slot documentation goes here. |
|
153 | 153 | """ |
|
154 | 154 | self.openProject() |
|
155 | 155 | |
|
156 | 156 | @pyqtSignature("") |
|
157 | 157 | def on_actionCreate_triggered(self): |
|
158 | 158 | """ |
|
159 | 159 | Slot documentation goes here. |
|
160 | 160 | """ |
|
161 | 161 | self.setInputsProject_View() |
|
162 | 162 | self.create = True |
|
163 | 163 | |
|
164 | 164 | @pyqtSignature("") |
|
165 | 165 | def on_actionSave_triggered(self): |
|
166 | 166 | """ |
|
167 | 167 | Slot documentation goes here. |
|
168 | 168 | """ |
|
169 | 169 | self.saveProject() |
|
170 | 170 | |
|
171 | 171 | @pyqtSignature("") |
|
172 | 172 | def on_actionClose_triggered(self): |
|
173 | 173 | """ |
|
174 | 174 | Slot documentation goes here. |
|
175 | 175 | """ |
|
176 | 176 | self.close() |
|
177 | 177 | |
|
178 | 178 | @pyqtSignature("") |
|
179 | 179 | def on_actionStart_triggered(self): |
|
180 | 180 | """ |
|
181 | 181 | """ |
|
182 | 182 | self.playProject() |
|
183 | 183 | |
|
184 | 184 | @pyqtSignature("") |
|
185 | 185 | def on_actionPause_triggered(self): |
|
186 | 186 | """ |
|
187 | 187 | """ |
|
188 | 188 | self.pauseProject() |
|
189 | 189 | |
|
190 | 190 | @pyqtSignature("") |
|
191 | 191 | def on_actionStop_triggered(self): |
|
192 | 192 | """ |
|
193 | 193 | """ |
|
194 | 194 | self.stopProject() |
|
195 | 195 | |
|
196 | 196 | @pyqtSignature("") |
|
197 | 197 | def on_actionAbout_triggered(self): |
|
198 | 198 | """ |
|
199 | 199 | """ |
|
200 | 200 | self.aboutEvent() |
|
201 | 201 | |
|
202 | 202 | @pyqtSignature("") |
|
203 | 203 | def on_actionFTP_triggered(self): |
|
204 | 204 | """ |
|
205 | 205 | """ |
|
206 | 206 | self.configFTPWindowObj = Ftp(self) |
|
207 | 207 | |
|
208 | 208 | if not self.temporalFTP.create: |
|
209 | 209 | self.temporalFTP.setwithoutconfiguration() |
|
210 | 210 | |
|
211 | 211 | self.configFTPWindowObj.setParmsfromTemporal(self.temporalFTP.server, |
|
212 | 212 | self.temporalFTP.remotefolder, |
|
213 | 213 | self.temporalFTP.username, |
|
214 | 214 | self.temporalFTP.password, |
|
215 | 215 | self.temporalFTP.ftp_wei, |
|
216 | 216 | self.temporalFTP.exp_code, |
|
217 | 217 | self.temporalFTP.sub_exp_code, |
|
218 | 218 | self.temporalFTP.plot_pos) |
|
219 | 219 | |
|
220 | 220 | self.configFTPWindowObj.show() |
|
221 | 221 | self.configFTPWindowObj.closed.connect(self.createFTPConfig) |
|
222 | 222 | |
|
223 | 223 | def createFTPConfig(self): |
|
224 | 224 | |
|
225 | 225 | if not self.configFTPWindowObj.create: |
|
226 | 226 | self.console.clear() |
|
227 | 227 | self.console.append("There is no FTP configuration") |
|
228 | 228 | return |
|
229 | 229 | |
|
230 | 230 | self.console.append("Push Ok in Spectra view to Add FTP Configuration") |
|
231 | 231 | |
|
232 | 232 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.configFTPWindowObj.getParmsFromFtpWindow() |
|
233 | 233 | self.temporalFTP.save(server=server, |
|
234 | 234 | remotefolder=remotefolder, |
|
235 | 235 | username=username, |
|
236 | 236 | password=password, |
|
237 | 237 | ftp_wei=ftp_wei, |
|
238 | 238 | exp_code=exp_code, |
|
239 | 239 | sub_exp_code=sub_exp_code, |
|
240 | 240 | plot_pos=plot_pos) |
|
241 | 241 | |
|
242 | 242 | @pyqtSignature("") |
|
243 | 243 | def on_actionOpenToolbar_triggered(self): |
|
244 | 244 | """ |
|
245 | 245 | Slot documentation goes here. |
|
246 | 246 | """ |
|
247 | 247 | self.openProject() |
|
248 | 248 | |
|
249 | 249 | @pyqtSignature("") |
|
250 | 250 | def on_actionCreateToolbar_triggered(self): |
|
251 | 251 | """ |
|
252 | 252 | Slot documentation goes here. |
|
253 | 253 | """ |
|
254 | 254 | self.setInputsProject_View() |
|
255 | 255 | self.create = True |
|
256 | 256 | |
|
257 | 257 | @pyqtSignature("") |
|
258 | 258 | def on_actionAddPU_triggered(self): |
|
259 | 259 | if len(self.__projectObjDict) == 0: |
|
260 | 260 | outputstr = "First Create a Project then add Processing Unit" |
|
261 | 261 | self.console.clear() |
|
262 | 262 | self.console.append(outputstr) |
|
263 | 263 | return 0 |
|
264 | 264 | else: |
|
265 | 265 | self.addPUWindow() |
|
266 | 266 | self.console.clear() |
|
267 | 267 | self.console.append("Please, Choose the type of Processing Unit") |
|
268 | 268 | self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") |
|
269 | 269 | self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") |
|
270 | 270 | self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") |
|
271 | 271 | |
|
272 | 272 | |
|
273 | 273 | @pyqtSignature("") |
|
274 | 274 | def on_actionSaveToolbar_triggered(self): |
|
275 | 275 | """ |
|
276 | 276 | Slot documentation goes here. |
|
277 | 277 | """ |
|
278 | 278 | self.saveProject() |
|
279 | 279 | |
|
280 | 280 | @pyqtSignature("") |
|
281 | 281 | def on_actionStarToolbar_triggered(self): |
|
282 | 282 | """ |
|
283 | 283 | Slot documentation goes here. |
|
284 | 284 | """ |
|
285 | 285 | self.playProject() |
|
286 | 286 | |
|
287 | 287 | @pyqtSignature("") |
|
288 | 288 | def on_actionPauseToolbar_triggered(self): |
|
289 | 289 | |
|
290 | 290 | self.pauseProject() |
|
291 | 291 | |
|
292 | 292 | @pyqtSignature("") |
|
293 | 293 | def on_actionStopToolbar_triggered(self): |
|
294 | 294 | """ |
|
295 | 295 | Slot documentation goes here. |
|
296 | 296 | """ |
|
297 | 297 | self.stopProject() |
|
298 | 298 | |
|
299 | 299 | @pyqtSignature("int") |
|
300 | 300 | def on_proComReadMode_activated(self, index): |
|
301 | 301 | """ |
|
302 | 302 | SELECCION DEL MODO DE LECTURA ON=1, OFF=0 |
|
303 | 303 | """ |
|
304 | 304 | if index == 0: |
|
305 | 305 | self.online = 0 |
|
306 | 306 | self.proDelay.setText("0") |
|
307 | 307 | self.proSet.setText("") |
|
308 | 308 | self.proSet.setEnabled(False) |
|
309 | 309 | self.proDelay.setEnabled(False) |
|
310 | 310 | elif index == 1: |
|
311 | 311 | self.online = 1 |
|
312 | 312 | self.proSet.setText("") |
|
313 | 313 | self.proDelay.setText("5") |
|
314 | 314 | self.proSet.setEnabled(True) |
|
315 | 315 | self.proDelay.setEnabled(True) |
|
316 | 316 | |
|
317 | 317 | @pyqtSignature("int") |
|
318 | 318 | def on_proComDataType_activated(self, index): |
|
319 | 319 | """ |
|
320 | 320 | Voltage or Spectra |
|
321 | 321 | """ |
|
322 | 322 | self.labelSet.show() |
|
323 | 323 | self.proSet.show() |
|
324 | 324 | |
|
325 | 325 | self.labExpLabel.show() |
|
326 | 326 | self.proExpLabel.show() |
|
327 | 327 | |
|
328 | 328 | self.labelIPPKm.hide() |
|
329 | 329 | self.proIPPKm.hide() |
|
330 | 330 | |
|
331 | 331 | if index == 0: |
|
332 | 332 | extension = '.r' |
|
333 | 333 | elif index == 1: |
|
334 | 334 | extension = '.pdata' |
|
335 | 335 | elif index == 2: |
|
336 | 336 | extension = '.fits' |
|
337 | 337 | elif index == 3: |
|
338 | 338 | extension = '.hdf5' |
|
339 | 339 | |
|
340 | 340 | self.labelIPPKm.show() |
|
341 | 341 | self.proIPPKm.show() |
|
342 | 342 | |
|
343 | 343 | self.labelSet.hide() |
|
344 | 344 | self.proSet.hide() |
|
345 | 345 | |
|
346 | 346 | self.labExpLabel.hide() |
|
347 | 347 | self.proExpLabel.hide() |
|
348 | 348 | |
|
349 | 349 | self.proDataType.setText(extension) |
|
350 | 350 | |
|
351 | 351 | @pyqtSignature("int") |
|
352 | 352 | def on_proComWalk_activated(self, index): |
|
353 | 353 | """ |
|
354 | 354 | |
|
355 | 355 | """ |
|
356 | 356 | if index == 0: |
|
357 | 357 | self.walk = 0 |
|
358 | 358 | elif index == 1: |
|
359 | 359 | self.walk = 1 |
|
360 | 360 | |
|
361 | 361 | @pyqtSignature("") |
|
362 | 362 | def on_proToolPath_clicked(self): |
|
363 | 363 | """ |
|
364 | 364 | Choose your path |
|
365 | 365 | """ |
|
366 | 366 | |
|
367 | 367 | current_dpath = './' |
|
368 | 368 | if self.dataPath: |
|
369 | 369 | current_dpath = self.dataPath |
|
370 | 370 | |
|
371 | 371 | datapath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', current_dpath, QtGui.QFileDialog.ShowDirsOnly)) |
|
372 | 372 | |
|
373 | 373 | #If it was canceled |
|
374 | 374 | if not datapath: |
|
375 | 375 | return |
|
376 | 376 | |
|
377 | 377 | #If any change was done |
|
378 | 378 | if datapath == self.dataPath: |
|
379 | 379 | return |
|
380 | 380 | |
|
381 | 381 | self.proDataPath.setText(datapath) |
|
382 | 382 | |
|
383 | 383 | self.actionStart.setEnabled(False) |
|
384 | 384 | self.actionStarToolbar.setEnabled(False) |
|
385 | 385 | self.proOk.setEnabled(False) |
|
386 | 386 | |
|
387 | 387 | self.proComStartDate.clear() |
|
388 | 388 | self.proComEndDate.clear() |
|
389 | 389 | |
|
390 | 390 | if not os.path.exists(datapath): |
|
391 | 391 | |
|
392 | 392 | self.console.clear() |
|
393 | 393 | self.console.append("Write a valid path") |
|
394 | 394 | return |
|
395 | 395 | |
|
396 | 396 | self.dataPath = datapath |
|
397 | 397 | |
|
398 | 398 | self.console.clear() |
|
399 | 399 | self.console.append("Select the read mode and press 'load button'") |
|
400 | 400 | |
|
401 | 401 | |
|
402 | 402 | @pyqtSignature("") |
|
403 | 403 | def on_proLoadButton_clicked(self): |
|
404 | 404 | |
|
405 | 405 | self.console.clear() |
|
406 | 406 | |
|
407 | 407 | # if not self.getSelectedProjectObj(): |
|
408 | 408 | # self.console.append("Please select a project before load files") |
|
409 | 409 | # return |
|
410 | 410 | |
|
411 | 411 | parameter_list = self.checkInputsProject() |
|
412 | 412 | |
|
413 | 413 | # if not parameter_list[0]: |
|
414 | 414 | # return |
|
415 | 415 | |
|
416 | 416 | parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set, expLabel = parameter_list |
|
417 | 417 | |
|
418 | 418 | if read_mode == "Offline": |
|
419 | 419 | self.proComStartDate.clear() |
|
420 | 420 | self.proComEndDate.clear() |
|
421 | 421 | self.proComStartDate.setEnabled(True) |
|
422 | 422 | self.proComEndDate.setEnabled(True) |
|
423 | 423 | self.proStartTime.setEnabled(True) |
|
424 | 424 | self.proEndTime.setEnabled(True) |
|
425 | 425 | self.frame_2.setEnabled(True) |
|
426 | 426 | |
|
427 | 427 | if read_mode == "Online": |
|
428 | 428 | self.proComStartDate.addItem("1960/01/30") |
|
429 | 429 | self.proComEndDate.addItem("2018/12/31") |
|
430 | 430 | self.proComStartDate.setEnabled(False) |
|
431 | 431 | self.proComEndDate.setEnabled(False) |
|
432 | 432 | self.proStartTime.setEnabled(False) |
|
433 | 433 | self.proEndTime.setEnabled(False) |
|
434 | 434 | self.frame_2.setEnabled(True) |
|
435 | 435 | |
|
436 | 436 | self.loadDays(data_path, ext, walk, expLabel) |
|
437 | 437 | |
|
438 | 438 | @pyqtSignature("int") |
|
439 | 439 | def on_proComStartDate_activated(self, index): |
|
440 | 440 | """ |
|
441 | 441 | SELECCION DEL RANGO DE FECHAS -START DATE |
|
442 | 442 | """ |
|
443 | 443 | stopIndex = self.proComEndDate.count() - self.proComEndDate.currentIndex() - 1 |
|
444 | 444 | |
|
445 | 445 | self.proComEndDate.clear() |
|
446 | 446 | for i in self.dateList[index:]: |
|
447 | 447 | self.proComEndDate.addItem(i) |
|
448 | 448 | |
|
449 | 449 | if self.proComEndDate.count() - stopIndex - 1 >= 0: |
|
450 | 450 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - stopIndex - 1) |
|
451 | 451 | else: |
|
452 | 452 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - 1) |
|
453 | 453 | |
|
454 | 454 | @pyqtSignature("int") |
|
455 | 455 | def on_proComEndDate_activated(self, index): |
|
456 | 456 | """ |
|
457 | 457 | SELECCION DEL RANGO DE FECHAS-END DATE |
|
458 | 458 | """ |
|
459 | 459 | pass |
|
460 | 460 | |
|
461 | 461 | @pyqtSignature("") |
|
462 | 462 | def on_proOk_clicked(self): |
|
463 | 463 | """ |
|
464 | 464 | AΓ±ade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml. |
|
465 | 465 | Prepara la configuraciΓ³n del diΓ‘grama del Arbol del treeView numero 2 |
|
466 | 466 | """ |
|
467 | 467 | |
|
468 | 468 | self.actionSaveToolbar.setEnabled(False) |
|
469 | 469 | self.actionStarToolbar.setEnabled(False) |
|
470 | 470 | |
|
471 | 471 | self.actionSave.setEnabled(False) |
|
472 | 472 | self.actionStart.setEnabled(False) |
|
473 | 473 | |
|
474 | 474 | self.console.clear() |
|
475 | 475 | |
|
476 | 476 | if self.create: |
|
477 | 477 | |
|
478 | 478 | projectId = self.__getNewProjectId() |
|
479 | 479 | |
|
480 | 480 | if not projectId: |
|
481 | 481 | return 0 |
|
482 | 482 | |
|
483 | 483 | projectObjView = self.createProjectView(projectId) |
|
484 | 484 | |
|
485 | 485 | if not projectObjView: |
|
486 | 486 | return 0 |
|
487 | 487 | |
|
488 | 488 | self.create = False |
|
489 | 489 | |
|
490 | 490 | readUnitObj = self.createReadUnitView(projectObjView) |
|
491 | 491 | |
|
492 | 492 | if not readUnitObj: |
|
493 | 493 | return 0 |
|
494 | 494 | |
|
495 | 495 | else: |
|
496 | 496 | projectObjView = self.updateProjectView() |
|
497 | 497 | |
|
498 | 498 | if not projectObjView: |
|
499 | 499 | return 0 |
|
500 | 500 | |
|
501 | 501 | projectId = projectObjView.getId() |
|
502 | 502 | idReadUnit = projectObjView.getReadUnitId() |
|
503 | 503 | readUnitObj = self.updateReadUnitView(projectObjView, idReadUnit) |
|
504 | 504 | |
|
505 | 505 | if not readUnitObj: |
|
506 | 506 | return 0 |
|
507 | 507 | |
|
508 | 508 | self.__itemTreeDict[projectId].setText(projectObjView.name) |
|
509 | 509 | # Project Properties |
|
510 | 510 | self.refreshProjectProperties(projectObjView) |
|
511 | 511 | # Disable tabProject after finish the creation |
|
512 | 512 | |
|
513 | 513 | self.actionSaveToolbar.setEnabled(True) |
|
514 | 514 | self.actionStarToolbar.setEnabled(True) |
|
515 | 515 | |
|
516 | 516 | self.actionSave.setEnabled(True) |
|
517 | 517 | self.actionStart.setEnabled(True) |
|
518 | 518 | |
|
519 | 519 | self.console.clear() |
|
520 | 520 | self.console.append("The project parameters were validated") |
|
521 | 521 | |
|
522 | 522 | return 1 |
|
523 | 523 | |
|
524 | 524 | @pyqtSignature("") |
|
525 | 525 | def on_proClear_clicked(self): |
|
526 | 526 | |
|
527 | 527 | self.console.clear() |
|
528 | 528 | |
|
529 | 529 | @pyqtSignature("int") |
|
530 | 530 | def on_volOpCebChannels_stateChanged(self, p0): |
|
531 | 531 | """ |
|
532 | 532 | Check Box habilita operaciones de SelecciοΏ½n de Canales |
|
533 | 533 | """ |
|
534 | 534 | if p0 == 2: |
|
535 | 535 | self.volOpComChannels.setEnabled(True) |
|
536 | 536 | self.volOpChannel.setEnabled(True) |
|
537 | 537 | |
|
538 | 538 | if p0 == 0: |
|
539 | 539 | self.volOpComChannels.setEnabled(False) |
|
540 | 540 | self.volOpChannel.setEnabled(False) |
|
541 | 541 | self.volOpChannel.clear() |
|
542 | 542 | |
|
543 | 543 | @pyqtSignature("int") |
|
544 | 544 | def on_volOpCebHeights_stateChanged(self, p0): |
|
545 | 545 | """ |
|
546 | 546 | Check Box habilita operaciones de SelecciοΏ½n de Alturas |
|
547 | 547 | """ |
|
548 | 548 | if p0 == 2: |
|
549 | 549 | self.volOpHeights.setEnabled(True) |
|
550 | 550 | self.volOpComHeights.setEnabled(True) |
|
551 | 551 | |
|
552 | 552 | if p0 == 0: |
|
553 | 553 | self.volOpHeights.setEnabled(False) |
|
554 | 554 | self.volOpHeights.clear() |
|
555 | 555 | self.volOpComHeights.setEnabled(False) |
|
556 | 556 | |
|
557 | 557 | @pyqtSignature("int") |
|
558 | 558 | def on_volOpCebFilter_stateChanged(self, p0): |
|
559 | 559 | """ |
|
560 | 560 | Name='Decoder', optype='other' |
|
561 | 561 | """ |
|
562 | 562 | if p0 == 2: |
|
563 | 563 | self.volOpFilter.setEnabled(True) |
|
564 | 564 | |
|
565 | 565 | if p0 == 0: |
|
566 | 566 | self.volOpFilter.setEnabled(False) |
|
567 | 567 | self.volOpFilter.clear() |
|
568 | 568 | |
|
569 | 569 | @pyqtSignature("int") |
|
570 | 570 | def on_volOpCebProfile_stateChanged(self, p0): |
|
571 | 571 | """ |
|
572 | 572 | Check Box habilita ingreso del rango de Perfiles |
|
573 | 573 | """ |
|
574 | 574 | if p0 == 2: |
|
575 | 575 | self.volOpComProfile.setEnabled(True) |
|
576 | 576 | self.volOpProfile.setEnabled(True) |
|
577 | 577 | |
|
578 | 578 | if p0 == 0: |
|
579 | 579 | self.volOpComProfile.setEnabled(False) |
|
580 | 580 | self.volOpProfile.setEnabled(False) |
|
581 | 581 | self.volOpProfile.clear() |
|
582 | 582 | |
|
583 | 583 | @pyqtSignature("int") |
|
584 | 584 | def on_volOpComProfile_activated(self, index): |
|
585 | 585 | """ |
|
586 | 586 | Check Box habilita ingreso del rango de Perfiles |
|
587 | 587 | """ |
|
588 | 588 | #Profile List |
|
589 | 589 | if index == 0: |
|
590 | 590 | self.volOpProfile.setToolTip('List of selected profiles. Example: 0, 1, 2, 3, 4, 5, 6, 7') |
|
591 | 591 | |
|
592 | 592 | #Profile Range |
|
593 | 593 | if index == 1: |
|
594 | 594 | self.volOpProfile.setToolTip('Minimum and maximum profile index. Example: 0, 7') |
|
595 | 595 | |
|
596 | 596 | #Profile Range List |
|
597 | 597 | if index == 2: |
|
598 | 598 | self.volOpProfile.setToolTip('List of profile ranges. Example: (0, 7), (12, 19), (100, 200)') |
|
599 | 599 | |
|
600 | 600 | @pyqtSignature("int") |
|
601 | 601 | def on_volOpCebDecodification_stateChanged(self, p0): |
|
602 | 602 | """ |
|
603 | 603 | Check Box habilita |
|
604 | 604 | """ |
|
605 | 605 | if p0 == 2: |
|
606 | 606 | self.volOpComCode.setEnabled(True) |
|
607 | 607 | self.volOpComMode.setEnabled(True) |
|
608 | 608 | if p0 == 0: |
|
609 | 609 | self.volOpComCode.setEnabled(False) |
|
610 | 610 | self.volOpComMode.setEnabled(False) |
|
611 | 611 | |
|
612 | 612 | @pyqtSignature("int") |
|
613 | 613 | def on_volOpComCode_activated(self, index): |
|
614 | 614 | """ |
|
615 | 615 | Check Box habilita ingreso |
|
616 | 616 | """ |
|
617 | 617 | if index == 13: |
|
618 | 618 | self.volOpCode.setEnabled(True) |
|
619 | 619 | else: |
|
620 | 620 | self.volOpCode.setEnabled(False) |
|
621 | 621 | |
|
622 | 622 | if index == 0: |
|
623 | 623 | code = '' |
|
624 | 624 | self.volOpCode.setText(str(code)) |
|
625 | 625 | return |
|
626 | 626 | |
|
627 | 627 | if index == 1: |
|
628 | 628 | code = '(1,1,-1)' |
|
629 | 629 | nCode = '1' |
|
630 | 630 | nBaud = '3' |
|
631 | 631 | if index == 2: |
|
632 | 632 | code = '(1,1,-1,1)' |
|
633 | 633 | nCode = '1' |
|
634 | 634 | nBaud = '4' |
|
635 | 635 | if index == 3: |
|
636 | 636 | code = '(1,1,1,-1,1)' |
|
637 | 637 | nCode = '1' |
|
638 | 638 | nBaud = '5' |
|
639 | 639 | if index == 4: |
|
640 | 640 | code = '(1,1,1,-1,-1,1,-1)' |
|
641 | 641 | nCode = '1' |
|
642 | 642 | nBaud = '7' |
|
643 | 643 | if index == 5: |
|
644 | 644 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1)' |
|
645 | 645 | nCode = '1' |
|
646 | 646 | nBaud = '11' |
|
647 | 647 | if index == 6: |
|
648 | 648 | code = '(1,1,1,1,1,-1,-1,1,1,-1,1,-1,1)' |
|
649 | 649 | nCode = '1' |
|
650 | 650 | nBaud = '13' |
|
651 | 651 | if index == 7: |
|
652 | 652 | code = '(1,1,-1,-1,-1,1)' |
|
653 | 653 | nCode = '2' |
|
654 | 654 | nBaud = '3' |
|
655 | 655 | if index == 8: |
|
656 | 656 | code = '(1,1,-1,1,-1,-1,1,-1)' |
|
657 | 657 | nCode = '2' |
|
658 | 658 | nBaud = '4' |
|
659 | 659 | if index == 9: |
|
660 | 660 | code = '(1,1,1,-1,1,-1,-1,-1,1,-1)' |
|
661 | 661 | nCode = '2' |
|
662 | 662 | nBaud = '5' |
|
663 | 663 | if index == 10: |
|
664 | 664 | code = '(1,1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1)' |
|
665 | 665 | nCode = '2' |
|
666 | 666 | nBaud = '7' |
|
667 | 667 | if index == 11: |
|
668 | 668 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1 ,-1 ,-1 ,1 ,1,1,-1 ,1 ,1 ,-1 ,1)' |
|
669 | 669 | nCode = '2' |
|
670 | 670 | nBaud = '11' |
|
671 | 671 | if index == 12: |
|
672 | 672 | 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)' |
|
673 | 673 | nCode = '2' |
|
674 | 674 | nBaud = '13' |
|
675 | 675 | |
|
676 | 676 | code = ast.literal_eval(code) |
|
677 | 677 | nCode = int(nCode) |
|
678 | 678 | nBaud = int(nBaud) |
|
679 | 679 | |
|
680 | 680 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() |
|
681 | 681 | |
|
682 | 682 | self.volOpCode.setText(str(code)) |
|
683 | 683 | |
|
684 | 684 | @pyqtSignature("int") |
|
685 | 685 | def on_volOpCebFlip_stateChanged(self, p0): |
|
686 | 686 | """ |
|
687 | 687 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
688 | 688 | """ |
|
689 | 689 | if p0 == 2: |
|
690 | 690 | self.volOpFlip.setEnabled(True) |
|
691 | 691 | if p0 == 0: |
|
692 | 692 | self.volOpFlip.setEnabled(False) |
|
693 | 693 | self.volOpFlip.clear() |
|
694 | 694 | |
|
695 | 695 | @pyqtSignature("int") |
|
696 | 696 | def on_volOpCebCohInt_stateChanged(self, p0): |
|
697 | 697 | """ |
|
698 | 698 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
699 | 699 | """ |
|
700 | 700 | if p0 == 2: |
|
701 | 701 | self.volOpCohInt.setEnabled(True) |
|
702 | 702 | if p0 == 0: |
|
703 | 703 | self.volOpCohInt.setEnabled(False) |
|
704 | 704 | self.volOpCohInt.clear() |
|
705 | 705 | |
|
706 | 706 | @pyqtSignature("int") |
|
707 | 707 | def on_volOpCebRadarfrequency_stateChanged(self, p0): |
|
708 | 708 | """ |
|
709 | 709 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
710 | 710 | """ |
|
711 | 711 | if p0 == 2: |
|
712 | 712 | self.volOpRadarfrequency.setEnabled(True) |
|
713 | 713 | if p0 == 0: |
|
714 | 714 | self.volOpRadarfrequency.clear() |
|
715 | 715 | self.volOpRadarfrequency.setEnabled(False) |
|
716 | 716 | |
|
717 | 717 | @pyqtSignature("") |
|
718 | 718 | def on_volOutputToolPath_clicked(self): |
|
719 | 719 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
720 | 720 | self.volOutputPath.setText(dirOutPath) |
|
721 | 721 | |
|
722 | 722 | @pyqtSignature("") |
|
723 | 723 | def on_specOutputToolPath_clicked(self): |
|
724 | 724 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
725 | 725 | self.specOutputPath.setText(dirOutPath) |
|
726 | 726 | |
|
727 | 727 | @pyqtSignature("") |
|
728 | 728 | def on_specHeisOutputToolPath_clicked(self): |
|
729 | 729 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
730 | 730 | self.specHeisOutputPath.setText(dirOutPath) |
|
731 | 731 | |
|
732 | 732 | @pyqtSignature("") |
|
733 | 733 | def on_specHeisOutputMetadaToolPath_clicked(self): |
|
734 | 734 | |
|
735 | 735 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) |
|
736 | 736 | self.specHeisOutputMetada.setText(filename) |
|
737 | 737 | |
|
738 | 738 | @pyqtSignature("") |
|
739 | 739 | def on_volOpOk_clicked(self): |
|
740 | 740 | """ |
|
741 | 741 | BUSCA EN LA LISTA DE OPERACIONES DEL TIPO VOLTAJE Y LES AοΏ½ADE EL PARAMETRO ADECUADO ESPERANDO LA ACEPTACION DEL USUARIO |
|
742 | 742 | PARA AGREGARLO AL ARCHIVO DE CONFIGURACION XML |
|
743 | 743 | """ |
|
744 | 744 | |
|
745 | 745 | checkPath = False |
|
746 | 746 | |
|
747 | 747 | self.actionSaveToolbar.setEnabled(False) |
|
748 | 748 | self.actionStarToolbar.setEnabled(False) |
|
749 | 749 | |
|
750 | 750 | self.actionSave.setEnabled(False) |
|
751 | 751 | self.actionStart.setEnabled(False) |
|
752 | 752 | |
|
753 | 753 | self.console.clear() |
|
754 | 754 | self.console.append("Checking input parameters ...") |
|
755 | 755 | |
|
756 | 756 | puObj = self.getSelectedItemObj() |
|
757 | 757 | puObj.removeOperations() |
|
758 | 758 | |
|
759 | 759 | if self.volOpCebRadarfrequency.isChecked(): |
|
760 | 760 | value = str(self.volOpRadarfrequency.text()) |
|
761 | 761 | format = 'float' |
|
762 | 762 | name_operation = 'setRadarFrequency' |
|
763 | 763 | name_parameter = 'frequency' |
|
764 | 764 | if not value == "": |
|
765 | 765 | try: |
|
766 | 766 | radarfreq = float(self.volOpRadarfrequency.text())*1e6 |
|
767 | 767 | except: |
|
768 | 768 | self.console.clear() |
|
769 | 769 | self.console.append("Invalid value '%s' for Radar Frequency" %value) |
|
770 | 770 | return 0 |
|
771 | 771 | |
|
772 | 772 | opObj = puObj.addOperation(name=name_operation) |
|
773 | 773 | if not opObj.addParameter(name=name_parameter, value=radarfreq, format=format): |
|
774 | 774 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) |
|
775 | 775 | return 0 |
|
776 | 776 | |
|
777 | 777 | if self.volOpCebChannels.isChecked(): |
|
778 | 778 | value = str(self.volOpChannel.text()) |
|
779 | 779 | |
|
780 | 780 | if value == "": |
|
781 | 781 | print "Please fill channel list" |
|
782 | 782 | return 0 |
|
783 | 783 | |
|
784 | 784 | format = 'intlist' |
|
785 | 785 | if self.volOpComChannels.currentIndex() == 0: |
|
786 | 786 | name_operation = "selectChannels" |
|
787 | 787 | name_parameter = 'channelList' |
|
788 | 788 | else: |
|
789 | 789 | name_operation = "selectChannelsByIndex" |
|
790 | 790 | name_parameter = 'channelIndexList' |
|
791 | 791 | |
|
792 | 792 | opObj = puObj.addOperation(name=name_operation) |
|
793 | 793 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
794 | 794 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) |
|
795 | 795 | return 0 |
|
796 | 796 | |
|
797 | 797 | if self.volOpCebHeights.isChecked(): |
|
798 | 798 | value = str(self.volOpHeights.text()) |
|
799 | 799 | |
|
800 | 800 | if value == "": |
|
801 | 801 | print "Please fill height range" |
|
802 | 802 | return 0 |
|
803 | 803 | |
|
804 | 804 | valueList = value.split(',') |
|
805 | 805 | |
|
806 | 806 | if self.volOpComHeights.currentIndex() == 0: |
|
807 | 807 | format = 'float' |
|
808 | 808 | name_operation = 'selectHeights' |
|
809 | 809 | name_parameter1 = 'minHei' |
|
810 | 810 | name_parameter2 = 'maxHei' |
|
811 | 811 | else: |
|
812 | 812 | format = 'int' |
|
813 | 813 | name_operation = 'selectHeightsByIndex' |
|
814 | 814 | name_parameter1 = 'minIndex' |
|
815 | 815 | name_parameter2 = 'maxIndex' |
|
816 | 816 | |
|
817 | 817 | opObj = puObj.addOperation(name=name_operation) |
|
818 | 818 | opObj.addParameter(name=name_parameter1, value=valueList[0], format=format) |
|
819 | 819 | opObj.addParameter(name=name_parameter2, value=valueList[1], format=format) |
|
820 | 820 | |
|
821 | 821 | if self.volOpCebFilter.isChecked(): |
|
822 | 822 | value = str(self.volOpFilter.text()) |
|
823 | 823 | if value == "": |
|
824 | 824 | print "Please fill filter value" |
|
825 | 825 | return 0 |
|
826 | 826 | |
|
827 | 827 | format = 'int' |
|
828 | 828 | name_operation = 'filterByHeights' |
|
829 | 829 | name_parameter = 'window' |
|
830 | 830 | opObj = puObj.addOperation(name=name_operation) |
|
831 | 831 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
832 | 832 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) |
|
833 | 833 | return 0 |
|
834 | 834 | |
|
835 | 835 | if self.volOpCebProfile.isChecked(): |
|
836 | 836 | value = str(self.volOpProfile.text()) |
|
837 | 837 | |
|
838 | 838 | if value == "": |
|
839 | 839 | print "Please fill profile value" |
|
840 | 840 | return 0 |
|
841 | 841 | |
|
842 | 842 | format = 'intlist' |
|
843 | 843 | optype = 'other' |
|
844 | 844 | name_operation = 'ProfileSelector' |
|
845 | 845 | if self.volOpComProfile.currentIndex() == 0: |
|
846 | 846 | name_parameter = 'profileList' |
|
847 | 847 | if self.volOpComProfile.currentIndex() == 1: |
|
848 | 848 | name_parameter = 'profileRangeList' |
|
849 | 849 | if self.volOpComProfile.currentIndex() == 2: |
|
850 | 850 | name_parameter = 'rangeList' |
|
851 | 851 | |
|
852 | 852 | opObj = puObj.addOperation(name='ProfileSelector', optype='other') |
|
853 | 853 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
854 | 854 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) |
|
855 | 855 | return 0 |
|
856 | 856 | |
|
857 | 857 | if self.volOpCebDecodification.isChecked(): |
|
858 | 858 | name_operation = 'Decoder' |
|
859 | 859 | opObj = puObj.addOperation(name=name_operation, optype='other') |
|
860 | 860 | |
|
861 | 861 | #User defined |
|
862 | 862 | nBaud = None |
|
863 | 863 | nCode = None |
|
864 | 864 | |
|
865 | 865 | code = str(self.volOpCode.text()) |
|
866 | 866 | try: |
|
867 | 867 | code_tmp = ast.literal_eval(code) |
|
868 | 868 | except: |
|
869 | 869 | code_tmp = [] |
|
870 | 870 | |
|
871 | 871 | if len(code_tmp) > 0: |
|
872 | 872 | |
|
873 | 873 | if type(code_tmp) not in (tuple, list): |
|
874 | 874 | self.console.append("Please write a right value for Code (Exmaple: [1,1,-1], [1,-1,1])") |
|
875 | 875 | return 0 |
|
876 | 876 | |
|
877 | 877 | if len(code_tmp) > 1 and type(code_tmp[0]) in (tuple, list): #[ [1,-1,1], [1,1,-1] ] |
|
878 | 878 | nBaud = len(code_tmp[0]) |
|
879 | 879 | nCode = len(code_tmp) |
|
880 | 880 | elif len(code_tmp) == 1 and type(code_tmp[0]) in (tuple, list): #[ [1,-1,1] ] |
|
881 | 881 | nBaud = len(code_tmp[0]) |
|
882 | 882 | nCode = 1 |
|
883 | 883 | elif type(code_tmp[0]) in (int, float): #[1,-1,1] or (1,-1,1) |
|
884 | 884 | nBaud = len(code_tmp) |
|
885 | 885 | nCode = 1 |
|
886 | 886 | else: |
|
887 | 887 | self.console.append("Please write a right value for Code (Exmaple: [1,1,-1], [1,-1,1])") |
|
888 | 888 | return 0 |
|
889 | 889 | |
|
890 | 890 | if not nBaud or not nCode: |
|
891 | 891 | self.console.append("Please write a right value for Code") |
|
892 | 892 | return 0 |
|
893 | 893 | |
|
894 | 894 | code = code.replace("(", "") |
|
895 | 895 | code = code.replace(")", "") |
|
896 | 896 | code = code.replace("[", "") |
|
897 | 897 | code = code.replace("]", "") |
|
898 | 898 | |
|
899 | 899 | if not opObj.addParameter(name='code', value=code, format='intlist'): |
|
900 | 900 | self.console.append("Please write a right value for Code") |
|
901 | 901 | return 0 |
|
902 | 902 | if not opObj.addParameter(name='nCode', value=nCode, format='int'): |
|
903 | 903 | self.console.append("Please write a right value for Code") |
|
904 | 904 | return 0 |
|
905 | 905 | if not opObj.addParameter(name='nBaud', value=nBaud, format='int'): |
|
906 | 906 | self.console.append("Please write a right value for Code") |
|
907 | 907 | return 0 |
|
908 | 908 | |
|
909 | 909 | name_parameter = 'mode' |
|
910 | 910 | format = 'int' |
|
911 | 911 | |
|
912 | 912 | value = str(self.volOpComMode.currentIndex()) |
|
913 | 913 | |
|
914 | 914 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
915 | 915 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) |
|
916 | 916 | return 0 |
|
917 | 917 | |
|
918 | 918 | |
|
919 | 919 | if self.volOpCebFlip.isChecked(): |
|
920 | 920 | name_operation = 'deFlip' |
|
921 | 921 | optype = 'self' |
|
922 | 922 | |
|
923 | 923 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
924 | 924 | |
|
925 | 925 | name_parameter = 'channelList' |
|
926 | 926 | format = 'intlist' |
|
927 | 927 | value = str(self.volOpFlip.text()) |
|
928 | 928 | |
|
929 | 929 | if value != "": |
|
930 | 930 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
931 | 931 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) |
|
932 | 932 | return 0 |
|
933 | 933 | |
|
934 | 934 | if self.volOpCebCohInt.isChecked(): |
|
935 | 935 | name_operation = 'CohInt' |
|
936 | 936 | optype = 'other' |
|
937 | 937 | value = str(self.volOpCohInt.text()) |
|
938 | 938 | |
|
939 | 939 | if value == "": |
|
940 | 940 | print "Please fill number of coherent integrations" |
|
941 | 941 | return 0 |
|
942 | 942 | |
|
943 | 943 | name_parameter = 'n' |
|
944 | 944 | format = 'int' |
|
945 | 945 | |
|
946 | 946 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
947 | 947 | |
|
948 | 948 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
949 | 949 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) |
|
950 | 950 | return 0 |
|
951 | 951 | |
|
952 | 952 | if self.volGraphCebshow.isChecked(): |
|
953 | 953 | name_operation = 'Scope' |
|
954 | 954 | optype = 'other' |
|
955 | 955 | name_parameter = 'type' |
|
956 | 956 | value = 'Scope' |
|
957 | 957 | if self.idImagscope == 0: |
|
958 | 958 | self.idImagscope = 100 |
|
959 | 959 | else: |
|
960 | 960 | self.idImagscope = self.idImagscope + 1 |
|
961 | 961 | |
|
962 | 962 | name_parameter1 = 'id' |
|
963 | 963 | value1 = int(self.idImagscope) |
|
964 | 964 | format1 = 'int' |
|
965 | 965 | format = 'str' |
|
966 | 966 | |
|
967 | 967 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
968 | 968 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
969 | 969 | opObj.addParameter(name=name_parameter1, value=opObj.id, format=format1) |
|
970 | 970 | |
|
971 | 971 | channelList = str(self.volGraphChannelList.text()).replace(" ","") |
|
972 | 972 | xvalue = str(self.volGraphfreqrange.text()).replace(" ","") |
|
973 | 973 | yvalue = str(self.volGraphHeightrange.text()).replace(" ","") |
|
974 | 974 | |
|
975 | 975 | if channelList: |
|
976 | 976 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
977 | 977 | |
|
978 | 978 | if xvalue: |
|
979 | 979 | xvalueList = xvalue.split(',') |
|
980 | 980 | try: |
|
981 | 981 | value0 = float(xvalueList[0]) |
|
982 | 982 | value1 = float(xvalueList[1]) |
|
983 | 983 | except: |
|
984 | 984 | return 0 |
|
985 | 985 | opObj.addParameter(name='xmin', value=value0, format='float') |
|
986 | 986 | opObj.addParameter(name='xmax', value=value1, format='float') |
|
987 | 987 | |
|
988 | 988 | |
|
989 | 989 | if not yvalue == "": |
|
990 | 990 | yvalueList = yvalue.split(",") |
|
991 | 991 | try: |
|
992 | 992 | value0 = int(yvalueList[0]) |
|
993 | 993 | value1 = int(yvalueList[1]) |
|
994 | 994 | except: |
|
995 | 995 | return 0 |
|
996 | 996 | |
|
997 | 997 | opObj.addParameter(name='ymin', value=value0, format='int') |
|
998 | 998 | opObj.addParameter(name='ymax', value=value1, format='int') |
|
999 | 999 | |
|
1000 | 1000 | if self.volGraphCebSave.isChecked(): |
|
1001 | 1001 | checkPath = True |
|
1002 | 1002 | opObj.addParameter(name='save', value='1', format='int') |
|
1003 | 1003 | opObj.addParameter(name='figpath', value=str(self.volGraphPath.text()), format='str') |
|
1004 | 1004 | value = str(self.volGraphPrefix.text()).replace(" ","") |
|
1005 | 1005 | if value: |
|
1006 | 1006 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1007 | 1007 | |
|
1008 | 1008 | localfolder = None |
|
1009 | 1009 | if checkPath: |
|
1010 | 1010 | localfolder = str(self.volGraphPath.text()) |
|
1011 | 1011 | if localfolder == '': |
|
1012 | 1012 | self.console.clear() |
|
1013 | 1013 | self.console.append("Graphic path should be defined") |
|
1014 | 1014 | return 0 |
|
1015 | 1015 | |
|
1016 | 1016 | # if something happend |
|
1017 | 1017 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Voltage') |
|
1018 | 1018 | if parms_ok: |
|
1019 | 1019 | name_operation = 'VoltageWriter' |
|
1020 | 1020 | optype = 'other' |
|
1021 | 1021 | name_parameter1 = 'path' |
|
1022 | 1022 | name_parameter2 = 'blocksPerFile' |
|
1023 | 1023 | name_parameter3 = 'profilesPerBlock' |
|
1024 | 1024 | value1 = output_path |
|
1025 | 1025 | value2 = blocksperfile |
|
1026 | 1026 | value3 = profilesperblock |
|
1027 | 1027 | format = "int" |
|
1028 | 1028 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1029 | 1029 | opObj.addParameter(name=name_parameter1, value=value1) |
|
1030 | 1030 | opObj.addParameter(name=name_parameter2, value=value2, format=format) |
|
1031 | 1031 | opObj.addParameter(name=name_parameter3, value=value3, format=format) |
|
1032 | 1032 | |
|
1033 | 1033 | self.console.clear() |
|
1034 | 1034 | try: |
|
1035 | 1035 | self.refreshPUProperties(puObj) |
|
1036 | 1036 | except: |
|
1037 | 1037 | self.console.append("An error reading input parameters was found ...Check them!") |
|
1038 | 1038 | return 0 |
|
1039 | 1039 | |
|
1040 | 1040 | self.console.append("Save your project and press Play button to start signal processing") |
|
1041 | 1041 | |
|
1042 | 1042 | self.actionSaveToolbar.setEnabled(True) |
|
1043 | 1043 | self.actionStarToolbar.setEnabled(True) |
|
1044 | 1044 | |
|
1045 | 1045 | self.actionSave.setEnabled(True) |
|
1046 | 1046 | self.actionStart.setEnabled(True) |
|
1047 | 1047 | |
|
1048 | 1048 | return 1 |
|
1049 | 1049 | |
|
1050 | 1050 | """ |
|
1051 | 1051 | Voltage Graph |
|
1052 | 1052 | """ |
|
1053 | 1053 | @pyqtSignature("int") |
|
1054 | 1054 | def on_volGraphCebSave_stateChanged(self, p0): |
|
1055 | 1055 | """ |
|
1056 | 1056 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
1057 | 1057 | """ |
|
1058 | 1058 | if p0 == 2: |
|
1059 | 1059 | self.volGraphPath.setEnabled(True) |
|
1060 | 1060 | self.volGraphPrefix.setEnabled(True) |
|
1061 | 1061 | self.volGraphToolPath.setEnabled(True) |
|
1062 | 1062 | |
|
1063 | 1063 | if p0 == 0: |
|
1064 | 1064 | self.volGraphPath.setEnabled(False) |
|
1065 | 1065 | self.volGraphPrefix.setEnabled(False) |
|
1066 | 1066 | self.volGraphToolPath.setEnabled(False) |
|
1067 | 1067 | |
|
1068 | 1068 | @pyqtSignature("") |
|
1069 | 1069 | def on_volGraphToolPath_clicked(self): |
|
1070 | 1070 | """ |
|
1071 | 1071 | Donde se guardan los DATOS |
|
1072 | 1072 | """ |
|
1073 | 1073 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
1074 | 1074 | self.volGraphPath.setText(save_path) |
|
1075 | 1075 | |
|
1076 | 1076 | if not os.path.exists(save_path): |
|
1077 | 1077 | self.console.clear() |
|
1078 | 1078 | self.console.append("Set a valid path") |
|
1079 | 1079 | self.volGraphOk.setEnabled(False) |
|
1080 | 1080 | return |
|
1081 | 1081 | |
|
1082 | 1082 | @pyqtSignature("int") |
|
1083 | 1083 | def on_volGraphCebshow_stateChanged(self, p0): |
|
1084 | 1084 | """ |
|
1085 | 1085 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
1086 | 1086 | """ |
|
1087 | 1087 | if p0 == 0: |
|
1088 | 1088 | |
|
1089 | 1089 | self.volGraphChannelList.setEnabled(False) |
|
1090 | 1090 | self.volGraphfreqrange.setEnabled(False) |
|
1091 | 1091 | self.volGraphHeightrange.setEnabled(False) |
|
1092 | 1092 | if p0 == 2: |
|
1093 | 1093 | |
|
1094 | 1094 | self.volGraphChannelList.setEnabled(True) |
|
1095 | 1095 | self.volGraphfreqrange.setEnabled(True) |
|
1096 | 1096 | self.volGraphHeightrange.setEnabled(True) |
|
1097 | 1097 | |
|
1098 | 1098 | """ |
|
1099 | 1099 | Spectra operation |
|
1100 | 1100 | """ |
|
1101 | 1101 | @pyqtSignature("int") |
|
1102 | 1102 | def on_specOpCebRadarfrequency_stateChanged(self, p0): |
|
1103 | 1103 | """ |
|
1104 | 1104 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
1105 | 1105 | """ |
|
1106 | 1106 | if p0 == 2: |
|
1107 | 1107 | self.specOpRadarfrequency.setEnabled(True) |
|
1108 | 1108 | if p0 == 0: |
|
1109 | 1109 | self.specOpRadarfrequency.clear() |
|
1110 | 1110 | self.specOpRadarfrequency.setEnabled(False) |
|
1111 | 1111 | |
|
1112 | 1112 | |
|
1113 | 1113 | @pyqtSignature("int") |
|
1114 | 1114 | def on_specOpCebCrossSpectra_stateChanged(self, p0): |
|
1115 | 1115 | """ |
|
1116 | 1116 | Habilita la opcion de aοΏ½adir el parοΏ½metro CrossSpectra a la Unidad de Procesamiento . |
|
1117 | 1117 | """ |
|
1118 | 1118 | if p0 == 2: |
|
1119 | 1119 | # self.specOpnFFTpoints.setEnabled(True) |
|
1120 | 1120 | self.specOppairsList.setEnabled(True) |
|
1121 | 1121 | if p0 == 0: |
|
1122 | 1122 | # self.specOpnFFTpoints.setEnabled(False) |
|
1123 | 1123 | self.specOppairsList.setEnabled(False) |
|
1124 | 1124 | |
|
1125 | 1125 | @pyqtSignature("int") |
|
1126 | 1126 | def on_specOpCebChannel_stateChanged(self, p0): |
|
1127 | 1127 | """ |
|
1128 | 1128 | Habilita la opcion de aοΏ½adir el parοΏ½metro numero de Canales a la Unidad de Procesamiento . |
|
1129 | 1129 | """ |
|
1130 | 1130 | if p0 == 2: |
|
1131 | 1131 | self.specOpChannel.setEnabled(True) |
|
1132 | 1132 | self.specOpComChannel.setEnabled(True) |
|
1133 | 1133 | if p0 == 0: |
|
1134 | 1134 | self.specOpChannel.setEnabled(False) |
|
1135 | 1135 | self.specOpComChannel.setEnabled(False) |
|
1136 | 1136 | |
|
1137 | 1137 | @pyqtSignature("int") |
|
1138 | 1138 | def on_specOpCebHeights_stateChanged(self, p0): |
|
1139 | 1139 | """ |
|
1140 | 1140 | Habilita la opcion de aοΏ½adir el parοΏ½metro de alturas a la Unidad de Procesamiento . |
|
1141 | 1141 | """ |
|
1142 | 1142 | if p0 == 2: |
|
1143 | 1143 | self.specOpComHeights.setEnabled(True) |
|
1144 | 1144 | self.specOpHeights.setEnabled(True) |
|
1145 | 1145 | if p0 == 0: |
|
1146 | 1146 | self.specOpComHeights.setEnabled(False) |
|
1147 | 1147 | self.specOpHeights.setEnabled(False) |
|
1148 | 1148 | |
|
1149 | 1149 | |
|
1150 | 1150 | @pyqtSignature("int") |
|
1151 | 1151 | def on_specOpCebIncoherent_stateChanged(self, p0): |
|
1152 | 1152 | """ |
|
1153 | 1153 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . |
|
1154 | 1154 | """ |
|
1155 | 1155 | if p0 == 2: |
|
1156 | 1156 | self.specOpIncoherent.setEnabled(True) |
|
1157 | 1157 | if p0 == 0: |
|
1158 | 1158 | self.specOpIncoherent.setEnabled(False) |
|
1159 | 1159 | |
|
1160 | 1160 | @pyqtSignature("int") |
|
1161 | 1161 | def on_specOpCebRemoveDC_stateChanged(self, p0): |
|
1162 | 1162 | """ |
|
1163 | 1163 | Habilita la opcion de aοΏ½adir el parοΏ½metro remover DC a la Unidad de Procesamiento . |
|
1164 | 1164 | """ |
|
1165 | 1165 | if p0 == 2: |
|
1166 | 1166 | self.specOpComRemoveDC.setEnabled(True) |
|
1167 | 1167 | if p0 == 0: |
|
1168 | 1168 | self.specOpComRemoveDC.setEnabled(False) |
|
1169 | 1169 | |
|
1170 | 1170 | @pyqtSignature("int") |
|
1171 | 1171 | def on_specOpCebgetNoise_stateChanged(self, p0): |
|
1172 | 1172 | """ |
|
1173 | 1173 | Habilita la opcion de aοΏ½adir la estimacion de ruido a la Unidad de Procesamiento . |
|
1174 | 1174 | """ |
|
1175 | 1175 | if p0 == 2: |
|
1176 | 1176 | self.specOpgetNoise.setEnabled(True) |
|
1177 | 1177 | |
|
1178 | 1178 | if p0 == 0: |
|
1179 | 1179 | self.specOpgetNoise.setEnabled(False) |
|
1180 | 1180 | |
|
1181 | 1181 | @pyqtSignature("") |
|
1182 | 1182 | def on_specOpOk_clicked(self): |
|
1183 | 1183 | """ |
|
1184 | 1184 | AΓADE OPERACION SPECTRA |
|
1185 | 1185 | """ |
|
1186 | 1186 | |
|
1187 | 1187 | addFTP = False |
|
1188 | 1188 | checkPath = False |
|
1189 | 1189 | |
|
1190 | 1190 | self.actionSaveToolbar.setEnabled(False) |
|
1191 | 1191 | self.actionStarToolbar.setEnabled(False) |
|
1192 | 1192 | |
|
1193 | 1193 | self.actionSave.setEnabled(False) |
|
1194 | 1194 | self.actionStart.setEnabled(False) |
|
1195 | 1195 | |
|
1196 | 1196 | self.console.clear() |
|
1197 | 1197 | self.console.append("Checking input parameters ...") |
|
1198 | 1198 | |
|
1199 | 1199 | projectObj = self.getSelectedProjectObj() |
|
1200 | 1200 | |
|
1201 | 1201 | if not projectObj: |
|
1202 | 1202 | self.console.append("Please select a project before update it") |
|
1203 | 1203 | return |
|
1204 | 1204 | |
|
1205 | 1205 | puObj = self.getSelectedItemObj() |
|
1206 | 1206 | |
|
1207 | 1207 | puObj.removeOperations() |
|
1208 | 1208 | |
|
1209 | 1209 | if self.specOpCebRadarfrequency.isChecked(): |
|
1210 | 1210 | value = str(self.specOpRadarfrequency.text()) |
|
1211 | 1211 | format = 'float' |
|
1212 | 1212 | name_operation = 'setRadarFrequency' |
|
1213 | 1213 | name_parameter = 'frequency' |
|
1214 | 1214 | |
|
1215 | 1215 | if not isFloat(value): |
|
1216 | 1216 | self.console.clear() |
|
1217 | 1217 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
1218 | 1218 | return 0 |
|
1219 | 1219 | |
|
1220 | 1220 | radarfreq = float(value)*1e6 |
|
1221 | 1221 | opObj = puObj.addOperation(name=name_operation) |
|
1222 | 1222 | opObj.addParameter(name=name_parameter, value=radarfreq, format=format) |
|
1223 | 1223 | |
|
1224 | 1224 | inputId = puObj.getInputId() |
|
1225 | 1225 | inputPuObj = projectObj.getProcUnitObj(inputId) |
|
1226 | 1226 | |
|
1227 | 1227 | if inputPuObj.datatype == 'Voltage' or inputPuObj.datatype == 'USRP': |
|
1228 | 1228 | |
|
1229 | 1229 | value = str(self.specOpnFFTpoints.text()) |
|
1230 | 1230 | |
|
1231 | 1231 | if not isInt(value): |
|
1232 | 1232 | self.console.append("Invalid value '%s' for '%s'" %(value, 'nFFTPoints')) |
|
1233 | 1233 | return 0 |
|
1234 | 1234 | |
|
1235 | 1235 | puObj.addParameter(name='nFFTPoints', value=value, format='int') |
|
1236 | 1236 | |
|
1237 | 1237 | value = str(self.specOpProfiles.text()) |
|
1238 | 1238 | if not isInt(value): |
|
1239 | 1239 | self.console.append("Please write a value on Profiles field") |
|
1240 | 1240 | else: |
|
1241 | 1241 | puObj.addParameter(name='nProfiles', value=value, format='int') |
|
1242 | 1242 | |
|
1243 | 1243 | value = str(self.specOpippFactor.text()) |
|
1244 | 1244 | if not isInt(value): |
|
1245 | 1245 | self.console.append("Please write a value on IppFactor field") |
|
1246 | 1246 | else: |
|
1247 | 1247 | puObj.addParameter(name='ippFactor' , value=value , format='int') |
|
1248 | 1248 | |
|
1249 | 1249 | if self.specOpCebCrossSpectra.isChecked(): |
|
1250 | 1250 | name_parameter = 'pairsList' |
|
1251 | 1251 | format = 'pairslist' |
|
1252 | 1252 | value = str(self.specOppairsList.text()) |
|
1253 | 1253 | |
|
1254 | 1254 | if value == "": |
|
1255 | 1255 | print "Please fill the pairs list field" |
|
1256 | 1256 | return 0 |
|
1257 | 1257 | |
|
1258 | 1258 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
1259 | 1259 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) |
|
1260 | 1260 | return 0 |
|
1261 | 1261 | |
|
1262 | 1262 | if self.specOpCebHeights.isChecked(): |
|
1263 | 1263 | value = str(self.specOpHeights.text()) |
|
1264 | 1264 | |
|
1265 | 1265 | if value == "": |
|
1266 | 1266 | self.console.append("Empty value for '%s'" %(value, "Height range")) |
|
1267 | 1267 | return 0 |
|
1268 | 1268 | |
|
1269 | 1269 | valueList = value.split(',') |
|
1270 | 1270 | format = 'float' |
|
1271 | 1271 | value0 = valueList[0] |
|
1272 | 1272 | value1 = valueList[1] |
|
1273 | 1273 | |
|
1274 | 1274 | if not isFloat(value0) or not isFloat(value1): |
|
1275 | 1275 | self.console.append("Invalid value '%s' for '%s'" %(value, "Height range")) |
|
1276 | 1276 | return 0 |
|
1277 | 1277 | |
|
1278 | 1278 | if self.specOpComHeights.currentIndex() == 0: |
|
1279 | 1279 | name_operation = 'selectHeights' |
|
1280 | 1280 | name_parameter1 = 'minHei' |
|
1281 | 1281 | name_parameter2 = 'maxHei' |
|
1282 | 1282 | else: |
|
1283 | 1283 | name_operation = 'selectHeightsByIndex' |
|
1284 | 1284 | name_parameter1 = 'minIndex' |
|
1285 | 1285 | name_parameter2 = 'maxIndex' |
|
1286 | 1286 | |
|
1287 | 1287 | opObj = puObj.addOperation(name=name_operation) |
|
1288 | 1288 | opObj.addParameter(name=name_parameter1, value=value0, format=format) |
|
1289 | 1289 | opObj.addParameter(name=name_parameter2, value=value1, format=format) |
|
1290 | 1290 | |
|
1291 | 1291 | if self.specOpCebChannel.isChecked(): |
|
1292 | 1292 | |
|
1293 | 1293 | if self.specOpComChannel.currentIndex() == 0: |
|
1294 | 1294 | name_operation = "selectChannels" |
|
1295 | 1295 | name_parameter = 'channelList' |
|
1296 | 1296 | else: |
|
1297 | 1297 | name_operation = "selectChannelsByIndex" |
|
1298 | 1298 | name_parameter = 'channelIndexList' |
|
1299 | 1299 | |
|
1300 | 1300 | format = 'intlist' |
|
1301 | 1301 | value = str(self.specOpChannel.text()) |
|
1302 | 1302 | |
|
1303 | 1303 | if value == "": |
|
1304 | 1304 | print "Please fill channel list" |
|
1305 | 1305 | return 0 |
|
1306 | 1306 | |
|
1307 | 1307 | if not isList(value): |
|
1308 | 1308 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
1309 | 1309 | return 0 |
|
1310 | 1310 | |
|
1311 | 1311 | opObj = puObj.addOperation(name=name_operation) |
|
1312 | 1312 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1313 | 1313 | |
|
1314 | 1314 | if self.specOpCebIncoherent.isChecked(): |
|
1315 | 1315 | |
|
1316 | 1316 | name_operation = 'IncohInt' |
|
1317 | 1317 | optype = 'other' |
|
1318 | 1318 | |
|
1319 | 1319 | if self.specOpCobIncInt.currentIndex() == 0: |
|
1320 | 1320 | name_parameter = 'timeInterval' |
|
1321 | 1321 | format = 'float' |
|
1322 | 1322 | else: |
|
1323 | 1323 | name_parameter = 'n' |
|
1324 | 1324 | format = 'int' |
|
1325 | 1325 | |
|
1326 | 1326 | value = str(self.specOpIncoherent.text()) |
|
1327 | 1327 | |
|
1328 | 1328 | if value == "": |
|
1329 | 1329 | print "Please fill Incoherent integration value" |
|
1330 | 1330 | return 0 |
|
1331 | 1331 | |
|
1332 | 1332 | if not isFloat(value): |
|
1333 | 1333 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
1334 | 1334 | return 0 |
|
1335 | 1335 | |
|
1336 | 1336 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1337 | 1337 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1338 | 1338 | |
|
1339 | 1339 | if self.specOpCebRemoveDC.isChecked(): |
|
1340 | 1340 | name_operation = 'removeDC' |
|
1341 | 1341 | name_parameter = 'mode' |
|
1342 | 1342 | format = 'int' |
|
1343 | 1343 | if self.specOpComRemoveDC.currentIndex() == 0: |
|
1344 | 1344 | value = 1 |
|
1345 | 1345 | else: |
|
1346 | 1346 | value = 2 |
|
1347 | 1347 | opObj = puObj.addOperation(name=name_operation) |
|
1348 | 1348 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1349 | 1349 | |
|
1350 | 1350 | if self.specOpCebRemoveInt.isChecked(): |
|
1351 | 1351 | name_operation = 'removeInterference' |
|
1352 | 1352 | opObj = puObj.addOperation(name=name_operation) |
|
1353 | 1353 | |
|
1354 | 1354 | |
|
1355 | 1355 | if self.specOpCebgetNoise.isChecked(): |
|
1356 | 1356 | value = str(self.specOpgetNoise.text()) |
|
1357 | 1357 | valueList = value.split(',') |
|
1358 | 1358 | format = 'float' |
|
1359 | 1359 | name_operation = "getNoise" |
|
1360 | 1360 | opObj = puObj.addOperation(name=name_operation) |
|
1361 | 1361 | |
|
1362 | 1362 | if not value == '': |
|
1363 | 1363 | valueList = value.split(',') |
|
1364 | 1364 | length = len(valueList) |
|
1365 | 1365 | if length == 1: |
|
1366 | 1366 | try: |
|
1367 | 1367 | value1 = float(valueList[0]) |
|
1368 | 1368 | except: |
|
1369 | 1369 | self.console.clear() |
|
1370 | 1370 | self.console.append("Please Write correct parameter Get Noise") |
|
1371 | 1371 | return 0 |
|
1372 | 1372 | name1 = 'minHei' |
|
1373 | 1373 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1374 | 1374 | elif length == 2: |
|
1375 | 1375 | try: |
|
1376 | 1376 | value1 = float(valueList[0]) |
|
1377 | 1377 | value2 = float(valueList[1]) |
|
1378 | 1378 | except: |
|
1379 | 1379 | self.console.clear() |
|
1380 | 1380 | self.console.append("Please Write corrects parameter Get Noise") |
|
1381 | 1381 | return 0 |
|
1382 | 1382 | name1 = 'minHei' |
|
1383 | 1383 | name2 = 'maxHei' |
|
1384 | 1384 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1385 | 1385 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1386 | 1386 | |
|
1387 | 1387 | elif length == 3: |
|
1388 | 1388 | try: |
|
1389 | 1389 | value1 = float(valueList[0]) |
|
1390 | 1390 | value2 = float(valueList[1]) |
|
1391 | 1391 | value3 = float(valueList[2]) |
|
1392 | 1392 | except: |
|
1393 | 1393 | self.console.clear() |
|
1394 | 1394 | self.console.append("Please Write corrects parameter Get Noise") |
|
1395 | 1395 | return 0 |
|
1396 | 1396 | name1 = 'minHei' |
|
1397 | 1397 | name2 = 'maxHei' |
|
1398 | 1398 | name3 = 'minVel' |
|
1399 | 1399 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1400 | 1400 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1401 | 1401 | opObj.addParameter(name=name3, value=value3, format=format) |
|
1402 | 1402 | |
|
1403 | 1403 | elif length == 4: |
|
1404 | 1404 | try: |
|
1405 | 1405 | value1 = float(valueList[0]) |
|
1406 | 1406 | value2 = float(valueList[1]) |
|
1407 | 1407 | value3 = float(valueList[2]) |
|
1408 | 1408 | value4 = float(valueList[3]) |
|
1409 | 1409 | except: |
|
1410 | 1410 | self.console.clear() |
|
1411 | 1411 | self.console.append("Please Write corrects parameter Get Noise") |
|
1412 | 1412 | return 0 |
|
1413 | 1413 | name1 = 'minHei' |
|
1414 | 1414 | name2 = 'maxHei' |
|
1415 | 1415 | name3 = 'minVel' |
|
1416 | 1416 | name4 = 'maxVel' |
|
1417 | 1417 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1418 | 1418 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1419 | 1419 | opObj.addParameter(name=name3, value=value3, format=format) |
|
1420 | 1420 | opObj.addParameter(name=name4, value=value4, format=format) |
|
1421 | 1421 | |
|
1422 | 1422 | elif length > 4: |
|
1423 | 1423 | self.console.clear() |
|
1424 | 1424 | self.console.append("Get Noise Operation only accepts 4 parameters") |
|
1425 | 1425 | return 0 |
|
1426 | 1426 | |
|
1427 | 1427 | channelList = str(self.specGgraphChannelList.text()).replace(" ","") |
|
1428 | 1428 | vel_range = str(self.specGgraphFreq.text()).replace(" ","") |
|
1429 | 1429 | hei_range = str(self.specGgraphHeight.text()).replace(" ","") |
|
1430 | 1430 | db_range = str(self.specGgraphDbsrange.text()).replace(" ","") |
|
1431 | 1431 | |
|
1432 | 1432 | trange = str(self.specGgraphTminTmax.text()).replace(" ","") |
|
1433 | 1433 | magrange = str(self.specGgraphmagnitud.text()).replace(" ","") |
|
1434 | 1434 | phaserange = str(self.specGgraphPhase.text()).replace(" ","") |
|
1435 | 1435 | # timerange = str(self.specGgraphTimeRange.text()).replace(" ","") |
|
1436 | 1436 | |
|
1437 | 1437 | figpath = str(self.specGraphPath.text()) |
|
1438 | 1438 | figfile = str(self.specGraphPrefix.text()).replace(" ","") |
|
1439 | 1439 | try: |
|
1440 | 1440 | wrperiod = int(str(self.specGgraphftpratio.text()).replace(" ","")) |
|
1441 | 1441 | except: |
|
1442 | 1442 | wrperiod = None |
|
1443 | 1443 | |
|
1444 | 1444 | #-----Spectra Plot----- |
|
1445 | 1445 | if self.specGraphCebSpectraplot.isChecked(): |
|
1446 | 1446 | |
|
1447 | 1447 | opObj = puObj.addOperation(name='SpectraPlot', optype='other') |
|
1448 | 1448 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1449 | 1449 | |
|
1450 | 1450 | if not channelList == '': |
|
1451 | 1451 | |
|
1452 | 1452 | if not isList(channelList): |
|
1453 | 1453 | self.console.append("Invalid channelList") |
|
1454 | 1454 | return 0 |
|
1455 | 1455 | |
|
1456 | 1456 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1457 | 1457 | |
|
1458 | 1458 | if not vel_range == '': |
|
1459 | 1459 | xvalueList = vel_range.split(',') |
|
1460 | 1460 | try: |
|
1461 | 1461 | value1 = float(xvalueList[0]) |
|
1462 | 1462 | value2 = float(xvalueList[1]) |
|
1463 | 1463 | except: |
|
1464 | 1464 | self.console.clear() |
|
1465 | 1465 | self.console.append("Invalid velocity/frequency range") |
|
1466 | 1466 | return 0 |
|
1467 | 1467 | |
|
1468 | 1468 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1469 | 1469 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1470 | 1470 | |
|
1471 | 1471 | if not hei_range == '': |
|
1472 | 1472 | yvalueList = hei_range.split(",") |
|
1473 | 1473 | try: |
|
1474 | 1474 | value1 = float(yvalueList[0]) |
|
1475 | 1475 | value2 = float(yvalueList[1]) |
|
1476 | 1476 | except: |
|
1477 | 1477 | self.console.clear() |
|
1478 | 1478 | self.console.append("Invalid height range") |
|
1479 | 1479 | return 0 |
|
1480 | 1480 | |
|
1481 | 1481 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1482 | 1482 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1483 | 1483 | |
|
1484 | 1484 | if not db_range == '': |
|
1485 | 1485 | zvalueList = db_range.split(",") |
|
1486 | 1486 | try: |
|
1487 | 1487 | value1 = float(zvalueList[0]) |
|
1488 | 1488 | value2 = float(zvalueList[1]) |
|
1489 | 1489 | except: |
|
1490 | 1490 | self.console.clear() |
|
1491 | 1491 | self.console.append("Invalid db range") |
|
1492 | 1492 | return 0 |
|
1493 | 1493 | |
|
1494 | 1494 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1495 | 1495 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1496 | 1496 | |
|
1497 | 1497 | if self.specGraphSaveSpectra.isChecked(): |
|
1498 | 1498 | checkPath = True |
|
1499 | 1499 | opObj.addParameter(name='save', value=1 , format='bool') |
|
1500 | 1500 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1501 | 1501 | if figfile: |
|
1502 | 1502 | opObj.addParameter(name='figfile', value=figfile, format='str') |
|
1503 | 1503 | if wrperiod: |
|
1504 | 1504 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1505 | 1505 | |
|
1506 | 1506 | if self.specGraphftpSpectra.isChecked(): |
|
1507 | 1507 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1508 | 1508 | self.addFTPConf2Operation(puObj, opObj) |
|
1509 | 1509 | addFTP = True |
|
1510 | 1510 | |
|
1511 | 1511 | if self.specGraphCebCrossSpectraplot.isChecked(): |
|
1512 | 1512 | |
|
1513 | 1513 | opObj = puObj.addOperation(name='CrossSpectraPlot', optype='other') |
|
1514 | 1514 | # opObj.addParameter(name='power_cmap', value='jet', format='str') |
|
1515 | 1515 | # opObj.addParameter(name='coherence_cmap', value='jet', format='str') |
|
1516 | 1516 | # opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') |
|
1517 | 1517 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1518 | 1518 | |
|
1519 | 1519 | if not vel_range == '': |
|
1520 | 1520 | xvalueList = vel_range.split(',') |
|
1521 | 1521 | try: |
|
1522 | 1522 | value1 = float(xvalueList[0]) |
|
1523 | 1523 | value2 = float(xvalueList[1]) |
|
1524 | 1524 | except: |
|
1525 | 1525 | self.console.clear() |
|
1526 | 1526 | self.console.append("Invalid velocity/frequency range") |
|
1527 | 1527 | return 0 |
|
1528 | 1528 | |
|
1529 | 1529 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1530 | 1530 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1531 | 1531 | |
|
1532 | 1532 | if not hei_range == '': |
|
1533 | 1533 | yvalueList = hei_range.split(",") |
|
1534 | 1534 | try: |
|
1535 | 1535 | value1 = float(yvalueList[0]) |
|
1536 | 1536 | value2 = float(yvalueList[1]) |
|
1537 | 1537 | except: |
|
1538 | 1538 | self.console.clear() |
|
1539 | 1539 | self.console.append("Invalid height range") |
|
1540 | 1540 | return 0 |
|
1541 | 1541 | |
|
1542 | 1542 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1543 | 1543 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1544 | 1544 | |
|
1545 | 1545 | if not db_range == '': |
|
1546 | 1546 | zvalueList = db_range.split(",") |
|
1547 | 1547 | try: |
|
1548 | 1548 | value1 = float(zvalueList[0]) |
|
1549 | 1549 | value2 = float(zvalueList[1]) |
|
1550 | 1550 | except: |
|
1551 | 1551 | self.console.clear() |
|
1552 | 1552 | self.console.append("Invalid db range") |
|
1553 | 1553 | return 0 |
|
1554 | 1554 | |
|
1555 | 1555 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1556 | 1556 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1557 | 1557 | |
|
1558 | 1558 | if not magrange == '': |
|
1559 | 1559 | zvalueList = magrange.split(",") |
|
1560 | 1560 | try: |
|
1561 | 1561 | value1 = float(zvalueList[0]) |
|
1562 | 1562 | value2 = float(zvalueList[1]) |
|
1563 | 1563 | except: |
|
1564 | 1564 | self.console.clear() |
|
1565 | 1565 | self.console.append("Invalid magnitude range") |
|
1566 | 1566 | return 0 |
|
1567 | 1567 | |
|
1568 | 1568 | opObj.addParameter(name='coh_min', value=value1, format='float') |
|
1569 | 1569 | opObj.addParameter(name='coh_max', value=value2, format='float') |
|
1570 | 1570 | |
|
1571 | 1571 | if not phaserange == '': |
|
1572 | 1572 | zvalueList = phaserange.split(",") |
|
1573 | 1573 | try: |
|
1574 | 1574 | value1 = float(zvalueList[0]) |
|
1575 | 1575 | value2 = float(zvalueList[1]) |
|
1576 | 1576 | except: |
|
1577 | 1577 | self.console.clear() |
|
1578 | 1578 | self.console.append("Invalid phase range") |
|
1579 | 1579 | return 0 |
|
1580 | 1580 | |
|
1581 | 1581 | opObj.addParameter(name='phase_min', value=value1, format='float') |
|
1582 | 1582 | opObj.addParameter(name='phase_max', value=value2, format='float') |
|
1583 | 1583 | |
|
1584 | 1584 | if self.specGraphSaveCross.isChecked(): |
|
1585 | 1585 | checkPath = True |
|
1586 | 1586 | opObj.addParameter(name='save', value='1', format='bool') |
|
1587 | 1587 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1588 | 1588 | if figfile: |
|
1589 | 1589 | opObj.addParameter(name='figfile', value=figfile, format='str') |
|
1590 | 1590 | if wrperiod: |
|
1591 | 1591 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1592 | 1592 | |
|
1593 | 1593 | if self.specGraphftpCross.isChecked(): |
|
1594 | 1594 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1595 | 1595 | self.addFTPConf2Operation(puObj, opObj) |
|
1596 | 1596 | addFTP = True |
|
1597 | 1597 | |
|
1598 | 1598 | if self.specGraphCebRTIplot.isChecked(): |
|
1599 | 1599 | |
|
1600 | 1600 | opObj = puObj.addOperation(name='RTIPlot', optype='other') |
|
1601 | 1601 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1602 | 1602 | |
|
1603 | 1603 | if not channelList == '': |
|
1604 | 1604 | if not isList(channelList): |
|
1605 | 1605 | self.console.append("Invalid channelList") |
|
1606 | 1606 | return 0 |
|
1607 | 1607 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1608 | 1608 | |
|
1609 | 1609 | if not trange == '': |
|
1610 | 1610 | xvalueList = trange.split(',') |
|
1611 | 1611 | try: |
|
1612 | 1612 | value1 = float(xvalueList[0]) |
|
1613 | 1613 | value2 = float(xvalueList[1]) |
|
1614 | 1614 | except: |
|
1615 | 1615 | self.console.clear() |
|
1616 | 1616 | self.console.append("Invalid time range") |
|
1617 | 1617 | return 0 |
|
1618 | 1618 | |
|
1619 | 1619 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1620 | 1620 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1621 | 1621 | |
|
1622 | 1622 | # if not timerange == '': |
|
1623 | 1623 | # try: |
|
1624 | 1624 | # timerange = float(timerange) |
|
1625 | 1625 | # except: |
|
1626 | 1626 | # self.console.clear() |
|
1627 | 1627 | # self.console.append("Invalid time range") |
|
1628 | 1628 | # return 0 |
|
1629 | 1629 | # |
|
1630 | 1630 | # opObj.addParameter(name='timerange', value=timerange, format='float') |
|
1631 | 1631 | |
|
1632 | 1632 | if not hei_range == '': |
|
1633 | 1633 | yvalueList = hei_range.split(",") |
|
1634 | 1634 | try: |
|
1635 | 1635 | value1 = float(yvalueList[0]) |
|
1636 | 1636 | value2 = float(yvalueList[1]) |
|
1637 | 1637 | except: |
|
1638 | 1638 | self.console.clear() |
|
1639 | 1639 | self.console.append("Invalid height range") |
|
1640 | 1640 | return 0 |
|
1641 | 1641 | |
|
1642 | 1642 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1643 | 1643 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1644 | 1644 | |
|
1645 | 1645 | if not db_range == '': |
|
1646 | 1646 | zvalueList = db_range.split(",") |
|
1647 | 1647 | try: |
|
1648 | 1648 | value1 = float(zvalueList[0]) |
|
1649 | 1649 | value2 = float(zvalueList[1]) |
|
1650 | 1650 | except: |
|
1651 | 1651 | self.console.clear() |
|
1652 | 1652 | self.console.append("Invalid db range") |
|
1653 | 1653 | return 0 |
|
1654 | 1654 | |
|
1655 | 1655 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1656 | 1656 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1657 | 1657 | |
|
1658 | 1658 | if self.specGraphSaveRTIplot.isChecked(): |
|
1659 | 1659 | checkPath = True |
|
1660 | 1660 | opObj.addParameter(name='save', value='1', format='bool') |
|
1661 | 1661 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1662 | 1662 | if figfile: |
|
1663 | 1663 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1664 | 1664 | if wrperiod: |
|
1665 | 1665 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1666 | 1666 | |
|
1667 | 1667 | if self.specGraphftpRTIplot.isChecked(): |
|
1668 | 1668 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1669 | 1669 | self.addFTPConf2Operation(puObj, opObj) |
|
1670 | 1670 | addFTP = True |
|
1671 | 1671 | |
|
1672 | 1672 | if self.specGraphCebCoherencmap.isChecked(): |
|
1673 | 1673 | |
|
1674 | 1674 | opObj = puObj.addOperation(name='CoherenceMap', optype='other') |
|
1675 | 1675 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1676 | 1676 | # opObj.addParameter(name='coherence_cmap', value='jet', format='str') |
|
1677 | 1677 | # opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') |
|
1678 | 1678 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1679 | 1679 | |
|
1680 | 1680 | # if not timerange == '': |
|
1681 | 1681 | # try: |
|
1682 | 1682 | # timerange = int(timerange) |
|
1683 | 1683 | # except: |
|
1684 | 1684 | # self.console.clear() |
|
1685 | 1685 | # self.console.append("Invalid time range") |
|
1686 | 1686 | # return 0 |
|
1687 | 1687 | # |
|
1688 | 1688 | # opObj.addParameter(name='timerange', value=timerange, format='int') |
|
1689 | 1689 | |
|
1690 | 1690 | if not trange == '': |
|
1691 | 1691 | xvalueList = trange.split(',') |
|
1692 | 1692 | try: |
|
1693 | 1693 | value1 = float(xvalueList[0]) |
|
1694 | 1694 | value2 = float(xvalueList[1]) |
|
1695 | 1695 | except: |
|
1696 | 1696 | self.console.clear() |
|
1697 | 1697 | self.console.append("Invalid time range") |
|
1698 | 1698 | return 0 |
|
1699 | 1699 | |
|
1700 | 1700 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1701 | 1701 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1702 | 1702 | |
|
1703 | 1703 | if not hei_range == '': |
|
1704 | 1704 | yvalueList = hei_range.split(",") |
|
1705 | 1705 | try: |
|
1706 | 1706 | value1 = float(yvalueList[0]) |
|
1707 | 1707 | value2 = float(yvalueList[1]) |
|
1708 | 1708 | except: |
|
1709 | 1709 | self.console.clear() |
|
1710 | 1710 | self.console.append("Invalid height range") |
|
1711 | 1711 | return 0 |
|
1712 | 1712 | |
|
1713 | 1713 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1714 | 1714 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1715 | 1715 | |
|
1716 | 1716 | if not magrange == '': |
|
1717 | 1717 | zvalueList = magrange.split(",") |
|
1718 | 1718 | try: |
|
1719 | 1719 | value1 = float(zvalueList[0]) |
|
1720 | 1720 | value2 = float(zvalueList[1]) |
|
1721 | 1721 | except: |
|
1722 | 1722 | self.console.clear() |
|
1723 | 1723 | self.console.append("Invalid magnitude range") |
|
1724 | 1724 | return 0 |
|
1725 | 1725 | |
|
1726 | 1726 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1727 | 1727 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1728 | 1728 | |
|
1729 | 1729 | if not phaserange == '': |
|
1730 | 1730 | zvalueList = phaserange.split(",") |
|
1731 | 1731 | try: |
|
1732 | 1732 | value1 = float(zvalueList[0]) |
|
1733 | 1733 | value2 = float(zvalueList[1]) |
|
1734 | 1734 | except: |
|
1735 | 1735 | self.console.clear() |
|
1736 | 1736 | self.console.append("Invalid phase range") |
|
1737 | 1737 | return 0 |
|
1738 | 1738 | |
|
1739 | 1739 | opObj.addParameter(name='phase_min', value=value1, format='float') |
|
1740 | 1740 | opObj.addParameter(name='phase_max', value=value2, format='float') |
|
1741 | 1741 | |
|
1742 | 1742 | if self.specGraphSaveCoherencemap.isChecked(): |
|
1743 | 1743 | checkPath = True |
|
1744 | 1744 | opObj.addParameter(name='save', value='1', format='bool') |
|
1745 | 1745 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1746 | 1746 | if figfile: |
|
1747 | 1747 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1748 | 1748 | if wrperiod: |
|
1749 | 1749 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1750 | 1750 | |
|
1751 | 1751 | if self.specGraphftpCoherencemap.isChecked(): |
|
1752 | 1752 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1753 | 1753 | self.addFTPConf2Operation(puObj, opObj) |
|
1754 | 1754 | addFTP = True |
|
1755 | 1755 | |
|
1756 | 1756 | if self.specGraphPowerprofile.isChecked(): |
|
1757 | 1757 | |
|
1758 | 1758 | opObj = puObj.addOperation(name='PowerProfilePlot', optype='other') |
|
1759 | 1759 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1760 | 1760 | |
|
1761 | 1761 | if not channelList == '': |
|
1762 | 1762 | if not isList(channelList): |
|
1763 | 1763 | self.console.append("Invalid channelList") |
|
1764 | 1764 | return 0 |
|
1765 | 1765 | |
|
1766 | 1766 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1767 | 1767 | |
|
1768 | 1768 | if not db_range == '': |
|
1769 | 1769 | xvalueList = db_range.split(',') |
|
1770 | 1770 | try: |
|
1771 | 1771 | value1 = float(xvalueList[0]) |
|
1772 | 1772 | value2 = float(xvalueList[1]) |
|
1773 | 1773 | except: |
|
1774 | 1774 | self.console.clear() |
|
1775 | 1775 | self.console.append("Invalid db range") |
|
1776 | 1776 | return 0 |
|
1777 | 1777 | |
|
1778 | 1778 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1779 | 1779 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1780 | 1780 | |
|
1781 | 1781 | if not hei_range == '': |
|
1782 | 1782 | yvalueList = hei_range.split(",") |
|
1783 | 1783 | try: |
|
1784 | 1784 | value1 = float(yvalueList[0]) |
|
1785 | 1785 | value2 = float(yvalueList[1]) |
|
1786 | 1786 | except: |
|
1787 | 1787 | self.console.clear() |
|
1788 | 1788 | self.console.append("Invalid height range") |
|
1789 | 1789 | return 0 |
|
1790 | 1790 | |
|
1791 | 1791 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1792 | 1792 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1793 | 1793 | |
|
1794 | 1794 | if self.specGraphSavePowerprofile.isChecked(): |
|
1795 | 1795 | checkPath = True |
|
1796 | 1796 | opObj.addParameter(name='save', value='1', format='bool') |
|
1797 | 1797 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1798 | 1798 | if figfile: |
|
1799 | 1799 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1800 | 1800 | if wrperiod: |
|
1801 | 1801 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1802 | 1802 | |
|
1803 | 1803 | if self.specGraphftpPowerprofile.isChecked(): |
|
1804 | 1804 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1805 | 1805 | self.addFTPConf2Operation(puObj, opObj) |
|
1806 | 1806 | addFTP = True |
|
1807 | 1807 | # rti noise |
|
1808 | 1808 | |
|
1809 | 1809 | if self.specGraphCebRTInoise.isChecked(): |
|
1810 | 1810 | |
|
1811 | 1811 | opObj = puObj.addOperation(name='Noise', optype='other') |
|
1812 | 1812 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1813 | 1813 | |
|
1814 | 1814 | if not channelList == '': |
|
1815 | 1815 | if not isList(channelList): |
|
1816 | 1816 | self.console.append("Invalid channelList") |
|
1817 | 1817 | return 0 |
|
1818 | 1818 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1819 | 1819 | |
|
1820 | 1820 | # if not timerange == '': |
|
1821 | 1821 | # try: |
|
1822 | 1822 | # timerange = float(timerange) |
|
1823 | 1823 | # except: |
|
1824 | 1824 | # self.console.clear() |
|
1825 | 1825 | # self.console.append("Invalid time range") |
|
1826 | 1826 | # return 0 |
|
1827 | 1827 | # |
|
1828 | 1828 | # opObj.addParameter(name='timerange', value=timerange, format='float') |
|
1829 | 1829 | |
|
1830 | 1830 | if not trange == '': |
|
1831 | 1831 | xvalueList = trange.split(',') |
|
1832 | 1832 | try: |
|
1833 | 1833 | value1 = float(xvalueList[0]) |
|
1834 | 1834 | value2 = float(xvalueList[1]) |
|
1835 | 1835 | except: |
|
1836 | 1836 | self.console.clear() |
|
1837 | 1837 | self.console.append("Invalid time range") |
|
1838 | 1838 | return 0 |
|
1839 | 1839 | |
|
1840 | 1840 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1841 | 1841 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1842 | 1842 | |
|
1843 | 1843 | if not db_range == '': |
|
1844 | 1844 | yvalueList = db_range.split(",") |
|
1845 | 1845 | try: |
|
1846 | 1846 | value1 = float(yvalueList[0]) |
|
1847 | 1847 | value2 = float(yvalueList[1]) |
|
1848 | 1848 | except: |
|
1849 | 1849 | self.console.clear() |
|
1850 | 1850 | self.console.append("Invalid db range") |
|
1851 | 1851 | return 0 |
|
1852 | 1852 | |
|
1853 | 1853 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1854 | 1854 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1855 | 1855 | |
|
1856 | 1856 | if self.specGraphSaveRTInoise.isChecked(): |
|
1857 | 1857 | checkPath = True |
|
1858 | 1858 | opObj.addParameter(name='save', value='1', format='bool') |
|
1859 | 1859 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1860 | 1860 | if figfile: |
|
1861 | 1861 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1862 | 1862 | if wrperiod: |
|
1863 | 1863 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1864 | 1864 | |
|
1865 | 1865 | # test_ftp |
|
1866 | 1866 | if self.specGraphftpRTInoise.isChecked(): |
|
1867 | 1867 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1868 | 1868 | self.addFTPConf2Operation(puObj, opObj) |
|
1869 | 1869 | addFTP = True |
|
1870 | 1870 | |
|
1871 | 1871 | if checkPath: |
|
1872 | 1872 | if not figpath: |
|
1873 | 1873 | self.console.clear() |
|
1874 | 1874 | self.console.append("Graphic path should be defined") |
|
1875 | 1875 | return 0 |
|
1876 | 1876 | |
|
1877 | 1877 | if addFTP and not figpath: |
|
1878 | 1878 | self.console.clear() |
|
1879 | 1879 | self.console.append("You have to save the plots before sending them to FTP Server") |
|
1880 | 1880 | return 0 |
|
1881 | 1881 | |
|
1882 | 1882 | # if something happend |
|
1883 | 1883 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Spectra') |
|
1884 | 1884 | if parms_ok: |
|
1885 | 1885 | opObj = puObj.addOperation(name='SpectraWriter', optype='other') |
|
1886 | 1886 | opObj.addParameter(name='path', value=output_path) |
|
1887 | 1887 | opObj.addParameter(name='blocksPerFile', value=blocksperfile, format='int') |
|
1888 | 1888 | |
|
1889 | 1889 | self.console.clear() |
|
1890 | 1890 | try: |
|
1891 | 1891 | self.refreshPUProperties(puObj) |
|
1892 | 1892 | except: |
|
1893 | 1893 | self.console.append("An error reading input parameters was found ... Check them!") |
|
1894 | 1894 | return 0 |
|
1895 | 1895 | |
|
1896 | 1896 | self.console.append("Save your project and press Play button to start signal processing") |
|
1897 | 1897 | |
|
1898 | 1898 | self.actionSaveToolbar.setEnabled(True) |
|
1899 | 1899 | self.actionStarToolbar.setEnabled(True) |
|
1900 | 1900 | |
|
1901 | 1901 | self.actionSave.setEnabled(True) |
|
1902 | 1902 | self.actionStart.setEnabled(True) |
|
1903 | 1903 | |
|
1904 | 1904 | return 1 |
|
1905 | 1905 | |
|
1906 | 1906 | """ |
|
1907 | 1907 | Spectra Graph |
|
1908 | 1908 | """ |
|
1909 | 1909 | @pyqtSignature("int") |
|
1910 | 1910 | def on_specGraphCebSpectraplot_stateChanged(self, p0): |
|
1911 | 1911 | |
|
1912 | 1912 | self.__checkSpecGraphFilters() |
|
1913 | 1913 | |
|
1914 | 1914 | |
|
1915 | 1915 | @pyqtSignature("int") |
|
1916 | 1916 | def on_specGraphCebCrossSpectraplot_stateChanged(self, p0): |
|
1917 | 1917 | |
|
1918 | 1918 | self.__checkSpecGraphFilters() |
|
1919 | 1919 | |
|
1920 | 1920 | @pyqtSignature("int") |
|
1921 | 1921 | def on_specGraphCebRTIplot_stateChanged(self, p0): |
|
1922 | 1922 | |
|
1923 | 1923 | self.__checkSpecGraphFilters() |
|
1924 | 1924 | |
|
1925 | 1925 | |
|
1926 | 1926 | @pyqtSignature("int") |
|
1927 | 1927 | def on_specGraphCebRTInoise_stateChanged(self, p0): |
|
1928 | 1928 | |
|
1929 | 1929 | self.__checkSpecGraphFilters() |
|
1930 | 1930 | |
|
1931 | 1931 | |
|
1932 | 1932 | @pyqtSignature("int") |
|
1933 | 1933 | def on_specGraphCebCoherencmap_stateChanged(self, p0): |
|
1934 | 1934 | |
|
1935 | 1935 | self.__checkSpecGraphFilters() |
|
1936 | 1936 | |
|
1937 | 1937 | @pyqtSignature("int") |
|
1938 | 1938 | def on_specGraphPowerprofile_stateChanged(self, p0): |
|
1939 | 1939 | |
|
1940 | 1940 | self.__checkSpecGraphFilters() |
|
1941 | 1941 | |
|
1942 | 1942 | @pyqtSignature("int") |
|
1943 | 1943 | def on_specGraphPhase_stateChanged(self, p0): |
|
1944 | 1944 | |
|
1945 | 1945 | self.__checkSpecGraphFilters() |
|
1946 | 1946 | |
|
1947 | 1947 | @pyqtSignature("int") |
|
1948 | 1948 | def on_specGraphSaveSpectra_stateChanged(self, p0): |
|
1949 | 1949 | """ |
|
1950 | 1950 | """ |
|
1951 | 1951 | self.__checkSpecGraphSaving() |
|
1952 | 1952 | |
|
1953 | 1953 | @pyqtSignature("int") |
|
1954 | 1954 | def on_specGraphSaveCross_stateChanged(self, p0): |
|
1955 | 1955 | |
|
1956 | 1956 | self.__checkSpecGraphSaving() |
|
1957 | 1957 | |
|
1958 | 1958 | @pyqtSignature("int") |
|
1959 | 1959 | def on_specGraphSaveRTIplot_stateChanged(self, p0): |
|
1960 | 1960 | |
|
1961 | 1961 | self.__checkSpecGraphSaving() |
|
1962 | 1962 | |
|
1963 | 1963 | @pyqtSignature("int") |
|
1964 | 1964 | def on_specGraphSaveRTInoise_stateChanged(self, p0): |
|
1965 | 1965 | |
|
1966 | 1966 | self.__checkSpecGraphSaving() |
|
1967 | 1967 | |
|
1968 | 1968 | @pyqtSignature("int") |
|
1969 | 1969 | def on_specGraphSaveCoherencemap_stateChanged(self, p0): |
|
1970 | 1970 | |
|
1971 | 1971 | self.__checkSpecGraphSaving() |
|
1972 | 1972 | |
|
1973 | 1973 | @pyqtSignature("int") |
|
1974 | 1974 | def on_specGraphSavePowerprofile_stateChanged(self, p0): |
|
1975 | 1975 | |
|
1976 | 1976 | self.__checkSpecGraphSaving() |
|
1977 | 1977 | |
|
1978 | 1978 | @pyqtSignature("int") |
|
1979 | 1979 | def on_specGraphftpSpectra_stateChanged(self, p0): |
|
1980 | 1980 | """ |
|
1981 | 1981 | """ |
|
1982 | 1982 | self.__checkSpecGraphFTP() |
|
1983 | 1983 | |
|
1984 | 1984 | |
|
1985 | 1985 | @pyqtSignature("int") |
|
1986 | 1986 | def on_specGraphftpCross_stateChanged(self, p0): |
|
1987 | 1987 | |
|
1988 | 1988 | self.__checkSpecGraphFTP() |
|
1989 | 1989 | |
|
1990 | 1990 | @pyqtSignature("int") |
|
1991 | 1991 | def on_specGraphftpRTIplot_stateChanged(self, p0): |
|
1992 | 1992 | |
|
1993 | 1993 | self.__checkSpecGraphFTP() |
|
1994 | 1994 | |
|
1995 | 1995 | @pyqtSignature("int") |
|
1996 | 1996 | def on_specGraphftpRTInoise_stateChanged(self, p0): |
|
1997 | 1997 | |
|
1998 | 1998 | self.__checkSpecGraphFTP() |
|
1999 | 1999 | |
|
2000 | 2000 | @pyqtSignature("int") |
|
2001 | 2001 | def on_specGraphftpCoherencemap_stateChanged(self, p0): |
|
2002 | 2002 | |
|
2003 | 2003 | self.__checkSpecGraphFTP() |
|
2004 | 2004 | |
|
2005 | 2005 | @pyqtSignature("int") |
|
2006 | 2006 | def on_specGraphftpPowerprofile_stateChanged(self, p0): |
|
2007 | 2007 | |
|
2008 | 2008 | self.__checkSpecGraphFTP() |
|
2009 | 2009 | |
|
2010 | 2010 | @pyqtSignature("") |
|
2011 | 2011 | def on_specGraphToolPath_clicked(self): |
|
2012 | 2012 | """ |
|
2013 | 2013 | """ |
|
2014 | 2014 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
2015 | 2015 | self.specGraphPath.setText(save_path) |
|
2016 | 2016 | if not os.path.exists(save_path): |
|
2017 | 2017 | self.console.clear() |
|
2018 | 2018 | self.console.append("Write a valid path") |
|
2019 | 2019 | return |
|
2020 | 2020 | |
|
2021 | 2021 | @pyqtSignature("") |
|
2022 | 2022 | def on_specGraphClear_clicked(self): |
|
2023 | 2023 | return |
|
2024 | 2024 | |
|
2025 | 2025 | @pyqtSignature("") |
|
2026 | 2026 | def on_specHeisGraphToolPath_clicked(self): |
|
2027 | 2027 | """ |
|
2028 | 2028 | """ |
|
2029 | 2029 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
2030 | 2030 | self.specHeisGraphPath.setText(save_path) |
|
2031 | 2031 | if not os.path.exists(save_path): |
|
2032 | 2032 | self.console.clear() |
|
2033 | 2033 | self.console.append("Write a valid path") |
|
2034 | 2034 | return |
|
2035 | 2035 | |
|
2036 | 2036 | @pyqtSignature("int") |
|
2037 | 2037 | def on_specHeisOpCebIncoherent_stateChanged(self, p0): |
|
2038 | 2038 | """ |
|
2039 | 2039 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . |
|
2040 | 2040 | """ |
|
2041 | 2041 | if p0 == 2: |
|
2042 | 2042 | self.specHeisOpIncoherent.setEnabled(True) |
|
2043 | 2043 | self.specHeisOpCobIncInt.setEnabled(True) |
|
2044 | 2044 | if p0 == 0: |
|
2045 | 2045 | self.specHeisOpIncoherent.setEnabled(False) |
|
2046 | 2046 | self.specHeisOpCobIncInt.setEnabled(False) |
|
2047 | 2047 | |
|
2048 | 2048 | @pyqtSignature("") |
|
2049 | 2049 | def on_specHeisOpOk_clicked(self): |
|
2050 | 2050 | """ |
|
2051 | 2051 | AΓADE OPERACION SPECTRAHEIS |
|
2052 | 2052 | """ |
|
2053 | 2053 | addFTP = False |
|
2054 | 2054 | checkPath = False |
|
2055 | 2055 | |
|
2056 | 2056 | self.actionSaveToolbar.setEnabled(False) |
|
2057 | 2057 | self.actionStarToolbar.setEnabled(False) |
|
2058 | 2058 | |
|
2059 | 2059 | self.actionSave.setEnabled(False) |
|
2060 | 2060 | self.actionStart.setEnabled(False) |
|
2061 | 2061 | |
|
2062 | 2062 | self.console.clear() |
|
2063 | 2063 | self.console.append("Checking input parameters ...") |
|
2064 | 2064 | |
|
2065 | 2065 | puObj = self.getSelectedItemObj() |
|
2066 | 2066 | puObj.removeOperations() |
|
2067 | 2067 | |
|
2068 | 2068 | if self.specHeisOpCebIncoherent.isChecked(): |
|
2069 | 2069 | value = str(self.specHeisOpIncoherent.text()) |
|
2070 | 2070 | name_operation = 'IncohInt4SpectraHeis' |
|
2071 | 2071 | optype = 'other' |
|
2072 | 2072 | |
|
2073 | 2073 | name_parameter = 'timeInterval' |
|
2074 | 2074 | format = 'float' |
|
2075 | 2075 | |
|
2076 | 2076 | if self.specOpCobIncInt.currentIndex() == 0: |
|
2077 | 2077 | name_parameter = 'timeInterval' |
|
2078 | 2078 | format = 'float' |
|
2079 | 2079 | |
|
2080 | 2080 | if not isFloat(value): |
|
2081 | 2081 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
2082 | 2082 | return 0 |
|
2083 | 2083 | |
|
2084 | 2084 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2085 | 2085 | |
|
2086 | 2086 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
2087 | 2087 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
2088 | 2088 | return 0 |
|
2089 | 2089 | |
|
2090 | 2090 | channelList = str(self.specHeisGgraphChannelList.text()) |
|
2091 | 2091 | freq_range = str(self.specHeisGgraphXminXmax.text()) |
|
2092 | 2092 | power_range = str(self.specHeisGgraphYminYmax.text()) |
|
2093 | 2093 | time_range = str(self.specHeisGgraphTminTmax.text()) |
|
2094 | 2094 | timerange = str(self.specHeisGgraphTimeRange.text()) |
|
2095 | 2095 | |
|
2096 | 2096 | # ---- Spectra Plot----- |
|
2097 | 2097 | if self.specHeisGraphCebSpectraplot.isChecked(): |
|
2098 | 2098 | |
|
2099 | 2099 | name_operation = 'SpectraHeisScope' |
|
2100 | 2100 | optype = 'other' |
|
2101 | 2101 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2102 | 2102 | |
|
2103 | 2103 | name_parameter = 'id' |
|
2104 | 2104 | format = 'int' |
|
2105 | 2105 | value = opObj.id |
|
2106 | 2106 | |
|
2107 | 2107 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
2108 | 2108 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
2109 | 2109 | return 0 |
|
2110 | 2110 | |
|
2111 | 2111 | if not (channelList == ''): |
|
2112 | 2112 | name_parameter = 'channelList' |
|
2113 | 2113 | format = 'intlist' |
|
2114 | 2114 | |
|
2115 | 2115 | if not isList(channelList): |
|
2116 | 2116 | self.console.append("Invalid value '%s' for '%s'" %(channelList, name_parameter)) |
|
2117 | 2117 | return 0 |
|
2118 | 2118 | |
|
2119 | 2119 | opObj.addParameter(name=name_parameter, value=channelList, format=format) |
|
2120 | 2120 | |
|
2121 | 2121 | if not freq_range == '': |
|
2122 | 2122 | xvalueList = freq_range.split(',') |
|
2123 | 2123 | |
|
2124 | 2124 | if len(xvalueList) != 2: |
|
2125 | 2125 | self.console.append("Invalid value '%s' for '%s'" %(freq_range, "xrange")) |
|
2126 | 2126 | return 0 |
|
2127 | 2127 | |
|
2128 | 2128 | value1 = xvalueList[0] |
|
2129 | 2129 | value2 = xvalueList[1] |
|
2130 | 2130 | |
|
2131 | 2131 | if not isFloat(value1) or not isFloat(value2): |
|
2132 | 2132 | self.console.append("Invalid value '%s' for '%s'" %(freq_range, "xrange")) |
|
2133 | 2133 | return 0 |
|
2134 | 2134 | |
|
2135 | 2135 | name1 = 'xmin' |
|
2136 | 2136 | name2 = 'xmax' |
|
2137 | 2137 | format = 'float' |
|
2138 | 2138 | |
|
2139 | 2139 | opObj.addParameter(name=name1, value=value1, format=format) |
|
2140 | 2140 | opObj.addParameter(name=name2, value=value2, format=format) |
|
2141 | 2141 | |
|
2142 | 2142 | #------specHeisGgraphYmin-Ymax--- |
|
2143 | 2143 | if not power_range == '': |
|
2144 | 2144 | yvalueList = power_range.split(",") |
|
2145 | 2145 | |
|
2146 | 2146 | if len(yvalueList) != 2: |
|
2147 | 2147 | self.console.append("Invalid value '%s' for '%s'" %(power_range, "xrange")) |
|
2148 | 2148 | return 0 |
|
2149 | 2149 | |
|
2150 | 2150 | value1 = yvalueList[0] |
|
2151 | 2151 | value2 = yvalueList[1] |
|
2152 | 2152 | |
|
2153 | 2153 | if not isFloat(value1) or not isFloat(value2): |
|
2154 | 2154 | self.console.append("Invalid value '%s' for '%s'" %(power_range, "yrange")) |
|
2155 | 2155 | return 0 |
|
2156 | 2156 | |
|
2157 | 2157 | name1 = 'ymin' |
|
2158 | 2158 | name2 = 'ymax' |
|
2159 | 2159 | format = 'float' |
|
2160 | 2160 | opObj.addParameter(name=name1, value=value1, format=format) |
|
2161 | 2161 | opObj.addParameter(name=name2, value=value2, format=format) |
|
2162 | 2162 | |
|
2163 | 2163 | if self.specHeisGraphSaveSpectra.isChecked(): |
|
2164 | 2164 | checkPath = True |
|
2165 | 2165 | name_parameter1 = 'save' |
|
2166 | 2166 | name_parameter2 = 'figpath' |
|
2167 | 2167 | name_parameter3 = 'figfile' |
|
2168 | 2168 | value1 = '1' |
|
2169 | 2169 | value2 = str(self.specHeisGraphPath.text()) |
|
2170 | 2170 | value3 = str(self.specHeisGraphPrefix.text()) |
|
2171 | 2171 | format1 = 'bool' |
|
2172 | 2172 | format2 = 'str' |
|
2173 | 2173 | opObj.addParameter(name=name_parameter1, value=value1 , format=format1) |
|
2174 | 2174 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) |
|
2175 | 2175 | if not value3 == "": |
|
2176 | 2176 | try: |
|
2177 | 2177 | value3 = str(self.specHeisGraphPrefix.text()) |
|
2178 | 2178 | except: |
|
2179 | 2179 | self.console.clear() |
|
2180 | 2180 | self.console.append("Please Write prefix") |
|
2181 | 2181 | return 0 |
|
2182 | 2182 | opObj.addParameter(name='figfile', value=str(self.specHeisGraphPrefix.text()), format='str') |
|
2183 | 2183 | |
|
2184 | 2184 | # opObj.addParameter(name=name_parameter3, value=value3, format=format2) |
|
2185 | 2185 | # opObj.addParameter(name='wr_period', value='5',format='int') |
|
2186 | 2186 | |
|
2187 | 2187 | if self.specHeisGraphftpSpectra.isChecked(): |
|
2188 | 2188 | opObj.addParameter(name='ftp', value='1', format='int') |
|
2189 | 2189 | self.addFTPConf2Operation(puObj, opObj) |
|
2190 | 2190 | addFTP = True |
|
2191 | 2191 | |
|
2192 | 2192 | if self.specHeisGraphCebRTIplot.isChecked(): |
|
2193 | 2193 | name_operation = 'RTIfromSpectraHeis' |
|
2194 | 2194 | optype = 'other' |
|
2195 | 2195 | |
|
2196 | 2196 | name_parameter = 'id' |
|
2197 | 2197 | format = 'int' |
|
2198 | 2198 | |
|
2199 | 2199 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2200 | 2200 | value = opObj.id |
|
2201 | 2201 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
2202 | 2202 | |
|
2203 | 2203 | if not channelList == '': |
|
2204 | 2204 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
2205 | 2205 | |
|
2206 | 2206 | if not time_range == '': |
|
2207 | 2207 | xvalueList = time_range.split(',') |
|
2208 | 2208 | try: |
|
2209 | 2209 | value = float(xvalueList[0]) |
|
2210 | 2210 | value = float(xvalueList[1]) |
|
2211 | 2211 | except: |
|
2212 | 2212 | return 0 |
|
2213 | 2213 | format = 'float' |
|
2214 | 2214 | opObj.addParameter(name='xmin', value=xvalueList[0], format=format) |
|
2215 | 2215 | opObj.addParameter(name='xmax', value=xvalueList[1], format=format) |
|
2216 | 2216 | |
|
2217 | 2217 | if not timerange == '': |
|
2218 | 2218 | format = 'int' |
|
2219 | 2219 | try: |
|
2220 | 2220 | timerange = int(timerange) |
|
2221 | 2221 | except: |
|
2222 | 2222 | return 0 |
|
2223 | 2223 | opObj.addParameter(name='timerange', value=timerange, format=format) |
|
2224 | 2224 | |
|
2225 | 2225 | |
|
2226 | 2226 | if not power_range == '': |
|
2227 | 2227 | yvalueList = power_range.split(",") |
|
2228 | 2228 | try: |
|
2229 | 2229 | value = float(yvalueList[0]) |
|
2230 | 2230 | value = float(yvalueList[1]) |
|
2231 | 2231 | except: |
|
2232 | 2232 | return 0 |
|
2233 | 2233 | |
|
2234 | 2234 | format = 'float' |
|
2235 | 2235 | opObj.addParameter(name='ymin', value=yvalueList[0], format=format) |
|
2236 | 2236 | opObj.addParameter(name='ymax', value=yvalueList[1], format=format) |
|
2237 | 2237 | |
|
2238 | 2238 | if self.specHeisGraphSaveRTIplot.isChecked(): |
|
2239 | 2239 | checkPath = True |
|
2240 | 2240 | opObj.addParameter(name='save', value='1', format='bool') |
|
2241 | 2241 | opObj.addParameter(name='figpath', value=str(self.specHeisGraphPath.text()), format='str') |
|
2242 | 2242 | value = str(self.specHeisGraphPrefix.text()) |
|
2243 | 2243 | if not value == "": |
|
2244 | 2244 | try: |
|
2245 | 2245 | value = str(self.specHeisGraphPrefix.text()) |
|
2246 | 2246 | except: |
|
2247 | 2247 | self.console.clear() |
|
2248 | 2248 | self.console.append("Please Write prefix") |
|
2249 | 2249 | return 0 |
|
2250 | 2250 | opObj.addParameter(name='figfile', value=value, format='str') |
|
2251 | 2251 | |
|
2252 | 2252 | # test_ftp |
|
2253 | 2253 | if self.specHeisGraphftpRTIplot.isChecked(): |
|
2254 | 2254 | opObj.addParameter(name='ftp', value='1', format='int') |
|
2255 | 2255 | self.addFTPConf2Operation(puObj, opObj) |
|
2256 | 2256 | addFTP = True |
|
2257 | 2257 | |
|
2258 | 2258 | localfolder = None |
|
2259 | 2259 | if checkPath: |
|
2260 | 2260 | localfolder = str(self.specHeisGraphPath.text()) |
|
2261 | 2261 | if localfolder == '': |
|
2262 | 2262 | self.console.clear() |
|
2263 | 2263 | self.console.append("Graphic path should be defined") |
|
2264 | 2264 | return 0 |
|
2265 | 2265 | |
|
2266 | 2266 | if addFTP and not localfolder: |
|
2267 | 2267 | self.console.clear() |
|
2268 | 2268 | self.console.append("You should save plots before send them to FTP Server") |
|
2269 | 2269 | return 0 |
|
2270 | 2270 | |
|
2271 | 2271 | # if something happened |
|
2272 | 2272 | parms_ok, output_path, blocksperfile, metadata_file = self.checkInputsPUSave(datatype='SpectraHeis') |
|
2273 | 2273 | if parms_ok: |
|
2274 | 2274 | name_operation = 'FitsWriter' |
|
2275 | 2275 | optype = 'other' |
|
2276 | 2276 | name_parameter1 = 'path' |
|
2277 | 2277 | name_parameter2 = 'dataBlocksPerFile' |
|
2278 | 2278 | name_parameter3 = 'metadatafile' |
|
2279 | 2279 | value1 = output_path |
|
2280 | 2280 | value2 = blocksperfile |
|
2281 | 2281 | value3 = metadata_file |
|
2282 | 2282 | format2 = "int" |
|
2283 | 2283 | format3 = "str" |
|
2284 | 2284 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2285 | 2285 | |
|
2286 | 2286 | opObj.addParameter(name=name_parameter1, value=value1) |
|
2287 | 2287 | |
|
2288 | 2288 | if blocksperfile: |
|
2289 | 2289 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) |
|
2290 | 2290 | |
|
2291 | 2291 | if metadata_file: |
|
2292 | 2292 | opObj.addParameter(name=name_parameter3, value=value3, format=format3) |
|
2293 | 2293 | |
|
2294 | 2294 | self.console.clear() |
|
2295 | 2295 | try: |
|
2296 | 2296 | self.refreshPUProperties(puObj) |
|
2297 | 2297 | except: |
|
2298 | 2298 | self.console.append("An error reading input parameters was found ... Check them!") |
|
2299 | 2299 | return 0 |
|
2300 | 2300 | |
|
2301 | 2301 | self.console.append("Save your project and press Play button to start signal processing") |
|
2302 | 2302 | |
|
2303 | 2303 | self.actionSaveToolbar.setEnabled(True) |
|
2304 | 2304 | self.actionStarToolbar.setEnabled(True) |
|
2305 | 2305 | |
|
2306 | 2306 | self.actionSave.setEnabled(True) |
|
2307 | 2307 | self.actionStart.setEnabled(True) |
|
2308 | 2308 | |
|
2309 | 2309 | return 1 |
|
2310 | 2310 | @pyqtSignature("int") |
|
2311 | 2311 | def on_specHeisGraphCebSpectraplot_stateChanged(self, p0): |
|
2312 | 2312 | |
|
2313 | 2313 | if p0 == 2: |
|
2314 | 2314 | self.specHeisGgraphChannelList.setEnabled(True) |
|
2315 | 2315 | self.specHeisGgraphXminXmax.setEnabled(True) |
|
2316 | 2316 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
2317 | 2317 | if p0 == 0: |
|
2318 | 2318 | self.specHeisGgraphXminXmax.setEnabled(False) |
|
2319 | 2319 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
2320 | 2320 | |
|
2321 | 2321 | @pyqtSignature("int") |
|
2322 | 2322 | def on_specHeisGraphCebRTIplot_stateChanged(self, p0): |
|
2323 | 2323 | |
|
2324 | 2324 | if p0 == 2: |
|
2325 | 2325 | self.specHeisGgraphChannelList.setEnabled(True) |
|
2326 | 2326 | self.specHeisGgraphTminTmax.setEnabled(True) |
|
2327 | 2327 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
2328 | 2328 | self.specHeisGgraphTimeRange.setEnabled(True) |
|
2329 | 2329 | |
|
2330 | 2330 | if p0 == 0: |
|
2331 | 2331 | self.specHeisGgraphTminTmax.setEnabled(False) |
|
2332 | 2332 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
2333 | 2333 | self.specHeisGgraphTimeRange.setEnabled(False) |
|
2334 | 2334 | |
|
2335 | 2335 | @pyqtSignature("int") |
|
2336 | 2336 | def on_specHeisGraphSaveSpectra_stateChanged(self, p0): |
|
2337 | 2337 | """ |
|
2338 | 2338 | """ |
|
2339 | 2339 | if p0 == 2: |
|
2340 | 2340 | self.specHeisGraphPath.setEnabled(True) |
|
2341 | 2341 | self.specHeisGraphPrefix.setEnabled(True) |
|
2342 | 2342 | self.specHeisGraphToolPath.setEnabled(True) |
|
2343 | 2343 | if p0 == 0: |
|
2344 | 2344 | self.specHeisGraphPath.setEnabled(False) |
|
2345 | 2345 | self.specHeisGraphPrefix.setEnabled(False) |
|
2346 | 2346 | self.specHeisGraphToolPath.setEnabled(False) |
|
2347 | 2347 | |
|
2348 | 2348 | @pyqtSignature("int") |
|
2349 | 2349 | def on_specHeisGraphSaveRTIplot_stateChanged(self, p0): |
|
2350 | 2350 | if p0 == 2: |
|
2351 | 2351 | self.specHeisGraphPath.setEnabled(True) |
|
2352 | 2352 | self.specHeisGraphPrefix.setEnabled(True) |
|
2353 | 2353 | self.specHeisGraphToolPath.setEnabled(True) |
|
2354 | 2354 | |
|
2355 | 2355 | @pyqtSignature("int") |
|
2356 | 2356 | def on_specHeisGraphftpSpectra_stateChanged(self, p0): |
|
2357 | 2357 | """ |
|
2358 | 2358 | """ |
|
2359 | 2359 | if p0 == 2: |
|
2360 | 2360 | self.specHeisGgraphftpratio.setEnabled(True) |
|
2361 | 2361 | |
|
2362 | 2362 | if p0 == 0: |
|
2363 | 2363 | self.specHeisGgraphftpratio.setEnabled(False) |
|
2364 | 2364 | |
|
2365 | 2365 | @pyqtSignature("int") |
|
2366 | 2366 | def on_specHeisGraphftpRTIplot_stateChanged(self, p0): |
|
2367 | 2367 | if p0 == 2: |
|
2368 | 2368 | self.specHeisGgraphftpratio.setEnabled(True) |
|
2369 | 2369 | |
|
2370 | 2370 | @pyqtSignature("") |
|
2371 | 2371 | def on_specHeisGraphClear_clicked(self): |
|
2372 | 2372 | pass |
|
2373 | 2373 | |
|
2374 | 2374 | def __checkSpecGraphSaving(self): |
|
2375 | 2375 | |
|
2376 | 2376 | enable = False |
|
2377 | 2377 | |
|
2378 | 2378 | if self.specGraphSaveSpectra.checkState(): |
|
2379 | 2379 | enable = True |
|
2380 | 2380 | |
|
2381 | 2381 | if self.specGraphSaveCross.checkState(): |
|
2382 | 2382 | enable = True |
|
2383 | 2383 | |
|
2384 | 2384 | if self.specGraphSaveRTIplot.checkState(): |
|
2385 | 2385 | enable = True |
|
2386 | 2386 | |
|
2387 | 2387 | if self.specGraphSaveCoherencemap.checkState(): |
|
2388 | 2388 | enable = True |
|
2389 | 2389 | |
|
2390 | 2390 | if self.specGraphSavePowerprofile.checkState(): |
|
2391 | 2391 | enable = True |
|
2392 | 2392 | |
|
2393 | 2393 | if self.specGraphSaveRTInoise.checkState(): |
|
2394 | 2394 | enable = True |
|
2395 | 2395 | |
|
2396 | 2396 | self.specGraphPath.setEnabled(enable) |
|
2397 | 2397 | self.specGraphPrefix.setEnabled(enable) |
|
2398 | 2398 | self.specGraphToolPath.setEnabled(enable) |
|
2399 | 2399 | |
|
2400 | 2400 | self.specGgraphftpratio.setEnabled(enable) |
|
2401 | 2401 | |
|
2402 | 2402 | def __checkSpecGraphFTP(self): |
|
2403 | 2403 | |
|
2404 | 2404 | enable = False |
|
2405 | 2405 | |
|
2406 | 2406 | if self.specGraphftpSpectra.checkState(): |
|
2407 | 2407 | enable = True |
|
2408 | 2408 | |
|
2409 | 2409 | if self.specGraphftpCross.checkState(): |
|
2410 | 2410 | enable = True |
|
2411 | 2411 | |
|
2412 | 2412 | if self.specGraphftpRTIplot.checkState(): |
|
2413 | 2413 | enable = True |
|
2414 | 2414 | |
|
2415 | 2415 | if self.specGraphftpCoherencemap.checkState(): |
|
2416 | 2416 | enable = True |
|
2417 | 2417 | |
|
2418 | 2418 | if self.specGraphftpPowerprofile.checkState(): |
|
2419 | 2419 | enable = True |
|
2420 | 2420 | |
|
2421 | 2421 | if self.specGraphftpRTInoise.checkState(): |
|
2422 | 2422 | enable = True |
|
2423 | 2423 | |
|
2424 | 2424 | # self.specGgraphftpratio.setEnabled(enable) |
|
2425 | 2425 | |
|
2426 | 2426 | def __checkSpecGraphFilters(self): |
|
2427 | 2427 | |
|
2428 | 2428 | freq = False |
|
2429 | 2429 | height = False |
|
2430 | 2430 | db = False |
|
2431 | 2431 | time = False |
|
2432 | 2432 | magnitud = False |
|
2433 | 2433 | phase = False |
|
2434 | 2434 | channelList = False |
|
2435 | 2435 | |
|
2436 | 2436 | if self.specGraphCebSpectraplot.checkState(): |
|
2437 | 2437 | freq = True |
|
2438 | 2438 | height = True |
|
2439 | 2439 | db = True |
|
2440 | 2440 | channelList = True |
|
2441 | 2441 | |
|
2442 | 2442 | if self.specGraphCebCrossSpectraplot.checkState(): |
|
2443 | 2443 | freq = True |
|
2444 | 2444 | height = True |
|
2445 | 2445 | db = True |
|
2446 | 2446 | magnitud = True |
|
2447 | 2447 | phase = True |
|
2448 | 2448 | |
|
2449 | 2449 | if self.specGraphCebRTIplot.checkState(): |
|
2450 | 2450 | height = True |
|
2451 | 2451 | db = True |
|
2452 | 2452 | time = True |
|
2453 | 2453 | channelList = True |
|
2454 | 2454 | |
|
2455 | 2455 | if self.specGraphCebCoherencmap.checkState(): |
|
2456 | 2456 | height = True |
|
2457 | 2457 | time = True |
|
2458 | 2458 | magnitud = True |
|
2459 | 2459 | phase = True |
|
2460 | 2460 | |
|
2461 | 2461 | if self.specGraphPowerprofile.checkState(): |
|
2462 | 2462 | height = True |
|
2463 | 2463 | db = True |
|
2464 | 2464 | channelList = True |
|
2465 | 2465 | |
|
2466 | 2466 | if self.specGraphCebRTInoise.checkState(): |
|
2467 | 2467 | db = True |
|
2468 | 2468 | time = True |
|
2469 | 2469 | channelList = True |
|
2470 | 2470 | |
|
2471 | 2471 | |
|
2472 | 2472 | self.specGgraphFreq.setEnabled(freq) |
|
2473 | 2473 | self.specGgraphHeight.setEnabled(height) |
|
2474 | 2474 | self.specGgraphDbsrange.setEnabled(db) |
|
2475 | 2475 | self.specGgraphTminTmax.setEnabled(time) |
|
2476 | 2476 | |
|
2477 | 2477 | self.specGgraphmagnitud.setEnabled(magnitud) |
|
2478 | 2478 | self.specGgraphPhase.setEnabled(phase) |
|
2479 | 2479 | self.specGgraphChannelList.setEnabled(channelList) |
|
2480 | 2480 | |
|
2481 | 2481 | def __getParmsFromProjectWindow(self): |
|
2482 | 2482 | """ |
|
2483 | 2483 | Check Inputs Project: |
|
2484 | 2484 | - project_name |
|
2485 | 2485 | - datatype |
|
2486 | 2486 | - ext |
|
2487 | 2487 | - data_path |
|
2488 | 2488 | - readmode |
|
2489 | 2489 | - delay |
|
2490 | 2490 | - set |
|
2491 | 2491 | - walk |
|
2492 | 2492 | """ |
|
2493 | 2493 | parms_ok = True |
|
2494 | 2494 | |
|
2495 | 2495 | project_name = str(self.proName.text()) |
|
2496 | 2496 | |
|
2497 | 2497 | if project_name == '' or project_name == None: |
|
2498 | 2498 | outputstr = "Enter a project Name" |
|
2499 | 2499 | self.console.append(outputstr) |
|
2500 | 2500 | parms_ok = False |
|
2501 | 2501 | project_name = None |
|
2502 | 2502 | |
|
2503 | 2503 | description = str(self.proDescription.toPlainText()) |
|
2504 | 2504 | |
|
2505 | 2505 | datatype = str(self.proComDataType.currentText()) |
|
2506 | 2506 | |
|
2507 | 2507 | ext = str(self.proDataType.text()) |
|
2508 | 2508 | |
|
2509 | 2509 | dpath = str(self.proDataPath.text()) |
|
2510 | 2510 | |
|
2511 | 2511 | if dpath == '': |
|
2512 | 2512 | outputstr = 'Datapath is empty' |
|
2513 | 2513 | self.console.append(outputstr) |
|
2514 | 2514 | parms_ok = False |
|
2515 | 2515 | dpath = None |
|
2516 | 2516 | |
|
2517 | 2517 | if dpath != None: |
|
2518 | 2518 | if not os.path.isdir(dpath): |
|
2519 | 2519 | outputstr = 'Datapath (%s) does not exist' % dpath |
|
2520 | 2520 | self.console.append(outputstr) |
|
2521 | 2521 | parms_ok = False |
|
2522 | 2522 | dpath = None |
|
2523 | 2523 | |
|
2524 | 2524 | online = int(self.proComReadMode.currentIndex()) |
|
2525 | 2525 | |
|
2526 | 2526 | delay = None |
|
2527 | 2527 | if online==1: |
|
2528 | 2528 | try: |
|
2529 | 2529 | delay = int(str(self.proDelay.text())) |
|
2530 | 2530 | except: |
|
2531 | 2531 | outputstr = 'Delay value (%s) must be a integer number' %str(self.proDelay.text()) |
|
2532 | 2532 | self.console.append(outputstr) |
|
2533 | 2533 | parms_ok = False |
|
2534 | 2534 | |
|
2535 | 2535 | |
|
2536 | 2536 | set = None |
|
2537 | 2537 | value = str(self.proSet.text()) |
|
2538 | 2538 | try: |
|
2539 | 2539 | set = int(value) |
|
2540 | 2540 | except: |
|
2541 | 2541 | pass |
|
2542 | 2542 | |
|
2543 | 2543 | ippKm = None |
|
2544 | 2544 | |
|
2545 | 2545 | value = str(self.proIPPKm.text()) |
|
2546 | 2546 | |
|
2547 | 2547 | try: |
|
2548 | 2548 | ippKm = float(value) |
|
2549 | 2549 | except: |
|
2550 | 2550 | if datatype=="USRP": |
|
2551 | 2551 | outputstr = 'IPP value "%s" must be a float number' % str(self.proIPPKm.text()) |
|
2552 | 2552 | self.console.append(outputstr) |
|
2553 | 2553 | parms_ok = False |
|
2554 | 2554 | |
|
2555 | 2555 | walk = int(self.proComWalk.currentIndex()) |
|
2556 | 2556 | expLabel = str(self.proExpLabel.text()) |
|
2557 | 2557 | |
|
2558 | 2558 | startDate = str(self.proComStartDate.currentText()) |
|
2559 | 2559 | endDate = str(self.proComEndDate.currentText()) |
|
2560 | 2560 | |
|
2561 | 2561 | # startDateList = startDate.split("/") |
|
2562 | 2562 | # endDateList = endDate.split("/") |
|
2563 | 2563 | # |
|
2564 | 2564 | # startDate = datetime.date(int(startDateList[0]), int(startDateList[1]), int(startDateList[2])) |
|
2565 | 2565 | # endDate = datetime.date(int(endDateList[0]), int(endDateList[1]), int(endDateList[2])) |
|
2566 | 2566 | |
|
2567 | 2567 | startTime = self.proStartTime.time() |
|
2568 | 2568 | endTime = self.proEndTime.time() |
|
2569 | 2569 | |
|
2570 | 2570 | startTime = str(startTime.toString("H:m:s")) |
|
2571 | 2571 | endTime = str(endTime.toString("H:m:s")) |
|
2572 | 2572 | |
|
2573 | 2573 | projectParms = ProjectParms() |
|
2574 | 2574 | |
|
2575 | 2575 | projectParms.name = project_name |
|
2576 | 2576 | projectParms.description = description |
|
2577 | 2577 | projectParms.datatype = datatype |
|
2578 | 2578 | projectParms.ext = ext |
|
2579 | 2579 | projectParms.dpath = dpath |
|
2580 | 2580 | projectParms.online = online |
|
2581 | 2581 | projectParms.startDate = startDate |
|
2582 | 2582 | projectParms.endDate = endDate |
|
2583 | 2583 | projectParms.startTime = startTime |
|
2584 | 2584 | projectParms.endTime = endTime |
|
2585 | 2585 | projectParms.delay = delay |
|
2586 | 2586 | projectParms.walk = walk |
|
2587 | 2587 | projectParms.expLabel = expLabel |
|
2588 | 2588 | projectParms.set = set |
|
2589 | 2589 | projectParms.ippKm = ippKm |
|
2590 | 2590 | projectParms.parmsOk = parms_ok |
|
2591 | 2591 | |
|
2592 | 2592 | return projectParms |
|
2593 | 2593 | |
|
2594 | 2594 | |
|
2595 | 2595 | def __getParmsFromProjectObj(self, projectObjView): |
|
2596 | 2596 | |
|
2597 | 2597 | parms_ok = True |
|
2598 | 2598 | |
|
2599 | 2599 | project_name, description = projectObjView.name, projectObjView.description |
|
2600 | 2600 | |
|
2601 | 2601 | readUnitObj = projectObjView.getReadUnitObj() |
|
2602 | 2602 | datatype = readUnitObj.datatype |
|
2603 | 2603 | |
|
2604 | 2604 | operationObj = readUnitObj.getOperationObj(name='run') |
|
2605 | 2605 | |
|
2606 | 2606 | dpath = operationObj.getParameterValue(parameterName='path') |
|
2607 | 2607 | startDate = operationObj.getParameterValue(parameterName='startDate') |
|
2608 | 2608 | endDate = operationObj.getParameterValue(parameterName='endDate') |
|
2609 | 2609 | |
|
2610 | 2610 | startDate = startDate.strftime("%Y/%m/%d") |
|
2611 | 2611 | endDate = endDate.strftime("%Y/%m/%d") |
|
2612 | 2612 | |
|
2613 | 2613 | startTime = operationObj.getParameterValue(parameterName='startTime') |
|
2614 | 2614 | endTime = operationObj.getParameterValue(parameterName='endTime') |
|
2615 | 2615 | |
|
2616 | 2616 | startTime = startTime.strftime("%H:%M:%S") |
|
2617 | 2617 | endTime = endTime.strftime("%H:%M:%S") |
|
2618 | 2618 | |
|
2619 | 2619 | online = 0 |
|
2620 | 2620 | try: |
|
2621 | 2621 | online = operationObj.getParameterValue(parameterName='online') |
|
2622 | 2622 | except: |
|
2623 | 2623 | pass |
|
2624 | 2624 | |
|
2625 | 2625 | delay = '' |
|
2626 | 2626 | try: |
|
2627 | 2627 | delay = operationObj.getParameterValue(parameterName='delay') |
|
2628 | 2628 | except: |
|
2629 | 2629 | pass |
|
2630 | 2630 | |
|
2631 | 2631 | walk = 0 |
|
2632 | 2632 | try: |
|
2633 | 2633 | walk = operationObj.getParameterValue(parameterName='walk') |
|
2634 | 2634 | except: |
|
2635 | 2635 | pass |
|
2636 | 2636 | |
|
2637 | 2637 | set = '' |
|
2638 | 2638 | try: |
|
2639 | 2639 | set = operationObj.getParameterValue(parameterName='set') |
|
2640 | 2640 | except: |
|
2641 | 2641 | pass |
|
2642 | 2642 | |
|
2643 | 2643 | expLabel = '' |
|
2644 | 2644 | try: |
|
2645 | 2645 | expLabel = operationObj.getParameterValue(parameterName='expLabel') |
|
2646 | 2646 | except: |
|
2647 | 2647 | pass |
|
2648 | 2648 | |
|
2649 | 2649 | ippKm = '' |
|
2650 | 2650 | if datatype.lower() == 'usrp': |
|
2651 | 2651 | try: |
|
2652 | 2652 | ippKm = operationObj.getParameterValue(parameterName='ippKm') |
|
2653 | 2653 | except: |
|
2654 | 2654 | pass |
|
2655 | 2655 | |
|
2656 | 2656 | projectParms = ProjectParms() |
|
2657 | 2657 | |
|
2658 | 2658 | projectParms.name = project_name |
|
2659 | 2659 | projectParms.description = description |
|
2660 | 2660 | projectParms.datatype = datatype |
|
2661 | 2661 | projectParms.ext = None |
|
2662 | 2662 | projectParms.dpath = dpath |
|
2663 | 2663 | projectParms.online = online |
|
2664 | 2664 | projectParms.startDate = startDate |
|
2665 | 2665 | projectParms.endDate = endDate |
|
2666 | 2666 | projectParms.startTime = startTime |
|
2667 | 2667 | projectParms.endTime = endTime |
|
2668 | 2668 | projectParms.delay=delay |
|
2669 | 2669 | projectParms.walk=walk |
|
2670 | 2670 | projectParms.set=set |
|
2671 | 2671 | projectParms.ippKm=ippKm |
|
2672 | 2672 | projectParms.expLabel = expLabel |
|
2673 | 2673 | projectParms.parmsOk=parms_ok |
|
2674 | 2674 | |
|
2675 | 2675 | return projectParms |
|
2676 | 2676 | |
|
2677 | 2677 | def refreshProjectWindow(self, projectObjView): |
|
2678 | 2678 | |
|
2679 | 2679 | projectParms = self.__getParmsFromProjectObj(projectObjView) |
|
2680 | 2680 | |
|
2681 | 2681 | index = projectParms.getDatatypeIndex() |
|
2682 | 2682 | |
|
2683 | 2683 | self.proName.setText(projectParms.name) |
|
2684 | 2684 | self.proDescription.clear() |
|
2685 | 2685 | self.proDescription.append(projectParms.description) |
|
2686 | 2686 | |
|
2687 | 2687 | self.on_proComDataType_activated(index=index) |
|
2688 | 2688 | self.proDataPath.setText(projectParms.dpath) |
|
2689 | 2689 | self.proComDataType.setCurrentIndex(index) |
|
2690 | 2690 | self.proComReadMode.setCurrentIndex(projectParms.online) |
|
2691 | 2691 | self.proDelay.setText(str(projectParms.delay)) |
|
2692 | 2692 | self.proSet.setText(str(projectParms.set)) |
|
2693 | 2693 | self.proIPPKm.setText(str(projectParms.ippKm)) |
|
2694 | 2694 | self.proComWalk.setCurrentIndex(projectParms.walk) |
|
2695 | 2695 | self.proExpLabel.setText(str(projectParms.expLabel).strip()) |
|
2696 | 2696 | |
|
2697 | 2697 | dateList = self.loadDays(data_path = projectParms.dpath, |
|
2698 | 2698 | ext = projectParms.getExt(), |
|
2699 | 2699 | walk = projectParms.walk, |
|
2700 | 2700 | expLabel = projectParms.expLabel) |
|
2701 | 2701 | |
|
2702 | 2702 | try: |
|
2703 | 2703 | startDateIndex = dateList.index(projectParms.startDate) |
|
2704 | 2704 | except: |
|
2705 | 2705 | startDateIndex = 0 |
|
2706 | 2706 | |
|
2707 | 2707 | try: |
|
2708 | 2708 | endDateIndex = dateList.index(projectParms.endDate) |
|
2709 | 2709 | except: |
|
2710 | 2710 | endDateIndex = int(self.proComEndDate.count()-1) |
|
2711 | 2711 | |
|
2712 | 2712 | self.proComStartDate.setCurrentIndex(startDateIndex) |
|
2713 | 2713 | self.proComEndDate.setCurrentIndex(endDateIndex) |
|
2714 | 2714 | |
|
2715 | 2715 | startlist = projectParms.startTime.split(":") |
|
2716 | 2716 | endlist = projectParms.endTime.split(":") |
|
2717 | 2717 | |
|
2718 | 2718 | self.time.setHMS(int(startlist[0]), int(startlist[1]), int(startlist[2])) |
|
2719 | 2719 | self.proStartTime.setTime(self.time) |
|
2720 | 2720 | |
|
2721 | 2721 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
2722 | 2722 | self.proEndTime.setTime(self.time) |
|
2723 | 2723 | |
|
2724 | 2724 | |
|
2725 | 2725 | def __refreshVoltageWindow(self, puObj): |
|
2726 | 2726 | |
|
2727 | 2727 | opObj = puObj.getOperationObj(name='setRadarFrequency') |
|
2728 | 2728 | if opObj == None: |
|
2729 | 2729 | self.volOpRadarfrequency.clear() |
|
2730 | 2730 | self.volOpCebRadarfrequency.setCheckState(0) |
|
2731 | 2731 | else: |
|
2732 | 2732 | value = opObj.getParameterValue(parameterName='frequency') |
|
2733 | 2733 | value = str(float(value)/1e6) |
|
2734 | 2734 | self.volOpRadarfrequency.setText(value) |
|
2735 | 2735 | self.volOpRadarfrequency.setEnabled(True) |
|
2736 | 2736 | self.volOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) |
|
2737 | 2737 | |
|
2738 | 2738 | opObj = puObj.getOperationObj(name="selectChannels") |
|
2739 | 2739 | |
|
2740 | 2740 | if opObj == None: |
|
2741 | 2741 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") |
|
2742 | 2742 | |
|
2743 | 2743 | if opObj == None: |
|
2744 | 2744 | self.volOpChannel.clear() |
|
2745 | 2745 | self.volOpCebChannels.setCheckState(0) |
|
2746 | 2746 | else: |
|
2747 | 2747 | channelEnabled = False |
|
2748 | 2748 | try: |
|
2749 | 2749 | value = opObj.getParameterValue(parameterName='channelList') |
|
2750 | 2750 | value = str(value)[1:-1] |
|
2751 | 2751 | channelEnabled = True |
|
2752 | 2752 | channelMode = 0 |
|
2753 | 2753 | except: |
|
2754 | 2754 | pass |
|
2755 | 2755 | try: |
|
2756 | 2756 | value = opObj.getParameterValue(parameterName='channelIndexList') |
|
2757 | 2757 | value = str(value)[1:-1] |
|
2758 | 2758 | channelEnabled = True |
|
2759 | 2759 | channelMode = 1 |
|
2760 | 2760 | except: |
|
2761 | 2761 | pass |
|
2762 | 2762 | |
|
2763 | 2763 | if channelEnabled: |
|
2764 | 2764 | self.volOpChannel.setText(value) |
|
2765 | 2765 | self.volOpChannel.setEnabled(True) |
|
2766 | 2766 | self.volOpCebChannels.setCheckState(QtCore.Qt.Checked) |
|
2767 | 2767 | self.volOpComChannels.setCurrentIndex(channelMode) |
|
2768 | 2768 | |
|
2769 | 2769 | opObj = puObj.getOperationObj(name="selectHeights") |
|
2770 | 2770 | if opObj == None: |
|
2771 | 2771 | self.volOpHeights.clear() |
|
2772 | 2772 | self.volOpCebHeights.setCheckState(0) |
|
2773 | 2773 | else: |
|
2774 | 2774 | value1 = str(opObj.getParameterValue(parameterName='minHei')) |
|
2775 | 2775 | value2 = str(opObj.getParameterValue(parameterName='maxHei')) |
|
2776 | 2776 | value = value1 + "," + value2 |
|
2777 | 2777 | self.volOpHeights.setText(value) |
|
2778 | 2778 | self.volOpHeights.setEnabled(True) |
|
2779 | 2779 | self.volOpCebHeights.setCheckState(QtCore.Qt.Checked) |
|
2780 | 2780 | |
|
2781 | 2781 | opObj = puObj.getOperationObj(name="filterByHeights") |
|
2782 | 2782 | if opObj == None: |
|
2783 | 2783 | self.volOpFilter.clear() |
|
2784 | 2784 | self.volOpCebFilter.setCheckState(0) |
|
2785 | 2785 | else: |
|
2786 | 2786 | value = opObj.getParameterValue(parameterName='window') |
|
2787 | 2787 | value = str(value) |
|
2788 | 2788 | self.volOpFilter.setText(value) |
|
2789 | 2789 | self.volOpFilter.setEnabled(True) |
|
2790 | 2790 | self.volOpCebFilter.setCheckState(QtCore.Qt.Checked) |
|
2791 | 2791 | |
|
2792 | 2792 | opObj = puObj.getOperationObj(name="ProfileSelector") |
|
2793 | 2793 | if opObj == None: |
|
2794 | 2794 | self.volOpProfile.clear() |
|
2795 | 2795 | self.volOpCebProfile.setCheckState(0) |
|
2796 | 2796 | else: |
|
2797 | 2797 | for parmObj in opObj.getParameterObjList(): |
|
2798 | 2798 | |
|
2799 | 2799 | if parmObj.name == "profileList": |
|
2800 | 2800 | value = parmObj.getValue() |
|
2801 | 2801 | value = str(value)[1:-1] |
|
2802 | 2802 | self.volOpProfile.setText(value) |
|
2803 | 2803 | self.volOpProfile.setEnabled(True) |
|
2804 | 2804 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2805 | 2805 | self.volOpComProfile.setCurrentIndex(0) |
|
2806 | 2806 | |
|
2807 | 2807 | if parmObj.name == "profileRangeList": |
|
2808 | 2808 | value = parmObj.getValue() |
|
2809 | 2809 | value = str(value)[1:-1] |
|
2810 | 2810 | self.volOpProfile.setText(value) |
|
2811 | 2811 | self.volOpProfile.setEnabled(True) |
|
2812 | 2812 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2813 | 2813 | self.volOpComProfile.setCurrentIndex(1) |
|
2814 | 2814 | |
|
2815 | 2815 | if parmObj.name == "rangeList": |
|
2816 | 2816 | value = parmObj.getValue() |
|
2817 | 2817 | value = str(value)[1:-1] |
|
2818 | 2818 | self.volOpProfile.setText(value) |
|
2819 | 2819 | self.volOpProfile.setEnabled(True) |
|
2820 | 2820 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2821 | 2821 | self.volOpComProfile.setCurrentIndex(2) |
|
2822 | 2822 | |
|
2823 | 2823 | opObj = puObj.getOperationObj(name="Decoder") |
|
2824 | 2824 | self.volOpCode.setText("") |
|
2825 | 2825 | if opObj == None: |
|
2826 | 2826 | self.volOpCebDecodification.setCheckState(0) |
|
2827 | 2827 | else: |
|
2828 | 2828 | self.volOpCebDecodification.setCheckState(QtCore.Qt.Checked) |
|
2829 | 2829 | |
|
2830 | 2830 | parmObj = opObj.getParameterObj('code') |
|
2831 | 2831 | |
|
2832 | 2832 | if parmObj == None: |
|
2833 | 2833 | self.volOpComCode.setCurrentIndex(0) |
|
2834 | 2834 | else: |
|
2835 | 2835 | |
|
2836 | 2836 | parmObj1 = opObj.getParameterObj('nCode') |
|
2837 | 2837 | parmObj2 = opObj.getParameterObj('nBaud') |
|
2838 | 2838 | |
|
2839 | 2839 | if parmObj1 == None or parmObj2 == None: |
|
2840 | 2840 | self.volOpComCode.setCurrentIndex(0) |
|
2841 | 2841 | else: |
|
2842 | 2842 | code = ast.literal_eval(str(parmObj.getValue())) |
|
2843 | 2843 | nCode = parmObj1.getValue() |
|
2844 | 2844 | nBaud = parmObj2.getValue() |
|
2845 | 2845 | |
|
2846 | 2846 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() |
|
2847 | 2847 | |
|
2848 | 2848 | #User defined by default |
|
2849 | 2849 | self.volOpComCode.setCurrentIndex(13) |
|
2850 | 2850 | self.volOpCode.setText(str(code)) |
|
2851 | 2851 | |
|
2852 | 2852 | if nCode == 1: |
|
2853 | 2853 | if nBaud == 3: |
|
2854 | 2854 | self.volOpComCode.setCurrentIndex(1) |
|
2855 | 2855 | if nBaud == 4: |
|
2856 | 2856 | self.volOpComCode.setCurrentIndex(2) |
|
2857 | 2857 | if nBaud == 5: |
|
2858 | 2858 | self.volOpComCode.setCurrentIndex(3) |
|
2859 | 2859 | if nBaud == 7: |
|
2860 | 2860 | self.volOpComCode.setCurrentIndex(4) |
|
2861 | 2861 | if nBaud == 11: |
|
2862 | 2862 | self.volOpComCode.setCurrentIndex(5) |
|
2863 | 2863 | if nBaud == 13: |
|
2864 | 2864 | self.volOpComCode.setCurrentIndex(6) |
|
2865 | 2865 | |
|
2866 | 2866 | if nCode == 2: |
|
2867 | 2867 | if nBaud == 3: |
|
2868 | 2868 | self.volOpComCode.setCurrentIndex(7) |
|
2869 | 2869 | if nBaud == 4: |
|
2870 | 2870 | self.volOpComCode.setCurrentIndex(8) |
|
2871 | 2871 | if nBaud == 5: |
|
2872 | 2872 | self.volOpComCode.setCurrentIndex(9) |
|
2873 | 2873 | if nBaud == 7: |
|
2874 | 2874 | self.volOpComCode.setCurrentIndex(10) |
|
2875 | 2875 | if nBaud == 11: |
|
2876 | 2876 | self.volOpComCode.setCurrentIndex(11) |
|
2877 | 2877 | if nBaud == 13: |
|
2878 | 2878 | self.volOpComCode.setCurrentIndex(12) |
|
2879 | 2879 | |
|
2880 | 2880 | |
|
2881 | 2881 | opObj = puObj.getOperationObj(name="deFlip") |
|
2882 | 2882 | if opObj == None: |
|
2883 | 2883 | self.volOpFlip.clear() |
|
2884 | 2884 | self.volOpFlip.setEnabled(False) |
|
2885 | 2885 | self.volOpCebFlip.setCheckState(0) |
|
2886 | 2886 | else: |
|
2887 | 2887 | try: |
|
2888 | 2888 | value = opObj.getParameterValue(parameterName='channelList') |
|
2889 | 2889 | value = str(value)[1:-1] |
|
2890 | 2890 | except: |
|
2891 | 2891 | value = "" |
|
2892 | 2892 | |
|
2893 | 2893 | self.volOpFlip.setText(value) |
|
2894 | 2894 | self.volOpFlip.setEnabled(True) |
|
2895 | 2895 | self.volOpCebFlip.setCheckState(QtCore.Qt.Checked) |
|
2896 | 2896 | |
|
2897 | 2897 | opObj = puObj.getOperationObj(name="CohInt") |
|
2898 | 2898 | if opObj == None: |
|
2899 | 2899 | self.volOpCohInt.clear() |
|
2900 | 2900 | self.volOpCebCohInt.setCheckState(0) |
|
2901 | 2901 | else: |
|
2902 | 2902 | value = opObj.getParameterValue(parameterName='n') |
|
2903 | 2903 | self.volOpCohInt.setText(str(value)) |
|
2904 | 2904 | self.volOpCohInt.setEnabled(True) |
|
2905 | 2905 | self.volOpCebCohInt.setCheckState(QtCore.Qt.Checked) |
|
2906 | 2906 | |
|
2907 | 2907 | opObj = puObj.getOperationObj(name='Scope') |
|
2908 | 2908 | if opObj == None: |
|
2909 | 2909 | self.volGraphCebshow.setCheckState(0) |
|
2910 | 2910 | else: |
|
2911 | 2911 | self.volGraphCebshow.setCheckState(QtCore.Qt.Checked) |
|
2912 | 2912 | |
|
2913 | 2913 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
2914 | 2914 | |
|
2915 | 2915 | if parmObj == None: |
|
2916 | 2916 | self.volGraphChannelList.clear() |
|
2917 | 2917 | else: |
|
2918 | 2918 | value = parmObj.getValue() |
|
2919 | 2919 | value = str(value) |
|
2920 | 2920 | self.volGraphChannelList.setText(value) |
|
2921 | 2921 | self.volOpProfile.setEnabled(True) |
|
2922 | 2922 | |
|
2923 | 2923 | parmObj1 = opObj.getParameterObj(parameterName='xmin') |
|
2924 | 2924 | parmObj2 = opObj.getParameterObj(parameterName='xmax') |
|
2925 | 2925 | |
|
2926 | 2926 | if parmObj1 == None or parmObj2 ==None: |
|
2927 | 2927 | self.volGraphfreqrange.clear() |
|
2928 | 2928 | else: |
|
2929 | 2929 | value1 = parmObj1.getValue() |
|
2930 | 2930 | value1 = str(value1) |
|
2931 | 2931 | value2 = parmObj2.getValue() |
|
2932 | 2932 | value2 = str(value2) |
|
2933 | 2933 | value = value1 + "," + value2 |
|
2934 | 2934 | self.volGraphfreqrange.setText(value) |
|
2935 | 2935 | |
|
2936 | 2936 | parmObj1 = opObj.getParameterObj(parameterName='ymin') |
|
2937 | 2937 | parmObj2 = opObj.getParameterObj(parameterName='ymax') |
|
2938 | 2938 | |
|
2939 | 2939 | if parmObj1 == None or parmObj2 ==None: |
|
2940 | 2940 | self.volGraphHeightrange.clear() |
|
2941 | 2941 | else: |
|
2942 | 2942 | value1 = parmObj1.getValue() |
|
2943 | 2943 | value1 = str(value1) |
|
2944 | 2944 | value2 = parmObj2.getValue() |
|
2945 | 2945 | value2 = str(value2) |
|
2946 | 2946 | value = value1 + "," + value2 |
|
2947 | 2947 | value2 = str(value2) |
|
2948 | 2948 | self.volGraphHeightrange.setText(value) |
|
2949 | 2949 | |
|
2950 | 2950 | parmObj = opObj.getParameterObj(parameterName='save') |
|
2951 | 2951 | |
|
2952 | 2952 | if parmObj == None: |
|
2953 | 2953 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) |
|
2954 | 2954 | else: |
|
2955 | 2955 | value = parmObj.getValue() |
|
2956 |
if |
|
|
2956 | if value: | |
|
2957 | 2957 | self.volGraphCebSave.setCheckState(QtCore.Qt.Checked) |
|
2958 | 2958 | else: |
|
2959 | 2959 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) |
|
2960 | 2960 | |
|
2961 | 2961 | parmObj = opObj.getParameterObj(parameterName='figpath') |
|
2962 | 2962 | if parmObj == None: |
|
2963 | 2963 | self.volGraphPath.clear() |
|
2964 | 2964 | else: |
|
2965 | 2965 | value = parmObj.getValue() |
|
2966 | 2966 | path = str(value) |
|
2967 | 2967 | self.volGraphPath.setText(path) |
|
2968 | 2968 | |
|
2969 | 2969 | parmObj = opObj.getParameterObj(parameterName='figfile') |
|
2970 | 2970 | if parmObj == None: |
|
2971 | 2971 | self.volGraphPrefix.clear() |
|
2972 | 2972 | else: |
|
2973 | 2973 | value = parmObj.getValue() |
|
2974 | 2974 | figfile = str(value) |
|
2975 | 2975 | self.volGraphPrefix.setText(figfile) |
|
2976 | 2976 | |
|
2977 | 2977 | # outputVoltageWrite |
|
2978 | 2978 | opObj = puObj.getOperationObj(name='VoltageWriter') |
|
2979 | 2979 | |
|
2980 | 2980 | if opObj == None: |
|
2981 | 2981 | self.volOutputPath.clear() |
|
2982 | 2982 | self.volOutputblocksperfile.clear() |
|
2983 | 2983 | self.volOutputprofilesperblock.clear() |
|
2984 | 2984 | else: |
|
2985 | 2985 | parmObj = opObj.getParameterObj(parameterName='path') |
|
2986 | 2986 | if parmObj == None: |
|
2987 | 2987 | self.volOutputPath.clear() |
|
2988 | 2988 | else: |
|
2989 | 2989 | value = parmObj.getValue() |
|
2990 | 2990 | path = str(value) |
|
2991 | 2991 | self.volOutputPath.setText(path) |
|
2992 | 2992 | |
|
2993 | 2993 | parmObj = opObj.getParameterObj(parameterName='blocksPerFile') |
|
2994 | 2994 | if parmObj == None: |
|
2995 | 2995 | self.volOutputblocksperfile.clear() |
|
2996 | 2996 | else: |
|
2997 | 2997 | value = parmObj.getValue() |
|
2998 | 2998 | blocksperfile = str(value) |
|
2999 | 2999 | self.volOutputblocksperfile.setText(blocksperfile) |
|
3000 | 3000 | |
|
3001 | 3001 | parmObj = opObj.getParameterObj(parameterName='profilesPerBlock') |
|
3002 | 3002 | if parmObj == None: |
|
3003 | 3003 | self.volOutputprofilesperblock.clear() |
|
3004 | 3004 | else: |
|
3005 | 3005 | value = parmObj.getValue() |
|
3006 | 3006 | profilesPerBlock = str(value) |
|
3007 | 3007 | self.volOutputprofilesperblock.setText(profilesPerBlock) |
|
3008 | 3008 | |
|
3009 | 3009 | return |
|
3010 | 3010 | |
|
3011 | 3011 | def __refreshSpectraWindow(self, puObj): |
|
3012 | 3012 | |
|
3013 | 3013 | inputId = puObj.getInputId() |
|
3014 | 3014 | inputPUObj = self.__puObjDict[inputId] |
|
3015 | 3015 | |
|
3016 | 3016 | if inputPUObj.datatype == 'Voltage': |
|
3017 | 3017 | self.specOpnFFTpoints.setEnabled(True) |
|
3018 | 3018 | self.specOpProfiles.setEnabled(True) |
|
3019 | 3019 | self.specOpippFactor.setEnabled(True) |
|
3020 | 3020 | else: |
|
3021 | 3021 | self.specOpnFFTpoints.setEnabled(False) |
|
3022 | 3022 | self.specOpProfiles.setEnabled(False) |
|
3023 | 3023 | self.specOpippFactor.setEnabled(False) |
|
3024 | 3024 | |
|
3025 | 3025 | opObj = puObj.getOperationObj(name='setRadarFrequency') |
|
3026 | 3026 | if opObj == None: |
|
3027 | 3027 | self.specOpRadarfrequency.clear() |
|
3028 | 3028 | self.specOpCebRadarfrequency.setCheckState(0) |
|
3029 | 3029 | else: |
|
3030 | 3030 | value = opObj.getParameterValue(parameterName='frequency') |
|
3031 | 3031 | value = str(float(value)/1e6) |
|
3032 | 3032 | self.specOpRadarfrequency.setText(value) |
|
3033 | 3033 | self.specOpRadarfrequency.setEnabled(True) |
|
3034 | 3034 | self.specOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) |
|
3035 | 3035 | |
|
3036 | 3036 | opObj = puObj.getOperationObj(name="run") |
|
3037 | 3037 | if opObj == None: |
|
3038 | 3038 | self.specOpnFFTpoints.clear() |
|
3039 | 3039 | self.specOpProfiles.clear() |
|
3040 | 3040 | self.specOpippFactor.clear() |
|
3041 | 3041 | else: |
|
3042 | 3042 | parmObj = opObj.getParameterObj(parameterName='nFFTPoints') |
|
3043 | 3043 | if parmObj == None: |
|
3044 | 3044 | self.specOpnFFTpoints.clear() |
|
3045 | 3045 | else: |
|
3046 | 3046 | self.specOpnFFTpoints.setEnabled(True) |
|
3047 | 3047 | value = opObj.getParameterValue(parameterName='nFFTPoints') |
|
3048 | 3048 | self.specOpnFFTpoints.setText(str(value)) |
|
3049 | 3049 | |
|
3050 | 3050 | parmObj = opObj.getParameterObj(parameterName='nProfiles') |
|
3051 | 3051 | if parmObj == None: |
|
3052 | 3052 | self.specOpProfiles.clear() |
|
3053 | 3053 | else: |
|
3054 | 3054 | self.specOpProfiles.setEnabled(True) |
|
3055 | 3055 | value = opObj.getParameterValue(parameterName='nProfiles') |
|
3056 | 3056 | self.specOpProfiles.setText(str(value)) |
|
3057 | 3057 | |
|
3058 | 3058 | parmObj = opObj.getParameterObj(parameterName='ippFactor') |
|
3059 | 3059 | if parmObj == None: |
|
3060 | 3060 | self.specOpippFactor.clear() |
|
3061 | 3061 | else: |
|
3062 | 3062 | self.specOpippFactor.setEnabled(True) |
|
3063 | 3063 | value = opObj.getParameterValue(parameterName='ippFactor') |
|
3064 | 3064 | self.specOpippFactor.setText(str(value)) |
|
3065 | 3065 | |
|
3066 | 3066 | opObj = puObj.getOperationObj(name="run") |
|
3067 | 3067 | if opObj == None: |
|
3068 | 3068 | self.specOppairsList.clear() |
|
3069 | 3069 | self.specOpCebCrossSpectra.setCheckState(0) |
|
3070 | 3070 | else: |
|
3071 | 3071 | parmObj = opObj.getParameterObj(parameterName='pairsList') |
|
3072 | 3072 | if parmObj == None: |
|
3073 | 3073 | self.specOppairsList.clear() |
|
3074 | 3074 | self.specOpCebCrossSpectra.setCheckState(0) |
|
3075 | 3075 | else: |
|
3076 | 3076 | value = opObj.getParameterValue(parameterName='pairsList') |
|
3077 | 3077 | value = str(value)[1:-1] |
|
3078 | 3078 | self.specOppairsList.setText(str(value)) |
|
3079 | 3079 | self.specOppairsList.setEnabled(True) |
|
3080 | 3080 | self.specOpCebCrossSpectra.setCheckState(QtCore.Qt.Checked) |
|
3081 | 3081 | |
|
3082 | 3082 | opObj = puObj.getOperationObj(name="selectChannels") |
|
3083 | 3083 | |
|
3084 | 3084 | if opObj == None: |
|
3085 | 3085 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") |
|
3086 | 3086 | |
|
3087 | 3087 | if opObj == None: |
|
3088 | 3088 | self.specOpChannel.clear() |
|
3089 | 3089 | self.specOpCebChannel.setCheckState(0) |
|
3090 | 3090 | else: |
|
3091 | 3091 | channelEnabled = False |
|
3092 | 3092 | try: |
|
3093 | 3093 | value = opObj.getParameterValue(parameterName='channelList') |
|
3094 | 3094 | value = str(value)[1:-1] |
|
3095 | 3095 | channelEnabled = True |
|
3096 | 3096 | channelMode = 0 |
|
3097 | 3097 | except: |
|
3098 | 3098 | pass |
|
3099 | 3099 | try: |
|
3100 | 3100 | value = opObj.getParameterValue(parameterName='channelIndexList') |
|
3101 | 3101 | value = str(value)[1:-1] |
|
3102 | 3102 | channelEnabled = True |
|
3103 | 3103 | channelMode = 1 |
|
3104 | 3104 | except: |
|
3105 | 3105 | pass |
|
3106 | 3106 | |
|
3107 | 3107 | if channelEnabled: |
|
3108 | 3108 | self.specOpChannel.setText(value) |
|
3109 | 3109 | self.specOpChannel.setEnabled(True) |
|
3110 | 3110 | self.specOpCebChannel.setCheckState(QtCore.Qt.Checked) |
|
3111 | 3111 | self.specOpComChannel.setCurrentIndex(channelMode) |
|
3112 | 3112 | |
|
3113 | 3113 | opObj = puObj.getOperationObj(name="selectHeights") |
|
3114 | 3114 | if opObj == None: |
|
3115 | 3115 | self.specOpHeights.clear() |
|
3116 | 3116 | self.specOpCebHeights.setCheckState(0) |
|
3117 | 3117 | else: |
|
3118 | 3118 | value1 = int(opObj.getParameterValue(parameterName='minHei')) |
|
3119 | 3119 | value1 = str(value1) |
|
3120 | 3120 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) |
|
3121 | 3121 | value2 = str(value2) |
|
3122 | 3122 | value = value1 + "," + value2 |
|
3123 | 3123 | self.specOpHeights.setText(value) |
|
3124 | 3124 | self.specOpHeights.setEnabled(True) |
|
3125 | 3125 | self.specOpCebHeights.setCheckState(QtCore.Qt.Checked) |
|
3126 | 3126 | |
|
3127 | 3127 | opObj = puObj.getOperationObj(name="IncohInt") |
|
3128 | 3128 | if opObj == None: |
|
3129 | 3129 | self.specOpIncoherent.clear() |
|
3130 | 3130 | self.specOpCebIncoherent.setCheckState(0) |
|
3131 | 3131 | else: |
|
3132 | 3132 | for parmObj in opObj.getParameterObjList(): |
|
3133 | 3133 | if parmObj.name == 'timeInterval': |
|
3134 |
value = opObj.getParameterValue(parameterName='timeInterval') |
|
|
3135 | value = float(value) | |
|
3134 | value = opObj.getParameterValue(parameterName='timeInterval') | |
|
3136 | 3135 | self.specOpIncoherent.setText(str(value)) |
|
3137 | 3136 | self.specOpIncoherent.setEnabled(True) |
|
3138 | 3137 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3139 | 3138 | self.specOpCobIncInt.setCurrentIndex(0) |
|
3140 | 3139 | |
|
3141 | 3140 | if parmObj.name == 'n': |
|
3142 |
value = opObj.getParameterValue(parameterName='n') |
|
|
3143 | value = float(value) | |
|
3141 | value = opObj.getParameterValue(parameterName='n') | |
|
3144 | 3142 | self.specOpIncoherent.setText(str(value)) |
|
3145 | 3143 | self.specOpIncoherent.setEnabled(True) |
|
3146 | 3144 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3147 | 3145 | self.specOpCobIncInt.setCurrentIndex(1) |
|
3148 | 3146 | |
|
3149 | 3147 | opObj = puObj.getOperationObj(name="removeDC") |
|
3150 | 3148 | if opObj == None: |
|
3151 | 3149 | self.specOpCebRemoveDC.setCheckState(0) |
|
3152 | 3150 | else: |
|
3153 | 3151 | self.specOpCebRemoveDC.setCheckState(QtCore.Qt.Checked) |
|
3154 | 3152 | value = opObj.getParameterValue(parameterName='mode') |
|
3155 | 3153 | if value == 1: |
|
3156 | 3154 | self.specOpComRemoveDC.setCurrentIndex(0) |
|
3157 | 3155 | elif value == 2: |
|
3158 | 3156 | self.specOpComRemoveDC.setCurrentIndex(1) |
|
3159 | 3157 | |
|
3160 | 3158 | opObj = puObj.getOperationObj(name="removeInterference") |
|
3161 | 3159 | if opObj == None: |
|
3162 | 3160 | self.specOpCebRemoveInt.setCheckState(0) |
|
3163 | 3161 | else: |
|
3164 | 3162 | self.specOpCebRemoveInt.setCheckState(QtCore.Qt.Checked) |
|
3165 | 3163 | |
|
3166 | 3164 | opObj = puObj.getOperationObj(name='getNoise') |
|
3167 | 3165 | if opObj == None: |
|
3168 | 3166 | self.specOpCebgetNoise.setCheckState(0) |
|
3169 | 3167 | self.specOpgetNoise.clear() |
|
3170 | 3168 | else: |
|
3171 | 3169 | self.specOpCebgetNoise.setCheckState(QtCore.Qt.Checked) |
|
3172 | 3170 | parmObj = opObj.getParameterObj(parameterName='minHei') |
|
3173 | 3171 | if parmObj == None: |
|
3174 | 3172 | self.specOpgetNoise.clear() |
|
3175 | 3173 | value1 = None |
|
3176 | 3174 | else: |
|
3177 | 3175 | value1 = opObj.getParameterValue(parameterName='minHei') |
|
3178 | 3176 | value1 = str(value1) |
|
3179 | 3177 | parmObj = opObj.getParameterObj(parameterName='maxHei') |
|
3180 | 3178 | if parmObj == None: |
|
3181 | 3179 | value2 = None |
|
3182 | 3180 | value = value1 |
|
3183 | 3181 | self.specOpgetNoise.setText(value) |
|
3184 | 3182 | self.specOpgetNoise.setEnabled(True) |
|
3185 | 3183 | else: |
|
3186 | 3184 | value2 = opObj.getParameterValue(parameterName='maxHei') |
|
3187 | 3185 | value2 = str(value2) |
|
3188 | 3186 | parmObj = opObj.getParameterObj(parameterName='minVel') |
|
3189 | 3187 | if parmObj == None: |
|
3190 | 3188 | value3 = None |
|
3191 | 3189 | value = value1 + "," + value2 |
|
3192 | 3190 | self.specOpgetNoise.setText(value) |
|
3193 | 3191 | self.specOpgetNoise.setEnabled(True) |
|
3194 | 3192 | else: |
|
3195 | 3193 | value3 = opObj.getParameterValue(parameterName='minVel') |
|
3196 | 3194 | value3 = str(value3) |
|
3197 | 3195 | parmObj = opObj.getParameterObj(parameterName='maxVel') |
|
3198 | 3196 | if parmObj == None: |
|
3199 | 3197 | value4 = None |
|
3200 | 3198 | value = value1 + "," + value2 + "," + value3 |
|
3201 | 3199 | self.specOpgetNoise.setText(value) |
|
3202 | 3200 | self.specOpgetNoise.setEnabled(True) |
|
3203 | 3201 | else: |
|
3204 | 3202 | value4 = opObj.getParameterValue(parameterName='maxVel') |
|
3205 | 3203 | value4 = str(value4) |
|
3206 | 3204 | value = value1 + "," + value2 + "," + value3 + ',' + value4 |
|
3207 | 3205 | self.specOpgetNoise.setText(value) |
|
3208 | 3206 | self.specOpgetNoise.setEnabled(True) |
|
3209 | 3207 | |
|
3210 | 3208 | self.specGraphPath.clear() |
|
3211 | 3209 | self.specGraphPrefix.clear() |
|
3212 | 3210 | self.specGgraphFreq.clear() |
|
3213 | 3211 | self.specGgraphHeight.clear() |
|
3214 | 3212 | self.specGgraphDbsrange.clear() |
|
3215 | 3213 | self.specGgraphmagnitud.clear() |
|
3216 | 3214 | self.specGgraphPhase.clear() |
|
3217 | 3215 | self.specGgraphChannelList.clear() |
|
3218 | 3216 | self.specGgraphTminTmax.clear() |
|
3219 | 3217 | self.specGgraphTimeRange.clear() |
|
3220 | 3218 | self.specGgraphftpratio.clear() |
|
3221 | 3219 | |
|
3222 | 3220 | opObj = puObj.getOperationObj(name='SpectraPlot') |
|
3223 | 3221 | |
|
3224 | 3222 | if opObj == None: |
|
3225 | 3223 | self.specGraphCebSpectraplot.setCheckState(0) |
|
3226 | 3224 | self.specGraphSaveSpectra.setCheckState(0) |
|
3227 | 3225 | self.specGraphftpSpectra.setCheckState(0) |
|
3228 | 3226 | else: |
|
3229 | 3227 | operationSpectraPlot = "Enable" |
|
3230 | 3228 | self.specGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3231 | 3229 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3232 | 3230 | if parmObj == None: |
|
3233 | 3231 | self.specGgraphChannelList.clear() |
|
3234 | 3232 | else: |
|
3235 | 3233 | value = opObj.getParameterValue(parameterName='channelList') |
|
3236 | 3234 | channelListSpectraPlot = str(value)[1:-1] |
|
3237 | 3235 | self.specGgraphChannelList.setText(channelListSpectraPlot) |
|
3238 | 3236 | self.specGgraphChannelList.setEnabled(True) |
|
3239 | 3237 | |
|
3240 | 3238 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3241 | 3239 | if parmObj == None: |
|
3242 | 3240 | self.specGgraphFreq.clear() |
|
3243 | 3241 | else: |
|
3244 | 3242 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3245 | 3243 | value1 = str(value1) |
|
3246 | 3244 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3247 | 3245 | value2 = str(value2) |
|
3248 | 3246 | value = value1 + "," + value2 |
|
3249 | 3247 | self.specGgraphFreq.setText(value) |
|
3250 | 3248 | self.specGgraphFreq.setEnabled(True) |
|
3251 | 3249 | |
|
3252 | 3250 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3253 | 3251 | if parmObj == None: |
|
3254 | 3252 | self.specGgraphHeight.clear() |
|
3255 | 3253 | else: |
|
3256 | 3254 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3257 | 3255 | value1 = str(value1) |
|
3258 | 3256 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3259 | 3257 | value2 = str(value2) |
|
3260 | 3258 | value = value1 + "," + value2 |
|
3261 | 3259 | self.specGgraphHeight.setText(value) |
|
3262 | 3260 | self.specGgraphHeight.setEnabled(True) |
|
3263 | 3261 | |
|
3264 | 3262 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3265 | 3263 | if parmObj == None: |
|
3266 | 3264 | self.specGgraphDbsrange.clear() |
|
3267 | 3265 | else: |
|
3268 | 3266 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3269 | 3267 | value1 = str(value1) |
|
3270 | 3268 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3271 | 3269 | value2 = str(value2) |
|
3272 | 3270 | value = value1 + "," + value2 |
|
3273 | 3271 | self.specGgraphDbsrange.setText(value) |
|
3274 | 3272 | self.specGgraphDbsrange.setEnabled(True) |
|
3275 | 3273 | |
|
3276 | 3274 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3277 | 3275 | if parmObj == None: |
|
3278 | 3276 | self.specGraphSaveSpectra.setCheckState(0) |
|
3279 | 3277 | else: |
|
3280 | 3278 | self.specGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) |
|
3281 | 3279 | |
|
3282 | 3280 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3283 | 3281 | if parmObj == None: |
|
3284 | 3282 | self.specGraphftpSpectra.setCheckState(0) |
|
3285 | 3283 | else: |
|
3286 | 3284 | self.specGraphftpSpectra.setCheckState(QtCore.Qt.Checked) |
|
3287 | 3285 | |
|
3288 | 3286 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3289 | 3287 | if parmObj: |
|
3290 | 3288 | value = parmObj.getValue() |
|
3291 | 3289 | self.specGraphPath.setText(value) |
|
3292 | 3290 | |
|
3293 | 3291 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3294 | 3292 | if parmObj: |
|
3295 | 3293 | value = parmObj.getValue() |
|
3296 | 3294 | self.specGgraphftpratio.setText(str(value)) |
|
3297 | 3295 | |
|
3298 | 3296 | opObj = puObj.getOperationObj(name='CrossSpectraPlot') |
|
3299 | 3297 | |
|
3300 | 3298 | if opObj == None: |
|
3301 | 3299 | self.specGraphCebCrossSpectraplot.setCheckState(0) |
|
3302 | 3300 | self.specGraphSaveCross.setCheckState(0) |
|
3303 | 3301 | self.specGraphftpCross.setCheckState(0) |
|
3304 | 3302 | else: |
|
3305 | 3303 | operationCrossSpectraPlot = "Enable" |
|
3306 | 3304 | self.specGraphCebCrossSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3307 | 3305 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3308 | 3306 | if parmObj == None: |
|
3309 | 3307 | self.specGgraphFreq.clear() |
|
3310 | 3308 | else: |
|
3311 | 3309 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3312 | 3310 | value1 = str(value1) |
|
3313 | 3311 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3314 | 3312 | value2 = str(value2) |
|
3315 | 3313 | value = value1 + "," + value2 |
|
3316 | 3314 | self.specGgraphFreq.setText(value) |
|
3317 | 3315 | self.specGgraphFreq.setEnabled(True) |
|
3318 | 3316 | |
|
3319 | 3317 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3320 | 3318 | if parmObj == None: |
|
3321 | 3319 | self.specGgraphHeight.clear() |
|
3322 | 3320 | else: |
|
3323 | 3321 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3324 | 3322 | value1 = str(value1) |
|
3325 | 3323 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3326 | 3324 | value2 = str(value2) |
|
3327 | 3325 | value = value1 + "," + value2 |
|
3328 | 3326 | self.specGgraphHeight.setText(value) |
|
3329 | 3327 | self.specGgraphHeight.setEnabled(True) |
|
3330 | 3328 | |
|
3331 | 3329 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3332 | 3330 | if parmObj == None: |
|
3333 | 3331 | self.specGgraphDbsrange.clear() |
|
3334 | 3332 | else: |
|
3335 | 3333 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3336 | 3334 | value1 = str(value1) |
|
3337 | 3335 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3338 | 3336 | value2 = str(value2) |
|
3339 | 3337 | value = value1 + "," + value2 |
|
3340 | 3338 | self.specGgraphDbsrange.setText(value) |
|
3341 | 3339 | self.specGgraphDbsrange.setEnabled(True) |
|
3342 | 3340 | |
|
3343 | 3341 | parmObj = opObj.getParameterObj(parameterName='coh_min') |
|
3344 | 3342 | if parmObj == None: |
|
3345 | 3343 | self.specGgraphmagnitud.clear() |
|
3346 | 3344 | else: |
|
3347 | 3345 | value1 = opObj.getParameterValue(parameterName='coh_min') |
|
3348 | 3346 | value1 = str(value1) |
|
3349 | 3347 | value2 = opObj.getParameterValue(parameterName='coh_max') |
|
3350 | 3348 | value2 = str(value2) |
|
3351 | 3349 | value = value1 + "," + value2 |
|
3352 | 3350 | self.specGgraphmagnitud.setText(value) |
|
3353 | 3351 | self.specGgraphmagnitud.setEnabled(True) |
|
3354 | 3352 | |
|
3355 | 3353 | parmObj = opObj.getParameterObj(parameterName='phase_min') |
|
3356 | 3354 | if parmObj == None: |
|
3357 | 3355 | self.specGgraphPhase.clear() |
|
3358 | 3356 | else: |
|
3359 | 3357 | value1 = opObj.getParameterValue(parameterName='phase_min') |
|
3360 | 3358 | value1 = str(value1) |
|
3361 | 3359 | value2 = opObj.getParameterValue(parameterName='phase_max') |
|
3362 | 3360 | value2 = str(value2) |
|
3363 | 3361 | value = value1 + "," + value2 |
|
3364 | 3362 | self.specGgraphPhase.setText(value) |
|
3365 | 3363 | self.specGgraphPhase.setEnabled(True) |
|
3366 | 3364 | |
|
3367 | 3365 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3368 | 3366 | if parmObj == None: |
|
3369 | 3367 | self.specGraphSaveCross.setCheckState(0) |
|
3370 | 3368 | else: |
|
3371 | 3369 | self.specGraphSaveCross.setCheckState(QtCore.Qt.Checked) |
|
3372 | 3370 | |
|
3373 | 3371 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3374 | 3372 | if parmObj == None: |
|
3375 | 3373 | self.specGraphftpCross.setCheckState(0) |
|
3376 | 3374 | else: |
|
3377 | 3375 | self.specGraphftpCross.setCheckState(QtCore.Qt.Checked) |
|
3378 | 3376 | |
|
3379 | 3377 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3380 | 3378 | if parmObj: |
|
3381 | 3379 | value = parmObj.getValue() |
|
3382 | 3380 | self.specGraphPath.setText(value) |
|
3383 | 3381 | |
|
3384 | 3382 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3385 | 3383 | if parmObj: |
|
3386 | 3384 | value = parmObj.getValue() |
|
3387 | 3385 | self.specGgraphftpratio.setText(str(value)) |
|
3388 | 3386 | |
|
3389 | 3387 | opObj = puObj.getOperationObj(name='RTIPlot') |
|
3390 | 3388 | |
|
3391 | 3389 | if opObj == None: |
|
3392 | 3390 | self.specGraphCebRTIplot.setCheckState(0) |
|
3393 | 3391 | self.specGraphSaveRTIplot.setCheckState(0) |
|
3394 | 3392 | self.specGraphftpRTIplot.setCheckState(0) |
|
3395 | 3393 | else: |
|
3396 | 3394 | self.specGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3397 | 3395 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3398 | 3396 | if parmObj == None: |
|
3399 | 3397 | self.specGgraphChannelList.clear() |
|
3400 | 3398 | else: |
|
3401 | 3399 | value = opObj.getParameterValue(parameterName='channelList') |
|
3402 | 3400 | channelListRTIPlot = str(value)[1:-1] |
|
3403 | 3401 | self.specGgraphChannelList.setText(channelListRTIPlot) |
|
3404 | 3402 | self.specGgraphChannelList.setEnabled(True) |
|
3405 | 3403 | |
|
3406 | 3404 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3407 | 3405 | if parmObj == None: |
|
3408 | 3406 | self.specGgraphTminTmax.clear() |
|
3409 | 3407 | else: |
|
3410 | 3408 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3411 | 3409 | value1 = str(value1) |
|
3412 | 3410 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3413 | 3411 | value2 = str(value2) |
|
3414 | 3412 | value = value1 + "," + value2 |
|
3415 | 3413 | self.specGgraphTminTmax.setText(value) |
|
3416 | 3414 | self.specGgraphTminTmax.setEnabled(True) |
|
3417 | 3415 | |
|
3418 | 3416 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3419 | 3417 | if parmObj == None: |
|
3420 | 3418 | self.specGgraphTimeRange.clear() |
|
3421 | 3419 | else: |
|
3422 | 3420 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3423 | 3421 | value1 = str(value1) |
|
3424 | 3422 | self.specGgraphTimeRange.setText(value1) |
|
3425 | 3423 | self.specGgraphTimeRange.setEnabled(True) |
|
3426 | 3424 | |
|
3427 | 3425 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3428 | 3426 | if parmObj == None: |
|
3429 | 3427 | self.specGgraphHeight.clear() |
|
3430 | 3428 | else: |
|
3431 | 3429 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3432 | 3430 | value1 = str(value1) |
|
3433 | 3431 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3434 | 3432 | value2 = str(value2) |
|
3435 | 3433 | value = value1 + "," + value2 |
|
3436 | 3434 | self.specGgraphHeight.setText(value) |
|
3437 | 3435 | self.specGgraphHeight.setEnabled(True) |
|
3438 | 3436 | |
|
3439 | 3437 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3440 | 3438 | if parmObj == None: |
|
3441 | 3439 | self.specGgraphDbsrange.clear() |
|
3442 | 3440 | else: |
|
3443 | 3441 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3444 | 3442 | value1 = str(value1) |
|
3445 | 3443 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3446 | 3444 | value2 = str(value2) |
|
3447 | 3445 | value = value1 + "," + value2 |
|
3448 | 3446 | self.specGgraphDbsrange.setText(value) |
|
3449 | 3447 | self.specGgraphDbsrange.setEnabled(True) |
|
3450 | 3448 | |
|
3451 | 3449 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3452 | 3450 | if parmObj == None: |
|
3453 | 3451 | self.specGraphSaveRTIplot.setCheckState(0) |
|
3454 | 3452 | else: |
|
3455 | 3453 | self.specGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3456 | 3454 | |
|
3457 | 3455 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3458 | 3456 | if parmObj == None: |
|
3459 | 3457 | self.specGraphftpRTIplot.setCheckState(0) |
|
3460 | 3458 | else: |
|
3461 | 3459 | self.specGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3462 | 3460 | |
|
3463 | 3461 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3464 | 3462 | if parmObj: |
|
3465 | 3463 | value = parmObj.getValue() |
|
3466 | 3464 | self.specGraphPath.setText(value) |
|
3467 | 3465 | |
|
3468 | 3466 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3469 | 3467 | if parmObj: |
|
3470 | 3468 | value = parmObj.getValue() |
|
3471 | 3469 | self.specGgraphftpratio.setText(str(value)) |
|
3472 | 3470 | |
|
3473 | 3471 | opObj = puObj.getOperationObj(name='CoherenceMap') |
|
3474 | 3472 | |
|
3475 | 3473 | if opObj == None: |
|
3476 | 3474 | self.specGraphCebCoherencmap.setCheckState(0) |
|
3477 | 3475 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
3478 | 3476 | self.specGraphftpCoherencemap.setCheckState(0) |
|
3479 | 3477 | else: |
|
3480 | 3478 | operationCoherenceMap = "Enable" |
|
3481 | 3479 | self.specGraphCebCoherencmap.setCheckState(QtCore.Qt.Checked) |
|
3482 | 3480 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3483 | 3481 | if parmObj == None: |
|
3484 | 3482 | self.specGgraphTminTmax.clear() |
|
3485 | 3483 | else: |
|
3486 | 3484 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3487 | 3485 | value1 = str(value1) |
|
3488 | 3486 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3489 | 3487 | value2 = str(value2) |
|
3490 | 3488 | value = value1 + "," + value2 |
|
3491 | 3489 | self.specGgraphTminTmax.setText(value) |
|
3492 | 3490 | self.specGgraphTminTmax.setEnabled(True) |
|
3493 | 3491 | |
|
3494 | 3492 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3495 | 3493 | if parmObj == None: |
|
3496 | 3494 | self.specGgraphTimeRange.clear() |
|
3497 | 3495 | else: |
|
3498 | 3496 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3499 | 3497 | value1 = str(value1) |
|
3500 | 3498 | self.specGgraphTimeRange.setText(value1) |
|
3501 | 3499 | self.specGgraphTimeRange.setEnabled(True) |
|
3502 | 3500 | |
|
3503 | 3501 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3504 | 3502 | if parmObj == None: |
|
3505 | 3503 | self.specGgraphHeight.clear() |
|
3506 | 3504 | else: |
|
3507 | 3505 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3508 | 3506 | value1 = str(value1) |
|
3509 | 3507 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3510 | 3508 | value2 = str(value2) |
|
3511 | 3509 | value = value1 + "," + value2 |
|
3512 | 3510 | self.specGgraphHeight.setText(value) |
|
3513 | 3511 | self.specGgraphHeight.setEnabled(True) |
|
3514 | 3512 | |
|
3515 | 3513 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3516 | 3514 | if parmObj == None: |
|
3517 | 3515 | self.specGgraphmagnitud.clear() |
|
3518 | 3516 | else: |
|
3519 | 3517 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3520 | 3518 | value1 = str(value1) |
|
3521 | 3519 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3522 | 3520 | value2 = str(value2) |
|
3523 | 3521 | value = value1 + "," + value2 |
|
3524 | 3522 | self.specGgraphmagnitud.setText(value) |
|
3525 | 3523 | self.specGgraphmagnitud.setEnabled(True) |
|
3526 | 3524 | |
|
3527 | 3525 | parmObj = opObj.getParameterObj(parameterName='coh_min') |
|
3528 | 3526 | if parmObj == None: |
|
3529 | 3527 | self.specGgraphmagnitud.clear() |
|
3530 | 3528 | else: |
|
3531 | 3529 | value1 = opObj.getParameterValue(parameterName='coh_min') |
|
3532 | 3530 | value1 = str(value1) |
|
3533 | 3531 | value2 = opObj.getParameterValue(parameterName='coh_max') |
|
3534 | 3532 | value2 = str(value2) |
|
3535 | 3533 | value = value1 + "," + value2 |
|
3536 | 3534 | self.specGgraphmagnitud.setText(value) |
|
3537 | 3535 | self.specGgraphmagnitud.setEnabled(True) |
|
3538 | 3536 | |
|
3539 | 3537 | parmObj = opObj.getParameterObj(parameterName='phase_min') |
|
3540 | 3538 | if parmObj == None: |
|
3541 | 3539 | self.specGgraphPhase.clear() |
|
3542 | 3540 | else: |
|
3543 | 3541 | value1 = opObj.getParameterValue(parameterName='phase_min') |
|
3544 | 3542 | value1 = str(value1) |
|
3545 | 3543 | value2 = opObj.getParameterValue(parameterName='phase_max') |
|
3546 | 3544 | value2 = str(value2) |
|
3547 | 3545 | value = value1 + "," + value2 |
|
3548 | 3546 | self.specGgraphPhase.setText(value) |
|
3549 | 3547 | self.specGgraphPhase.setEnabled(True) |
|
3550 | 3548 | |
|
3551 | 3549 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3552 | 3550 | if parmObj == None: |
|
3553 | 3551 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
3554 | 3552 | else: |
|
3555 | 3553 | self.specGraphSaveCoherencemap.setCheckState(QtCore.Qt.Checked) |
|
3556 | 3554 | |
|
3557 | 3555 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3558 | 3556 | if parmObj == None: |
|
3559 | 3557 | self.specGraphftpCoherencemap.setCheckState(0) |
|
3560 | 3558 | else: |
|
3561 | 3559 | self.specGraphftpCoherencemap.setCheckState(QtCore.Qt.Checked) |
|
3562 | 3560 | |
|
3563 | 3561 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3564 | 3562 | if parmObj: |
|
3565 | 3563 | value = parmObj.getValue() |
|
3566 | 3564 | self.specGraphPath.setText(value) |
|
3567 | 3565 | |
|
3568 | 3566 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3569 | 3567 | if parmObj: |
|
3570 | 3568 | value = parmObj.getValue() |
|
3571 | 3569 | self.specGgraphftpratio.setText(str(value)) |
|
3572 | 3570 | |
|
3573 | 3571 | opObj = puObj.getOperationObj(name='PowerProfilePlot') |
|
3574 | 3572 | |
|
3575 | 3573 | if opObj == None: |
|
3576 | 3574 | self.specGraphPowerprofile.setCheckState(0) |
|
3577 | 3575 | self.specGraphSavePowerprofile.setCheckState(0) |
|
3578 | 3576 | self.specGraphftpPowerprofile.setCheckState(0) |
|
3579 | 3577 | operationPowerProfilePlot = "Disabled" |
|
3580 | 3578 | channelList = None |
|
3581 | 3579 | freq_vel = None |
|
3582 | 3580 | heightsrange = None |
|
3583 | 3581 | else: |
|
3584 | 3582 | operationPowerProfilePlot = "Enable" |
|
3585 | 3583 | self.specGraphPowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3586 | 3584 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3587 | 3585 | if parmObj == None: |
|
3588 | 3586 | self.specGgraphDbsrange.clear() |
|
3589 | 3587 | else: |
|
3590 | 3588 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3591 | 3589 | value1 = str(value1) |
|
3592 | 3590 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3593 | 3591 | value2 = str(value2) |
|
3594 | 3592 | value = value1 + "," + value2 |
|
3595 | 3593 | self.specGgraphDbsrange.setText(value) |
|
3596 | 3594 | self.specGgraphDbsrange.setEnabled(True) |
|
3597 | 3595 | |
|
3598 | 3596 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3599 | 3597 | if parmObj == None: |
|
3600 | 3598 | self.specGgraphHeight.clear() |
|
3601 | 3599 | else: |
|
3602 | 3600 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3603 | 3601 | value1 = str(value1) |
|
3604 | 3602 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3605 | 3603 | value2 = str(value2) |
|
3606 | 3604 | value = value1 + "," + value2 |
|
3607 | 3605 | self.specGgraphHeight.setText(value) |
|
3608 | 3606 | self.specGgraphHeight.setEnabled(True) |
|
3609 | 3607 | |
|
3610 | 3608 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3611 | 3609 | if parmObj == None: |
|
3612 | 3610 | self.specGraphSavePowerprofile.setCheckState(0) |
|
3613 | 3611 | else: |
|
3614 | 3612 | self.specGraphSavePowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3615 | 3613 | |
|
3616 | 3614 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3617 | 3615 | if parmObj == None: |
|
3618 | 3616 | self.specGraphftpPowerprofile.setCheckState(0) |
|
3619 | 3617 | else: |
|
3620 | 3618 | self.specGraphftpPowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3621 | 3619 | |
|
3622 | 3620 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3623 | 3621 | if parmObj: |
|
3624 | 3622 | value = parmObj.getValue() |
|
3625 | 3623 | self.specGraphPath.setText(value) |
|
3626 | 3624 | |
|
3627 | 3625 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3628 | 3626 | if parmObj: |
|
3629 | 3627 | value = parmObj.getValue() |
|
3630 | 3628 | self.specGgraphftpratio.setText(str(value)) |
|
3631 | 3629 | |
|
3632 | 3630 | opObj = puObj.getOperationObj(name='Noise') |
|
3633 | 3631 | |
|
3634 | 3632 | if opObj == None: |
|
3635 | 3633 | self.specGraphCebRTInoise.setCheckState(0) |
|
3636 | 3634 | self.specGraphSaveRTInoise.setCheckState(0) |
|
3637 | 3635 | self.specGraphftpRTInoise.setCheckState(0) |
|
3638 | 3636 | else: |
|
3639 | 3637 | self.specGraphCebRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3640 | 3638 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3641 | 3639 | if parmObj == None: |
|
3642 | 3640 | self.specGgraphChannelList.clear() |
|
3643 | 3641 | else: |
|
3644 | 3642 | value = opObj.getParameterValue(parameterName='channelList') |
|
3645 | 3643 | channelListRTINoise = str(value)[1:-1] |
|
3646 | 3644 | self.specGgraphChannelList.setText(channelListRTINoise) |
|
3647 | 3645 | self.specGgraphChannelList.setEnabled(True) |
|
3648 | 3646 | |
|
3649 | 3647 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3650 | 3648 | if parmObj == None: |
|
3651 | 3649 | self.specGgraphTminTmax.clear() |
|
3652 | 3650 | else: |
|
3653 | 3651 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3654 | 3652 | value1 = str(value1) |
|
3655 | 3653 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3656 | 3654 | value2 = str(value2) |
|
3657 | 3655 | value = value1 + "," + value2 |
|
3658 | 3656 | self.specGgraphTminTmax.setText(value) |
|
3659 | 3657 | self.specGgraphTminTmax.setEnabled(True) |
|
3660 | 3658 | |
|
3661 | 3659 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3662 | 3660 | if parmObj == None: |
|
3663 | 3661 | self.specGgraphTimeRange.clear() |
|
3664 | 3662 | else: |
|
3665 | 3663 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3666 | 3664 | value1 = str(value1) |
|
3667 | 3665 | self.specGgraphTimeRange.setText(value1) |
|
3668 | 3666 | self.specGgraphTimeRange.setEnabled(True) |
|
3669 | 3667 | |
|
3670 | 3668 | |
|
3671 | 3669 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3672 | 3670 | if parmObj == None: |
|
3673 | 3671 | self.specGgraphDbsrange.clear() |
|
3674 | 3672 | else: |
|
3675 | 3673 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3676 | 3674 | value1 = str(value1) |
|
3677 | 3675 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3678 | 3676 | value2 = str(value2) |
|
3679 | 3677 | value = value1 + "," + value2 |
|
3680 | 3678 | self.specGgraphDbsrange.setText(value) |
|
3681 | 3679 | self.specGgraphDbsrange.setEnabled(True) |
|
3682 | 3680 | |
|
3683 | 3681 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3684 | 3682 | if parmObj == None: |
|
3685 | 3683 | self.specGraphSaveRTInoise.setCheckState(0) |
|
3686 | 3684 | else: |
|
3687 | 3685 | self.specGraphSaveRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3688 | 3686 | |
|
3689 | 3687 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3690 | 3688 | if parmObj == None: |
|
3691 | 3689 | self.specGraphftpRTInoise.setCheckState(0) |
|
3692 | 3690 | else: |
|
3693 | 3691 | self.specGraphftpRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3694 | 3692 | |
|
3695 | 3693 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3696 | 3694 | if parmObj: |
|
3697 | 3695 | value = parmObj.getValue() |
|
3698 | 3696 | self.specGraphPath.setText(value) |
|
3699 | 3697 | |
|
3700 | 3698 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3701 | 3699 | if parmObj: |
|
3702 | 3700 | value = parmObj.getValue() |
|
3703 | 3701 | self.specGgraphftpratio.setText(str(value)) |
|
3704 | 3702 | |
|
3705 | 3703 | opObj = puObj.getOperationObj(name='SpectraWriter') |
|
3706 | 3704 | if opObj == None: |
|
3707 | 3705 | self.specOutputPath.clear() |
|
3708 | 3706 | self.specOutputblocksperfile.clear() |
|
3709 | 3707 | else: |
|
3710 | 3708 | value = opObj.getParameterObj(parameterName='path') |
|
3711 | 3709 | if value == None: |
|
3712 | 3710 | self.specOutputPath.clear() |
|
3713 | 3711 | else: |
|
3714 | 3712 | value = opObj.getParameterValue(parameterName='path') |
|
3715 | 3713 | path = str(value) |
|
3716 | 3714 | self.specOutputPath.setText(path) |
|
3717 | 3715 | value = opObj.getParameterObj(parameterName='blocksPerFile') |
|
3718 | 3716 | if value == None: |
|
3719 | 3717 | self.specOutputblocksperfile.clear() |
|
3720 | 3718 | else: |
|
3721 | 3719 | value = opObj.getParameterValue(parameterName='blocksPerFile') |
|
3722 | 3720 | blocksperfile = str(value) |
|
3723 | 3721 | self.specOutputblocksperfile.setText(blocksperfile) |
|
3724 | 3722 | |
|
3725 | 3723 | return |
|
3726 | 3724 | |
|
3727 | 3725 | def __refreshSpectraHeisWindow(self, puObj): |
|
3728 | 3726 | |
|
3729 | 3727 | opObj = puObj.getOperationObj(name="IncohInt4SpectraHeis") |
|
3730 | 3728 | if opObj == None: |
|
3731 | 3729 | self.specHeisOpIncoherent.clear() |
|
3732 | 3730 | self.specHeisOpCebIncoherent.setCheckState(0) |
|
3733 | 3731 | else: |
|
3734 | 3732 | for parmObj in opObj.getParameterObjList(): |
|
3735 | 3733 | if parmObj.name == 'timeInterval': |
|
3736 |
value = opObj.getParameterValue(parameterName='timeInterval') |
|
|
3737 | value = float(value) | |
|
3734 | value = opObj.getParameterValue(parameterName='timeInterval') | |
|
3738 | 3735 | self.specHeisOpIncoherent.setText(str(value)) |
|
3739 | 3736 | self.specHeisOpIncoherent.setEnabled(True) |
|
3740 | 3737 | self.specHeisOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3741 | 3738 | self.specHeisOpCobIncInt.setCurrentIndex(0) |
|
3742 | 3739 | |
|
3743 | 3740 | # SpectraHeis Graph |
|
3744 | 3741 | |
|
3745 | 3742 | self.specHeisGgraphXminXmax.clear() |
|
3746 | 3743 | self.specHeisGgraphYminYmax.clear() |
|
3747 | 3744 | |
|
3748 | 3745 | self.specHeisGgraphChannelList.clear() |
|
3749 | 3746 | self.specHeisGgraphTminTmax.clear() |
|
3750 | 3747 | self.specHeisGgraphTimeRange.clear() |
|
3751 | 3748 | self.specHeisGgraphftpratio.clear() |
|
3752 | 3749 | |
|
3753 | 3750 | opObj = puObj.getOperationObj(name='SpectraHeisScope') |
|
3754 | 3751 | if opObj == None: |
|
3755 | 3752 | self.specHeisGraphCebSpectraplot.setCheckState(0) |
|
3756 | 3753 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
3757 | 3754 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
3758 | 3755 | else: |
|
3759 | 3756 | operationSpectraHeisScope = "Enable" |
|
3760 | 3757 | self.specHeisGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3761 | 3758 | |
|
3762 | 3759 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3763 | 3760 | if parmObj == None: |
|
3764 | 3761 | self.specHeisGgraphChannelList.clear() |
|
3765 | 3762 | else: |
|
3766 | 3763 | value = opObj.getParameterValue(parameterName='channelList') |
|
3767 | 3764 | channelListSpectraHeisScope = str(value)[1:-1] |
|
3768 | 3765 | self.specHeisGgraphChannelList.setText(channelListSpectraHeisScope) |
|
3769 | 3766 | self.specHeisGgraphChannelList.setEnabled(True) |
|
3770 | 3767 | |
|
3771 | 3768 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3772 | 3769 | if parmObj == None: |
|
3773 | 3770 | self.specHeisGgraphXminXmax.clear() |
|
3774 | 3771 | else: |
|
3775 | 3772 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3776 | 3773 | value1 = str(value1) |
|
3777 | 3774 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3778 | 3775 | value2 = str(value2) |
|
3779 | 3776 | value = value1 + "," + value2 |
|
3780 | 3777 | self.specHeisGgraphXminXmax.setText(value) |
|
3781 | 3778 | self.specHeisGgraphXminXmax.setEnabled(True) |
|
3782 | 3779 | |
|
3783 | 3780 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3784 | 3781 | if parmObj == None: |
|
3785 | 3782 | self.specHeisGgraphYminYmax.clear() |
|
3786 | 3783 | else: |
|
3787 | 3784 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3788 | 3785 | value1 = str(value1) |
|
3789 | 3786 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3790 | 3787 | value2 = str(value2) |
|
3791 | 3788 | value = value1 + "," + value2 |
|
3792 | 3789 | self.specHeisGgraphYminYmax.setText(value) |
|
3793 | 3790 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
3794 | 3791 | |
|
3795 | 3792 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3796 | 3793 | if parmObj == None: |
|
3797 | 3794 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
3798 | 3795 | else: |
|
3799 | 3796 | self.specHeisGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) |
|
3800 | 3797 | |
|
3801 | 3798 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3802 | 3799 | if parmObj == None: |
|
3803 | 3800 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
3804 | 3801 | else: |
|
3805 | 3802 | self.specHeisGraphftpSpectra.setCheckState(QtCore.Qt.Checked) |
|
3806 | 3803 | |
|
3807 | 3804 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3808 | 3805 | if parmObj: |
|
3809 | 3806 | value = parmObj.getValue() |
|
3810 | 3807 | self.specHeisGraphPath.setText(value) |
|
3811 | 3808 | |
|
3812 | 3809 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3813 | 3810 | if parmObj: |
|
3814 | 3811 | value = parmObj.getValue() |
|
3815 | 3812 | self.specHeisGgraphftpratio.setText(str(value)) |
|
3816 | 3813 | |
|
3817 | 3814 | opObj = puObj.getOperationObj(name='RTIfromSpectraHeis') |
|
3818 | 3815 | |
|
3819 | 3816 | if opObj == None: |
|
3820 | 3817 | self.specHeisGraphCebRTIplot.setCheckState(0) |
|
3821 | 3818 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
3822 | 3819 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
3823 | 3820 | else: |
|
3824 | 3821 | self.specHeisGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3825 | 3822 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3826 | 3823 | if parmObj == None: |
|
3827 | 3824 | self.specHeisGgraphChannelList.clear() |
|
3828 | 3825 | else: |
|
3829 | 3826 | value = opObj.getParameterValue(parameterName='channelList') |
|
3830 | 3827 | channelListRTIPlot = str(value)[1:-1] |
|
3831 | 3828 | self.specGgraphChannelList.setText(channelListRTIPlot) |
|
3832 | 3829 | self.specGgraphChannelList.setEnabled(True) |
|
3833 | 3830 | |
|
3834 | 3831 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3835 | 3832 | if parmObj == None: |
|
3836 | 3833 | self.specHeisGgraphTminTmax.clear() |
|
3837 | 3834 | else: |
|
3838 | 3835 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3839 | 3836 | value1 = str(value1) |
|
3840 | 3837 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3841 | 3838 | value2 = str(value2) |
|
3842 | 3839 | value = value1 + "," + value2 |
|
3843 | 3840 | self.specHeisGgraphTminTmax.setText(value) |
|
3844 | 3841 | self.specHeisGgraphTminTmax.setEnabled(True) |
|
3845 | 3842 | |
|
3846 | 3843 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3847 | 3844 | if parmObj == None: |
|
3848 | 3845 | self.specGgraphTimeRange.clear() |
|
3849 | 3846 | else: |
|
3850 | 3847 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3851 | 3848 | value1 = str(value1) |
|
3852 | 3849 | self.specHeisGgraphTimeRange.setText(value1) |
|
3853 | 3850 | self.specHeisGgraphTimeRange.setEnabled(True) |
|
3854 | 3851 | |
|
3855 | 3852 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3856 | 3853 | if parmObj == None: |
|
3857 | 3854 | self.specHeisGgraphYminYmax.clear() |
|
3858 | 3855 | else: |
|
3859 | 3856 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3860 | 3857 | value1 = str(value1) |
|
3861 | 3858 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3862 | 3859 | value2 = str(value2) |
|
3863 | 3860 | value = value1 + "," + value2 |
|
3864 | 3861 | self.specHeisGgraphYminYmax.setText(value) |
|
3865 | 3862 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
3866 | 3863 | |
|
3867 | 3864 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3868 | 3865 | if parmObj == None: |
|
3869 | 3866 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
3870 | 3867 | else: |
|
3871 | 3868 | self.specHeisGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3872 | 3869 | |
|
3873 | 3870 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3874 | 3871 | if parmObj == None: |
|
3875 | 3872 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
3876 | 3873 | else: |
|
3877 | 3874 | self.specHeisGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3878 | 3875 | |
|
3879 | 3876 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3880 | 3877 | if parmObj: |
|
3881 | 3878 | value = parmObj.getValue() |
|
3882 | 3879 | self.specHeisGraphPath.setText(value) |
|
3883 | 3880 | |
|
3884 | 3881 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3885 | 3882 | if parmObj: |
|
3886 | 3883 | value = parmObj.getValue() |
|
3887 | 3884 | self.specHeisGgraphftpratio.setText(str(value)) |
|
3888 | 3885 | |
|
3889 | 3886 | # outputSpectraHeisWrite |
|
3890 | 3887 | opObj = puObj.getOperationObj(name='FitsWriter') |
|
3891 | 3888 | if opObj == None: |
|
3892 | 3889 | self.specHeisOutputPath.clear() |
|
3893 | 3890 | self.specHeisOutputblocksperfile.clear() |
|
3894 | 3891 | self.specHeisOutputMetada.clear() |
|
3895 | 3892 | else: |
|
3896 | 3893 | value = opObj.getParameterObj(parameterName='path') |
|
3897 | 3894 | if value == None: |
|
3898 | 3895 | self.specHeisOutputPath.clear() |
|
3899 | 3896 | else: |
|
3900 | 3897 | value = opObj.getParameterValue(parameterName='path') |
|
3901 | 3898 | path = str(value) |
|
3902 | 3899 | self.specHeisOutputPath.setText(path) |
|
3903 | 3900 | value = opObj.getParameterObj(parameterName='dataBlocksPerFile') |
|
3904 | 3901 | if value == None: |
|
3905 | 3902 | self.specHeisOutputblocksperfile.clear() |
|
3906 | 3903 | else: |
|
3907 | 3904 | value = opObj.getParameterValue(parameterName='dataBlocksPerFile') |
|
3908 | 3905 | blocksperfile = str(value) |
|
3909 | 3906 | self.specHeisOutputblocksperfile.setText(blocksperfile) |
|
3910 | 3907 | value = opObj.getParameterObj(parameterName='metadatafile') |
|
3911 | 3908 | if value == None: |
|
3912 | 3909 | self.specHeisOutputMetada.clear() |
|
3913 | 3910 | else: |
|
3914 | 3911 | value = opObj.getParameterValue(parameterName='metadatafile') |
|
3915 | 3912 | metadata_file = str(value) |
|
3916 | 3913 | self.specHeisOutputMetada.setText(metadata_file) |
|
3917 | 3914 | |
|
3918 | 3915 | return |
|
3919 | 3916 | |
|
3920 | 3917 | def __refreshCorrelationWindow(self, puObj): |
|
3921 | 3918 | pass |
|
3922 | 3919 | |
|
3923 | 3920 | def refreshPUWindow(self, puObj): |
|
3924 | 3921 | |
|
3925 | 3922 | if puObj.datatype == 'Voltage': |
|
3926 | 3923 | self.__refreshVoltageWindow(puObj) |
|
3927 | 3924 | |
|
3928 | 3925 | if puObj.datatype == 'Spectra': |
|
3929 | 3926 | self.__refreshSpectraWindow(puObj) |
|
3930 | 3927 | |
|
3931 | 3928 | if puObj.datatype == 'SpectraHeis': |
|
3932 | 3929 | self.__refreshSpectraHeisWindow(puObj) |
|
3933 | 3930 | |
|
3934 | 3931 | def refreshProjectProperties(self, projectObjView): |
|
3935 | 3932 | |
|
3936 | 3933 | propertyBuffObj = PropertyBuffer() |
|
3937 | 3934 | name = projectObjView.name |
|
3938 | 3935 | |
|
3939 | 3936 | propertyBuffObj.append("Properties", "Name", projectObjView.name), |
|
3940 | 3937 | propertyBuffObj.append("Properties", "Description", projectObjView.description) |
|
3941 | 3938 | propertyBuffObj.append("Properties", "Workspace", self.pathWorkSpace) |
|
3942 | 3939 | |
|
3943 | 3940 | readUnitObj = projectObjView.getReadUnitObj() |
|
3944 | 3941 | runOperationObj = readUnitObj.getOperationObj(name='run') |
|
3945 | 3942 | |
|
3946 | 3943 | for thisParmObj in runOperationObj.getParameterObjList(): |
|
3947 | 3944 | propertyBuffObj.append("Reading parms", thisParmObj.name, str(thisParmObj.getValue())) |
|
3948 | 3945 | |
|
3949 | 3946 | propertiesModel = propertyBuffObj.getPropertyModel() |
|
3950 | 3947 | |
|
3951 | 3948 | self.treeProjectProperties.setModel(propertiesModel) |
|
3952 | 3949 | self.treeProjectProperties.expandAll() |
|
3953 | 3950 | self.treeProjectProperties.resizeColumnToContents(0) |
|
3954 | 3951 | self.treeProjectProperties.resizeColumnToContents(1) |
|
3955 | 3952 | |
|
3956 | 3953 | def refreshPUProperties(self, puObjView): |
|
3957 | 3954 | |
|
3958 | 3955 | ############ FTP CONFIG ################################ |
|
3959 | 3956 | #Deleting FTP Conf. This processing unit have not got any |
|
3960 | 3957 | #FTP configuration by default |
|
3961 | 3958 | if puObjView.id in self.__puLocalFolder2FTP.keys(): |
|
3962 | 3959 | self.__puLocalFolder2FTP.pop(puObjView.id) |
|
3963 | 3960 | ######################################################## |
|
3964 | 3961 | |
|
3965 | 3962 | propertyBuffObj = PropertyBuffer() |
|
3966 | 3963 | |
|
3967 | 3964 | for thisOp in puObjView.getOperationObjList(): |
|
3968 | 3965 | |
|
3969 | 3966 | operationName = thisOp.name |
|
3970 | 3967 | |
|
3971 | 3968 | if operationName == 'run': |
|
3972 | 3969 | operationName = 'Properties' |
|
3973 | 3970 | |
|
3974 | 3971 | else: |
|
3975 | 3972 | if not thisOp.getParameterObjList(): |
|
3976 | 3973 | propertyBuffObj.append(operationName, '--', '--') |
|
3977 | 3974 | continue |
|
3978 | 3975 | |
|
3979 | 3976 | for thisParmObj in thisOp.getParameterObjList(): |
|
3980 | 3977 | propertyBuffObj.append(operationName, thisParmObj.name, str(thisParmObj.getValue())) |
|
3981 | 3978 | |
|
3982 | 3979 | ############ FTP CONFIG ################################ |
|
3983 | 3980 | if thisParmObj.name == "ftp_wei" and thisParmObj.getValue(): |
|
3984 | 3981 | value = thisParmObj.getValue() |
|
3985 | 3982 | self.temporalFTP.ftp_wei = value |
|
3986 | 3983 | |
|
3987 | 3984 | if thisParmObj.name == "exp_code" and thisParmObj.getValue(): |
|
3988 | 3985 | value = thisParmObj.getValue() |
|
3989 | 3986 | self.temporalFTP.exp_code = value |
|
3990 | 3987 | |
|
3991 | 3988 | if thisParmObj.name == "sub_exp_code" and thisParmObj.getValue(): |
|
3992 | 3989 | value = thisParmObj.getValue() |
|
3993 | 3990 | self.temporalFTP.sub_exp_code = value |
|
3994 | 3991 | |
|
3995 | 3992 | if thisParmObj.name == "plot_pos" and thisParmObj.getValue(): |
|
3996 | 3993 | value = thisParmObj.getValue() |
|
3997 | 3994 | self.temporalFTP.plot_pos = value |
|
3998 | 3995 | |
|
3999 | 3996 | if thisParmObj.name == 'ftp' and thisParmObj.getValue(): |
|
4000 | 3997 | figpathObj = thisOp.getParameterObj('figpath') |
|
4001 | 3998 | if figpathObj: |
|
4002 | 3999 | self.__puLocalFolder2FTP[puObjView.id] = figpathObj.getValue() |
|
4003 | 4000 | |
|
4004 | 4001 | ######################################################## |
|
4005 | 4002 | |
|
4006 | 4003 | propertiesModel = propertyBuffObj.getPropertyModel() |
|
4007 | 4004 | |
|
4008 | 4005 | self.treeProjectProperties.setModel(propertiesModel) |
|
4009 | 4006 | self.treeProjectProperties.expandAll() |
|
4010 | 4007 | self.treeProjectProperties.resizeColumnToContents(0) |
|
4011 | 4008 | self.treeProjectProperties.resizeColumnToContents(1) |
|
4012 | 4009 | |
|
4013 | 4010 | def refreshGraphicsId(self): |
|
4014 | 4011 | |
|
4015 | 4012 | projectObj = self.getSelectedProjectObj() |
|
4016 | 4013 | |
|
4017 | 4014 | if not projectObj: |
|
4018 | 4015 | return |
|
4019 | 4016 | |
|
4020 | 4017 | for idPU, puObj in projectObj.procUnitConfObjDict.items(): |
|
4021 | 4018 | |
|
4022 | 4019 | for opObj in puObj.getOperationObjList(): |
|
4023 | 4020 | |
|
4024 | 4021 | if opObj.name not in ('Scope', 'SpectraPlot', 'CrossSpectraPlot', 'RTIPlot', 'CoherenceMap', 'PowerProfilePlot', 'Noise', 'SpectraHeisScope', 'RTIfromSpectraHeis'): |
|
4025 | 4022 | continue |
|
4026 | 4023 | |
|
4027 | 4024 | opObj.changeParameter(name='id', value=opObj.id, format='int') |
|
4028 | 4025 | |
|
4029 | 4026 | def on_click(self, index): |
|
4030 | 4027 | |
|
4031 | 4028 | self.selectedItemTree = self.projectExplorerModel.itemFromIndex(index) |
|
4032 | 4029 | |
|
4033 | 4030 | projectObjView = self.getSelectedProjectObj() |
|
4034 | 4031 | |
|
4035 | 4032 | if not projectObjView: |
|
4036 | 4033 | return |
|
4037 | 4034 | |
|
4038 | 4035 | self.create = False |
|
4039 | 4036 | selectedObjView = self.getSelectedItemObj() |
|
4040 | 4037 | |
|
4041 | 4038 | #A project has been selected |
|
4042 | 4039 | if projectObjView == selectedObjView: |
|
4043 | 4040 | |
|
4044 | 4041 | self.refreshProjectWindow(projectObjView) |
|
4045 | 4042 | self.refreshProjectProperties(projectObjView) |
|
4046 | 4043 | |
|
4047 | 4044 | self.tabProject.setEnabled(True) |
|
4048 | 4045 | self.tabVoltage.setEnabled(False) |
|
4049 | 4046 | self.tabSpectra.setEnabled(False) |
|
4050 | 4047 | self.tabCorrelation.setEnabled(False) |
|
4051 | 4048 | self.tabSpectraHeis.setEnabled(False) |
|
4052 | 4049 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
4053 | 4050 | |
|
4054 | 4051 | return |
|
4055 | 4052 | |
|
4056 | 4053 | #A processing unit has been selected |
|
4057 | 4054 | voltEnable = False |
|
4058 | 4055 | specEnable = False |
|
4059 | 4056 | corrEnable = False |
|
4060 | 4057 | specHeisEnable = False |
|
4061 | 4058 | tabSelected = self.tabProject |
|
4062 | 4059 | |
|
4063 | 4060 | puObj = selectedObjView |
|
4064 | 4061 | |
|
4065 | 4062 | self.refreshPUWindow(puObj) |
|
4066 | 4063 | self.refreshPUProperties(puObj) |
|
4067 | 4064 | self.showtabPUCreated(puObj.datatype) |
|
4068 | 4065 | |
|
4069 | 4066 | def on_right_click(self, pos): |
|
4070 | 4067 | |
|
4071 | 4068 | self.menu = QtGui.QMenu() |
|
4072 | 4069 | quitAction0 = self.menu.addAction("Create a New Project") |
|
4073 | 4070 | quitAction1 = self.menu.addAction("Create a New Processing Unit") |
|
4074 | 4071 | quitAction2 = self.menu.addAction("Delete Item") |
|
4075 | 4072 | quitAction3 = self.menu.addAction("Quit") |
|
4076 | 4073 | |
|
4077 | 4074 | if len(self.__itemTreeDict) == 0: |
|
4078 | 4075 | quitAction2.setEnabled(False) |
|
4079 | 4076 | else: |
|
4080 | 4077 | quitAction2.setEnabled(True) |
|
4081 | 4078 | |
|
4082 | 4079 | action = self.menu.exec_(self.mapToGlobal(pos)) |
|
4083 | 4080 | |
|
4084 | 4081 | if action == quitAction0: |
|
4085 | 4082 | self. setInputsProject_View() |
|
4086 | 4083 | self.create = True |
|
4087 | 4084 | |
|
4088 | 4085 | if action == quitAction1: |
|
4089 | 4086 | if len(self.__projectObjDict) == 0: |
|
4090 | 4087 | outputstr = "You need to create a Project before adding a Processing Unit" |
|
4091 | 4088 | self.console.clear() |
|
4092 | 4089 | self.console.append(outputstr) |
|
4093 | 4090 | return 0 |
|
4094 | 4091 | else: |
|
4095 | 4092 | self.addPUWindow() |
|
4096 | 4093 | self.console.clear() |
|
4097 | 4094 | self.console.append("Please, Choose the type of Processing Unit") |
|
4098 | 4095 | # self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") |
|
4099 | 4096 | # self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") |
|
4100 | 4097 | # self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") |
|
4101 | 4098 | |
|
4102 | 4099 | if action == quitAction2: |
|
4103 | 4100 | index = self.selectedItemTree |
|
4104 | 4101 | try: |
|
4105 | 4102 | index.parent() |
|
4106 | 4103 | except: |
|
4107 | 4104 | self.console.append('Please first select a Project or Processing Unit') |
|
4108 | 4105 | return 0 |
|
4109 | 4106 | # print index.parent(),index |
|
4110 | 4107 | if index.parent() == None: |
|
4111 | 4108 | self.projectExplorerModel.removeRow(index.row()) |
|
4112 | 4109 | else: |
|
4113 | 4110 | index.parent().removeRow(index.row()) |
|
4114 | 4111 | self.removeItemTreeFromProject() |
|
4115 | 4112 | self.console.clear() |
|
4116 | 4113 | # for i in self.projectExplorerTree.selectionModel().selection().indexes(): |
|
4117 | 4114 | # print i.row() |
|
4118 | 4115 | |
|
4119 | 4116 | if action == quitAction3: |
|
4120 | 4117 | self.close() |
|
4121 | 4118 | return 0 |
|
4122 | 4119 | |
|
4123 | 4120 | def createProjectView(self, id): |
|
4124 | 4121 | |
|
4125 | 4122 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
4126 | 4123 | id = str(id) |
|
4127 | 4124 | projectParms = self.__getParmsFromProjectWindow() |
|
4128 | 4125 | |
|
4129 | 4126 | if not projectParms.isValid(): |
|
4130 | 4127 | return None |
|
4131 | 4128 | |
|
4132 | 4129 | projectObjView = Project() |
|
4133 | 4130 | projectObjView.setup(id=id, name=projectParms.name, description=projectParms.description) |
|
4134 | 4131 | |
|
4135 | 4132 | self.__projectObjDict[id] = projectObjView |
|
4136 | 4133 | self.addProject2ProjectExplorer(id=id, name=projectObjView.name) |
|
4137 | 4134 | |
|
4138 | 4135 | return projectObjView |
|
4139 | 4136 | |
|
4140 | 4137 | def updateProjectView(self): |
|
4141 | 4138 | |
|
4142 | 4139 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
4143 | 4140 | |
|
4144 | 4141 | projectParms = self.__getParmsFromProjectWindow() |
|
4145 | 4142 | |
|
4146 | 4143 | if not projectParms.isValid(): |
|
4147 | 4144 | return None |
|
4148 | 4145 | |
|
4149 | 4146 | projectObjView = self.getSelectedProjectObj() |
|
4150 | 4147 | |
|
4151 | 4148 | if not projectObjView: |
|
4152 | 4149 | self.console.append("Please select a project before update it") |
|
4153 | 4150 | return None |
|
4154 | 4151 | |
|
4155 | 4152 | projectObjView.update(name=projectParms.name, description=projectParms.description) |
|
4156 | 4153 | |
|
4157 | 4154 | return projectObjView |
|
4158 | 4155 | |
|
4159 | 4156 | def createReadUnitView(self, projectObjView): |
|
4160 | 4157 | |
|
4161 | 4158 | # project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
4162 | 4159 | |
|
4163 | 4160 | projectParms = self.__getParmsFromProjectWindow() |
|
4164 | 4161 | |
|
4165 | 4162 | if not projectParms.isValid(): |
|
4166 | 4163 | return None |
|
4167 | 4164 | |
|
4168 | 4165 | if projectParms.datatype in ("Voltage", "Spectra", "Fits"): |
|
4169 | 4166 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, |
|
4170 | 4167 | path=projectParms.dpath, |
|
4171 | 4168 | startDate=projectParms.startDate, |
|
4172 | 4169 | endDate=projectParms.endDate, |
|
4173 | 4170 | startTime=projectParms.startTime, |
|
4174 | 4171 | endTime=projectParms.endTime, |
|
4175 | 4172 | online=projectParms.online, |
|
4176 | 4173 | walk=projectParms.walk |
|
4177 | 4174 | ) |
|
4178 | 4175 | |
|
4179 | 4176 | if projectParms.set: |
|
4180 | 4177 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") |
|
4181 | 4178 | |
|
4182 | 4179 | if projectParms.delay: |
|
4183 | 4180 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4184 | 4181 | |
|
4185 | 4182 | if projectParms.expLabel: |
|
4186 | 4183 | readUnitConfObj.addParameter(name="expLabel", value=projectParms.expLabel) |
|
4187 | 4184 | |
|
4188 | 4185 | readUnitConfObj.addOperation(name="printInfo") |
|
4189 | 4186 | |
|
4190 | 4187 | if projectParms.datatype == "USRP": |
|
4191 | 4188 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, |
|
4192 | 4189 | path=projectParms.dpath, |
|
4193 | 4190 | startDate=projectParms.startDate, |
|
4194 | 4191 | endDate=projectParms.endDate, |
|
4195 | 4192 | startTime=projectParms.startTime, |
|
4196 | 4193 | endTime=projectParms.endTime, |
|
4197 | 4194 | online=projectParms.online, |
|
4198 | 4195 | ippKm=projectParms.ippKm |
|
4199 | 4196 | ) |
|
4200 | 4197 | |
|
4201 | 4198 | if projectParms.delay: |
|
4202 | 4199 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4203 | 4200 | |
|
4204 | 4201 | return readUnitConfObj |
|
4205 | 4202 | |
|
4206 | 4203 | def updateReadUnitView(self, projectObjView, idReadUnit): |
|
4207 | 4204 | |
|
4208 | 4205 | # project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk , set = self.getParmsFromProjectWindow() |
|
4209 | 4206 | |
|
4210 | 4207 | readUnitConfObj = projectObjView.getProcUnitObj(idReadUnit) |
|
4211 | 4208 | |
|
4212 | 4209 | projectParms = self.__getParmsFromProjectWindow() |
|
4213 | 4210 | |
|
4214 | 4211 | if not projectParms.isValid(): |
|
4215 | 4212 | return None |
|
4216 | 4213 | |
|
4217 | 4214 | if projectParms.datatype in ["Voltage", "Spectra", "Fits"]: |
|
4218 | 4215 | readUnitConfObj.update(datatype=projectParms.datatype, |
|
4219 | 4216 | path=projectParms.dpath, |
|
4220 | 4217 | startDate=projectParms.startDate, |
|
4221 | 4218 | endDate=projectParms.endDate, |
|
4222 | 4219 | startTime=projectParms.startTime, |
|
4223 | 4220 | endTime=projectParms.endTime, |
|
4224 | 4221 | online=projectParms.online, |
|
4225 | 4222 | walk=projectParms.walk |
|
4226 | 4223 | ) |
|
4227 | 4224 | if projectParms.set: |
|
4228 | 4225 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") |
|
4229 | 4226 | |
|
4230 | 4227 | if projectParms.delay: |
|
4231 | 4228 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4232 | 4229 | |
|
4233 | 4230 | if projectParms.expLabel: |
|
4234 | 4231 | readUnitConfObj.addParameter(name="expLabel", value=projectParms.expLabel) |
|
4235 | 4232 | |
|
4236 | 4233 | readUnitConfObj.addOperation(name="printInfo") |
|
4237 | 4234 | |
|
4238 | 4235 | if projectParms.datatype == "USRP": |
|
4239 | 4236 | readUnitConfObj.update(datatype=projectParms.datatype, |
|
4240 | 4237 | path=projectParms.dpath, |
|
4241 | 4238 | startDate=projectParms.startDate, |
|
4242 | 4239 | endDate=projectParms.endDate, |
|
4243 | 4240 | startTime=projectParms.startTime, |
|
4244 | 4241 | endTime=projectParms.endTime, |
|
4245 | 4242 | online=projectParms.online, |
|
4246 | 4243 | ippKm=projectParms.ippKm |
|
4247 | 4244 | ) |
|
4248 | 4245 | |
|
4249 | 4246 | if projectParms.delay: |
|
4250 | 4247 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4251 | 4248 | |
|
4252 | 4249 | return readUnitConfObj |
|
4253 | 4250 | |
|
4254 | 4251 | def createProcUnitView(self, projectObjView, datatype, inputId): |
|
4255 | 4252 | |
|
4256 | 4253 | procUnitConfObj = projectObjView.addProcUnit(datatype=datatype, inputId=inputId) |
|
4257 | 4254 | |
|
4258 | 4255 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
4259 | 4256 | |
|
4260 | 4257 | return procUnitConfObj |
|
4261 | 4258 | |
|
4262 | 4259 | def updateProcUnitView(self, id): |
|
4263 | 4260 | |
|
4264 | 4261 | pass |
|
4265 | 4262 | |
|
4266 | 4263 | def addPUWindow(self): |
|
4267 | 4264 | |
|
4268 | 4265 | self.configUPWindowObj = UnitProcessWindow(self) |
|
4269 | 4266 | fatherObj = self.getSelectedItemObj() |
|
4270 | 4267 | try: |
|
4271 | 4268 | fatherObj.getElementName() |
|
4272 | 4269 | except: |
|
4273 | 4270 | self.console.append("First left click on Project or Processing Unit") |
|
4274 | 4271 | return 0 |
|
4275 | 4272 | |
|
4276 | 4273 | if fatherObj.getElementName() == 'Project': |
|
4277 | 4274 | readUnitConfObj = fatherObj.getReadUnitObj() |
|
4278 | 4275 | self.configUPWindowObj.dataTypeProject = str(readUnitConfObj.datatype) |
|
4279 | 4276 | |
|
4280 | 4277 | self.configUPWindowObj.getfromWindowList.append(fatherObj) |
|
4281 | 4278 | self.configUPWindowObj.loadTotalList() |
|
4282 | 4279 | self.configUPWindowObj.show() |
|
4283 | 4280 | self.configUPWindowObj.closed.connect(self.createPUWindow) |
|
4284 | 4281 | |
|
4285 | 4282 | def createPUWindow(self): |
|
4286 | 4283 | |
|
4287 | 4284 | if not self.configUPWindowObj.create: |
|
4288 | 4285 | return |
|
4289 | 4286 | |
|
4290 | 4287 | fatherObj = self.configUPWindowObj.getFromWindow |
|
4291 | 4288 | datatype = self.configUPWindowObj.typeofUP |
|
4292 | 4289 | |
|
4293 | 4290 | if fatherObj.getElementName() == 'Project': |
|
4294 | 4291 | inputId = fatherObj.getReadUnitId() |
|
4295 | 4292 | projectObjView = fatherObj |
|
4296 | 4293 | else: |
|
4297 | 4294 | inputId = fatherObj.getId() |
|
4298 | 4295 | projectObjView = self.getSelectedProjectObj() |
|
4299 | 4296 | |
|
4300 | 4297 | if not projectObjView: |
|
4301 | 4298 | return |
|
4302 | 4299 | |
|
4303 | 4300 | puObj = self.createProcUnitView(projectObjView, datatype, inputId) |
|
4304 | 4301 | |
|
4305 | 4302 | self.addPU2ProjectExplorer(puObj) |
|
4306 | 4303 | |
|
4307 | 4304 | self.showtabPUCreated(datatype) |
|
4308 | 4305 | |
|
4309 | 4306 | self.clearPUWindow(datatype) |
|
4310 | 4307 | |
|
4311 | 4308 | self.showPUinitView() |
|
4312 | 4309 | |
|
4313 | 4310 | def addFTPConf2Operation(self, puObj, opObj): |
|
4314 | 4311 | |
|
4315 | 4312 | if not self.temporalFTP.create: |
|
4316 | 4313 | self.temporalFTP.setwithoutconfiguration() |
|
4317 | 4314 | |
|
4318 | 4315 | # opObj.addParameter(name='server', value=self.temporalFTP.server, format='str') |
|
4319 | 4316 | # opObj.addParameter(name='remotefolder', value=self.temporalFTP.remotefolder, format='str') |
|
4320 | 4317 | # opObj.addParameter(name='username', value=self.temporalFTP.username, format='str') |
|
4321 | 4318 | # opObj.addParameter(name='password', value=self.temporalFTP.password, format='str') |
|
4322 | 4319 | |
|
4323 | 4320 | if self.temporalFTP.ftp_wei: |
|
4324 | 4321 | opObj.addParameter(name='ftp_wei', value=int(self.temporalFTP.ftp_wei), format='int') |
|
4325 | 4322 | if self.temporalFTP.exp_code: |
|
4326 | 4323 | opObj.addParameter(name='exp_code', value=int(self.temporalFTP.exp_code), format='int') |
|
4327 | 4324 | if self.temporalFTP.sub_exp_code: |
|
4328 | 4325 | opObj.addParameter(name='sub_exp_code', value=int(self.temporalFTP.sub_exp_code), format='int') |
|
4329 | 4326 | if self.temporalFTP.plot_pos: |
|
4330 | 4327 | opObj.addParameter(name='plot_pos', value=int(self.temporalFTP.plot_pos), format='int') |
|
4331 | 4328 | |
|
4332 | 4329 | # def __checkFTPProcUnit(self, projectObj, localfolder): |
|
4333 | 4330 | # |
|
4334 | 4331 | # puId = None |
|
4335 | 4332 | # puObj = None |
|
4336 | 4333 | # |
|
4337 | 4334 | # for thisPuId, thisPuObj in projectObj.procUnitItems(): |
|
4338 | 4335 | # |
|
4339 | 4336 | # if not thisPuObj.name == "SendToServer": |
|
4340 | 4337 | # continue |
|
4341 | 4338 | # |
|
4342 | 4339 | # opObj = thisPuObj.getOperationObj(name='run') |
|
4343 | 4340 | # |
|
4344 | 4341 | # parmObj = opObj.getParameterObj('localfolder') |
|
4345 | 4342 | # |
|
4346 | 4343 | # #localfolder parameter should always be set, if it is not set then ProcUnit should be removed |
|
4347 | 4344 | # if not parmObj: |
|
4348 | 4345 | # projectObj.removeProcUnit(thisPuId) |
|
4349 | 4346 | # continue |
|
4350 | 4347 | # |
|
4351 | 4348 | # thisLocalfolder = parmObj.getValue() |
|
4352 | 4349 | # |
|
4353 | 4350 | # if localfolder != thisLocalfolder: |
|
4354 | 4351 | # continue |
|
4355 | 4352 | # |
|
4356 | 4353 | # puId = thisPuId |
|
4357 | 4354 | # puObj = thisPuObj |
|
4358 | 4355 | # break |
|
4359 | 4356 | # |
|
4360 | 4357 | # return puObj |
|
4361 | 4358 | |
|
4362 | 4359 | def createFTPProcUnitView(self): |
|
4363 | 4360 | |
|
4364 | 4361 | if not self.temporalFTP.create: |
|
4365 | 4362 | self.temporalFTP.setwithoutconfiguration() |
|
4366 | 4363 | |
|
4367 | 4364 | projectObj = self.getSelectedProjectObj() |
|
4368 | 4365 | |
|
4369 | 4366 | if not projectObj: |
|
4370 | 4367 | return |
|
4371 | 4368 | |
|
4372 | 4369 | self.removeAllFTPProcUnitView(projectObj) |
|
4373 | 4370 | |
|
4374 | 4371 | if not self.__puLocalFolder2FTP: |
|
4375 | 4372 | return |
|
4376 | 4373 | |
|
4377 | 4374 | folderList = ",".join(self.__puLocalFolder2FTP.values()) |
|
4378 | 4375 | |
|
4379 | 4376 | procUnitConfObj = projectObj.addProcUnit(name="SendToServer") |
|
4380 | 4377 | |
|
4381 | 4378 | procUnitConfObj.addParameter(name='server', value=self.temporalFTP.server, format='str') |
|
4382 | 4379 | procUnitConfObj.addParameter(name='username', value=self.temporalFTP.username, format='str') |
|
4383 | 4380 | procUnitConfObj.addParameter(name='password', value=self.temporalFTP.password, format='str') |
|
4384 | 4381 | procUnitConfObj.addParameter(name='localfolder', value=folderList, format='list') |
|
4385 | 4382 | procUnitConfObj.addParameter(name='remotefolder', value=self.temporalFTP.remotefolder, format='str') |
|
4386 | 4383 | procUnitConfObj.addParameter(name='ext', value=self.temporalFTP.extension, format='str') |
|
4387 | 4384 | procUnitConfObj.addParameter(name='period', value=self.temporalFTP.period, format='int') |
|
4388 | 4385 | procUnitConfObj.addParameter(name='protocol', value=self.temporalFTP.protocol, format='str') |
|
4389 | 4386 | |
|
4390 | 4387 | procUnitConfObj.addParameter(name='ftp_wei', value=self.temporalFTP.ftp_wei, format='int') |
|
4391 | 4388 | procUnitConfObj.addParameter(name='exp_code', value=self.temporalFTP.exp_code, format='int') |
|
4392 | 4389 | procUnitConfObj.addParameter(name='sub_exp_code', value=self.temporalFTP.sub_exp_code, format='int') |
|
4393 | 4390 | procUnitConfObj.addParameter(name='plot_pos', value=self.temporalFTP.plot_pos, format='int') |
|
4394 | 4391 | |
|
4395 | 4392 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
4396 | 4393 | |
|
4397 | 4394 | def removeAllFTPProcUnitView(self, projectObj): |
|
4398 | 4395 | |
|
4399 | 4396 | for thisPuId, thisPuObj in projectObj.procUnitItems(): |
|
4400 | 4397 | |
|
4401 | 4398 | if not thisPuObj.name == "SendToServer": |
|
4402 | 4399 | continue |
|
4403 | 4400 | |
|
4404 | 4401 | projectObj.removeProcUnit(thisPuId) |
|
4405 | 4402 | |
|
4406 | 4403 | if thisPuId not in self.__puObjDict.keys(): |
|
4407 | 4404 | continue |
|
4408 | 4405 | |
|
4409 | 4406 | self.__puObjDict.pop(thisPuId) |
|
4410 | 4407 | |
|
4411 | 4408 | def showPUinitView(self): |
|
4412 | 4409 | |
|
4413 | 4410 | self.propertiesModel = TreeModel() |
|
4414 | 4411 | self.propertiesModel.initPUVoltageView() |
|
4415 | 4412 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
4416 | 4413 | self.treeProjectProperties.expandAll() |
|
4417 | 4414 | self.treeProjectProperties.allColumnsShowFocus() |
|
4418 | 4415 | self.treeProjectProperties.resizeColumnToContents(1) |
|
4419 | 4416 | |
|
4420 | 4417 | def saveFTPFromOpObj(self, operationObj): |
|
4421 | 4418 | |
|
4422 | 4419 | if operationObj.name != "SendByFTP": |
|
4423 | 4420 | return |
|
4424 | 4421 | |
|
4425 | 4422 | server = operationObj.getParameterValue("server") |
|
4426 | 4423 | username = operationObj.getParameterValue("username") |
|
4427 | 4424 | password = operationObj.getParameterValue("password") |
|
4428 | 4425 | localfolder = operationObj.getParameterValue("localfolder") |
|
4429 | 4426 | remotefolder = operationObj.getParameterValue("remotefolder") |
|
4430 | 4427 | ext = operationObj.getParameterValue("ext") |
|
4431 | 4428 | period = operationObj.getParameterValue("period") |
|
4432 | 4429 | |
|
4433 | 4430 | self.temporalFTP.save(server=server, |
|
4434 | 4431 | remotefolder=remotefolder, |
|
4435 | 4432 | username=username, |
|
4436 | 4433 | password=password, |
|
4437 | 4434 | localfolder=localfolder, |
|
4438 | 4435 | extension=ext) |
|
4439 | 4436 | |
|
4440 | 4437 | return |
|
4441 | 4438 | |
|
4442 | 4439 | def saveFTPFromProcUnitObj(self, puObj): |
|
4443 | 4440 | |
|
4444 | 4441 | opObj = puObj.getOperationObj(name="run") |
|
4445 | 4442 | |
|
4446 | 4443 | parmObj = opObj.getParameterObj(parameterName="server") |
|
4447 | 4444 | if parmObj == None: |
|
4448 | 4445 | server = 'jro-app.igp.gob.pe' |
|
4449 | 4446 | else: |
|
4450 | 4447 | server = parmObj.getValue() |
|
4451 | 4448 | |
|
4452 | 4449 | parmObj = opObj.getParameterObj(parameterName="remotefolder") |
|
4453 | 4450 | if parmObj == None: |
|
4454 | 4451 | remotefolder = '/home/wmaster/graficos' |
|
4455 | 4452 | else: |
|
4456 | 4453 | remotefolder = parmObj.getValue() |
|
4457 | 4454 | |
|
4458 | 4455 | parmObj = opObj.getParameterObj(parameterName="username") |
|
4459 | 4456 | if parmObj == None: |
|
4460 | 4457 | username = 'wmaster' |
|
4461 | 4458 | else: |
|
4462 | 4459 | username = parmObj.getValue() |
|
4463 | 4460 | |
|
4464 | 4461 | parmObj = opObj.getParameterObj(parameterName="password") |
|
4465 | 4462 | if parmObj == None: |
|
4466 | 4463 | password = 'mst2010vhf' |
|
4467 | 4464 | else: |
|
4468 | 4465 | password = parmObj.getValue() |
|
4469 | 4466 | |
|
4470 | 4467 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") |
|
4471 | 4468 | if parmObj == None: |
|
4472 | 4469 | ftp_wei = 0 |
|
4473 | 4470 | else: |
|
4474 | 4471 | ftp_wei = parmObj.getValue() |
|
4475 | 4472 | |
|
4476 | 4473 | parmObj = opObj.getParameterObj(parameterName="exp_code") |
|
4477 | 4474 | if parmObj == None: |
|
4478 | 4475 | exp_code = 0 |
|
4479 | 4476 | else: |
|
4480 | 4477 | exp_code = parmObj.getValue() |
|
4481 | 4478 | |
|
4482 | 4479 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") |
|
4483 | 4480 | if parmObj == None: |
|
4484 | 4481 | sub_exp_code = 0 |
|
4485 | 4482 | else: |
|
4486 | 4483 | sub_exp_code = parmObj.getValue() |
|
4487 | 4484 | |
|
4488 | 4485 | parmObj = opObj.getParameterObj(parameterName="plot_pos") |
|
4489 | 4486 | if parmObj == None: |
|
4490 | 4487 | plot_pos = 0 |
|
4491 | 4488 | else: |
|
4492 | 4489 | plot_pos = parmObj.getValue() |
|
4493 | 4490 | |
|
4494 | 4491 | parmObj = opObj.getParameterObj(parameterName="localfolder") |
|
4495 | 4492 | if parmObj == None: |
|
4496 | 4493 | localfolder = None |
|
4497 | 4494 | else: |
|
4498 | 4495 | localfolder = parmObj.getValue() |
|
4499 | 4496 | |
|
4500 | 4497 | parmObj = opObj.getParameterObj(parameterName="ext") |
|
4501 | 4498 | if parmObj == None: |
|
4502 | 4499 | extension = '.png' |
|
4503 | 4500 | else: |
|
4504 | 4501 | extension = parmObj.getValue() |
|
4505 | 4502 | |
|
4506 | 4503 | self.temporalFTP.save(server=server, |
|
4507 | 4504 | remotefolder=remotefolder, |
|
4508 | 4505 | username=username, |
|
4509 | 4506 | password=password, |
|
4510 | 4507 | ftp_wei=ftp_wei, |
|
4511 | 4508 | exp_code=exp_code, |
|
4512 | 4509 | sub_exp_code=sub_exp_code, |
|
4513 | 4510 | plot_pos=plot_pos, |
|
4514 | 4511 | localfolder=localfolder, |
|
4515 | 4512 | extension=extension) |
|
4516 | 4513 | |
|
4517 | 4514 | def addProject2ProjectExplorer(self, id, name): |
|
4518 | 4515 | |
|
4519 | 4516 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4520 | 4517 | |
|
4521 | 4518 | parentItem = self.projectExplorerModel.invisibleRootItem() |
|
4522 | 4519 | parentItem.appendRow(itemTree) |
|
4523 | 4520 | |
|
4524 | 4521 | self.projectExplorerTree.setCurrentIndex(itemTree.index()) |
|
4525 | 4522 | |
|
4526 | 4523 | self.selectedItemTree = itemTree |
|
4527 | 4524 | |
|
4528 | 4525 | self.__itemTreeDict[id] = itemTree |
|
4529 | 4526 | |
|
4530 | 4527 | def addPU2ProjectExplorer(self, puObj): |
|
4531 | 4528 | |
|
4532 | 4529 | id, name = puObj.id, puObj.datatype |
|
4533 | 4530 | |
|
4534 | 4531 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4535 | 4532 | |
|
4536 | 4533 | parentItem = self.selectedItemTree |
|
4537 | 4534 | parentItem.appendRow(itemTree) |
|
4538 | 4535 | self.projectExplorerTree.expandAll() |
|
4539 | 4536 | |
|
4540 | 4537 | self.projectExplorerTree.setCurrentIndex(itemTree.index()) |
|
4541 | 4538 | |
|
4542 | 4539 | self.selectedItemTree = itemTree |
|
4543 | 4540 | |
|
4544 | 4541 | self.__itemTreeDict[id] = itemTree |
|
4545 | 4542 | |
|
4546 | 4543 | def addPU2PELoadXML(self, puObj): |
|
4547 | 4544 | |
|
4548 | 4545 | id, name, inputId = puObj.id, puObj.datatype, puObj.inputId |
|
4549 | 4546 | |
|
4550 | 4547 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4551 | 4548 | |
|
4552 | 4549 | if self.__itemTreeDict.has_key(inputId): |
|
4553 | 4550 | parentItem = self.__itemTreeDict[inputId] |
|
4554 | 4551 | else: |
|
4555 | 4552 | #If parent is a Reader object |
|
4556 | 4553 | parentItem = self.__itemTreeDict[id[:-1]] |
|
4557 | 4554 | |
|
4558 | 4555 | parentItem.appendRow(itemTree) |
|
4559 | 4556 | self.projectExplorerTree.expandAll() |
|
4560 | 4557 | parentItem = itemTree |
|
4561 | 4558 | self.projectExplorerTree.setCurrentIndex(parentItem.index()) |
|
4562 | 4559 | |
|
4563 | 4560 | self.__itemTreeDict[id] = itemTree |
|
4564 | 4561 | self.selectedItemTree = itemTree |
|
4565 | 4562 | |
|
4566 | 4563 | def getSelectedProjectObj(self): |
|
4567 | 4564 | """ |
|
4568 | 4565 | Return the current project object selected. If a processing unit is |
|
4569 | 4566 | actually selected this function returns associated project. |
|
4570 | 4567 | |
|
4571 | 4568 | None if any project or processing unit is selected |
|
4572 | 4569 | """ |
|
4573 | 4570 | for key in self.__itemTreeDict.keys(): |
|
4574 | 4571 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
4575 | 4572 | continue |
|
4576 | 4573 | |
|
4577 | 4574 | if self.__projectObjDict.has_key(key): |
|
4578 | 4575 | projectObj = self.__projectObjDict[key] |
|
4579 | 4576 | return projectObj |
|
4580 | 4577 | |
|
4581 | 4578 | puObj = self.__puObjDict[key] |
|
4582 | 4579 | |
|
4583 | 4580 | if puObj.parentId == None: |
|
4584 | 4581 | projectId = puObj.getId()[0] |
|
4585 | 4582 | else: |
|
4586 | 4583 | projectId = puObj.parentId |
|
4587 | 4584 | |
|
4588 | 4585 | projectObj = self.__projectObjDict[projectId] |
|
4589 | 4586 | return projectObj |
|
4590 | 4587 | |
|
4591 | 4588 | return None |
|
4592 | 4589 | |
|
4593 | 4590 | def getSelectedItemObj(self): |
|
4594 | 4591 | """ |
|
4595 | 4592 | Return the current project or processing unit object selected |
|
4596 | 4593 | |
|
4597 | 4594 | None if any project or processing unit is selected |
|
4598 | 4595 | """ |
|
4599 | 4596 | for key in self.__itemTreeDict.keys(): |
|
4600 | 4597 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
4601 | 4598 | continue |
|
4602 | 4599 | |
|
4603 | 4600 | if self.__projectObjDict.has_key(key) == True: |
|
4604 | 4601 | fatherObj = self.__projectObjDict[key] |
|
4605 | 4602 | else: |
|
4606 | 4603 | fatherObj = self.__puObjDict[key] |
|
4607 | 4604 | |
|
4608 | 4605 | return fatherObj |
|
4609 | 4606 | |
|
4610 | 4607 | return None |
|
4611 | 4608 | |
|
4612 | 4609 | def _WarningWindow(self, text, information): |
|
4613 | 4610 | |
|
4614 | 4611 | msgBox = QtGui.QMessageBox() |
|
4615 | 4612 | msgBox.setText(text) |
|
4616 | 4613 | msgBox.setInformativeText(information) |
|
4617 | 4614 | msgBox.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) |
|
4618 | 4615 | msgBox.setDefaultButton(QtGui.QMessageBox.Ok) |
|
4619 | 4616 | ret = msgBox.exec_() |
|
4620 | 4617 | |
|
4621 | 4618 | answer = False |
|
4622 | 4619 | |
|
4623 | 4620 | if ret == QtGui.QMessageBox.Ok: |
|
4624 | 4621 | answer = True |
|
4625 | 4622 | |
|
4626 | 4623 | return answer |
|
4627 | 4624 | |
|
4628 | 4625 | def __getNewProjectId(self): |
|
4629 | 4626 | |
|
4630 | 4627 | loadProject = False |
|
4631 | 4628 | |
|
4632 | 4629 | for thisId in range(1,10): |
|
4633 | 4630 | newId = str(thisId) |
|
4634 | 4631 | if newId in self.__projectObjDict.keys(): |
|
4635 | 4632 | continue |
|
4636 | 4633 | |
|
4637 | 4634 | loadProject = True |
|
4638 | 4635 | projectId = newId |
|
4639 | 4636 | break |
|
4640 | 4637 | |
|
4641 | 4638 | if not loadProject: |
|
4642 | 4639 | self.console.clear() |
|
4643 | 4640 | self.console.append("The maximum number of projects has been loaded, a new project can not be loaded") |
|
4644 | 4641 | return None |
|
4645 | 4642 | |
|
4646 | 4643 | return projectId |
|
4647 | 4644 | |
|
4648 | 4645 | def openProject(self): |
|
4649 | 4646 | |
|
4650 | 4647 | self.actionStart.setEnabled(False) |
|
4651 | 4648 | self.actionStarToolbar.setEnabled(False) |
|
4652 | 4649 | |
|
4653 | 4650 | self.frame_2.setEnabled(True) |
|
4654 | 4651 | |
|
4655 | 4652 | # print self.dir |
|
4656 | 4653 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) |
|
4657 | 4654 | |
|
4658 | 4655 | projectObjLoad = Project() |
|
4659 | 4656 | |
|
4660 | 4657 | try: |
|
4661 | 4658 | projectObjLoad.readXml(filename) |
|
4662 | 4659 | except: |
|
4663 | 4660 | self.console.clear() |
|
4664 | 4661 | self.console.append("The selected xml file could not be loaded ...") |
|
4665 | 4662 | return 0 |
|
4666 | 4663 | |
|
4667 | 4664 | self.create = False |
|
4668 | 4665 | self.refreshProjectWindow(projectObjLoad) |
|
4669 | 4666 | self.refreshProjectProperties(projectObjLoad) |
|
4670 | 4667 | |
|
4671 | 4668 | projectId = projectObjLoad.id |
|
4672 | 4669 | |
|
4673 | 4670 | if projectId in self.__projectObjDict.keys(): |
|
4674 | 4671 | |
|
4675 | 4672 | # answer = self._WarningWindow("You already have a project loaded with the same Id", |
|
4676 | 4673 | # "Do you want to load the file anyway?") |
|
4677 | 4674 | # if not answer: |
|
4678 | 4675 | # return |
|
4679 | 4676 | |
|
4680 | 4677 | projectId = self.__getNewProjectId() |
|
4681 | 4678 | |
|
4682 | 4679 | if not projectId: |
|
4683 | 4680 | return |
|
4684 | 4681 | |
|
4685 | 4682 | projectObjLoad.updateId(projectId) |
|
4686 | 4683 | |
|
4687 | 4684 | self.__projectObjDict[projectId] = projectObjLoad |
|
4688 | 4685 | |
|
4689 | 4686 | self.addProject2ProjectExplorer(id=projectId, name=projectObjLoad.name) |
|
4690 | 4687 | |
|
4691 | 4688 | self.tabWidgetProject.setEnabled(True) |
|
4692 | 4689 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
4693 | 4690 | # Disable tabProject after finish the creation |
|
4694 | 4691 | self.tabProject.setEnabled(True) |
|
4695 | 4692 | puObjorderList = OrderedDict(sorted(projectObjLoad.procUnitConfObjDict.items(), key=lambda x: x[0])) |
|
4696 | 4693 | |
|
4697 | 4694 | for puId, puObj in puObjorderList.items(): |
|
4698 | 4695 | |
|
4699 | 4696 | self.__puObjDict[puId] = puObj |
|
4700 | 4697 | |
|
4701 | 4698 | if puObj.name == "SendToServer": |
|
4702 | 4699 | self.saveFTPFromProcUnitObj(puObj) |
|
4703 | 4700 | |
|
4704 | 4701 | ############## COMPATIBLE WITH OLD VERSIONS ################ |
|
4705 | 4702 | operationObj = puObj.getOperationObj("SendByFTP") |
|
4706 | 4703 | |
|
4707 | 4704 | if operationObj: |
|
4708 | 4705 | self.saveFTPFromOpObj(operationObj) |
|
4709 | 4706 | ############################################################ |
|
4710 | 4707 | |
|
4711 | 4708 | if puObj.inputId == '0': |
|
4712 | 4709 | continue |
|
4713 | 4710 | |
|
4714 | 4711 | self.addPU2PELoadXML(puObj) |
|
4715 | 4712 | |
|
4716 | 4713 | self.refreshPUWindow(puObj) |
|
4717 | 4714 | self.refreshPUProperties(puObj) |
|
4718 | 4715 | self.showtabPUCreated(datatype=puObj.datatype) |
|
4719 | 4716 | |
|
4720 | 4717 | self.console.clear() |
|
4721 | 4718 | self.console.append("The selected xml file has been loaded successfully") |
|
4722 | 4719 | |
|
4723 | 4720 | self.actionStart.setEnabled(True) |
|
4724 | 4721 | self.actionStarToolbar.setEnabled(True) |
|
4725 | 4722 | |
|
4726 | 4723 | def create_updating_timer(self): |
|
4727 | 4724 | self.comm_data_timer = QtCore.QTimer(self) |
|
4728 | 4725 | self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) |
|
4729 | 4726 | self.comm_data_timer.start(1000) |
|
4730 | 4727 | |
|
4731 | 4728 | def on_comm_updating_timer(self): |
|
4732 | 4729 | # Verifica si algun proceso ha sido inicializado y sigue ejecutandose |
|
4733 | 4730 | # Si el proceso se ha parado actualizar el GUI (stopProject) |
|
4734 | 4731 | if not self.threadStarted: |
|
4735 | 4732 | return |
|
4736 | 4733 | |
|
4737 | 4734 | if self.controllerThread.isFinished(): |
|
4738 | 4735 | self.stopProject() |
|
4739 | 4736 | |
|
4740 | 4737 | def playProject(self, ext=".xml", save=1): |
|
4741 | 4738 | |
|
4742 | 4739 | projectObj = self.getSelectedProjectObj() |
|
4743 | 4740 | |
|
4744 | 4741 | if not projectObj: |
|
4745 | 4742 | self.console.append("Please select a project before pressing PLAY button") |
|
4746 | 4743 | return |
|
4747 | 4744 | |
|
4748 | 4745 | if save: |
|
4749 | 4746 | filename = self.saveProject() |
|
4750 | 4747 | if filename == None: |
|
4751 | 4748 | self.console.append("Process did not initialize.") |
|
4752 | 4749 | return |
|
4753 | 4750 | else: |
|
4754 | 4751 | filename = TEMPORAL_FILE |
|
4755 | 4752 | projectObj.writeXml( os.path.join(self.pathWorkSpace,filename) ) |
|
4756 | 4753 | |
|
4757 | 4754 | self.actionStart.setEnabled(False) |
|
4758 | 4755 | self.actionPause.setEnabled(True) |
|
4759 | 4756 | self.actionStop.setEnabled(True) |
|
4760 | 4757 | |
|
4761 | 4758 | self.actionStarToolbar.setEnabled(False) |
|
4762 | 4759 | self.actionPauseToolbar.setEnabled(True) |
|
4763 | 4760 | self.actionStopToolbar.setEnabled(True) |
|
4764 | 4761 | |
|
4765 | 4762 | self.console.append("Please Wait...") |
|
4766 | 4763 | |
|
4767 | 4764 | self.controllerThread = ControllerThread(filename) |
|
4768 | 4765 | |
|
4769 | 4766 | # QObject.connect( self.controllerThread, SIGNAL( "jobFinished( PyQt_PyObject )" ), self.jobFinishedFromThread ) |
|
4770 | 4767 | # QObject.connect( self.controllerThread, SIGNAL( "jobStarted( PyQt_PyObject )" ), self.jobStartedFromThread ) |
|
4771 | 4768 | self.console.clear() |
|
4772 | 4769 | self.controllerThread.start() |
|
4773 | 4770 | sleep(0.5) |
|
4774 | 4771 | self.threadStarted = True |
|
4775 | 4772 | |
|
4776 | 4773 | self.changeStartIcon(started=True) |
|
4777 | 4774 | |
|
4778 | 4775 | def stopProject(self): |
|
4779 | 4776 | |
|
4780 | 4777 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) |
|
4781 | 4778 | self.controllerThread.stop() |
|
4782 | 4779 | self.threadStarted = False |
|
4783 | 4780 | |
|
4784 | 4781 | while self.controllerThread.isRunning(): |
|
4785 | 4782 | sleep(0.5) |
|
4786 | 4783 | |
|
4787 | 4784 | self.actionStart.setEnabled(True) |
|
4788 | 4785 | self.actionPause.setEnabled(False) |
|
4789 | 4786 | self.actionStop.setEnabled(False) |
|
4790 | 4787 | |
|
4791 | 4788 | self.actionStarToolbar.setEnabled(True) |
|
4792 | 4789 | self.actionPauseToolbar.setEnabled(False) |
|
4793 | 4790 | self.actionStopToolbar.setEnabled(False) |
|
4794 | 4791 | |
|
4795 | 4792 | self.restorePauseIcon() |
|
4796 | 4793 | self.restoreStartIcon() |
|
4797 | 4794 | |
|
4798 | 4795 | def pauseProject(self): |
|
4799 | 4796 | |
|
4800 | 4797 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PAUSE, data=True)) |
|
4801 | 4798 | paused = self.controllerThread.pause() |
|
4802 | 4799 | |
|
4803 | 4800 | self.actionStart.setEnabled(False) |
|
4804 | 4801 | self.actionPause.setEnabled(True) |
|
4805 | 4802 | self.actionStop.setEnabled(True) |
|
4806 | 4803 | |
|
4807 | 4804 | self.actionStarToolbar.setEnabled(False) |
|
4808 | 4805 | self.actionPauseToolbar.setEnabled(True) |
|
4809 | 4806 | self.actionStopToolbar.setEnabled(True) |
|
4810 | 4807 | |
|
4811 | 4808 | self.changePauseIcon(paused) |
|
4812 | 4809 | |
|
4813 | 4810 | def saveProject(self, filename=None): |
|
4814 | 4811 | |
|
4815 | 4812 | self.actionStart.setEnabled(False) |
|
4816 | 4813 | self.actionStarToolbar.setEnabled(False) |
|
4817 | 4814 | |
|
4818 | 4815 | projectObj = self.getSelectedProjectObj() |
|
4819 | 4816 | |
|
4820 | 4817 | if not projectObj: |
|
4821 | 4818 | |
|
4822 | 4819 | if self.create: |
|
4823 | 4820 | self.console.append("Please press Ok before save it") |
|
4824 | 4821 | else: |
|
4825 | 4822 | self.console.append("Please select a project before save it") |
|
4826 | 4823 | return |
|
4827 | 4824 | |
|
4828 | 4825 | self.refreshGraphicsId() |
|
4829 | 4826 | |
|
4830 | 4827 | sts = True |
|
4831 | 4828 | selectedItemObj = self.getSelectedItemObj() |
|
4832 | 4829 | |
|
4833 | 4830 | #A Processing Unit has been selected |
|
4834 | 4831 | if projectObj == selectedItemObj: |
|
4835 | 4832 | if not self.on_proOk_clicked(): |
|
4836 | 4833 | return None |
|
4837 | 4834 | |
|
4838 | 4835 | #A Processing Unit has been selected |
|
4839 | 4836 | if projectObj != selectedItemObj: |
|
4840 | 4837 | puObj = selectedItemObj |
|
4841 | 4838 | |
|
4842 | 4839 | if puObj.name == 'VoltageProc': |
|
4843 | 4840 | sts = self.on_volOpOk_clicked() |
|
4844 | 4841 | if puObj.name == 'SpectraProc': |
|
4845 | 4842 | sts = self.on_specOpOk_clicked() |
|
4846 | 4843 | if puObj.name == 'SpectraHeisProc': |
|
4847 | 4844 | sts = self.on_specHeisOpOk_clicked() |
|
4848 | 4845 | |
|
4849 | 4846 | if not sts: |
|
4850 | 4847 | return None |
|
4851 | 4848 | |
|
4852 | 4849 | self.createFTPProcUnitView() |
|
4853 | 4850 | |
|
4854 | 4851 | if not filename: |
|
4855 | 4852 | filename = os.path.join( str(self.pathWorkSpace), "%s%s" %(str(projectObj.name), '.xml') ) |
|
4856 | 4853 | |
|
4857 | 4854 | projectObj.writeXml(filename) |
|
4858 | 4855 | self.console.clear() |
|
4859 | 4856 | self.console.append("Project saved") |
|
4860 | 4857 | self.console.append("Press Play button to start data processing ...") |
|
4861 | 4858 | |
|
4862 | 4859 | self.actionSaveToolbar.setEnabled(False) |
|
4863 | 4860 | self.actionStarToolbar.setEnabled(True) |
|
4864 | 4861 | |
|
4865 | 4862 | self.actionSave.setEnabled(False) |
|
4866 | 4863 | self.actionStart.setEnabled(True) |
|
4867 | 4864 | |
|
4868 | 4865 | return filename |
|
4869 | 4866 | |
|
4870 | 4867 | def removeItemTreeFromProject(self): |
|
4871 | 4868 | """ |
|
4872 | 4869 | Metodo para eliminar el proyecto en el dictionario de proyectos y en el dictionario de vista de arbol |
|
4873 | 4870 | """ |
|
4874 | 4871 | for key in self.__itemTreeDict.keys(): |
|
4875 | 4872 | |
|
4876 | 4873 | #Check again because an item can delete multiple items (childs) |
|
4877 | 4874 | if key not in self.__itemTreeDict.keys(): |
|
4878 | 4875 | continue |
|
4879 | 4876 | |
|
4880 | 4877 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
4881 | 4878 | continue |
|
4882 | 4879 | |
|
4883 | 4880 | if self.__projectObjDict.has_key(key) == True: |
|
4884 | 4881 | |
|
4885 | 4882 | del self.__projectObjDict[key] |
|
4886 | 4883 | del self.__itemTreeDict[key] |
|
4887 | 4884 | |
|
4888 | 4885 | else: |
|
4889 | 4886 | puObj = self.__puObjDict[key] |
|
4890 | 4887 | idProjectParent = puObj.parentId |
|
4891 | 4888 | projectObj = self.__projectObjDict[idProjectParent] |
|
4892 | 4889 | |
|
4893 | 4890 | del self.__puObjDict[key] |
|
4894 | 4891 | del self.__itemTreeDict[key] |
|
4895 | 4892 | del projectObj.procUnitConfObjDict[key] |
|
4896 | 4893 | |
|
4897 | 4894 | for key in projectObj.procUnitConfObjDict.keys(): |
|
4898 | 4895 | if projectObj.procUnitConfObjDict[key].inputId != puObj.getId(): |
|
4899 | 4896 | continue |
|
4900 | 4897 | del self.__puObjDict[projectObj.procUnitConfObjDict[key].getId()] |
|
4901 | 4898 | del self.__itemTreeDict[projectObj.procUnitConfObjDict[key].getId()] |
|
4902 | 4899 | del projectObj.procUnitConfObjDict[key] |
|
4903 | 4900 | # print projectObj.procUnitConfObjDict |
|
4904 | 4901 | # print self.__itemTreeDict,self.__projectObjDict,self.__puObjDict |
|
4905 | 4902 | |
|
4906 | 4903 | def setInputsProject_View(self): |
|
4907 | 4904 | |
|
4908 | 4905 | self.tabWidgetProject.setEnabled(True) |
|
4909 | 4906 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
4910 | 4907 | self.tabProject.setEnabled(True) |
|
4911 | 4908 | self.frame_2.setEnabled(False) |
|
4912 | 4909 | self.proName.clear() |
|
4913 | 4910 | self.proName.setFocus() |
|
4914 | 4911 | self.proName.setSelection(0, 0) |
|
4915 | 4912 | self.proName.setCursorPosition(0) |
|
4916 | 4913 | self.proDataType.setText('.r') |
|
4917 | 4914 | self.proDataPath.clear() |
|
4918 | 4915 | self.proComDataType.clear() |
|
4919 | 4916 | self.proComDataType.addItem("Voltage") |
|
4920 | 4917 | self.proComDataType.addItem("Spectra") |
|
4921 | 4918 | self.proComDataType.addItem("Fits") |
|
4922 | 4919 | self.proComDataType.addItem("USRP") |
|
4923 | 4920 | |
|
4924 | 4921 | self.proComStartDate.clear() |
|
4925 | 4922 | self.proComEndDate.clear() |
|
4926 | 4923 | |
|
4927 | 4924 | startTime = "00:00:00" |
|
4928 | 4925 | endTime = "23:59:59" |
|
4929 | 4926 | starlist = startTime.split(":") |
|
4930 | 4927 | endlist = endTime.split(":") |
|
4931 | 4928 | self.proDelay.setText("60") |
|
4932 | 4929 | self.proSet.setText("") |
|
4933 | 4930 | |
|
4934 | 4931 | self.labelSet.show() |
|
4935 | 4932 | self.proSet.show() |
|
4936 | 4933 | |
|
4937 | 4934 | self.labelIPPKm.hide() |
|
4938 | 4935 | self.proIPPKm.hide() |
|
4939 | 4936 | |
|
4940 | 4937 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) |
|
4941 | 4938 | self.proStartTime.setTime(self.time) |
|
4942 | 4939 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
4943 | 4940 | self.proEndTime.setTime(self.time) |
|
4944 | 4941 | self.proDescription.clear() |
|
4945 | 4942 | self.proOk.setEnabled(False) |
|
4946 | 4943 | # self.console.append("Please, Write a name Project") |
|
4947 | 4944 | # self.console.append("Introduce Project Parameters")DC |
|
4948 | 4945 | # self.console.append("Select data type Voltage( .rawdata) or Spectra(.pdata)") |
|
4949 | 4946 | |
|
4950 | 4947 | def clearPUWindow(self, datatype): |
|
4951 | 4948 | |
|
4952 | 4949 | projectObjView = self.getSelectedProjectObj() |
|
4953 | 4950 | |
|
4954 | 4951 | if not projectObjView: |
|
4955 | 4952 | return |
|
4956 | 4953 | |
|
4957 | 4954 | puObj = self.getSelectedItemObj() |
|
4958 | 4955 | inputId = puObj.getInputId() |
|
4959 | 4956 | inputPUObj = projectObjView.getProcUnitObj(inputId) |
|
4960 | 4957 | |
|
4961 | 4958 | if datatype == 'Voltage': |
|
4962 | 4959 | self.volOpComChannels.setEnabled(False) |
|
4963 | 4960 | self.volOpComHeights.setEnabled(False) |
|
4964 | 4961 | self.volOpFilter.setEnabled(False) |
|
4965 | 4962 | self.volOpComProfile.setEnabled(False) |
|
4966 | 4963 | self.volOpComCode.setEnabled(False) |
|
4967 | 4964 | self.volOpCohInt.setEnabled(False) |
|
4968 | 4965 | self.volOpChannel.setEnabled(False) |
|
4969 | 4966 | self.volOpHeights.setEnabled(False) |
|
4970 | 4967 | self.volOpProfile.setEnabled(False) |
|
4971 | 4968 | self.volOpRadarfrequency.setEnabled(False) |
|
4972 | 4969 | self.volOpCebChannels.setCheckState(0) |
|
4973 | 4970 | self.volOpCebRadarfrequency.setCheckState(0) |
|
4974 | 4971 | self.volOpCebHeights.setCheckState(0) |
|
4975 | 4972 | self.volOpCebFilter.setCheckState(0) |
|
4976 | 4973 | self.volOpCebProfile.setCheckState(0) |
|
4977 | 4974 | self.volOpCebDecodification.setCheckState(0) |
|
4978 | 4975 | self.volOpCebCohInt.setCheckState(0) |
|
4979 | 4976 | |
|
4980 | 4977 | self.volOpChannel.clear() |
|
4981 | 4978 | self.volOpHeights.clear() |
|
4982 | 4979 | self.volOpProfile.clear() |
|
4983 | 4980 | self.volOpFilter.clear() |
|
4984 | 4981 | self.volOpCohInt.clear() |
|
4985 | 4982 | self.volOpRadarfrequency.clear() |
|
4986 | 4983 | |
|
4987 | 4984 | if datatype == 'Spectra': |
|
4988 | 4985 | |
|
4989 | 4986 | if inputPUObj.datatype == 'Spectra': |
|
4990 | 4987 | self.specOpnFFTpoints.setEnabled(False) |
|
4991 | 4988 | self.specOpProfiles.setEnabled(False) |
|
4992 | 4989 | self.specOpippFactor.setEnabled(False) |
|
4993 | 4990 | else: |
|
4994 | 4991 | self.specOpnFFTpoints.setEnabled(True) |
|
4995 | 4992 | self.specOpProfiles.setEnabled(True) |
|
4996 | 4993 | self.specOpippFactor.setEnabled(True) |
|
4997 | 4994 | |
|
4998 | 4995 | self.specOpCebCrossSpectra.setCheckState(0) |
|
4999 | 4996 | self.specOpCebChannel.setCheckState(0) |
|
5000 | 4997 | self.specOpCebHeights.setCheckState(0) |
|
5001 | 4998 | self.specOpCebIncoherent.setCheckState(0) |
|
5002 | 4999 | self.specOpCebRemoveDC.setCheckState(0) |
|
5003 | 5000 | self.specOpCebRemoveInt.setCheckState(0) |
|
5004 | 5001 | self.specOpCebgetNoise.setCheckState(0) |
|
5005 | 5002 | self.specOpCebRadarfrequency.setCheckState(0) |
|
5006 | 5003 | |
|
5007 | 5004 | self.specOpRadarfrequency.setEnabled(False) |
|
5008 | 5005 | self.specOppairsList.setEnabled(False) |
|
5009 | 5006 | self.specOpChannel.setEnabled(False) |
|
5010 | 5007 | self.specOpHeights.setEnabled(False) |
|
5011 | 5008 | self.specOpIncoherent.setEnabled(False) |
|
5012 | 5009 | self.specOpgetNoise.setEnabled(False) |
|
5013 | 5010 | |
|
5014 | 5011 | self.specOpRadarfrequency.clear() |
|
5015 | 5012 | self.specOpnFFTpoints.clear() |
|
5016 | 5013 | self.specOpProfiles.clear() |
|
5017 | 5014 | self.specOpippFactor.clear |
|
5018 | 5015 | self.specOppairsList.clear() |
|
5019 | 5016 | self.specOpChannel.clear() |
|
5020 | 5017 | self.specOpHeights.clear() |
|
5021 | 5018 | self.specOpIncoherent.clear() |
|
5022 | 5019 | self.specOpgetNoise.clear() |
|
5023 | 5020 | |
|
5024 | 5021 | self.specGraphCebSpectraplot.setCheckState(0) |
|
5025 | 5022 | self.specGraphCebCrossSpectraplot.setCheckState(0) |
|
5026 | 5023 | self.specGraphCebRTIplot.setCheckState(0) |
|
5027 | 5024 | self.specGraphCebRTInoise.setCheckState(0) |
|
5028 | 5025 | self.specGraphCebCoherencmap.setCheckState(0) |
|
5029 | 5026 | self.specGraphPowerprofile.setCheckState(0) |
|
5030 | 5027 | |
|
5031 | 5028 | self.specGraphSaveSpectra.setCheckState(0) |
|
5032 | 5029 | self.specGraphSaveCross.setCheckState(0) |
|
5033 | 5030 | self.specGraphSaveRTIplot.setCheckState(0) |
|
5034 | 5031 | self.specGraphSaveRTInoise.setCheckState(0) |
|
5035 | 5032 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
5036 | 5033 | self.specGraphSavePowerprofile.setCheckState(0) |
|
5037 | 5034 | |
|
5038 | 5035 | self.specGraphftpRTIplot.setCheckState(0) |
|
5039 | 5036 | self.specGraphftpRTInoise.setCheckState(0) |
|
5040 | 5037 | self.specGraphftpCoherencemap.setCheckState(0) |
|
5041 | 5038 | |
|
5042 | 5039 | self.specGraphPath.clear() |
|
5043 | 5040 | self.specGraphPrefix.clear() |
|
5044 | 5041 | |
|
5045 | 5042 | self.specGgraphftpratio.clear() |
|
5046 | 5043 | |
|
5047 | 5044 | self.specGgraphChannelList.clear() |
|
5048 | 5045 | self.specGgraphFreq.clear() |
|
5049 | 5046 | self.specGgraphHeight.clear() |
|
5050 | 5047 | self.specGgraphDbsrange.clear() |
|
5051 | 5048 | self.specGgraphmagnitud.clear() |
|
5052 | 5049 | self.specGgraphTminTmax.clear() |
|
5053 | 5050 | self.specGgraphTimeRange.clear() |
|
5054 | 5051 | |
|
5055 | 5052 | if datatype == 'SpectraHeis': |
|
5056 | 5053 | self.specHeisOpCebIncoherent.setCheckState(0) |
|
5057 | 5054 | self.specHeisOpIncoherent.setEnabled(False) |
|
5058 | 5055 | self.specHeisOpIncoherent.clear() |
|
5059 | 5056 | |
|
5060 | 5057 | self.specHeisGraphCebSpectraplot.setCheckState(0) |
|
5061 | 5058 | self.specHeisGraphCebRTIplot.setCheckState(0) |
|
5062 | 5059 | |
|
5063 | 5060 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
5064 | 5061 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
5065 | 5062 | |
|
5066 | 5063 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
5067 | 5064 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
5068 | 5065 | |
|
5069 | 5066 | self.specHeisGraphPath.clear() |
|
5070 | 5067 | self.specHeisGraphPrefix.clear() |
|
5071 | 5068 | self.specHeisGgraphChannelList.clear() |
|
5072 | 5069 | self.specHeisGgraphXminXmax.clear() |
|
5073 | 5070 | self.specHeisGgraphYminYmax.clear() |
|
5074 | 5071 | self.specHeisGgraphTminTmax.clear() |
|
5075 | 5072 | self.specHeisGgraphTimeRange.clear() |
|
5076 | 5073 | self.specHeisGgraphftpratio.clear() |
|
5077 | 5074 | |
|
5078 | 5075 | def showtabPUCreated(self, datatype): |
|
5079 | 5076 | |
|
5080 | 5077 | if datatype == "Voltage": |
|
5081 | 5078 | self.tabVoltage.setEnabled(True) |
|
5082 | 5079 | self.tabProject.setEnabled(False) |
|
5083 | 5080 | self.tabSpectra.setEnabled(False) |
|
5084 | 5081 | self.tabCorrelation.setEnabled(False) |
|
5085 | 5082 | self.tabSpectraHeis.setEnabled(False) |
|
5086 | 5083 | self.tabWidgetProject.setCurrentWidget(self.tabVoltage) |
|
5087 | 5084 | |
|
5088 | 5085 | if datatype == "Spectra": |
|
5089 | 5086 | self.tabVoltage.setEnabled(False) |
|
5090 | 5087 | self.tabProject.setEnabled(False) |
|
5091 | 5088 | self.tabSpectra.setEnabled(True) |
|
5092 | 5089 | self.tabCorrelation.setEnabled(False) |
|
5093 | 5090 | self.tabSpectraHeis.setEnabled(False) |
|
5094 | 5091 | self.tabWidgetProject.setCurrentWidget(self.tabSpectra) |
|
5095 | 5092 | |
|
5096 | 5093 | if datatype == "SpectraHeis": |
|
5097 | 5094 | self.tabVoltage.setEnabled(False) |
|
5098 | 5095 | self.tabProject.setEnabled(False) |
|
5099 | 5096 | self.tabSpectra.setEnabled(False) |
|
5100 | 5097 | self.tabCorrelation.setEnabled(False) |
|
5101 | 5098 | self.tabSpectraHeis.setEnabled(True) |
|
5102 | 5099 | self.tabWidgetProject.setCurrentWidget(self.tabSpectraHeis) |
|
5103 | 5100 | |
|
5104 | 5101 | def checkInputsProject(self): |
|
5105 | 5102 | """ |
|
5106 | 5103 | Check Inputs Project: |
|
5107 | 5104 | - project_name |
|
5108 | 5105 | - datatype |
|
5109 | 5106 | - ext |
|
5110 | 5107 | - data_path |
|
5111 | 5108 | - readmode |
|
5112 | 5109 | - delay |
|
5113 | 5110 | - set |
|
5114 | 5111 | - walk |
|
5115 | 5112 | """ |
|
5116 | 5113 | parms_ok = True |
|
5117 | 5114 | project_name = str(self.proName.text()) |
|
5118 | 5115 | if project_name == '' or project_name == None: |
|
5119 | 5116 | outputstr = "Enter the Project Name" |
|
5120 | 5117 | self.console.append(outputstr) |
|
5121 | 5118 | parms_ok = False |
|
5122 | 5119 | project_name = None |
|
5123 | 5120 | |
|
5124 | 5121 | datatype = str(self.proComDataType.currentText()) |
|
5125 | 5122 | if not(datatype in ['Voltage', 'Spectra', 'Fits', 'USRP']): |
|
5126 | 5123 | outputstr = 'datatype = %s, this must be either Voltage, Spectra, SpectraHeis or USRP' % datatype |
|
5127 | 5124 | self.console.append(outputstr) |
|
5128 | 5125 | parms_ok = False |
|
5129 | 5126 | datatype = None |
|
5130 | 5127 | |
|
5131 | 5128 | ext = str(self.proDataType.text()) |
|
5132 | 5129 | if not(ext in ['.r', '.pdata', '.fits', '.hdf5']): |
|
5133 | 5130 | outputstr = "extension files must be .r , .pdata, .fits or .hdf5" |
|
5134 | 5131 | self.console.append(outputstr) |
|
5135 | 5132 | parms_ok = False |
|
5136 | 5133 | ext = None |
|
5137 | 5134 | |
|
5138 | 5135 | data_path = str(self.proDataPath.text()) |
|
5139 | 5136 | |
|
5140 | 5137 | if data_path == '': |
|
5141 | 5138 | outputstr = 'Datapath is empty' |
|
5142 | 5139 | self.console.append(outputstr) |
|
5143 | 5140 | parms_ok = False |
|
5144 | 5141 | data_path = None |
|
5145 | 5142 | |
|
5146 | 5143 | if data_path != None: |
|
5147 | 5144 | if not os.path.isdir(data_path): |
|
5148 | 5145 | outputstr = 'Datapath:%s does not exists' % data_path |
|
5149 | 5146 | self.console.append(outputstr) |
|
5150 | 5147 | parms_ok = False |
|
5151 | 5148 | data_path = None |
|
5152 | 5149 | |
|
5153 | 5150 | read_mode = str(self.proComReadMode.currentText()) |
|
5154 | 5151 | if not(read_mode in ['Online', 'Offline']): |
|
5155 | 5152 | outputstr = 'Read Mode: %s, this must be either Online or Offline' % read_mode |
|
5156 | 5153 | self.console.append(outputstr) |
|
5157 | 5154 | parms_ok = False |
|
5158 | 5155 | read_mode = None |
|
5159 | 5156 | |
|
5160 | 5157 | delay = None |
|
5161 | 5158 | if read_mode == "Online": |
|
5162 | 5159 | parms_ok = False |
|
5163 | 5160 | try: |
|
5164 | 5161 | delay = int(str(self.proDelay.text())) |
|
5165 | 5162 | parms_ok = True |
|
5166 | 5163 | except: |
|
5167 | 5164 | outputstr = 'Delay: %s, this must be a integer number' % str(self.proDelay.text()) |
|
5168 | 5165 | self.console.append(outputstr) |
|
5169 | 5166 | |
|
5170 | 5167 | try: |
|
5171 | 5168 | set = int(str(self.proSet.text())) |
|
5172 | 5169 | except: |
|
5173 | 5170 | # outputstr = 'Set: %s, this must be a integer number' % str(self.proName.text()) |
|
5174 | 5171 | # self.console.append(outputstr) |
|
5175 | 5172 | # parms_ok = False |
|
5176 | 5173 | set = None |
|
5177 | 5174 | |
|
5178 | 5175 | walk = int(self.proComWalk.currentIndex()) |
|
5179 | 5176 | expLabel = str(self.proExpLabel.text()) |
|
5180 | 5177 | |
|
5181 | 5178 | return parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set, expLabel |
|
5182 | 5179 | |
|
5183 | 5180 | def checkInputsPUSave(self, datatype): |
|
5184 | 5181 | """ |
|
5185 | 5182 | Check Inputs Spectra Save: |
|
5186 | 5183 | - path |
|
5187 | 5184 | - blocks Per File |
|
5188 | 5185 | - sufix |
|
5189 | 5186 | - dataformat |
|
5190 | 5187 | """ |
|
5191 | 5188 | parms_ok = True |
|
5192 | 5189 | |
|
5193 | 5190 | if datatype == "Voltage": |
|
5194 | 5191 | output_path = str(self.volOutputPath.text()) |
|
5195 | 5192 | blocksperfile = str(self.volOutputblocksperfile.text()) |
|
5196 | 5193 | profilesperblock = str(self.volOutputprofilesperblock.text()) |
|
5197 | 5194 | |
|
5198 | 5195 | if datatype == "Spectra": |
|
5199 | 5196 | output_path = str(self.specOutputPath.text()) |
|
5200 | 5197 | blocksperfile = str(self.specOutputblocksperfile.text()) |
|
5201 | 5198 | profilesperblock = 0 |
|
5202 | 5199 | |
|
5203 | 5200 | if datatype == "SpectraHeis": |
|
5204 | 5201 | output_path = str(self.specHeisOutputPath.text()) |
|
5205 | 5202 | blocksperfile = str(self.specHeisOutputblocksperfile.text()) |
|
5206 | 5203 | metadata_file = str(self.specHeisOutputMetada.text()) |
|
5207 | 5204 | |
|
5208 | 5205 | if output_path == '': |
|
5209 | 5206 | outputstr = 'Outputpath is empty' |
|
5210 | 5207 | self.console.append(outputstr) |
|
5211 | 5208 | parms_ok = False |
|
5212 | 5209 | |
|
5213 | 5210 | if not os.path.isdir(output_path): |
|
5214 | 5211 | outputstr = 'OutputPath:%s does not exists' % output_path |
|
5215 | 5212 | self.console.append(outputstr) |
|
5216 | 5213 | parms_ok = False |
|
5217 | 5214 | |
|
5218 | 5215 | try: |
|
5219 | 5216 | profilesperblock = int(profilesperblock) |
|
5220 | 5217 | except: |
|
5221 | 5218 | if datatype == "Voltage": |
|
5222 | 5219 | outputstr = 'Profilesperblock: %s, this must be a integer number' % str(self.volOutputprofilesperblock.text()) |
|
5223 | 5220 | self.console.append(outputstr) |
|
5224 | 5221 | parms_ok = False |
|
5225 | 5222 | profilesperblock = None |
|
5226 | 5223 | |
|
5227 | 5224 | try: |
|
5228 | 5225 | blocksperfile = int(blocksperfile) |
|
5229 | 5226 | except: |
|
5230 | 5227 | if datatype == "Voltage": |
|
5231 | 5228 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.volOutputblocksperfile.text()) |
|
5232 | 5229 | elif datatype == "Spectra": |
|
5233 | 5230 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.specOutputblocksperfile.text()) |
|
5234 | 5231 | elif datatype == "SpectraHeis": |
|
5235 | 5232 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.specHeisOutputblocksperfile.text()) |
|
5236 | 5233 | |
|
5237 | 5234 | self.console.append(outputstr) |
|
5238 | 5235 | parms_ok = False |
|
5239 | 5236 | blocksperfile = None |
|
5240 | 5237 | |
|
5241 | 5238 | if datatype == "SpectraHeis": |
|
5242 | 5239 | if metadata_file != '': |
|
5243 | 5240 | if not os.path.isfile(metadata_file): |
|
5244 | 5241 | outputstr = 'Metadata file %s does not exist' % metadata_file |
|
5245 | 5242 | self.console.append(outputstr) |
|
5246 | 5243 | parms_ok = False |
|
5247 | 5244 | |
|
5248 | 5245 | if datatype == "Voltage": |
|
5249 | 5246 | return parms_ok, output_path, blocksperfile, profilesperblock |
|
5250 | 5247 | |
|
5251 | 5248 | |
|
5252 | 5249 | if datatype == "Spectra": |
|
5253 | 5250 | return parms_ok, output_path, blocksperfile, profilesperblock |
|
5254 | 5251 | |
|
5255 | 5252 | |
|
5256 | 5253 | if datatype == "SpectraHeis": |
|
5257 | 5254 | return parms_ok, output_path, blocksperfile, metadata_file |
|
5258 | 5255 | |
|
5259 | 5256 | def findDatafiles(self, data_path, ext, walk, expLabel=''): |
|
5260 | 5257 | |
|
5261 | 5258 | dateList = [] |
|
5262 | 5259 | fileList = [] |
|
5263 | 5260 | |
|
5264 | 5261 | if ext == ".r": |
|
5265 | 5262 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5266 | 5263 | |
|
5267 | 5264 | readerObj = JRODataReader() |
|
5268 | 5265 | dateList = readerObj.findDatafiles(path=data_path, |
|
5269 | 5266 | expLabel=expLabel, |
|
5270 | 5267 | ext=ext, |
|
5271 | 5268 | walk=walk) |
|
5272 | 5269 | |
|
5273 | 5270 | if ext == ".pdata": |
|
5274 | 5271 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5275 | 5272 | |
|
5276 | 5273 | readerObj = JRODataReader() |
|
5277 | 5274 | dateList = readerObj.findDatafiles(path=data_path, |
|
5278 | 5275 | expLabel=expLabel, |
|
5279 | 5276 | ext=ext, |
|
5280 | 5277 | walk=walk) |
|
5281 | 5278 | |
|
5282 | 5279 | if ext == ".fits": |
|
5283 | 5280 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5284 | 5281 | |
|
5285 | 5282 | readerObj = JRODataReader() |
|
5286 | 5283 | dateList = readerObj.findDatafiles(path=data_path, |
|
5287 | 5284 | expLabel=expLabel, |
|
5288 | 5285 | ext=ext, |
|
5289 | 5286 | walk=walk) |
|
5290 | 5287 | |
|
5291 | 5288 | if ext == ".hdf5": |
|
5292 | 5289 | from schainpy.model.io.jroIO_usrp import USRPReader |
|
5293 | 5290 | |
|
5294 | 5291 | readerObj = USRPReader() |
|
5295 | 5292 | dateList = readerObj.findDatafiles(path=data_path) |
|
5296 | 5293 | |
|
5297 | 5294 | return dateList |
|
5298 | 5295 | |
|
5299 | 5296 | def loadDays(self, data_path, ext, walk, expLabel=''): |
|
5300 | 5297 | """ |
|
5301 | 5298 | Method to loads day |
|
5302 | 5299 | """ |
|
5303 | 5300 | self.actionSaveToolbar.setEnabled(False) |
|
5304 | 5301 | self.actionStarToolbar.setEnabled(False) |
|
5305 | 5302 | |
|
5306 | 5303 | self.actionSave.setEnabled(False) |
|
5307 | 5304 | self.actionStart.setEnabled(False) |
|
5308 | 5305 | |
|
5309 | 5306 | self.proOk.setEnabled(False) |
|
5310 | 5307 | self.proComStartDate.clear() |
|
5311 | 5308 | self.proComEndDate.clear() |
|
5312 | 5309 | |
|
5313 | 5310 | self.dateList = [] |
|
5314 | 5311 | |
|
5315 | 5312 | if not data_path: |
|
5316 | 5313 | return [] |
|
5317 | 5314 | |
|
5318 | 5315 | if not os.path.isdir(data_path): |
|
5319 | 5316 | return [] |
|
5320 | 5317 | |
|
5321 | 5318 | self.dataPath = data_path |
|
5322 | 5319 | |
|
5323 | 5320 | dateList = self.findDatafiles(data_path, ext=ext, walk=walk, expLabel=expLabel) |
|
5324 | 5321 | |
|
5325 | 5322 | if not dateList: |
|
5326 | 5323 | # self.console.clear() |
|
5327 | 5324 | if walk: |
|
5328 | 5325 | if expLabel: |
|
5329 | 5326 | outputstr = "No files (*%s) were found on %s/DOYPATH/%s" % (ext, data_path, expLabel) |
|
5330 | 5327 | else: |
|
5331 | 5328 | outputstr = "No files (*%s) were found on %s" % (ext, data_path) |
|
5332 | 5329 | else: |
|
5333 | 5330 | outputstr = "No files (*%s) were found on %s" % (ext, data_path) |
|
5334 | 5331 | |
|
5335 | 5332 | self.console.append(outputstr) |
|
5336 | 5333 | return [] |
|
5337 | 5334 | |
|
5338 | 5335 | dateStrList = [] |
|
5339 | 5336 | for thisDate in dateList: |
|
5340 | 5337 | dateStr = thisDate.strftime("%Y/%m/%d") |
|
5341 | 5338 | |
|
5342 | 5339 | self.proComStartDate.addItem(dateStr) |
|
5343 | 5340 | self.proComEndDate.addItem(dateStr) |
|
5344 | 5341 | dateStrList.append(dateStr) |
|
5345 | 5342 | |
|
5346 | 5343 | self.proComStartDate.setCurrentIndex(0) |
|
5347 | 5344 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - 1) |
|
5348 | 5345 | |
|
5349 | 5346 | self.dateList = dateStrList |
|
5350 | 5347 | |
|
5351 | 5348 | self.proOk.setEnabled(True) |
|
5352 | 5349 | |
|
5353 | 5350 | self.actionSaveToolbar.setEnabled(True) |
|
5354 | 5351 | self.actionStarToolbar.setEnabled(True) |
|
5355 | 5352 | |
|
5356 | 5353 | self.actionSave.setEnabled(True) |
|
5357 | 5354 | self.actionStart.setEnabled(True) |
|
5358 | 5355 | |
|
5359 | 5356 | self.console.clear() |
|
5360 | 5357 | self.console.append("Successful load") |
|
5361 | 5358 | |
|
5362 | 5359 | return self.dateList |
|
5363 | 5360 | |
|
5364 | 5361 | def setWorkSpaceGUI(self, pathWorkSpace=None): |
|
5365 | 5362 | |
|
5366 | 5363 | if pathWorkSpace == None: |
|
5367 | 5364 | home = os.path.expanduser("~") |
|
5368 | 5365 | pathWorkSpace = os.path.join(home,'schain_workspace') |
|
5369 | 5366 | |
|
5370 | 5367 | self.pathWorkSpace = pathWorkSpace |
|
5371 | 5368 | |
|
5372 | 5369 | """ |
|
5373 | 5370 | Comandos Usados en Console |
|
5374 | 5371 | """ |
|
5375 | 5372 | def __del__(self): |
|
5376 | 5373 | sys.stdout = sys.__stdout__ |
|
5377 | 5374 | sys.stderr = sys.__stderr__ |
|
5378 | 5375 | |
|
5379 | 5376 | def normalOutputWritten(self, text): |
|
5380 | 5377 | color_black = QtGui.QColor(0,0,0) |
|
5381 | 5378 | self.console.setTextColor(color_black) |
|
5382 | 5379 | self.console.append(text) |
|
5383 | 5380 | |
|
5384 | 5381 | def errorOutputWritten(self, text): |
|
5385 | 5382 | color_red = QtGui.QColor(255,0,0) |
|
5386 | 5383 | color_black = QtGui.QColor(0,0,0) |
|
5387 | 5384 | |
|
5388 | 5385 | self.console.setTextColor(color_red) |
|
5389 | 5386 | self.console.append(text) |
|
5390 | 5387 | self.console.setTextColor(color_black) |
|
5391 | 5388 | |
|
5392 | 5389 | def setGUIStatus(self): |
|
5393 | 5390 | |
|
5394 | 5391 | self.setWindowTitle("ROJ-Signal Chain") |
|
5395 | 5392 | self.setWindowIcon(QtGui.QIcon( os.path.join(FIGURES_PATH,"logo.png") )) |
|
5396 | 5393 | |
|
5397 | 5394 | self.tabWidgetProject.setEnabled(False) |
|
5398 | 5395 | self.tabVoltage.setEnabled(False) |
|
5399 | 5396 | self.tabSpectra.setEnabled(False) |
|
5400 | 5397 | self.tabCorrelation.setEnabled(False) |
|
5401 | 5398 | self.frame_2.setEnabled(False) |
|
5402 | 5399 | |
|
5403 | 5400 | self.actionCreate.setShortcut('Ctrl+N') |
|
5404 | 5401 | self.actionOpen.setShortcut('Ctrl+O') |
|
5405 | 5402 | self.actionSave.setShortcut('Ctrl+S') |
|
5406 | 5403 | self.actionClose.setShortcut('Ctrl+X') |
|
5407 | 5404 | |
|
5408 | 5405 | self.actionStart.setShortcut('Ctrl+1') |
|
5409 | 5406 | self.actionPause.setShortcut('Ctrl+2') |
|
5410 | 5407 | self.actionStop.setShortcut('Ctrl+3') |
|
5411 | 5408 | |
|
5412 | 5409 | self.actionFTP.setShortcut('Ctrl+F') |
|
5413 | 5410 | |
|
5414 | 5411 | self.actionStart.setEnabled(False) |
|
5415 | 5412 | self.actionPause.setEnabled(False) |
|
5416 | 5413 | self.actionStop.setEnabled(False) |
|
5417 | 5414 | |
|
5418 | 5415 | self.actionStarToolbar.setEnabled(False) |
|
5419 | 5416 | self.actionPauseToolbar.setEnabled(False) |
|
5420 | 5417 | self.actionStopToolbar.setEnabled(False) |
|
5421 | 5418 | |
|
5422 | 5419 | self.proName.clear() |
|
5423 | 5420 | self.proDataPath.setText('') |
|
5424 | 5421 | self.console.setReadOnly(True) |
|
5425 | 5422 | self.console.append("Welcome to Signal Chain\nOpen a project or Create a new one") |
|
5426 | 5423 | self.proStartTime.setDisplayFormat("hh:mm:ss") |
|
5427 | 5424 | self.proDataType.setEnabled(False) |
|
5428 | 5425 | self.time = QtCore.QTime() |
|
5429 | 5426 | self.hour = 0 |
|
5430 | 5427 | self.min = 0 |
|
5431 | 5428 | self.sec = 0 |
|
5432 | 5429 | self.proEndTime.setDisplayFormat("hh:mm:ss") |
|
5433 | 5430 | startTime = "00:00:00" |
|
5434 | 5431 | endTime = "23:59:59" |
|
5435 | 5432 | starlist = startTime.split(":") |
|
5436 | 5433 | endlist = endTime.split(":") |
|
5437 | 5434 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) |
|
5438 | 5435 | self.proStartTime.setTime(self.time) |
|
5439 | 5436 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
5440 | 5437 | self.proEndTime.setTime(self.time) |
|
5441 | 5438 | self.proOk.setEnabled(False) |
|
5442 | 5439 | # set model Project Explorer |
|
5443 | 5440 | self.projectExplorerModel = QtGui.QStandardItemModel() |
|
5444 | 5441 | self.projectExplorerModel.setHorizontalHeaderLabels(("Project Explorer",)) |
|
5445 | 5442 | layout = QtGui.QVBoxLayout() |
|
5446 | 5443 | layout.addWidget(self.projectExplorerTree) |
|
5447 | 5444 | self.projectExplorerTree.setModel(self.projectExplorerModel) |
|
5448 | 5445 | self.projectExplorerTree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) |
|
5449 | 5446 | self.projectExplorerTree.customContextMenuRequested.connect(self.on_right_click) |
|
5450 | 5447 | self.projectExplorerTree.clicked.connect(self.on_click) |
|
5451 | 5448 | self.projectExplorerTree.expandAll() |
|
5452 | 5449 | # set model Project Properties |
|
5453 | 5450 | |
|
5454 | 5451 | self.propertiesModel = TreeModel() |
|
5455 | 5452 | self.propertiesModel.initProjectView() |
|
5456 | 5453 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
5457 | 5454 | self.treeProjectProperties.expandAll() |
|
5458 | 5455 | self.treeProjectProperties.allColumnsShowFocus() |
|
5459 | 5456 | self.treeProjectProperties.resizeColumnToContents(1) |
|
5460 | 5457 | |
|
5461 | 5458 | # set Project |
|
5462 | 5459 | self.proExpLabel.setEnabled(True) |
|
5463 | 5460 | self.proDelay.setEnabled(False) |
|
5464 | 5461 | self.proSet.setEnabled(True) |
|
5465 | 5462 | self.proDataType.setReadOnly(True) |
|
5466 | 5463 | |
|
5467 | 5464 | # set Operation Voltage |
|
5468 | 5465 | self.volOpComChannels.setEnabled(False) |
|
5469 | 5466 | self.volOpComHeights.setEnabled(False) |
|
5470 | 5467 | self.volOpFilter.setEnabled(False) |
|
5471 | 5468 | self.volOpComProfile.setEnabled(False) |
|
5472 | 5469 | self.volOpComCode.setEnabled(False) |
|
5473 | 5470 | self.volOpFlip.setEnabled(False) |
|
5474 | 5471 | self.volOpCohInt.setEnabled(False) |
|
5475 | 5472 | self.volOpRadarfrequency.setEnabled(False) |
|
5476 | 5473 | |
|
5477 | 5474 | self.volOpChannel.setEnabled(False) |
|
5478 | 5475 | self.volOpHeights.setEnabled(False) |
|
5479 | 5476 | self.volOpProfile.setEnabled(False) |
|
5480 | 5477 | self.volOpComMode.setEnabled(False) |
|
5481 | 5478 | |
|
5482 | 5479 | self.volGraphPath.setEnabled(False) |
|
5483 | 5480 | self.volGraphPrefix.setEnabled(False) |
|
5484 | 5481 | self.volGraphToolPath.setEnabled(False) |
|
5485 | 5482 | |
|
5486 | 5483 | # set Graph Voltage |
|
5487 | 5484 | self.volGraphChannelList.setEnabled(False) |
|
5488 | 5485 | self.volGraphfreqrange.setEnabled(False) |
|
5489 | 5486 | self.volGraphHeightrange.setEnabled(False) |
|
5490 | 5487 | |
|
5491 | 5488 | # set Operation Spectra |
|
5492 | 5489 | self.specOpnFFTpoints.setEnabled(False) |
|
5493 | 5490 | self.specOpProfiles.setEnabled(False) |
|
5494 | 5491 | self.specOpippFactor.setEnabled(False) |
|
5495 | 5492 | self.specOppairsList.setEnabled(False) |
|
5496 | 5493 | self.specOpComChannel.setEnabled(False) |
|
5497 | 5494 | self.specOpComHeights.setEnabled(False) |
|
5498 | 5495 | self.specOpIncoherent.setEnabled(False) |
|
5499 | 5496 | self.specOpgetNoise.setEnabled(False) |
|
5500 | 5497 | self.specOpRadarfrequency.setEnabled(False) |
|
5501 | 5498 | |
|
5502 | 5499 | |
|
5503 | 5500 | self.specOpChannel.setEnabled(False) |
|
5504 | 5501 | self.specOpHeights.setEnabled(False) |
|
5505 | 5502 | # set Graph Spectra |
|
5506 | 5503 | self.specGgraphChannelList.setEnabled(False) |
|
5507 | 5504 | self.specGgraphFreq.setEnabled(False) |
|
5508 | 5505 | self.specGgraphHeight.setEnabled(False) |
|
5509 | 5506 | self.specGgraphDbsrange.setEnabled(False) |
|
5510 | 5507 | self.specGgraphmagnitud.setEnabled(False) |
|
5511 | 5508 | self.specGgraphTminTmax.setEnabled(False) |
|
5512 | 5509 | self.specGgraphTimeRange.setEnabled(False) |
|
5513 | 5510 | self.specGraphPath.setEnabled(False) |
|
5514 | 5511 | self.specGraphToolPath.setEnabled(False) |
|
5515 | 5512 | self.specGraphPrefix.setEnabled(False) |
|
5516 | 5513 | |
|
5517 | 5514 | self.specGgraphftpratio.setEnabled(False) |
|
5518 | 5515 | # set Operation SpectraHeis |
|
5519 | 5516 | self.specHeisOpIncoherent.setEnabled(False) |
|
5520 | 5517 | self.specHeisOpCobIncInt.setEnabled(False) |
|
5521 | 5518 | # set Graph SpectraHeis |
|
5522 | 5519 | self.specHeisGgraphChannelList.setEnabled(False) |
|
5523 | 5520 | self.specHeisGgraphXminXmax.setEnabled(False) |
|
5524 | 5521 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
5525 | 5522 | self.specHeisGgraphTminTmax.setEnabled(False) |
|
5526 | 5523 | self.specHeisGgraphTimeRange.setEnabled(False) |
|
5527 | 5524 | self.specHeisGgraphftpratio.setEnabled(False) |
|
5528 | 5525 | self.specHeisGraphPath.setEnabled(False) |
|
5529 | 5526 | self.specHeisGraphPrefix.setEnabled(False) |
|
5530 | 5527 | self.specHeisGraphToolPath.setEnabled(False) |
|
5531 | 5528 | |
|
5532 | 5529 | |
|
5533 | 5530 | # tool tip gui |
|
5534 | 5531 | QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10)) |
|
5535 | 5532 | self.projectExplorerTree.setToolTip('Right clik to add Project or Unit Process') |
|
5536 | 5533 | # tool tip gui project |
|
5537 | 5534 | 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>') |
|
5538 | 5535 | self.proComWalk.setCurrentIndex(0) |
|
5539 | 5536 | # tool tip gui volOp |
|
5540 | 5537 | self.volOpChannel.setToolTip('Example: 1,2,3,4,5') |
|
5541 | 5538 | self.volOpHeights.setToolTip('Example: 90,180') |
|
5542 | 5539 | self.volOpFilter.setToolTip('Example: 2') |
|
5543 | 5540 | self.volOpProfile.setToolTip('Example:0,127') |
|
5544 | 5541 | self.volOpCohInt.setToolTip('Example: 128') |
|
5545 | 5542 | self.volOpFlip.setToolTip('ChannelList where flip will be applied. Example: 0,2,3') |
|
5546 | 5543 | self.volOpOk.setToolTip('If you have finished, please Ok ') |
|
5547 | 5544 | # tool tip gui volGraph |
|
5548 | 5545 | self.volGraphfreqrange.setToolTip('Height range. Example: 50,100') |
|
5549 | 5546 | self.volGraphHeightrange.setToolTip('Amplitude. Example: 0,10000') |
|
5550 | 5547 | # tool tip gui specOp |
|
5551 | 5548 | self.specOpnFFTpoints.setToolTip('Example: 128') |
|
5552 | 5549 | self.specOpProfiles.setToolTip('Example: 128') |
|
5553 | 5550 | self.specOpippFactor.setToolTip('Example:1.0') |
|
5554 | 5551 | self.specOpIncoherent.setToolTip('Example: 10') |
|
5555 | 5552 | self.specOpgetNoise.setToolTip('Example:20,180,30,120 (minHei,maxHei,minVel,maxVel)') |
|
5556 | 5553 | |
|
5557 | 5554 | self.specOpChannel.setToolTip('Example: 0,1,2,3') |
|
5558 | 5555 | self.specOpHeights.setToolTip('Example: 90,180') |
|
5559 | 5556 | self.specOppairsList.setToolTip('Example: (0,1),(2,3)') |
|
5560 | 5557 | # tool tip gui specGraph |
|
5561 | 5558 | |
|
5562 | 5559 | self.specGgraphChannelList.setToolTip('Example: 0,3,4') |
|
5563 | 5560 | self.specGgraphFreq.setToolTip('Example: -20,20') |
|
5564 | 5561 | self.specGgraphHeight.setToolTip('Example: 100,400') |
|
5565 | 5562 | self.specGgraphDbsrange.setToolTip('Example: 30,170') |
|
5566 | 5563 | |
|
5567 | 5564 | self.specGraphPrefix.setToolTip('Example: EXPERIMENT_NAME') |
|
5568 | 5565 | |
|
5569 | 5566 | |
|
5570 | 5567 | self.specHeisOpIncoherent.setToolTip('Example: 10') |
|
5571 | 5568 | |
|
5572 | 5569 | self.specHeisGgraphChannelList.setToolTip('Example: 0,2,3') |
|
5573 | 5570 | self.specHeisGgraphXminXmax.setToolTip('Example (Hz): -1000, 1000') |
|
5574 | 5571 | self.specHeisGgraphYminYmax.setToolTip('Example (dB): 5, 35') |
|
5575 | 5572 | self.specHeisGgraphTminTmax.setToolTip('Example (hours): 0, 24') |
|
5576 | 5573 | self.specHeisGgraphTimeRange.setToolTip('Example (hours): 8') |
|
5577 | 5574 | |
|
5578 | 5575 | self.labelSet.show() |
|
5579 | 5576 | self.proSet.show() |
|
5580 | 5577 | |
|
5581 | 5578 | self.labelIPPKm.hide() |
|
5582 | 5579 | self.proIPPKm.hide() |
|
5583 | 5580 | |
|
5584 | 5581 | sys.stdout = ShowMeConsole(textWritten=self.normalOutputWritten) |
|
5585 | 5582 | # sys.stderr = ShowMeConsole(textWritten=self.errorOutputWritten) |
|
5586 | 5583 | |
|
5587 | 5584 | |
|
5588 | 5585 | class UnitProcessWindow(QMainWindow, Ui_UnitProcess): |
|
5589 | 5586 | """ |
|
5590 | 5587 | Class documentation goes here. |
|
5591 | 5588 | """ |
|
5592 | 5589 | closed = pyqtSignal() |
|
5593 | 5590 | create = False |
|
5594 | 5591 | |
|
5595 | 5592 | def __init__(self, parent=None): |
|
5596 | 5593 | """ |
|
5597 | 5594 | Constructor |
|
5598 | 5595 | """ |
|
5599 | 5596 | QMainWindow.__init__(self, parent) |
|
5600 | 5597 | self.setupUi(self) |
|
5601 | 5598 | self.getFromWindow = None |
|
5602 | 5599 | self.getfromWindowList = [] |
|
5603 | 5600 | self.dataTypeProject = None |
|
5604 | 5601 | |
|
5605 | 5602 | self.listUP = None |
|
5606 | 5603 | |
|
5607 | 5604 | @pyqtSignature("") |
|
5608 | 5605 | def on_unitPokbut_clicked(self): |
|
5609 | 5606 | """ |
|
5610 | 5607 | Slot documentation goes here. |
|
5611 | 5608 | """ |
|
5612 | 5609 | self.create = True |
|
5613 | 5610 | self.getFromWindow = self.getfromWindowList[int(self.comboInputBox.currentIndex())] |
|
5614 | 5611 | # self.nameofUP= str(self.nameUptxt.text()) |
|
5615 | 5612 | self.typeofUP = str(self.comboTypeBox.currentText()) |
|
5616 | 5613 | self.close() |
|
5617 | 5614 | |
|
5618 | 5615 | |
|
5619 | 5616 | @pyqtSignature("") |
|
5620 | 5617 | def on_unitPcancelbut_clicked(self): |
|
5621 | 5618 | """ |
|
5622 | 5619 | Slot documentation goes here. |
|
5623 | 5620 | """ |
|
5624 | 5621 | self.create = False |
|
5625 | 5622 | self.close() |
|
5626 | 5623 | |
|
5627 | 5624 | def loadTotalList(self): |
|
5628 | 5625 | self.comboInputBox.clear() |
|
5629 | 5626 | for i in self.getfromWindowList: |
|
5630 | 5627 | |
|
5631 | 5628 | name = i.getElementName() |
|
5632 | 5629 | if name == 'Project': |
|
5633 | 5630 | id = i.id |
|
5634 | 5631 | name = i.name |
|
5635 | 5632 | if self.dataTypeProject == 'Voltage': |
|
5636 | 5633 | self.comboTypeBox.clear() |
|
5637 | 5634 | self.comboTypeBox.addItem("Voltage") |
|
5638 | 5635 | |
|
5639 | 5636 | if self.dataTypeProject == 'Spectra': |
|
5640 | 5637 | self.comboTypeBox.clear() |
|
5641 | 5638 | self.comboTypeBox.addItem("Spectra") |
|
5642 | 5639 | self.comboTypeBox.addItem("Correlation") |
|
5643 | 5640 | if self.dataTypeProject == 'Fits': |
|
5644 | 5641 | self.comboTypeBox.clear() |
|
5645 | 5642 | self.comboTypeBox.addItem("SpectraHeis") |
|
5646 | 5643 | |
|
5647 | 5644 | |
|
5648 | 5645 | if name == 'ProcUnit': |
|
5649 | 5646 | id = int(i.id) - 1 |
|
5650 | 5647 | name = i.datatype |
|
5651 | 5648 | if name == 'Voltage': |
|
5652 | 5649 | self.comboTypeBox.clear() |
|
5653 | 5650 | self.comboTypeBox.addItem("Spectra") |
|
5654 | 5651 | self.comboTypeBox.addItem("SpectraHeis") |
|
5655 | 5652 | self.comboTypeBox.addItem("Correlation") |
|
5656 | 5653 | if name == 'Spectra': |
|
5657 | 5654 | self.comboTypeBox.clear() |
|
5658 | 5655 | self.comboTypeBox.addItem("Spectra") |
|
5659 | 5656 | self.comboTypeBox.addItem("SpectraHeis") |
|
5660 | 5657 | self.comboTypeBox.addItem("Correlation") |
|
5661 | 5658 | if name == 'SpectraHeis': |
|
5662 | 5659 | self.comboTypeBox.clear() |
|
5663 | 5660 | self.comboTypeBox.addItem("SpectraHeis") |
|
5664 | 5661 | |
|
5665 | 5662 | self.comboInputBox.addItem(str(name)) |
|
5666 | 5663 | # self.comboInputBox.addItem(str(name)+str(id)) |
|
5667 | 5664 | |
|
5668 | 5665 | def closeEvent(self, event): |
|
5669 | 5666 | self.closed.emit() |
|
5670 | 5667 | event.accept() |
|
5671 | 5668 | |
|
5672 | 5669 | class Ftp(QMainWindow, Ui_Ftp): |
|
5673 | 5670 | """ |
|
5674 | 5671 | Class documentation goes here. |
|
5675 | 5672 | """ |
|
5676 | 5673 | create = False |
|
5677 | 5674 | closed = pyqtSignal() |
|
5678 | 5675 | server = None |
|
5679 | 5676 | remotefolder = None |
|
5680 | 5677 | username = None |
|
5681 | 5678 | password = None |
|
5682 | 5679 | ftp_wei = None |
|
5683 | 5680 | exp_code = None |
|
5684 | 5681 | sub_exp_code = None |
|
5685 | 5682 | plot_pos = None |
|
5686 | 5683 | |
|
5687 | 5684 | def __init__(self, parent=None): |
|
5688 | 5685 | """ |
|
5689 | 5686 | Constructor |
|
5690 | 5687 | """ |
|
5691 | 5688 | QMainWindow.__init__(self, parent) |
|
5692 | 5689 | self.setupUi(self) |
|
5693 | 5690 | self.setGUIStatus() |
|
5694 | 5691 | |
|
5695 | 5692 | def setGUIStatus(self): |
|
5696 | 5693 | self.setWindowTitle("ROJ-Signal Chain") |
|
5697 | 5694 | self.serverFTP.setToolTip('Example: jro-app.igp.gob.pe') |
|
5698 | 5695 | self.folderFTP.setToolTip('Example: /home/wmaster/graficos') |
|
5699 | 5696 | self.usernameFTP.setToolTip('Example: myusername') |
|
5700 | 5697 | self.passwordFTP.setToolTip('Example: mypass ') |
|
5701 | 5698 | self.weightFTP.setToolTip('Example: 0') |
|
5702 | 5699 | self.expcodeFTP.setToolTip('Example: 0') |
|
5703 | 5700 | self.subexpFTP.setToolTip('Example: 0') |
|
5704 | 5701 | self.plotposFTP.setToolTip('Example: 0') |
|
5705 | 5702 | |
|
5706 | 5703 | def setParmsfromTemporal(self, server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos): |
|
5707 | 5704 | self.serverFTP.setText(str(server)) |
|
5708 | 5705 | self.folderFTP.setText(str(remotefolder)) |
|
5709 | 5706 | self.usernameFTP.setText(str(username)) |
|
5710 | 5707 | self.passwordFTP.setText(str(password)) |
|
5711 | 5708 | self.weightFTP.setText(str(ftp_wei)) |
|
5712 | 5709 | self.expcodeFTP.setText(str(exp_code)) |
|
5713 | 5710 | self.subexpFTP.setText(str(sub_exp_code)) |
|
5714 | 5711 | self.plotposFTP.setText(str(plot_pos)) |
|
5715 | 5712 | |
|
5716 | 5713 | def getParmsFromFtpWindow(self): |
|
5717 | 5714 | """ |
|
5718 | 5715 | Return Inputs Project: |
|
5719 | 5716 | - server |
|
5720 | 5717 | - remotefolder |
|
5721 | 5718 | - username |
|
5722 | 5719 | - password |
|
5723 | 5720 | - ftp_wei |
|
5724 | 5721 | - exp_code |
|
5725 | 5722 | - sub_exp_code |
|
5726 | 5723 | - plot_pos |
|
5727 | 5724 | """ |
|
5728 | 5725 | name_server_ftp = str(self.serverFTP.text()) |
|
5729 | 5726 | if not name_server_ftp: |
|
5730 | 5727 | self.console.clear() |
|
5731 | 5728 | self.console.append("Please Write a FTP Server") |
|
5732 | 5729 | return 0 |
|
5733 | 5730 | |
|
5734 | 5731 | folder_server_ftp = str(self.folderFTP.text()) |
|
5735 | 5732 | if not folder_server_ftp: |
|
5736 | 5733 | self.console.clear() |
|
5737 | 5734 | self.console.append("Please Write a Folder") |
|
5738 | 5735 | return 0 |
|
5739 | 5736 | |
|
5740 | 5737 | username_ftp = str(self.usernameFTP.text()) |
|
5741 | 5738 | if not username_ftp: |
|
5742 | 5739 | self.console.clear() |
|
5743 | 5740 | self.console.append("Please Write a User Name") |
|
5744 | 5741 | return 0 |
|
5745 | 5742 | |
|
5746 | 5743 | password_ftp = str(self.passwordFTP.text()) |
|
5747 | 5744 | if not password_ftp: |
|
5748 | 5745 | self.console.clear() |
|
5749 | 5746 | self.console.append("Please Write a passwordFTP") |
|
5750 | 5747 | return 0 |
|
5751 | 5748 | |
|
5752 | 5749 | ftp_wei = str(self.weightFTP.text()) |
|
5753 | 5750 | if not ftp_wei == "": |
|
5754 | 5751 | try: |
|
5755 | 5752 | ftp_wei = int(self.weightFTP.text()) |
|
5756 | 5753 | except: |
|
5757 | 5754 | self.console.clear() |
|
5758 | 5755 | self.console.append("Please Write a ftp_wei number") |
|
5759 | 5756 | return 0 |
|
5760 | 5757 | |
|
5761 | 5758 | exp_code = str(self.expcodeFTP.text()) |
|
5762 | 5759 | if not exp_code == "": |
|
5763 | 5760 | try: |
|
5764 | 5761 | exp_code = int(self.expcodeFTP.text()) |
|
5765 | 5762 | except: |
|
5766 | 5763 | self.console.clear() |
|
5767 | 5764 | self.console.append("Please Write a exp_code number") |
|
5768 | 5765 | return 0 |
|
5769 | 5766 | |
|
5770 | 5767 | |
|
5771 | 5768 | sub_exp_code = str(self.subexpFTP.text()) |
|
5772 | 5769 | if not sub_exp_code == "": |
|
5773 | 5770 | try: |
|
5774 | 5771 | sub_exp_code = int(self.subexpFTP.text()) |
|
5775 | 5772 | except: |
|
5776 | 5773 | self.console.clear() |
|
5777 | 5774 | self.console.append("Please Write a sub_exp_code number") |
|
5778 | 5775 | return 0 |
|
5779 | 5776 | |
|
5780 | 5777 | plot_pos = str(self.plotposFTP.text()) |
|
5781 | 5778 | if not plot_pos == "": |
|
5782 | 5779 | try: |
|
5783 | 5780 | plot_pos = int(self.plotposFTP.text()) |
|
5784 | 5781 | except: |
|
5785 | 5782 | self.console.clear() |
|
5786 | 5783 | self.console.append("Please Write a plot_pos number") |
|
5787 | 5784 | return 0 |
|
5788 | 5785 | |
|
5789 | 5786 | return name_server_ftp, folder_server_ftp, username_ftp, password_ftp, ftp_wei, exp_code, sub_exp_code, plot_pos |
|
5790 | 5787 | |
|
5791 | 5788 | @pyqtSignature("") |
|
5792 | 5789 | def on_ftpOkButton_clicked(self): |
|
5793 | 5790 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.getParmsFromFtpWindow() |
|
5794 | 5791 | self.create = True |
|
5795 | 5792 | self.close() |
|
5796 | 5793 | |
|
5797 | 5794 | @pyqtSignature("") |
|
5798 | 5795 | def on_ftpCancelButton_clicked(self): |
|
5799 | 5796 | self.create = False |
|
5800 | 5797 | self.close() |
|
5801 | 5798 | |
|
5802 | 5799 | def closeEvent(self, event): |
|
5803 | 5800 | self.closed.emit() |
|
5804 | 5801 | event.accept() |
|
5805 | 5802 | |
|
5806 | 5803 | class ftpBuffer(): |
|
5807 | 5804 | |
|
5808 | 5805 | server = None |
|
5809 | 5806 | remotefolder = None |
|
5810 | 5807 | username = None |
|
5811 | 5808 | password = None |
|
5812 | 5809 | ftp_wei = None |
|
5813 | 5810 | exp_code = None |
|
5814 | 5811 | sub_exp_code = None |
|
5815 | 5812 | plot_pos = None |
|
5816 | 5813 | create = False |
|
5817 | 5814 | withoutconfig = False |
|
5818 | 5815 | createforView = False |
|
5819 | 5816 | localfolder = None |
|
5820 | 5817 | extension = None |
|
5821 | 5818 | period = None |
|
5822 | 5819 | protocol = None |
|
5823 | 5820 | |
|
5824 | 5821 | def __init__(self): |
|
5825 | 5822 | |
|
5826 | 5823 | self.create = False |
|
5827 | 5824 | self.server = None |
|
5828 | 5825 | self.remotefolder = None |
|
5829 | 5826 | self.username = None |
|
5830 | 5827 | self.password = None |
|
5831 | 5828 | self.ftp_wei = None |
|
5832 | 5829 | self.exp_code = None |
|
5833 | 5830 | self.sub_exp_code = None |
|
5834 | 5831 | self.plot_pos = None |
|
5835 | 5832 | # self.create = False |
|
5836 | 5833 | self.localfolder = None |
|
5837 | 5834 | self.extension = None |
|
5838 | 5835 | self.period = None |
|
5839 | 5836 | self.protocol = None |
|
5840 | 5837 | |
|
5841 | 5838 | def setwithoutconfiguration(self): |
|
5842 | 5839 | |
|
5843 | 5840 | self.create = False |
|
5844 | 5841 | self.server = "jro-app.igp.gob.pe" |
|
5845 | 5842 | self.remotefolder = "/home/wmaster/graficos" |
|
5846 | 5843 | self.username = "wmaster" |
|
5847 | 5844 | self.password = "mst2010vhf" |
|
5848 | 5845 | self.withoutconfig = True |
|
5849 | 5846 | self.localfolder = './' |
|
5850 | 5847 | self.extension = '.png' |
|
5851 | 5848 | self.period = 60 |
|
5852 | 5849 | self.protocol = 'ftp' |
|
5853 | 5850 | self.createforView = True |
|
5854 | 5851 | |
|
5855 | 5852 | if not self.ftp_wei: |
|
5856 | 5853 | self.ftp_wei = 0 |
|
5857 | 5854 | |
|
5858 | 5855 | if not self.exp_code: |
|
5859 | 5856 | self.exp_code = 0 |
|
5860 | 5857 | |
|
5861 | 5858 | if not self.sub_exp_code: |
|
5862 | 5859 | self.sub_exp_code = 0 |
|
5863 | 5860 | |
|
5864 | 5861 | if not self.plot_pos: |
|
5865 | 5862 | self.plot_pos = 0 |
|
5866 | 5863 | |
|
5867 | 5864 | 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'): |
|
5868 | 5865 | |
|
5869 | 5866 | self.server = server |
|
5870 | 5867 | self.remotefolder = remotefolder |
|
5871 | 5868 | self.username = username |
|
5872 | 5869 | self.password = password |
|
5873 | 5870 | self.ftp_wei = ftp_wei |
|
5874 | 5871 | self.exp_code = exp_code |
|
5875 | 5872 | self.sub_exp_code = sub_exp_code |
|
5876 | 5873 | self.plot_pos = plot_pos |
|
5877 | 5874 | self.create = True |
|
5878 | 5875 | self.withoutconfig = False |
|
5879 | 5876 | self.createforView = True |
|
5880 | 5877 | self.localfolder = localfolder |
|
5881 | 5878 | self.extension = extension |
|
5882 | 5879 | self.period = period |
|
5883 | 5880 | self.protocol = protocol |
|
5884 | 5881 | |
|
5885 | 5882 | def recover(self): |
|
5886 | 5883 | |
|
5887 | 5884 | 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 |
|
5888 | 5885 | |
|
5889 | 5886 | class ShowMeConsole(QtCore.QObject): |
|
5890 | 5887 | |
|
5891 | 5888 | textWritten = QtCore.pyqtSignal(str) |
|
5892 | 5889 | |
|
5893 | 5890 | def write(self, text): |
|
5894 | 5891 | |
|
5895 | 5892 | if len(text) == 0: |
|
5896 | 5893 | self.textWritten.emit("\n") |
|
5897 | 5894 | return |
|
5898 | 5895 | |
|
5899 | 5896 | if text[-1] == "\n": |
|
5900 | 5897 | text = text[:-1] |
|
5901 | 5898 | |
|
5902 | 5899 | self.textWritten.emit(str(text)) |
@@ -1,342 +1,342 | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | # Form implementation generated from reading ui file '/home/alex/ui/MainWindow_21_02_13_v49.ui' |
|
4 | 4 | # |
|
5 | 5 | # Created: Mon Mar 24 13:28:36 2014 |
|
6 | 6 | # by: PyQt4 UI code generator 4.10 |
|
7 | 7 | # |
|
8 | 8 | # WARNING! All changes made in this file will be lost! |
|
9 | 9 | |
|
10 | 10 | from PyQt4 import QtCore, QtGui |
|
11 | 11 | from windows import * |
|
12 | 12 | |
|
13 | 13 | try: |
|
14 | 14 | _fromUtf8 = QtCore.QString.fromUtf8 |
|
15 | 15 | except AttributeError: |
|
16 | 16 | def _fromUtf8(s): |
|
17 | 17 | return s |
|
18 | 18 | |
|
19 | 19 | try: |
|
20 | 20 | _encoding = QtGui.QApplication.UnicodeUTF8 |
|
21 | 21 | def _translate(context, text, disambig): |
|
22 | 22 | return QtGui.QApplication.translate(context, text, disambig, _encoding) |
|
23 | 23 | except AttributeError: |
|
24 | 24 | def _translate(context, text, disambig): |
|
25 | 25 | return QtGui.QApplication.translate(context, text, disambig) |
|
26 | 26 | |
|
27 | 27 | import os |
|
28 | 28 | from schainpy.gui.figures import tools |
|
29 | 29 | from schainpy import __version__ |
|
30 | 30 | |
|
31 | 31 | FIGURES_PATH = tools.get_path() |
|
32 | 32 | |
|
33 | 33 | class Ui_EnvWindow(object): |
|
34 | 34 | paused = False |
|
35 | 35 | |
|
36 | 36 | def restorePauseIcon(self): |
|
37 | 37 | |
|
38 | 38 | icon_name = "pause.png" |
|
39 | 39 | iconPause = QtGui.QIcon() |
|
40 | 40 | iconPause.addPixmap(QtGui.QPixmap(_fromUtf8( os.path.join(FIGURES_PATH, icon_name) )), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
41 | 41 | self.actionPauseToolbar.setIcon(iconPause) |
|
42 | 42 | |
|
43 | 43 | def restoreStartIcon(self): |
|
44 | 44 | |
|
45 | 45 | icon_name = "start.png" |
|
46 | 46 | iconStart = QtGui.QIcon() |
|
47 | 47 | iconStart.addPixmap(QtGui.QPixmap(_fromUtf8( os.path.join(FIGURES_PATH, icon_name) )), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
48 | 48 | self.actionStarToolbar.setIcon(iconStart) |
|
49 | 49 | |
|
50 | 50 | def changePauseIcon(self, paused=False): |
|
51 | 51 | |
|
52 | 52 | if paused == True: |
|
53 | 53 | icon_name = "pausered.png" |
|
54 | 54 | else: |
|
55 | 55 | icon_name = "pause.png" |
|
56 | 56 | |
|
57 | 57 | iconPause = QtGui.QIcon() |
|
58 | 58 | iconPause.addPixmap(QtGui.QPixmap(_fromUtf8( os.path.join(FIGURES_PATH, icon_name) )), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
59 | 59 | self.actionPauseToolbar.setIcon(iconPause) |
|
60 | 60 | |
|
61 | 61 | return |
|
62 | 62 | |
|
63 | 63 | def changeStartIcon(self, started=False): |
|
64 | 64 | |
|
65 | 65 | if started == True: |
|
66 | 66 | icon_name = "startred.png" |
|
67 | 67 | else: |
|
68 | 68 | icon_name = "start.png" |
|
69 | 69 | |
|
70 | 70 | iconStart = QtGui.QIcon() |
|
71 | 71 | iconStart.addPixmap(QtGui.QPixmap(_fromUtf8( os.path.join(FIGURES_PATH, icon_name) )), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
72 | 72 | self.actionStarToolbar.setIcon(iconStart) |
|
73 |
|
|
|
73 | ||
|
74 | 74 | return |
|
75 | 75 | |
|
76 | 76 | def setupUi(self, MainWindow): |
|
77 | 77 | |
|
78 | 78 | self.paused=False |
|
79 | 79 | |
|
80 | 80 | MainWindow.setObjectName(_fromUtf8("MainWindow")) |
|
81 | 81 | MainWindow.resize(1200, 800) |
|
82 | 82 | |
|
83 | 83 | self.centralWidget = QtGui.QWidget(MainWindow) |
|
84 | 84 | self.centralWidget.setObjectName(_fromUtf8("centralWidget")) |
|
85 | 85 | self.gridLayout_16 = QtGui.QGridLayout(self.centralWidget) |
|
86 | 86 | self.gridLayout_16.setObjectName(_fromUtf8("gridLayout_16")) |
|
87 | 87 | self.splitter_2 = QtGui.QSplitter(self.centralWidget) |
|
88 | 88 | self.splitter_2.setOrientation(QtCore.Qt.Horizontal) |
|
89 | 89 | self.splitter_2.setObjectName(_fromUtf8("splitter_2")) |
|
90 | 90 | self.projectExplorerTree = QtGui.QTreeView(self.splitter_2) |
|
91 | 91 | self.projectExplorerTree.setObjectName(_fromUtf8("projectExplorerTree")) |
|
92 | 92 | self.splitter = QtGui.QSplitter(self.splitter_2) |
|
93 | 93 | self.splitter.setOrientation(QtCore.Qt.Vertical) |
|
94 | 94 | self.splitter.setObjectName(_fromUtf8("splitter")) |
|
95 | 95 | self.tabWidgetProject = QtGui.QTabWidget(self.splitter) |
|
96 | 96 | self.tabWidgetProject.setMinimumSize(QtCore.QSize(0, 278)) |
|
97 | 97 | self.tabWidgetProject.setMaximumSize(QtCore.QSize(16777215, 16777215)) |
|
98 | 98 | self.tabWidgetProject.setObjectName(_fromUtf8("tabWidgetProject")) |
|
99 | 99 | |
|
100 | 100 | self.tabConsole = QtGui.QTabWidget(self.splitter) |
|
101 | 101 | self.tabConsole.setMinimumSize(QtCore.QSize(0, 0)) |
|
102 | 102 | self.tabConsole.setObjectName(_fromUtf8("tabConsole")) |
|
103 | 103 | self.tab_5 = QtGui.QWidget() |
|
104 | 104 | self.tab_5.setObjectName(_fromUtf8("tab_5")) |
|
105 | 105 | self.gridLayout_4 = QtGui.QGridLayout(self.tab_5) |
|
106 | 106 | self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4")) |
|
107 | 107 | self.console = QtGui.QTextEdit(self.tab_5) |
|
108 | 108 | self.console.setObjectName(_fromUtf8("console")) |
|
109 | 109 | self.gridLayout_4.addWidget(self.console, 0, 0, 1, 1) |
|
110 | 110 | self.tabConsole.addTab(self.tab_5, _fromUtf8("")) |
|
111 | 111 | self.tabWidget = QtGui.QTabWidget(self.splitter_2) |
|
112 | 112 | self.tabWidget.setObjectName(_fromUtf8("tabWidget")) |
|
113 | 113 | self.tabProjectProperty = QtGui.QWidget() |
|
114 | 114 | self.tabProjectProperty.setObjectName(_fromUtf8("tabProjectProperty")) |
|
115 | 115 | self.gridLayout_8 = QtGui.QGridLayout(self.tabProjectProperty) |
|
116 | 116 | self.gridLayout_8.setObjectName(_fromUtf8("gridLayout_8")) |
|
117 | 117 | self.treeProjectProperties = QtGui.QTreeView(self.tabProjectProperty) |
|
118 | 118 | self.treeProjectProperties.setObjectName(_fromUtf8("treeProjectProperties")) |
|
119 | 119 | self.gridLayout_8.addWidget(self.treeProjectProperties, 0, 0, 1, 1) |
|
120 | 120 | self.tabWidget.addTab(self.tabProjectProperty, _fromUtf8("")) |
|
121 | 121 | self.gridLayout_16.addWidget(self.splitter_2, 1, 0, 1, 1) |
|
122 | 122 | |
|
123 | 123 | MainWindow.setCentralWidget(self.centralWidget) |
|
124 | 124 | self.toolBar = QtGui.QToolBar(MainWindow) |
|
125 | 125 | self.toolBar.setObjectName(_fromUtf8("toolBar")) |
|
126 | 126 | MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) |
|
127 | 127 | |
|
128 | 128 | self.menuBar = QtGui.QMenuBar(MainWindow) |
|
129 | 129 | self.menuBar.setGeometry(QtCore.QRect(0, 0, 1065, 25)) |
|
130 | 130 | self.menuBar.setObjectName(_fromUtf8("menuBar")) |
|
131 | 131 | self.menuProject = QtGui.QMenu(self.menuBar) |
|
132 | 132 | self.menuProject.setObjectName(_fromUtf8("menuProject")) |
|
133 | 133 | self.menuRun = QtGui.QMenu(self.menuBar) |
|
134 | 134 | self.menuRun.setObjectName(_fromUtf8("menuRun")) |
|
135 | 135 | self.menuOptions = QtGui.QMenu(self.menuBar) |
|
136 | 136 | self.menuOptions.setObjectName(_fromUtf8("menuOptions")) |
|
137 | 137 | self.menuHelp = QtGui.QMenu(self.menuBar) |
|
138 | 138 | self.menuHelp.setObjectName(_fromUtf8("menuHelp")) |
|
139 | 139 | MainWindow.setMenuBar(self.menuBar) |
|
140 | 140 | |
|
141 | 141 | iconOpen = QtGui.QIcon() |
|
142 | 142 | iconOpen.addPixmap(QtGui.QPixmap(_fromUtf8( os.path.join(FIGURES_PATH,"open.png") )), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
143 | 143 | iconCreate = QtGui.QIcon() |
|
144 | 144 | iconCreate.addPixmap(QtGui.QPixmap(_fromUtf8( os.path.join(FIGURES_PATH,"new.png") )), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
145 | 145 | iconSave = QtGui.QIcon() |
|
146 | 146 | iconSave.addPixmap(QtGui.QPixmap(_fromUtf8( os.path.join(FIGURES_PATH,"save.png") )), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
147 | 147 | iconStart = QtGui.QIcon() |
|
148 | 148 | iconStart.addPixmap(QtGui.QPixmap(_fromUtf8( os.path.join(FIGURES_PATH,"start.png") )), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
149 | 149 | iconStop = QtGui.QIcon() |
|
150 | 150 | iconStop.addPixmap(QtGui.QPixmap(_fromUtf8( os.path.join(FIGURES_PATH,"stop.png") )), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
151 | 151 | iconPause = QtGui.QIcon() |
|
152 | 152 | iconPause.addPixmap(QtGui.QPixmap(_fromUtf8( os.path.join(FIGURES_PATH,"pause.png") )), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
153 | 153 | iconAddPU = QtGui.QIcon() |
|
154 | 154 | iconAddPU.addPixmap(QtGui.QPixmap(_fromUtf8( os.path.join(FIGURES_PATH,"branch.png") )), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
155 | 155 | iconClose = QtGui.QIcon() |
|
156 | 156 | iconClose.addPixmap(QtGui.QPixmap(_fromUtf8( os.path.join(FIGURES_PATH,"close.png") )), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
|
157 | 157 | |
|
158 | 158 | |
|
159 | 159 | self.actionOpen = QtGui.QAction(MainWindow) |
|
160 | 160 | self.actionOpen.setIcon(iconOpen) |
|
161 | 161 | self.actionOpen.setObjectName(_fromUtf8("actionOpen")) |
|
162 | 162 | self.actionCreate = QtGui.QAction(MainWindow) |
|
163 | 163 | self.actionCreate.setIcon(iconCreate) |
|
164 | 164 | self.actionCreate.setObjectName(_fromUtf8("actionCreate")) |
|
165 | 165 | self.actionSave = QtGui.QAction(MainWindow) |
|
166 | 166 | self.actionSave.setIcon(iconSave) |
|
167 | 167 | self.actionSave.setObjectName(_fromUtf8("actionSave")) |
|
168 | 168 | self.actionClose = QtGui.QAction(MainWindow) |
|
169 | 169 | self.actionClose.setIcon(iconClose) |
|
170 | 170 | self.actionClose.setObjectName(_fromUtf8("actionClose")) |
|
171 | 171 | self.actionStart = QtGui.QAction(MainWindow) |
|
172 | 172 | self.actionStart.setIcon(iconStart) |
|
173 | 173 | self.actionStart.setObjectName(_fromUtf8("actionStart")) |
|
174 | 174 | self.actionPause = QtGui.QAction(MainWindow) |
|
175 | 175 | self.actionPause.setIcon(iconPause) |
|
176 | 176 | self.actionPause.setObjectName(_fromUtf8("actionPause")) |
|
177 | 177 | self.actionStop = QtGui.QAction(MainWindow) |
|
178 | 178 | self.actionStop.setIcon(iconStop) |
|
179 | 179 | self.actionStop.setObjectName(_fromUtf8("actionStop")) |
|
180 | 180 | self.actionAbout = QtGui.QAction(MainWindow) |
|
181 | 181 | self.actionAbout.setObjectName(_fromUtf8("actionAbout")) |
|
182 | 182 | |
|
183 | 183 | self.actionOpenToolbar = QtGui.QAction(MainWindow) |
|
184 | 184 | self.actionOpenToolbar.setIcon(iconOpen) |
|
185 | 185 | self.actionOpenToolbar.setObjectName(_fromUtf8("actionOpenToolbar")) |
|
186 | 186 | self.actionCreateToolbar = QtGui.QAction(MainWindow) |
|
187 | 187 | self.actionCreateToolbar.setIcon(iconCreate) |
|
188 | 188 | self.actionCreateToolbar.setObjectName(_fromUtf8("actionCreateToolbar")) |
|
189 | 189 | self.actionSaveToolbar = QtGui.QAction(MainWindow) |
|
190 | 190 | self.actionSaveToolbar.setIcon(iconSave) |
|
191 | 191 | self.actionSaveToolbar.setObjectName(_fromUtf8("actionSaveToolbar")) |
|
192 | 192 | self.actionStarToolbar = QtGui.QAction(MainWindow) |
|
193 | 193 | self.actionStarToolbar.setIcon(iconStart) |
|
194 | 194 | self.actionStarToolbar.setObjectName(_fromUtf8("actionStarToolbar")) |
|
195 | 195 | self.actionStopToolbar = QtGui.QAction(MainWindow) |
|
196 | 196 | self.actionStopToolbar.setIcon(iconStop) |
|
197 | 197 | self.actionStopToolbar.setObjectName(_fromUtf8("actionStopToolbar")) |
|
198 | 198 | self.actionPauseToolbar = QtGui.QAction(MainWindow) |
|
199 | 199 | self.actionPauseToolbar.setIcon(iconPause) |
|
200 | 200 | self.actionPauseToolbar.setObjectName(_fromUtf8("actionPauseToolbar")) |
|
201 | 201 | self.actionAddPU = QtGui.QAction(MainWindow) |
|
202 | 202 | self.actionAddPU.setIcon(iconAddPU) |
|
203 | 203 | self.actionAddPU.setObjectName(_fromUtf8("actionAddPU")) |
|
204 | 204 | self.actionFTP = QtGui.QAction(MainWindow) |
|
205 | 205 | self.actionFTP.setObjectName(_fromUtf8("actionFTP")) |
|
206 | 206 | self.toolBar.addAction(self.actionOpenToolbar) |
|
207 | 207 | self.toolBar.addSeparator() |
|
208 | 208 | self.toolBar.addAction(self.actionCreateToolbar) |
|
209 | 209 | self.toolBar.addSeparator() |
|
210 | 210 | self.toolBar.addAction(self.actionAddPU) |
|
211 | 211 | self.toolBar.addSeparator() |
|
212 | 212 | self.toolBar.addAction(self.actionSaveToolbar) |
|
213 | 213 | self.toolBar.addSeparator() |
|
214 | 214 | self.toolBar.addAction(self.actionStarToolbar) |
|
215 | 215 | self.toolBar.addSeparator() |
|
216 | 216 | self.toolBar.addAction(self.actionPauseToolbar) |
|
217 | 217 | self.toolBar.addSeparator() |
|
218 | 218 | self.toolBar.addAction(self.actionStopToolbar) |
|
219 | 219 | self.toolBar.addSeparator() |
|
220 | 220 | |
|
221 | 221 | # self.actionPause.triggered.connect(self.changePauseIcon) |
|
222 | 222 | # self.actionPauseToolbar.triggered.connect(self.changePauseIcon) |
|
223 | 223 | |
|
224 | 224 | self.menuProject.addAction(self.actionOpen) |
|
225 | 225 | self.menuProject.addAction(self.actionCreate) |
|
226 | 226 | self.menuProject.addAction(self.actionSave) |
|
227 | 227 | self.menuProject.addAction(self.actionClose) |
|
228 | 228 | self.menuRun.addAction(self.actionStart) |
|
229 | 229 | self.menuRun.addAction(self.actionPause) |
|
230 | 230 | self.menuRun.addAction(self.actionStop) |
|
231 | 231 | self.menuOptions.addAction(self.actionFTP) |
|
232 | 232 | self.menuHelp.addAction(self.actionAbout) |
|
233 | 233 | self.menuBar.addAction(self.menuProject.menuAction()) |
|
234 | 234 | self.menuBar.addAction(self.menuRun.menuAction()) |
|
235 | 235 | self.menuBar.addAction(self.menuOptions.menuAction()) |
|
236 | 236 | self.menuBar.addAction(self.menuHelp.menuAction()) |
|
237 | 237 | |
|
238 | 238 | self.tabConsole.setCurrentIndex(0) |
|
239 | 239 | self.tabWidget.setCurrentIndex(0) |
|
240 | 240 | |
|
241 | 241 | def retranslateUi(self, MainWindow): |
|
242 | 242 | |
|
243 | 243 | MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None)) |
|
244 | 244 | |
|
245 | 245 | self.tabConsole.setTabText(self.tabConsole.indexOf(self.tab_5), _translate("MainWindow", "Console", None)) |
|
246 | 246 | |
|
247 | 247 | self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabProjectProperty), _translate("MainWindow", "Project Property", None)) |
|
248 | 248 | self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar", None)) |
|
249 | 249 | self.menuProject.setTitle(_translate("MainWindow", "Project", None)) |
|
250 | 250 | self.menuRun.setTitle(_translate("MainWindow", "Run", None)) |
|
251 | 251 | self.menuOptions.setTitle(_translate("MainWindow", "Options", None)) |
|
252 | 252 | self.menuHelp.setTitle(_translate("MainWindow", "Help", None)) |
|
253 | 253 | self.actionOpen.setText(_translate("MainWindow", "Open", None)) |
|
254 | 254 | self.actionCreate.setText(_translate("MainWindow", "Create", None)) |
|
255 | 255 | self.actionSave.setText(_translate("MainWindow", "Save", None)) |
|
256 | 256 | self.actionClose.setText(_translate("MainWindow", "Close", None)) |
|
257 | 257 | self.actionStart.setText(_translate("MainWindow", "Start", None)) |
|
258 | 258 | self.actionPause.setText(_translate("MainWindow", "Pause", None)) |
|
259 | 259 | self.actionStop.setText(_translate("MainWindow", "Stop", None)) |
|
260 | 260 | self.actionAbout.setText(_translate("MainWindow", "About SChain", None)) |
|
261 | 261 | self.actionOpenToolbar.setText(_translate("MainWindow", "openToolbar", None)) |
|
262 | 262 | self.actionOpenToolbar.setToolTip(_translate("MainWindow", "Open a project", None)) |
|
263 | 263 | self.actionCreateToolbar.setText(_translate("MainWindow", "createToolbar", None)) |
|
264 | 264 | self.actionCreateToolbar.setToolTip(_translate("MainWindow", "Create a new project", None)) |
|
265 | 265 | self.actionSaveToolbar.setText(_translate("MainWindow", "saveToolbar", None)) |
|
266 | 266 | self.actionSaveToolbar.setToolTip(_translate("MainWindow", "Save a project", None)) |
|
267 | 267 | self.actionStarToolbar.setText(_translate("MainWindow", "starToolbar", None)) |
|
268 | 268 | self.actionStarToolbar.setToolTip(_translate("MainWindow", "Start process", None)) |
|
269 | 269 | self.actionStopToolbar.setText(_translate("MainWindow", "stopToolbar", None)) |
|
270 | 270 | self.actionStopToolbar.setToolTip(_translate("MainWindow", "Stop process", None)) |
|
271 | 271 | self.actionPauseToolbar.setText(_translate("MainWindow", "pauseToolbar", None)) |
|
272 | 272 | self.actionPauseToolbar.setToolTip(_translate("MainWindow", "Pause process", None)) |
|
273 | 273 | self.actionAddPU.setText(_translate("MainWindow", "Add Processing Unit", None)) |
|
274 | 274 | self.actionFTP.setText(_translate("MainWindow", "FTP", None)) |
|
275 | 275 | |
|
276 | 276 | def closeEvent(self, event): |
|
277 | 277 | |
|
278 | 278 | reply = QtGui.QMessageBox.question(self, 'Message', |
|
279 | 279 | "Are you sure to quit?", QtGui.QMessageBox.Yes | |
|
280 | 280 | QtGui.QMessageBox.No, QtGui.QMessageBox.No) |
|
281 | 281 | if reply == QtGui.QMessageBox.Yes: |
|
282 | 282 | event.accept() |
|
283 | 283 | else: |
|
284 | 284 | event.ignore() |
|
285 | 285 | |
|
286 | 286 | def aboutEvent(self): |
|
287 | 287 | title = "Signal Chain Processing Software v%s" %__version__ |
|
288 | 288 | message = """ |
|
289 | 289 | Developed by Jicamarca Radio Observatory |
|
290 | 290 | Any comment to miguel.urco@jro.igp.gob.pe |
|
291 | 291 | """ |
|
292 | 292 | QtGui.QMessageBox.about(self, title, message) |
|
293 | 293 | |
|
294 | 294 | |
|
295 | 295 | class Ui_BasicWindow(Ui_EnvWindow, Ui_ProjectTab, Ui_VoltageTab, Ui_SpectraTab, Ui_SpectraHeisTab, Ui_CorrelationTab): |
|
296 | 296 | |
|
297 | 297 | def setupUi(self, MainWindow): |
|
298 | 298 | |
|
299 | 299 | Ui_EnvWindow.setupUi(self, MainWindow) |
|
300 | 300 | |
|
301 | 301 | Ui_ProjectTab.setupUi(self) |
|
302 | 302 | Ui_VoltageTab.setupUi(self) |
|
303 | 303 | Ui_SpectraTab.setupUi(self) |
|
304 | 304 | Ui_SpectraHeisTab.setupUi(self) |
|
305 | 305 | Ui_CorrelationTab.setupUi(self) |
|
306 | 306 | |
|
307 | 307 | self.retranslateUi(MainWindow) |
|
308 | 308 | |
|
309 | 309 | QtCore.QMetaObject.connectSlotsByName(MainWindow) |
|
310 | 310 | |
|
311 | 311 | def retranslateUi(self, MainWindow): |
|
312 | 312 | |
|
313 | 313 | Ui_EnvWindow.retranslateUi(self, MainWindow) |
|
314 | 314 | |
|
315 | 315 | Ui_ProjectTab.retranslateUi(self) |
|
316 | 316 | Ui_VoltageTab.retranslateUi(self) |
|
317 | 317 | Ui_SpectraTab.retranslateUi(self) |
|
318 | 318 | Ui_SpectraHeisTab.retranslateUi(self) |
|
319 | 319 | Ui_CorrelationTab.retranslateUi(self) |
|
320 | 320 | |
|
321 | 321 | |
|
322 | 322 | class Ui_AdvancedWindow(Ui_EnvWindow): |
|
323 | 323 | |
|
324 | 324 | def setupUi(self, AdvancedWindow): |
|
325 | 325 | |
|
326 | 326 | Ui_MainWindow.setupUi(self, AdvancedWindow) |
|
327 | 327 | |
|
328 | 328 | def retranslateUi(self, AdvancedWindow): |
|
329 | 329 | |
|
330 | 330 | Ui_MainWindow.retranslateUi(self, AdvancedWindow) |
|
331 | 331 | |
|
332 | 332 | |
|
333 | 333 | |
|
334 | 334 | if __name__ == "__main__": |
|
335 | 335 | import sys |
|
336 | 336 | app = QtGui.QApplication(sys.argv) |
|
337 | 337 | MainWindow = QtGui.QMainWindow() |
|
338 | 338 | ui = Ui_BasicWindow() |
|
339 | 339 | ui.setupUi(MainWindow) |
|
340 | 340 | MainWindow.show() |
|
341 | 341 | sys.exit(app.exec_()) |
|
342 | 342 |
General Comments 0
You need to be logged in to leave comments.
Login now