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