@@ -9,6 +9,11 from xml.dom import minidom | |||
|
9 | 9 | #import datetime |
|
10 | 10 | from model import * |
|
11 | 11 | |
|
12 | try: | |
|
13 | from gevent import sleep | |
|
14 | except: | |
|
15 | from time import sleep | |
|
16 | ||
|
12 | 17 | import ast |
|
13 | 18 | |
|
14 | 19 | def prettify(elem): |
@@ -42,7 +47,7 class ParameterConf(): | |||
|
42 | 47 | if self.__formated_value != None: |
|
43 | 48 | |
|
44 | 49 | return self.__formated_value |
|
45 |
|
|
|
50 | ||
|
46 | 51 | value = self.value |
|
47 | 52 | |
|
48 | 53 | if self.format == 'bool': |
@@ -731,6 +736,11 class Project(): | |||
|
731 | 736 | |
|
732 | 737 | return procUnitConfObj |
|
733 | 738 | |
|
739 | def removeProcUnit(self, id): | |
|
740 | ||
|
741 | if id in self.procUnitConfObjDict.keys(): | |
|
742 | self.procUnitConfObjDict.pop(id) | |
|
743 | ||
|
734 | 744 | def getReadUnitId(self): |
|
735 | 745 | |
|
736 | 746 | readUnitConfObj = self.getReadUnitObj() |
@@ -886,7 +896,7 class Project(): | |||
|
886 | 896 | print "Process suspended" |
|
887 | 897 | |
|
888 | 898 | while True: |
|
889 |
|
|
|
899 | sleep(0.1) | |
|
890 | 900 | |
|
891 | 901 | if not self.control['pause']: |
|
892 | 902 | break |
@@ -896,7 +906,7 class Project(): | |||
|
896 | 906 | print "Process reinitialized" |
|
897 | 907 | |
|
898 | 908 | if self.control['stop']: |
|
899 |
print " |
|
|
909 | print "Process stopped" | |
|
900 | 910 | break |
|
901 | 911 | |
|
902 | 912 | #Closing every process |
@@ -904,7 +914,7 class Project(): | |||
|
904 | 914 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
905 | 915 | procUnitConfObj.close() |
|
906 | 916 | |
|
907 |
print "Process |
|
|
917 | print "Process finished" | |
|
908 | 918 | |
|
909 | 919 | def start(self, filename): |
|
910 | 920 |
@@ -24,6 +24,11 from os.path import expanduser | |||
|
24 | 24 | #from CodeWarrior.Standard_Suite import file |
|
25 | 25 | from comm import * |
|
26 | 26 | |
|
27 | try: | |
|
28 | from gevent import sleep | |
|
29 | except: | |
|
30 | from time import sleep | |
|
31 | ||
|
27 | 32 | from schainpy.gui.figures import tools |
|
28 | 33 | import numpy |
|
29 | 34 | |
@@ -80,9 +85,6 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
80 | 85 | self.create = False |
|
81 | 86 | self.selectedItemTree = None |
|
82 | 87 | self.commCtrlPThread = None |
|
83 | self.setParameter() | |
|
84 | self.create_comm() | |
|
85 | # self.create_timers() | |
|
86 | 88 | # self.create_figure() |
|
87 | 89 | self.temporalFTP = ftpBuffer() |
|
88 | 90 | self.projectProperCaracteristica = [] |
@@ -106,7 +108,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
106 | 108 | |
|
107 | 109 | self.__ftpProcUnitAdded = False |
|
108 | 110 | self.__ftpProcUnitId = None |
|
109 | ||
|
111 | self.__initialized = False | |
|
112 | ||
|
113 | self.create_comm() | |
|
114 | self.create_updating_timer() | |
|
115 | self.setParameter() | |
|
116 | ||
|
110 | 117 | @pyqtSignature("") |
|
111 | 118 | def on_actionOpen_triggered(self): |
|
112 | 119 | """ |
@@ -527,7 +534,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
527 | 534 | |
|
528 | 535 | |
|
529 | 536 | if self.volOpCebChannels.isChecked(): |
|
530 | value = self.volOpChannel.text() | |
|
537 | value = str(self.volOpChannel.text()) | |
|
538 | ||
|
539 | if value == "": | |
|
540 | print "Please fill channel list" | |
|
541 | return 0 | |
|
542 | ||
|
531 | 543 | format = 'intlist' |
|
532 | 544 | if self.volOpComChannels.currentIndex() == 0: |
|
533 | 545 | name_operation = "selectChannels" |
@@ -540,7 +552,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
540 | 552 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
541 | 553 | |
|
542 | 554 | if self.volOpCebHeights.isChecked(): |
|
543 | value = self.volOpHeights.text() | |
|
555 | value = str(self.volOpHeights.text()) | |
|
556 | ||
|
557 | if value == "": | |
|
558 | print "Please fill height range" | |
|
559 | return 0 | |
|
560 | ||
|
544 | 561 | valueList = value.split(',') |
|
545 | 562 | format = 'float' |
|
546 | 563 | if self.volOpComHeights.currentIndex() == 0: |
@@ -551,12 +568,17 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
551 | 568 | name_operation = 'selectHeightsByIndex' |
|
552 | 569 | name_parameter1 = 'minIndex' |
|
553 | 570 | name_parameter2 = 'maxIndex' |
|
571 | ||
|
554 | 572 | opObj = puObj.addOperation(name=name_operation) |
|
555 | 573 | opObj.addParameter(name=name_parameter1, value=valueList[0], format=format) |
|
556 | 574 | opObj.addParameter(name=name_parameter2, value=valueList[1], format=format) |
|
557 | 575 | |
|
558 | 576 | if self.volOpCebFilter.isChecked(): |
|
559 | value = self.volOpFilter.text() | |
|
577 | value = str(self.volOpFilter.text()) | |
|
578 | if value == "": | |
|
579 | print "Please fill filter value" | |
|
580 | return 0 | |
|
581 | ||
|
560 | 582 | format = 'int' |
|
561 | 583 | name_operation = 'filterByHeights' |
|
562 | 584 | name_parameter = 'window' |
@@ -564,7 +586,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
564 | 586 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
565 | 587 | |
|
566 | 588 | if self.volOpCebProfile.isChecked(): |
|
567 | value = self.volOpProfile.text() | |
|
589 | value = str(self.volOpProfile.text()) | |
|
590 | ||
|
591 | if value == "": | |
|
592 | print "Please fill profile value" | |
|
593 | return 0 | |
|
594 | ||
|
568 | 595 | format = 'intlist' |
|
569 | 596 | optype = 'other' |
|
570 | 597 | name_operation = 'ProfileSelector' |
@@ -1097,7 +1124,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
1097 | 1124 | puObj.addParameter(name=name_parameter, value=value2, format=format) |
|
1098 | 1125 | |
|
1099 | 1126 | if self.specOpCebHeights.isChecked(): |
|
1100 | value = self.specOpHeights.text() | |
|
1127 | value = str(self.specOpHeights.text()) | |
|
1128 | ||
|
1129 | if value == "": | |
|
1130 | print "Please fill height range" | |
|
1131 | return 0 | |
|
1132 | ||
|
1101 | 1133 | valueList = value.split(',') |
|
1102 | 1134 | format = 'float' |
|
1103 | 1135 | value0 = valueList[0] |
@@ -1116,7 +1148,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
1116 | 1148 | opObj.addParameter(name=name_parameter2, value=value1, format=format) |
|
1117 | 1149 | |
|
1118 | 1150 | if self.specOpCebChannel.isChecked(): |
|
1119 | value = self.specOpChannel.text() | |
|
1151 | value = str(self.specOpChannel.text()) | |
|
1152 | ||
|
1153 | if value == "": | |
|
1154 | print "Please fill channel list" | |
|
1155 | return 0 | |
|
1156 | ||
|
1120 | 1157 | format = 'intlist' |
|
1121 | 1158 | if self.specOpComChannel.currentIndex() == 0: |
|
1122 | 1159 | name_operation = "selectChannels" |
@@ -1124,11 +1161,16 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
1124 | 1161 | else: |
|
1125 | 1162 | name_operation = "selectChannelsByIndex" |
|
1126 | 1163 | name_parameter = 'channelIndexList' |
|
1127 |
opObj = puObj.addOperation(name= |
|
|
1164 | opObj = puObj.addOperation(name=name_operation) | |
|
1128 | 1165 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1129 | 1166 | |
|
1130 | 1167 | if self.specOpCebIncoherent.isChecked(): |
|
1131 |
value = self.specOpIncoherent.text() |
|
|
1168 | value = str(self.specOpIncoherent.text()) | |
|
1169 | ||
|
1170 | if value == "": | |
|
1171 | print "Please fill Incoherent integration value" | |
|
1172 | return 0 | |
|
1173 | ||
|
1132 | 1174 | name_operation = 'IncohInt' |
|
1133 | 1175 | optype = 'other' |
|
1134 | 1176 | if self.specOpCobIncInt.currentIndex() == 0: |
@@ -2300,8 +2342,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2300 | 2342 | self.specHeisGraphPath.setEnabled(True) |
|
2301 | 2343 | self.specHeisGraphPrefix.setEnabled(True) |
|
2302 | 2344 | self.specHeisGraphToolPath.setEnabled(True) |
|
2303 | ||
|
2304 | #-------ftp-----# | |
|
2345 | ||
|
2305 | 2346 | @pyqtSignature("int") |
|
2306 | 2347 | def on_specHeisGraphftpSpectra_stateChanged(self, p0): |
|
2307 | 2348 | """ |
@@ -2445,10 +2486,10 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2445 | 2486 | def on_right_click(self, pos): |
|
2446 | 2487 | |
|
2447 | 2488 | self.menu = QtGui.QMenu() |
|
2448 |
quitAction0 = self.menu.addAction(" |
|
|
2449 |
quitAction1 = self.menu.addAction(" |
|
|
2450 | quitAction2 = self.menu.addAction("Delete") | |
|
2451 |
quitAction3 = self.menu.addAction(" |
|
|
2489 | quitAction0 = self.menu.addAction("Create a new project") | |
|
2490 | quitAction1 = self.menu.addAction("Create a new processing unit") | |
|
2491 | quitAction2 = self.menu.addAction("Delete selected unit") | |
|
2492 | quitAction3 = self.menu.addAction("Quit") | |
|
2452 | 2493 | |
|
2453 | 2494 | if len(self.__itemTreeDict) == 0: |
|
2454 | 2495 | quitAction2.setEnabled(False) |
@@ -2493,7 +2534,8 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2493 | 2534 | # print i.row() |
|
2494 | 2535 | |
|
2495 | 2536 | if action == quitAction3: |
|
2496 |
|
|
|
2537 | self.close() | |
|
2538 | return 0 | |
|
2497 | 2539 | |
|
2498 | 2540 | def refreshProjectWindow(self, project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, set): |
|
2499 | 2541 | |
@@ -2545,18 +2587,36 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2545 | 2587 | |
|
2546 | 2588 | |
|
2547 | 2589 | opObj = puObj.getOperationObj(name="selectChannels") |
|
2590 | ||
|
2591 | if opObj == None: | |
|
2592 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") | |
|
2593 | ||
|
2548 | 2594 | if opObj == None: |
|
2549 | 2595 | self.volOpChannel.clear() |
|
2550 | 2596 | self.volOpCebChannels.setCheckState(0) |
|
2551 | ||
|
2552 | 2597 | else: |
|
2553 | value = opObj.getParameterValue(parameterName='channelList') | |
|
2554 |
|
|
|
2555 | self.volOpChannel.setText(value) | |
|
2556 | self.volOpChannel.setEnabled(True) | |
|
2557 | self.volOpCebChannels.setCheckState(QtCore.Qt.Checked) | |
|
2558 | ||
|
2559 | ||
|
2598 | channelEnabled = False | |
|
2599 | try: | |
|
2600 | value = opObj.getParameterValue(parameterName='channelList') | |
|
2601 | value = str(value)[1:-1] | |
|
2602 | channelEnabled = True | |
|
2603 | channelMode = 0 | |
|
2604 | except: | |
|
2605 | pass | |
|
2606 | try: | |
|
2607 | value = opObj.getParameterValue(parameterName='channelIndexList') | |
|
2608 | value = str(value)[1:-1] | |
|
2609 | channelEnabled = True | |
|
2610 | channelMode = 1 | |
|
2611 | except: | |
|
2612 | pass | |
|
2613 | ||
|
2614 | if channelEnabled: | |
|
2615 | self.volOpChannel.setText(value) | |
|
2616 | self.volOpChannel.setEnabled(True) | |
|
2617 | self.volOpCebChannels.setCheckState(QtCore.Qt.Checked) | |
|
2618 | self.VOLOpComChannel.setCurrentIndex(channelMode) | |
|
2619 | ||
|
2560 | 2620 | opObj = puObj.getOperationObj(name="selectHeights") |
|
2561 | 2621 | if opObj == None: |
|
2562 | 2622 | self.volOpHeights.clear() |
@@ -2811,15 +2871,35 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
2811 | 2871 | self.specOpCebCrossSpectra.setCheckState(QtCore.Qt.Checked) |
|
2812 | 2872 | |
|
2813 | 2873 | opObj = puObj.getOperationObj(name="selectChannels") |
|
2874 | ||
|
2875 | if opObj == None: | |
|
2876 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") | |
|
2877 | ||
|
2814 | 2878 | if opObj == None: |
|
2815 | 2879 | self.specOpChannel.clear() |
|
2816 | 2880 | self.specOpCebChannel.setCheckState(0) |
|
2817 |
else: |
|
|
2818 | value = opObj.getParameterValue(parameterName='channelList') | |
|
2819 |
|
|
|
2820 | self.specOpChannel.setText(value) | |
|
2821 | self.specOpChannel.setEnabled(True) | |
|
2822 | self.specOpCebChannel.setCheckState(QtCore.Qt.Checked) | |
|
2881 | else: | |
|
2882 | channelEnabled = False | |
|
2883 | try: | |
|
2884 | value = opObj.getParameterValue(parameterName='channelList') | |
|
2885 | value = str(value)[1:-1] | |
|
2886 | channelEnabled = True | |
|
2887 | channelMode = 0 | |
|
2888 | except: | |
|
2889 | pass | |
|
2890 | try: | |
|
2891 | value = opObj.getParameterValue(parameterName='channelIndexList') | |
|
2892 | value = str(value)[1:-1] | |
|
2893 | channelEnabled = True | |
|
2894 | channelMode = 1 | |
|
2895 | except: | |
|
2896 | pass | |
|
2897 | ||
|
2898 | if channelEnabled: | |
|
2899 | self.specOpChannel.setText(value) | |
|
2900 | self.specOpChannel.setEnabled(True) | |
|
2901 | self.specOpCebChannel.setCheckState(QtCore.Qt.Checked) | |
|
2902 | self.specOpComChannel.setCurrentIndex(channelMode) | |
|
2823 | 2903 | |
|
2824 | 2904 | opObj = puObj.getOperationObj(name="selectHeights") |
|
2825 | 2905 | if opObj == None: |
@@ -3556,13 +3636,14 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3556 | 3636 | self.specGgraphChannelList.clear() |
|
3557 | 3637 | |
|
3558 | 3638 | def create_comm(self): |
|
3639 | ||
|
3559 | 3640 | self.commCtrlPThread = CommCtrlProcessThread() |
|
3560 | 3641 | self.commCtrlPThread.start() |
|
3561 | 3642 | |
|
3562 |
def create_timer |
|
|
3643 | def create_updating_timer(self): | |
|
3563 | 3644 | self.comm_data_timer = QtCore.QTimer(self) |
|
3564 |
self.comm_data_timer.timeout.connect(self.on_comm_ |
|
|
3565 | self.comm_data_timer.start(10) | |
|
3645 | self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) | |
|
3646 | self.comm_data_timer.start(1000) | |
|
3566 | 3647 | |
|
3567 | 3648 | def create_figure(self): |
|
3568 | 3649 | self.queue_plot = Queue.Queue() |
@@ -3580,15 +3661,15 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3580 | 3661 | if not self.running: |
|
3581 | 3662 | app.quit() |
|
3582 | 3663 | |
|
3583 | def on_comm_data_timer(self): | |
|
3584 | # lee el data_queue y la coloca en el queue de ploteo | |
|
3585 | try: | |
|
3586 | reply = self.commCtrlPThread.data_q.get(block=False) | |
|
3587 | self.queue_plot.put(reply.data) | |
|
3588 | ||
|
3589 | except Queue.Empty: | |
|
3590 | pass | |
|
3591 | ||
|
3664 | # def on_comm_data_timer(self): | |
|
3665 | # # lee el data_queue y la coloca en el queue de ploteo | |
|
3666 | # try: | |
|
3667 | # reply = self.commCtrlPThread.data_q.get(block=False) | |
|
3668 | # self.queue_plot.put(reply.data) | |
|
3669 | # | |
|
3670 | # except Queue.Empty: | |
|
3671 | # pass | |
|
3672 | ||
|
3592 | 3673 | def createProjectView(self, id): |
|
3593 | 3674 | |
|
3594 | 3675 | self.create = False |
@@ -3812,7 +3893,10 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3812 | 3893 | if not procUnitConfObj: |
|
3813 | 3894 | return |
|
3814 | 3895 | |
|
3815 | procUnitConfObj.removeOperations() | |
|
3896 | projectObj.removeProcUnit(procUnitConfObj.getId()) | |
|
3897 | ||
|
3898 | if procUnitConfObj.getId() not in self.__puObjDict.keys(): | |
|
3899 | return | |
|
3816 | 3900 | |
|
3817 | 3901 | self.__puObjDict.pop(procUnitConfObj.getId()) |
|
3818 | 3902 | |
@@ -3935,8 +4019,15 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
3935 | 4019 | channel = value |
|
3936 | 4020 | self.bufferVoltage("Processing Unit", "Select Channel", channel) |
|
3937 | 4021 | |
|
3938 | ||
|
3939 | ||
|
4022 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") | |
|
4023 | if opObj == None: | |
|
4024 | channel = None | |
|
4025 | else: | |
|
4026 | value = opObj.getParameterValue(parameterName='channelIndexList') | |
|
4027 | value = str(value)#[1:-1] | |
|
4028 | channel = value | |
|
4029 | self.bufferVoltage("Processing Unit", "Select Channel by Index", channel) | |
|
4030 | ||
|
3940 | 4031 | opObj = puObj.getOperationObj(name="selectHeights") |
|
3941 | 4032 | if opObj == None: |
|
3942 | 4033 | heights = None |
@@ -4201,11 +4292,23 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
4201 | 4292 | opObj = puObj.getOperationObj(name="selectChannels") |
|
4202 | 4293 | if opObj == None: |
|
4203 | 4294 | channel = None |
|
4204 |
else: |
|
|
4205 | value = opObj.getParameterValue(parameterName='channelList') | |
|
4206 | value = str(value)[1:-1] | |
|
4207 | channel = value | |
|
4208 | self.bufferSpectra("Processing Unit", "Channel", channel) | |
|
4295 | else: | |
|
4296 | try: | |
|
4297 | value = opObj.getParameterValue(parameterName='channelList') | |
|
4298 | value = str(value)[1:-1] | |
|
4299 | channel = value | |
|
4300 | ||
|
4301 | self.bufferSpectra("Processing Unit", "Channel List", channel) | |
|
4302 | except: | |
|
4303 | pass | |
|
4304 | try: | |
|
4305 | value = opObj.getParameterValue(parameterName='channelIndexList') | |
|
4306 | value = str(value)[1:-1] | |
|
4307 | channel = value | |
|
4308 | ||
|
4309 | self.bufferSpectra("Processing Unit", "Channel Index List", channel) | |
|
4310 | except: | |
|
4311 | pass | |
|
4209 | 4312 | |
|
4210 | 4313 | opObj = puObj.getOperationObj(name="selectHeights") |
|
4211 | 4314 | if opObj == None: |
@@ -5262,6 +5365,9 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5262 | 5365 | |
|
5263 | 5366 | def openProject(self): |
|
5264 | 5367 | |
|
5368 | self.actionStart.setEnabled(False) | |
|
5369 | self.actionStarToolbar.setEnabled(False) | |
|
5370 | ||
|
5265 | 5371 | self.create = False |
|
5266 | 5372 | self.frame_2.setEnabled(True) |
|
5267 | 5373 | home = expanduser("~") |
@@ -5345,6 +5451,18 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5345 | 5451 | self.console.append("The selected xml file has been loaded successfully") |
|
5346 | 5452 | # self.refreshPUWindow(datatype=datatype,puObj=puObj) |
|
5347 | 5453 | |
|
5454 | self.actionStart.setEnabled(True) | |
|
5455 | self.actionStarToolbar.setEnabled(True) | |
|
5456 | ||
|
5457 | def on_comm_updating_timer(self): | |
|
5458 | # Verifica si algun proceso ha sido inicializado y sigue ejecutandose | |
|
5459 | ||
|
5460 | if not self.__initialized: | |
|
5461 | return | |
|
5462 | ||
|
5463 | if not self.commCtrlPThread.isRunning(): | |
|
5464 | self.stopProject() | |
|
5465 | ||
|
5348 | 5466 | def playProject(self, ext=".xml"): |
|
5349 | 5467 | |
|
5350 | 5468 | projectObj = self.getSelectedProjectObj() |
@@ -5369,21 +5487,14 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
5369 | 5487 | self.actionStopToolbar.setEnabled(True) |
|
5370 | 5488 | |
|
5371 | 5489 | self.console.append("Please Wait...") |
|
5372 | # try: | |
|
5373 | 5490 | self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PROCESS, filename)) |
|
5374 | # # | |
|
5375 | # except: | |
|
5376 | # self.console.append("Error............................................!") | |
|
5377 | # self.actionStarToolbar.setEnabled(True) | |
|
5378 | # self.actionPauseToolbar.setEnabled(False) | |
|
5379 | # self.actionStopToolbar.setEnabled(False) | |
|
5380 | ||
|
5381 | # filename = '/home/dsuarez/workspace_signalchain/schain_guiJune04/test/ewdrifts3.xml' | |
|
5382 | # data = filename | |
|
5383 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PROCESS, data)) | |
|
5491 | sleep(0.5) | |
|
5492 | self.__initialized = True | |
|
5384 | 5493 | |
|
5385 | 5494 | def stopProject(self): |
|
5386 | 5495 | |
|
5496 | self.__initialized = False | |
|
5497 | ||
|
5387 | 5498 | self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) |
|
5388 | 5499 | |
|
5389 | 5500 | self.actionStart.setEnabled(True) |
@@ -6029,15 +6140,23 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
6029 | 6140 | sys.stderr = sys.__stderr__ |
|
6030 | 6141 | |
|
6031 | 6142 | def normalOutputWritten(self, text): |
|
6032 | self.console.append(text) | |
|
6143 | color_black = QtGui.QColor(0,0,0) | |
|
6144 | self.console.setTextColor(color_black) | |
|
6145 | self.console.append(text) | |
|
6146 | ||
|
6147 | def errorOutputWritten(self, text): | |
|
6148 | color_red = QtGui.QColor(255,0,0) | |
|
6149 | color_black = QtGui.QColor(0,0,0) | |
|
6150 | ||
|
6151 | self.console.setTextColor(color_red) | |
|
6152 | self.console.append(text) | |
|
6153 | self.console.setTextColor(color_black) | |
|
6033 | 6154 | |
|
6034 | ||
|
6035 | 6155 | def setParameter(self): |
|
6036 | 6156 | |
|
6037 | 6157 | self.setWindowTitle("ROJ-Signal Chain") |
|
6038 | 6158 | self.setWindowIcon(QtGui.QIcon( os.path.join(FIGURES_PATH,"adn.jpg") )) |
|
6039 | sys.stdout = ShowMeConsole(textWritten=self.normalOutputWritten) | |
|
6040 | # sys.stderr = ShowMeConsole(textWritten=self.normalOutputWritten) | |
|
6159 | ||
|
6041 | 6160 | self.tabWidgetProject.setEnabled(False) |
|
6042 | 6161 | self.tabVoltage.setEnabled(False) |
|
6043 | 6162 | self.tabSpectra.setEnabled(False) |
@@ -6204,6 +6323,9 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||
|
6204 | 6323 | self.specGgraphDbsrange.setToolTip('Example: 30,170') |
|
6205 | 6324 | |
|
6206 | 6325 | self.specGraphPrefix.setToolTip('Example: EXPERIMENT_NAME') |
|
6326 | ||
|
6327 | sys.stdout = ShowMeConsole(textWritten=self.normalOutputWritten) | |
|
6328 | sys.stderr = ShowMeConsole(textWritten=self.errorOutputWritten) | |
|
6207 | 6329 | |
|
6208 | 6330 | |
|
6209 | 6331 | class UnitProcessWindow(QMainWindow, Ui_UnitProcess): |
@@ -1,6 +1,9 | |||
|
1 | 1 | import threading |
|
2 | 2 | import Queue |
|
3 | from time import sleep | |
|
3 | try: | |
|
4 | from gevent import sleep | |
|
5 | except: | |
|
6 | from time import sleep | |
|
4 | 7 | |
|
5 | 8 | from schainpy.controller import Project |
|
6 | 9 | from command import * |
@@ -49,6 +52,7 class CommCtrlProcessThread(threading.Thread): | |||
|
49 | 52 | self.socketIO = None |
|
50 | 53 | self.mySocket = None |
|
51 | 54 | |
|
55 | self.controllerObj = None | |
|
52 | 56 | |
|
53 | 57 | self.handlers = { |
|
54 | 58 | ProcessCommand.PROCESS: self._handle_ioPROCESSTHREAD, |
@@ -68,7 +72,16 class CommCtrlProcessThread(threading.Thread): | |||
|
68 | 72 | sleep(0.1) |
|
69 | 73 | continue |
|
70 | 74 | |
|
71 | ||
|
75 | def isRunning(self): | |
|
76 | ||
|
77 | if self.controllerObj == None: | |
|
78 | return False | |
|
79 | ||
|
80 | if self.controllerObj.isAlive(): | |
|
81 | return True | |
|
82 | ||
|
83 | return False | |
|
84 | ||
|
72 | 85 | def _handle_ioPROCESSTHREAD(self, cmd): |
|
73 | 86 | filename = cmd.data |
|
74 | 87 | self.controllerObj = ControllerThread(filename=filename) |
@@ -79,6 +92,8 class CommCtrlProcessThread(threading.Thread): | |||
|
79 | 92 | |
|
80 | 93 | def _handle_ioSTOP(self, cmd): |
|
81 | 94 | self.controllerObj.stop() |
|
95 | self.controllerObj.join() | |
|
96 | # print "Process thread finished" | |
|
82 | 97 | |
|
83 | 98 | def _handle_ioDATA(self, cmd): |
|
84 | 99 | self.reply_q.put(self._success_reply_data(data=cmd.data)) |
@@ -79,5 +79,12 class AMISR: | |||
|
79 | 79 | def isEmpty(self): |
|
80 | 80 | |
|
81 | 81 | return self.flagNoData |
|
82 | ||
|
83 | def getTimeInterval(self): | |
|
84 | ||
|
85 | timeInterval = self.ippSeconds * self.nCohInt | |
|
86 | ||
|
87 | return timeInterval | |
|
82 | 88 | |
|
89 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
|
83 | 90 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") No newline at end of file |
@@ -659,6 +659,8 class SpectraHeis(Spectra): | |||
|
659 | 659 | |
|
660 | 660 | pairsList = None |
|
661 | 661 | |
|
662 | nCohInt = None | |
|
663 | ||
|
662 | 664 | nIncohInt = None |
|
663 | 665 | |
|
664 | 666 | def __init__(self): |
@@ -694,6 +696,10 class SpectraHeis(Spectra): | |||
|
694 | 696 | self.blocksize = None |
|
695 | 697 | |
|
696 | 698 | self.profileIndex = 0 |
|
699 | ||
|
700 | self.nCohInt = 1 | |
|
701 | ||
|
702 | self.nIncohInt = 1 | |
|
697 | 703 | |
|
698 | 704 | def getNormFactor(self): |
|
699 | 705 | pwcode = 1 |
@@ -713,7 +719,7 class SpectraHeis(Spectra): | |||
|
713 | 719 | normFactor = property(getNormFactor, "I'm the 'getNormFactor' property.") |
|
714 | 720 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
715 | 721 | |
|
716 | class Fits: | |
|
722 | class Fits(JROData): | |
|
717 | 723 | |
|
718 | 724 | heightList = None |
|
719 | 725 | |
@@ -765,9 +771,9 class Fits: | |||
|
765 | 771 | |
|
766 | 772 | self.utctime = None |
|
767 | 773 | |
|
768 |
self.nCohInt = |
|
|
774 | self.nCohInt = 1 | |
|
769 | 775 | |
|
770 |
self.nIncohInt = |
|
|
776 | self.nIncohInt = 1 | |
|
771 | 777 | |
|
772 | 778 | self.useLocalTime = True |
|
773 | 779 | |
@@ -852,7 +858,9 class Fits: | |||
|
852 | 858 | |
|
853 | 859 | def getTimeInterval(self): |
|
854 | 860 | |
|
855 | raise ValueError, "This method is not implemented yet" | |
|
861 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt | |
|
862 | ||
|
863 | return timeInterval | |
|
856 | 864 | |
|
857 | 865 | datatime = property(getDatatime, "I'm the 'datatime' property") |
|
858 | 866 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") |
@@ -1026,7 +1034,14 class Correlation(JROData): | |||
|
1026 | 1034 | noise = jspectra0[:,freq_dc,:] - jspectra[:,freq_dc,:] |
|
1027 | 1035 | |
|
1028 | 1036 | return noise |
|
1037 | ||
|
1038 | def getTimeInterval(self): | |
|
1039 | ||
|
1040 | timeInterval = self.ippSeconds * self.nCohInt * self.nPoints | |
|
1041 | ||
|
1042 | return timeInterval | |
|
1029 | 1043 | |
|
1044 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
|
1030 | 1045 | # pairsList = property(getPairsList, "I'm the 'pairsList' property.") |
|
1031 | 1046 | # nPoints = property(getNPoints, "I'm the 'nPoints' property.") |
|
1032 | 1047 | calculateVelocity = property(getCalculateVelocity, "I'm the 'calculateVelocity' property.") |
@@ -1060,7 +1075,7 class Parameters(JROData): | |||
|
1060 | 1075 | |
|
1061 | 1076 | noise = None #Noise Potency |
|
1062 | 1077 | |
|
1063 | initUtcTime = None #Initial UTC time | |
|
1078 | # initUtcTime = None #Initial UTC time | |
|
1064 | 1079 | |
|
1065 | 1080 | paramInterval = None #Time interval to calculate Parameters in seconds |
|
1066 | 1081 | |
@@ -1078,8 +1093,6 class Parameters(JROData): | |||
|
1078 | 1093 | |
|
1079 | 1094 | data_output = None #Out signal |
|
1080 | 1095 | |
|
1081 | ||
|
1082 | ||
|
1083 | 1096 | def __init__(self): |
|
1084 | 1097 | ''' |
|
1085 | 1098 | Constructor |
@@ -1089,13 +1102,13 class Parameters(JROData): | |||
|
1089 | 1102 | self.systemHeaderObj = SystemHeader() |
|
1090 | 1103 | |
|
1091 | 1104 | self.type = "Parameters" |
|
1092 |
|
|
|
1105 | ||
|
1093 | 1106 | def getTimeRange1(self): |
|
1094 | 1107 | |
|
1095 | 1108 | datatime = [] |
|
1096 | 1109 | |
|
1097 |
datatime.append(self. |
|
|
1098 |
datatime.append(self. |
|
|
1110 | datatime.append(self.ltctime) | |
|
1111 | datatime.append(self.ltctime + self.outputInterval - 1) | |
|
1099 | 1112 | |
|
1100 | 1113 | datatime = numpy.array(datatime) |
|
1101 | 1114 |
@@ -102,42 +102,6 class Figure(Operation): | |||
|
102 | 102 | xmax_sec = time.mktime(maxdt.timetuple()) |
|
103 | 103 | |
|
104 | 104 | return xmin_sec, xmax_sec |
|
105 | ||
|
106 | ||
|
107 | ||
|
108 | ||
|
109 | ||
|
110 | # if timerange != None: | |
|
111 | # txmin = x[0] - x[0]%timerange | |
|
112 | # else: | |
|
113 | # txmin = numpy.min(x) | |
|
114 | # | |
|
115 | # thisdatetime = datetime.datetime.utcfromtimestamp(txmin) | |
|
116 | # thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0)) | |
|
117 | # | |
|
118 | # #################################################### | |
|
119 | # #If the x is out of xrange | |
|
120 | # if xmax != None: | |
|
121 | # if xmax < (thisdatetime - thisdate).seconds/(60*60.): | |
|
122 | # xmin = None | |
|
123 | # xmax = None | |
|
124 | # | |
|
125 | # if xmin == None: | |
|
126 | # td = thisdatetime - thisdate | |
|
127 | # xmin = td.seconds/(60*60.) | |
|
128 | # | |
|
129 | # if xmax == None: | |
|
130 | # xmax = xmin + self.timerange/(60*60.) | |
|
131 | # | |
|
132 | # mindt = thisdate + datetime.timedelta(hours=xmin) - datetime.timedelta(seconds=time.timezone) | |
|
133 | # tmin = time.mktime(mindt.timetuple()) | |
|
134 | # | |
|
135 | # maxdt = thisdate + datetime.timedelta(hours=xmax) - datetime.timedelta(seconds=time.timezone) | |
|
136 | # tmax = time.mktime(maxdt.timetuple()) | |
|
137 | # | |
|
138 | # #self.timerange = tmax - tmin | |
|
139 | # | |
|
140 | # return tmin, tmax | |
|
141 | 105 | |
|
142 | 106 | def init(self, id, nplots, wintitle): |
|
143 | 107 | |
@@ -284,9 +248,9 class Figure(Operation): | |||
|
284 | 248 | |
|
285 | 249 | raise ValueError, "This method is not implemented" |
|
286 | 250 | |
|
287 | def close(self): | |
|
251 | def close(self, show=False): | |
|
288 | 252 | |
|
289 | self.__driver.closeFigure() | |
|
253 | self.__driver.closeFigure(show=show, fig=self.fig) | |
|
290 | 254 | |
|
291 | 255 | axesList = property(getAxesObjList) |
|
292 | 256 |
@@ -294,11 +294,12 class CrossSpectraPlot(Figure): | |||
|
294 | 294 | raise ValueError, "Pair %s is not in dataOut.pairsList" %str(pair) |
|
295 | 295 | pairsIndexList.append(dataOut.pairsList.index(pair)) |
|
296 | 296 | |
|
297 |
if pairsIndexList |
|
|
297 | if not pairsIndexList: | |
|
298 | 298 | return |
|
299 | 299 | |
|
300 | 300 | if len(pairsIndexList) > 4: |
|
301 | 301 | pairsIndexList = pairsIndexList[0:4] |
|
302 | ||
|
302 | 303 | factor = dataOut.normFactor |
|
303 | 304 | x = dataOut.getVelRange(1) |
|
304 | 305 | y = dataOut.getHeiRange() |
@@ -30,13 +30,23 def createFigure(id, wintitle, width, height, facecolor="w", show=True): | |||
|
30 | 30 | |
|
31 | 31 | return fig |
|
32 | 32 | |
|
33 | def closeFigure(show=False): | |
|
33 | def closeFigure(show=False, fig=None): | |
|
34 | 34 | |
|
35 | 35 | matplotlib.pyplot.ioff() |
|
36 | matplotlib.pyplot.pause(0.1) | |
|
37 | ||
|
36 | 38 | if show: |
|
37 | 39 | matplotlib.pyplot.show() |
|
38 |
|
|
|
39 | matplotlib.pyplot.close() | |
|
40 | ||
|
41 | if fig != None: | |
|
42 | matplotlib.pyplot.close(fig) | |
|
43 | matplotlib.pyplot.pause(0.1) | |
|
44 | matplotlib.pyplot.ion() | |
|
45 | return | |
|
46 | ||
|
47 | matplotlib.pyplot.close("all") | |
|
48 | matplotlib.pyplot.pause(0.1) | |
|
49 | matplotlib.pyplot.ion() | |
|
40 | 50 | return |
|
41 | 51 | |
|
42 | 52 | def saveFigure(fig, filename): |
@@ -420,6 +430,6 def polar(iplot, x, y, xlabel='', ylabel='', title=''): | |||
|
420 | 430 | def draw(fig): |
|
421 | 431 | |
|
422 | 432 | if type(fig) == 'int': |
|
423 |
raise ValueError, " |
|
|
433 | raise ValueError, "Error drawing: Fig parameter should be a matplotlib figure object figure" | |
|
424 | 434 | |
|
425 | 435 | fig.canvas.draw() |
@@ -15,6 +15,11 import numpy | |||
|
15 | 15 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation |
|
16 | 16 | from schainpy.model.data.jroamisr import AMISR |
|
17 | 17 | |
|
18 | try: | |
|
19 | from gevent import sleep | |
|
20 | except: | |
|
21 | from time import sleep | |
|
22 | ||
|
18 | 23 | class RadacHeader(): |
|
19 | 24 | def __init__(self, fp): |
|
20 | 25 | header = 'Raw11/Data/RadacHeader' |
@@ -337,7 +342,7 class AMISRReader(ProcessingUnit): | |||
|
337 | 342 | filename = self.filenameList[0] |
|
338 | 343 | while self.__filename_online == filename: |
|
339 | 344 | print 'waiting %d seconds to get a new file...'%(self.__waitForNewFile) |
|
340 |
|
|
|
345 | sleep(self.__waitForNewFile) | |
|
341 | 346 | self.__selectDataForTimes(online=True) |
|
342 | 347 | filename = self.filenameList[0] |
|
343 | 348 |
@@ -384,6 +384,21 class FitsReader(ProcessingUnit): | |||
|
384 | 384 | |
|
385 | 385 | return 1 |
|
386 | 386 | |
|
387 | def __setValuesFromHeader(self): | |
|
388 | ||
|
389 | self.dataOut.header = self.header_dict | |
|
390 | self.dataOut.expName = self.expName | |
|
391 | self.dataOut.nChannels = self.nChannels | |
|
392 | self.dataOut.timeZone = self.timeZone | |
|
393 | self.dataOut.dataBlocksPerFile = self.dataBlocksPerFile | |
|
394 | self.dataOut.comments = self.comments | |
|
395 | # self.dataOut.timeInterval = self.timeInterval | |
|
396 | self.dataOut.channelList = self.channelList | |
|
397 | self.dataOut.heightList = self.heightList | |
|
398 | ||
|
399 | self.dataOut.nCohInt = self.nCohInt | |
|
400 | self.dataOut.nIncohInt = self.nIncohInt | |
|
401 | ||
|
387 | 402 | def readHeader(self): |
|
388 | 403 | headerObj = self.fitsObj[0] |
|
389 | 404 | |
@@ -438,7 +453,7 class FitsReader(ProcessingUnit): | |||
|
438 | 453 | return 0 |
|
439 | 454 | |
|
440 | 455 | self.readHeader() |
|
441 | ||
|
456 | self.__setValuesFromHeader() | |
|
442 | 457 | self.nReadBlocks = 0 |
|
443 | 458 | # self.blockIndex = 1 |
|
444 | 459 | return 1 |
@@ -695,15 +710,15 class FitsReader(ProcessingUnit): | |||
|
695 | 710 | self.dataOut.data_header = self.data_header_dict |
|
696 | 711 | self.dataOut.utctime = self.utc |
|
697 | 712 | |
|
698 | self.dataOut.header = self.header_dict | |
|
699 | self.dataOut.expName = self.expName | |
|
700 | self.dataOut.nChannels = self.nChannels | |
|
701 | self.dataOut.timeZone = self.timeZone | |
|
702 | self.dataOut.dataBlocksPerFile = self.dataBlocksPerFile | |
|
703 | self.dataOut.comments = self.comments | |
|
704 | self.dataOut.timeInterval = self.timeInterval | |
|
705 | self.dataOut.channelList = self.channelList | |
|
706 | self.dataOut.heightList = self.heightList | |
|
713 | # self.dataOut.header = self.header_dict | |
|
714 | # self.dataOut.expName = self.expName | |
|
715 | # self.dataOut.nChannels = self.nChannels | |
|
716 | # self.dataOut.timeZone = self.timeZone | |
|
717 | # self.dataOut.dataBlocksPerFile = self.dataBlocksPerFile | |
|
718 | # self.dataOut.comments = self.comments | |
|
719 | # # self.dataOut.timeInterval = self.timeInterval | |
|
720 | # self.dataOut.channelList = self.channelList | |
|
721 | # self.dataOut.heightList = self.heightList | |
|
707 | 722 | self.dataOut.flagNoData = False |
|
708 | 723 | |
|
709 | 724 | return self.dataOut.data |
@@ -16,6 +16,10 from model.data.jroheaderIO import RadarControllerHeader, SystemHeader | |||
|
16 | 16 | from model.data.jrodata import Voltage |
|
17 | 17 | from model.proc.jroproc_base import ProcessingUnit, Operation |
|
18 | 18 | |
|
19 | try: | |
|
20 | from gevent import sleep | |
|
21 | except: | |
|
22 | from time import sleep | |
|
19 | 23 | |
|
20 | 24 | def isNumber(str): |
|
21 | 25 | """ |
@@ -506,7 +510,7 class HFReader(ProcessingUnit): | |||
|
506 | 510 | filename = self.filenameList[0] |
|
507 | 511 | while self.filename_online == filename: |
|
508 | 512 | print 'waiting %d seconds to get a new file...'%(self.__waitForNewFile) |
|
509 |
|
|
|
513 | sleep(self.__waitForNewFile) | |
|
510 | 514 | #self.__findDataForDates(online=True) |
|
511 | 515 | self.__selectDataForTimes(online=True) |
|
512 | 516 | filename = self.filenameList[0] |
@@ -518,12 +522,12 class HFReader(ProcessingUnit): | |||
|
518 | 522 | print "%s is not the rigth size"%filename |
|
519 | 523 | delay=2 |
|
520 | 524 | print 'waiting %d seconds for delay...'%(delay) |
|
521 |
|
|
|
525 | sleep(delay) | |
|
522 | 526 | sizeoffile=os.path.getsize(filename) |
|
523 | 527 | if sizeoffile<1670240: |
|
524 | 528 | delay |
|
525 | 529 | print 'waiting %d more seconds for delay...'%(delay) |
|
526 |
|
|
|
530 | sleep(delay) | |
|
527 | 531 | |
|
528 | 532 | |
|
529 | 533 |
@@ -15,7 +15,7 class CorrelationProc(ProcessingUnit): | |||
|
15 | 15 | self.profIndex = 0 |
|
16 | 16 | self.dataOut = Correlation() |
|
17 | 17 | |
|
18 |
def __updateObjFrom |
|
|
18 | def __updateObjFromVoltage(self): | |
|
19 | 19 | |
|
20 | 20 | self.dataOut.timeZone = self.dataIn.timeZone |
|
21 | 21 | self.dataOut.dstFlag = self.dataIn.dstFlag |
@@ -42,7 +42,7 class CorrelationProc(ProcessingUnit): | |||
|
42 | 42 | self.dataOut.ippSeconds = self.dataIn.ippSeconds |
|
43 | 43 | # self.dataOut.windowOfFilter = self.dataIn.windowOfFilter |
|
44 | 44 | |
|
45 | self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nPoints | |
|
45 | # self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nPoints | |
|
46 | 46 | |
|
47 | 47 | |
|
48 | 48 | def removeDC(self, jspectra): |
@@ -189,7 +189,7 class CorrelationProc(ProcessingUnit): | |||
|
189 | 189 | self.buffer = self.removeDC(self.buffer) |
|
190 | 190 | #--------------------------------------------- |
|
191 | 191 | self.dataOut.data_volts = self.buffer |
|
192 |
self.__updateObjFrom |
|
|
192 | self.__updateObjFromVoltage() | |
|
193 | 193 | self.dataOut.data_corr = numpy.zeros((len(pairsList), |
|
194 | 194 | len(lagT),len(lagR), |
|
195 | 195 | self.dataIn.nHeights), |
@@ -14,7 +14,7 class SpectraHeisProc(ProcessingUnit): | |||
|
14 | 14 | # self.profIndex = 0 |
|
15 | 15 | self.dataOut = SpectraHeis() |
|
16 | 16 | |
|
17 |
def __updateObjFrom |
|
|
17 | def __updateObjFromVoltage(self): | |
|
18 | 18 | |
|
19 | 19 | self.dataOut.timeZone = self.dataIn.timeZone |
|
20 | 20 | self.dataOut.dstFlag = self.dataIn.dstFlag |
@@ -48,19 +48,23 class SpectraHeisProc(ProcessingUnit): | |||
|
48 | 48 | # self.dataOut.ippSeconds= self.dataIn.ippSeconds |
|
49 | 49 | self.dataOut.windowOfFilter = self.dataIn.windowOfFilter |
|
50 | 50 | |
|
51 | self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nIncohInt | |
|
51 | # self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nIncohInt | |
|
52 | 52 | # self.dataOut.set=self.dataIn.set |
|
53 | 53 | # self.dataOut.deltaHeight=self.dataIn.deltaHeight |
|
54 | 54 | |
|
55 | 55 | |
|
56 | 56 | def __updateObjFromFits(self): |
|
57 | ||
|
57 | 58 | self.dataOut.utctime = self.dataIn.utctime |
|
58 | 59 | self.dataOut.channelIndexList = self.dataIn.channelIndexList |
|
59 | 60 | |
|
60 | 61 | self.dataOut.channelList = self.dataIn.channelList |
|
61 | 62 | self.dataOut.heightList = self.dataIn.heightList |
|
62 | 63 | self.dataOut.data_spc = self.dataIn.data |
|
63 |
self.dataOut. |
|
|
64 | self.dataOut.ippSeconds = self.dataIn.ippSeconds | |
|
65 | self.dataOut.nCohInt = self.dataIn.nCohInt | |
|
66 | self.dataOut.nIncohInt = self.dataIn.nIncohInt | |
|
67 | # self.dataOut.timeInterval = self.dataIn.timeInterval | |
|
64 | 68 | self.dataOut.timeZone = self.dataIn.timeZone |
|
65 | 69 | self.dataOut.useLocalTime = True |
|
66 | 70 | # self.dataOut. |
@@ -87,7 +91,7 class SpectraHeisProc(ProcessingUnit): | |||
|
87 | 91 | return |
|
88 | 92 | |
|
89 | 93 | if self.dataIn.type == "Voltage": |
|
90 |
self.__updateObjFrom |
|
|
94 | self.__updateObjFromVoltage() | |
|
91 | 95 | self.__getFft() |
|
92 | 96 | self.dataOut.flagNoData = False |
|
93 | 97 |
@@ -1327,6 +1327,7 class WindProfiler(Operation): | |||
|
1327 | 1327 | return A1 |
|
1328 | 1328 | |
|
1329 | 1329 | def __correctValues(self, heiRang, phi, velRadial, SNR): |
|
1330 | ||
|
1330 | 1331 | listPhi = phi.tolist() |
|
1331 | 1332 | maxid = listPhi.index(max(listPhi)) |
|
1332 | 1333 | minid = listPhi.index(min(listPhi)) |
@@ -1615,14 +1616,19 class WindProfiler(Operation): | |||
|
1615 | 1616 | else: correctFactor = 1 |
|
1616 | 1617 | if kwargs.has_key('channelList'): |
|
1617 | 1618 | channelList = kwargs['channelList'] |
|
1618 | if len(channelList) == 2: | |
|
1619 | horizontalOnly = True | |
|
1620 | 1619 | arrayChannel = numpy.array(channelList) |
|
1621 | 1620 | param = param[arrayChannel,:,:] |
|
1622 | 1621 | theta_x = theta_x[arrayChannel] |
|
1623 | 1622 | theta_y = theta_y[arrayChannel] |
|
1624 | 1623 | |
|
1625 | 1624 | velRadial0 = param[:,1,:] #Radial velocity |
|
1625 | ||
|
1626 | if velRadial0.shape[0] != theta_x.shape[0] or velRadial0.shape[0] != theta_y.shape[0]: | |
|
1627 | raise ValueError, "The max number of channels is %d, and the length of cosine director is %d. Please check: dirCosX, dirCosY, elevation or azimuth arguments" %(velRadial0.shape[0], theta_x.shape[0]) | |
|
1628 | ||
|
1629 | if theta_x.shape[0] == 2: | |
|
1630 | horizontalOnly = True | |
|
1631 | ||
|
1626 | 1632 | dataOut.data_output, dataOut.heightList, dataOut.data_SNR = self.techniqueDBS(velRadial0, theta_x, theta_y, azimuth, correctFactor, horizontalOnly, heightList, SNR) #DBS Function |
|
1627 | 1633 | dataOut.utctimeInit = dataOut.utctime |
|
1628 | 1634 | dataOut.outputInterval = dataOut.timeInterval |
@@ -90,6 +90,11 class SpectraProc(ProcessingUnit): | |||
|
90 | 90 | #calculo de cross-spectra |
|
91 | 91 | cspc = numpy.zeros((self.dataOut.nPairs, self.dataOut.nFFTPoints, self.dataOut.nHeights), dtype='complex') |
|
92 | 92 | for pair in self.dataOut.pairsList: |
|
93 | if pair[0] not in self.dataOut.channelList: | |
|
94 | raise ValueError, "Error getting CrossSpectra: pair 0 of (%s) is not in channelList=%s" %(str(pair), str(self.dataOut.channelList)) | |
|
95 | if pair[1] not in self.dataOut.channelList: | |
|
96 | raise ValueError, "Error getting CrossSpectra: pair 1 of (%s) is not in channelList=%s" %(str(pair), str(self.dataOut.channelList)) | |
|
97 | ||
|
93 | 98 | cspc[pairIndex,:,:] = fft_volt[pair[0],:,:] * numpy.conjugate(fft_volt[pair[1],:,:]) |
|
94 | 99 | pairIndex += 1 |
|
95 | 100 | blocksize += cspc.size |
@@ -166,7 +171,33 class SpectraProc(ProcessingUnit): | |||
|
166 | 171 | |
|
167 | 172 | return True |
|
168 | 173 | |
|
169 | raise ValueError, "The type object %s is not valid"%(self.dataIn.type) | |
|
174 | raise ValueError, "The type of input object '%s' is not valid"%(self.dataIn.type) | |
|
175 | ||
|
176 | def __selectPairs(self, channelList=None): | |
|
177 | ||
|
178 | if channelList == None: | |
|
179 | return | |
|
180 | ||
|
181 | pairsIndexListSelected = [] | |
|
182 | for pairIndex in self.dataOut.pairsIndexList: | |
|
183 | #First pair | |
|
184 | if self.dataOut.pairsList[pairIndex][0] not in channelList: | |
|
185 | continue | |
|
186 | #Second pair | |
|
187 | if self.dataOut.pairsList[pairIndex][1] not in channelList: | |
|
188 | continue | |
|
189 | ||
|
190 | pairsIndexListSelected.append(pairIndex) | |
|
191 | ||
|
192 | if not pairsIndexListSelected: | |
|
193 | self.dataOut.data_cspc = None | |
|
194 | self.dataOut.pairsList = [] | |
|
195 | return | |
|
196 | ||
|
197 | self.dataOut.data_cspc = self.dataOut.data_cspc[pairsIndexListSelected] | |
|
198 | self.dataOut.pairsList = self.dataOut.pairsList[pairsIndexListSelected] | |
|
199 | ||
|
200 | return | |
|
170 | 201 | |
|
171 | 202 | def selectChannels(self, channelList): |
|
172 | 203 | |
@@ -174,7 +205,8 class SpectraProc(ProcessingUnit): | |||
|
174 | 205 | |
|
175 | 206 | for channel in channelList: |
|
176 | 207 | if channel not in self.dataOut.channelList: |
|
177 | continue | |
|
208 | raise ValueError, "Error selecting channels: The value %d in channelList is not valid.\nAvailable channels = %s" %(channel, str(self.dataOut.channelList)) | |
|
209 | ||
|
178 | 210 | index = self.dataOut.channelList.index(channel) |
|
179 | 211 | channelIndexList.append(index) |
|
180 | 212 | |
@@ -198,17 +230,21 class SpectraProc(ProcessingUnit): | |||
|
198 | 230 | |
|
199 | 231 | for channelIndex in channelIndexList: |
|
200 | 232 | if channelIndex not in self.dataOut.channelIndexList: |
|
201 | print channelIndexList | |
|
202 | raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex | |
|
233 | raise ValueError, "Error selecting channels: The value %d in channelIndexList is not valid.\nAvailable channel indexes = " %(channelIndex, self.dataOut.channelIndexList) | |
|
203 | 234 | |
|
204 | 235 | # nChannels = len(channelIndexList) |
|
205 | 236 | |
|
206 | 237 | data_spc = self.dataOut.data_spc[channelIndexList,:] |
|
238 | data_dc = self.dataOut.data_dc[channelIndexList,:] | |
|
207 | 239 | |
|
208 | 240 | self.dataOut.data_spc = data_spc |
|
241 | self.dataOut.data_dc = data_dc | |
|
242 | ||
|
209 | 243 | self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] |
|
210 | 244 | # self.dataOut.nChannels = nChannels |
|
211 | 245 | |
|
246 | self.__selectPairs(self.dataOut.channelList) | |
|
247 | ||
|
212 | 248 | return 1 |
|
213 | 249 | |
|
214 | 250 | def selectHeights(self, minHei, maxHei): |
@@ -226,8 +262,12 class SpectraProc(ProcessingUnit): | |||
|
226 | 262 | Return: |
|
227 | 263 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 |
|
228 | 264 | """ |
|
229 | if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei): | |
|
230 | raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) | |
|
265 | ||
|
266 | if (minHei > maxHei): | |
|
267 | raise ValueError, "Error selecting heights: Height range (%d,%d) is not valid" % (minHei, maxHei) | |
|
268 | ||
|
269 | if (minHei < self.dataOut.heightList[0]): | |
|
270 | minHei = self.dataOut.heightList[0] | |
|
231 | 271 | |
|
232 | 272 | if (maxHei > self.dataOut.heightList[-1]): |
|
233 | 273 | maxHei = self.dataOut.heightList[-1] |
@@ -314,7 +354,7 class SpectraProc(ProcessingUnit): | |||
|
314 | 354 | """ |
|
315 | 355 | |
|
316 | 356 | if (minIndex < 0) or (minIndex > maxIndex): |
|
317 |
raise ValueError, " |
|
|
357 | raise ValueError, "Error selecting heights by index: Index range in (%d,%d) is not valid" % (minIndex, maxIndex) | |
|
318 | 358 | |
|
319 | 359 | if (maxIndex >= self.dataOut.nHeights): |
|
320 | 360 | maxIndex = self.dataOut.nHeights-1 |
@@ -34,7 +34,7 class VoltageProc(ProcessingUnit): | |||
|
34 | 34 | self.dataOut.data = self.dataIn.data |
|
35 | 35 | self.dataOut.utctime = self.dataIn.utctime |
|
36 | 36 | self.dataOut.channelList = self.dataIn.channelList |
|
37 | self.dataOut.timeInterval = self.dataIn.timeInterval | |
|
37 | # self.dataOut.timeInterval = self.dataIn.timeInterval | |
|
38 | 38 | self.dataOut.heightList = self.dataIn.heightList |
|
39 | 39 | self.dataOut.nProfiles = self.dataIn.nProfiles |
|
40 | 40 | |
@@ -68,7 +68,7 class VoltageProc(ProcessingUnit): | |||
|
68 | 68 | |
|
69 | 69 | for channel in channelList: |
|
70 | 70 | if channel not in self.dataOut.channelList: |
|
71 | continue | |
|
71 | raise ValueError, "Channel %d is not in %s" %(channel, str(self.dataOut.channelList)) | |
|
72 | 72 | |
|
73 | 73 | index = self.dataOut.channelList.index(channel) |
|
74 | 74 | channelIndexList.append(index) |
@@ -255,7 +255,7 class VoltageProc(ProcessingUnit): | |||
|
255 | 255 | flip = self.flip |
|
256 | 256 | profileList = range(self.dataOut.nProfiles) |
|
257 | 257 | |
|
258 |
if channelList |
|
|
258 | if not channelList: | |
|
259 | 259 | for thisProfile in profileList: |
|
260 | 260 | data[:,thisProfile,:] = data[:,thisProfile,:]*flip |
|
261 | 261 | flip *= -1.0 |
@@ -271,7 +271,7 class VoltageProc(ProcessingUnit): | |||
|
271 | 271 | self.flip = flip |
|
272 | 272 | |
|
273 | 273 | else: |
|
274 |
if channelList |
|
|
274 | if not channelList: | |
|
275 | 275 | data[:,:] = data[:,:]*self.flip |
|
276 | 276 | else: |
|
277 | 277 | for thisChannel in channelList: |
General Comments 0
You need to be logged in to leave comments.
Login now