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