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