@@ -9,6 +9,11 from xml.dom import minidom | |||||
9 | #import datetime |
|
9 | #import datetime | |
10 | from model import * |
|
10 | from model import * | |
11 |
|
11 | |||
|
12 | try: | |||
|
13 | from gevent import sleep | |||
|
14 | except: | |||
|
15 | from time import sleep | |||
|
16 | ||||
12 | import ast |
|
17 | import ast | |
13 |
|
18 | |||
14 | def prettify(elem): |
|
19 | def prettify(elem): | |
@@ -42,7 +47,7 class ParameterConf(): | |||||
42 | if self.__formated_value != None: |
|
47 | if self.__formated_value != None: | |
43 |
|
48 | |||
44 | return self.__formated_value |
|
49 | return self.__formated_value | |
45 |
|
|
50 | ||
46 | value = self.value |
|
51 | value = self.value | |
47 |
|
52 | |||
48 | if self.format == 'bool': |
|
53 | if self.format == 'bool': | |
@@ -731,6 +736,11 class Project(): | |||||
731 |
|
736 | |||
732 | return procUnitConfObj |
|
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 | def getReadUnitId(self): |
|
744 | def getReadUnitId(self): | |
735 |
|
745 | |||
736 | readUnitConfObj = self.getReadUnitObj() |
|
746 | readUnitConfObj = self.getReadUnitObj() | |
@@ -886,7 +896,7 class Project(): | |||||
886 | print "Process suspended" |
|
896 | print "Process suspended" | |
887 |
|
897 | |||
888 | while True: |
|
898 | while True: | |
889 |
|
|
899 | sleep(0.1) | |
890 |
|
900 | |||
891 | if not self.control['pause']: |
|
901 | if not self.control['pause']: | |
892 | break |
|
902 | break | |
@@ -896,7 +906,7 class Project(): | |||||
896 | print "Process reinitialized" |
|
906 | print "Process reinitialized" | |
897 |
|
907 | |||
898 | if self.control['stop']: |
|
908 | if self.control['stop']: | |
899 |
print " |
|
909 | print "Process stopped" | |
900 | break |
|
910 | break | |
901 |
|
911 | |||
902 | #Closing every process |
|
912 | #Closing every process | |
@@ -904,7 +914,7 class Project(): | |||||
904 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
914 | procUnitConfObj = self.procUnitConfObjDict[procKey] | |
905 | procUnitConfObj.close() |
|
915 | procUnitConfObj.close() | |
906 |
|
916 | |||
907 |
print "Process |
|
917 | print "Process finished" | |
908 |
|
918 | |||
909 | def start(self, filename): |
|
919 | def start(self, filename): | |
910 |
|
920 |
@@ -24,6 +24,11 from os.path import expanduser | |||||
24 | #from CodeWarrior.Standard_Suite import file |
|
24 | #from CodeWarrior.Standard_Suite import file | |
25 | from comm import * |
|
25 | from comm import * | |
26 |
|
26 | |||
|
27 | try: | |||
|
28 | from gevent import sleep | |||
|
29 | except: | |||
|
30 | from time import sleep | |||
|
31 | ||||
27 | from schainpy.gui.figures import tools |
|
32 | from schainpy.gui.figures import tools | |
28 | import numpy |
|
33 | import numpy | |
29 |
|
34 | |||
@@ -80,9 +85,6 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
80 | self.create = False |
|
85 | self.create = False | |
81 | self.selectedItemTree = None |
|
86 | self.selectedItemTree = None | |
82 | self.commCtrlPThread = None |
|
87 | self.commCtrlPThread = None | |
83 | self.setParameter() |
|
|||
84 | self.create_comm() |
|
|||
85 | # self.create_timers() |
|
|||
86 | # self.create_figure() |
|
88 | # self.create_figure() | |
87 | self.temporalFTP = ftpBuffer() |
|
89 | self.temporalFTP = ftpBuffer() | |
88 | self.projectProperCaracteristica = [] |
|
90 | self.projectProperCaracteristica = [] | |
@@ -106,7 +108,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
106 |
|
108 | |||
107 | self.__ftpProcUnitAdded = False |
|
109 | self.__ftpProcUnitAdded = False | |
108 | self.__ftpProcUnitId = None |
|
110 | self.__ftpProcUnitId = None | |
109 |
|
111 | self.__initialized = False | ||
|
112 | ||||
|
113 | self.create_comm() | |||
|
114 | self.create_updating_timer() | |||
|
115 | self.setParameter() | |||
|
116 | ||||
110 | @pyqtSignature("") |
|
117 | @pyqtSignature("") | |
111 | def on_actionOpen_triggered(self): |
|
118 | def on_actionOpen_triggered(self): | |
112 | """ |
|
119 | """ | |
@@ -527,7 +534,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
527 |
|
534 | |||
528 |
|
535 | |||
529 | if self.volOpCebChannels.isChecked(): |
|
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 | format = 'intlist' |
|
543 | format = 'intlist' | |
532 | if self.volOpComChannels.currentIndex() == 0: |
|
544 | if self.volOpComChannels.currentIndex() == 0: | |
533 | name_operation = "selectChannels" |
|
545 | name_operation = "selectChannels" | |
@@ -540,7 +552,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
540 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
552 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
541 |
|
553 | |||
542 | if self.volOpCebHeights.isChecked(): |
|
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 | valueList = value.split(',') |
|
561 | valueList = value.split(',') | |
545 | format = 'float' |
|
562 | format = 'float' | |
546 | if self.volOpComHeights.currentIndex() == 0: |
|
563 | if self.volOpComHeights.currentIndex() == 0: | |
@@ -551,12 +568,17 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
551 | name_operation = 'selectHeightsByIndex' |
|
568 | name_operation = 'selectHeightsByIndex' | |
552 | name_parameter1 = 'minIndex' |
|
569 | name_parameter1 = 'minIndex' | |
553 | name_parameter2 = 'maxIndex' |
|
570 | name_parameter2 = 'maxIndex' | |
|
571 | ||||
554 | opObj = puObj.addOperation(name=name_operation) |
|
572 | opObj = puObj.addOperation(name=name_operation) | |
555 | opObj.addParameter(name=name_parameter1, value=valueList[0], format=format) |
|
573 | opObj.addParameter(name=name_parameter1, value=valueList[0], format=format) | |
556 | opObj.addParameter(name=name_parameter2, value=valueList[1], format=format) |
|
574 | opObj.addParameter(name=name_parameter2, value=valueList[1], format=format) | |
557 |
|
575 | |||
558 | if self.volOpCebFilter.isChecked(): |
|
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 | format = 'int' |
|
582 | format = 'int' | |
561 | name_operation = 'filterByHeights' |
|
583 | name_operation = 'filterByHeights' | |
562 | name_parameter = 'window' |
|
584 | name_parameter = 'window' | |
@@ -564,7 +586,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
564 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
586 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
565 |
|
587 | |||
566 | if self.volOpCebProfile.isChecked(): |
|
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 | format = 'intlist' |
|
595 | format = 'intlist' | |
569 | optype = 'other' |
|
596 | optype = 'other' | |
570 | name_operation = 'ProfileSelector' |
|
597 | name_operation = 'ProfileSelector' | |
@@ -1097,7 +1124,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
1097 | puObj.addParameter(name=name_parameter, value=value2, format=format) |
|
1124 | puObj.addParameter(name=name_parameter, value=value2, format=format) | |
1098 |
|
1125 | |||
1099 | if self.specOpCebHeights.isChecked(): |
|
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 | valueList = value.split(',') |
|
1133 | valueList = value.split(',') | |
1102 | format = 'float' |
|
1134 | format = 'float' | |
1103 | value0 = valueList[0] |
|
1135 | value0 = valueList[0] | |
@@ -1116,7 +1148,12 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
1116 | opObj.addParameter(name=name_parameter2, value=value1, format=format) |
|
1148 | opObj.addParameter(name=name_parameter2, value=value1, format=format) | |
1117 |
|
1149 | |||
1118 | if self.specOpCebChannel.isChecked(): |
|
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 | format = 'intlist' |
|
1157 | format = 'intlist' | |
1121 | if self.specOpComChannel.currentIndex() == 0: |
|
1158 | if self.specOpComChannel.currentIndex() == 0: | |
1122 | name_operation = "selectChannels" |
|
1159 | name_operation = "selectChannels" | |
@@ -1124,11 +1161,16 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
1124 | else: |
|
1161 | else: | |
1125 | name_operation = "selectChannelsByIndex" |
|
1162 | name_operation = "selectChannelsByIndex" | |
1126 | name_parameter = 'channelIndexList' |
|
1163 | name_parameter = 'channelIndexList' | |
1127 |
opObj = puObj.addOperation(name= |
|
1164 | opObj = puObj.addOperation(name=name_operation) | |
1128 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1165 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
1129 |
|
1166 | |||
1130 | if self.specOpCebIncoherent.isChecked(): |
|
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 | name_operation = 'IncohInt' |
|
1174 | name_operation = 'IncohInt' | |
1133 | optype = 'other' |
|
1175 | optype = 'other' | |
1134 | if self.specOpCobIncInt.currentIndex() == 0: |
|
1176 | if self.specOpCobIncInt.currentIndex() == 0: | |
@@ -2300,8 +2342,7 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
2300 | self.specHeisGraphPath.setEnabled(True) |
|
2342 | self.specHeisGraphPath.setEnabled(True) | |
2301 | self.specHeisGraphPrefix.setEnabled(True) |
|
2343 | self.specHeisGraphPrefix.setEnabled(True) | |
2302 | self.specHeisGraphToolPath.setEnabled(True) |
|
2344 | self.specHeisGraphToolPath.setEnabled(True) | |
2303 |
|
2345 | |||
2304 | #-------ftp-----# |
|
|||
2305 | @pyqtSignature("int") |
|
2346 | @pyqtSignature("int") | |
2306 | def on_specHeisGraphftpSpectra_stateChanged(self, p0): |
|
2347 | def on_specHeisGraphftpSpectra_stateChanged(self, p0): | |
2307 | """ |
|
2348 | """ | |
@@ -2445,10 +2486,10 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
2445 | def on_right_click(self, pos): |
|
2486 | def on_right_click(self, pos): | |
2446 |
|
2487 | |||
2447 | self.menu = QtGui.QMenu() |
|
2488 | self.menu = QtGui.QMenu() | |
2448 |
quitAction0 = self.menu.addAction(" |
|
2489 | quitAction0 = self.menu.addAction("Create a new project") | |
2449 |
quitAction1 = self.menu.addAction(" |
|
2490 | quitAction1 = self.menu.addAction("Create a new processing unit") | |
2450 | quitAction2 = self.menu.addAction("Delete") |
|
2491 | quitAction2 = self.menu.addAction("Delete selected unit") | |
2451 |
quitAction3 = self.menu.addAction(" |
|
2492 | quitAction3 = self.menu.addAction("Quit") | |
2452 |
|
2493 | |||
2453 | if len(self.__itemTreeDict) == 0: |
|
2494 | if len(self.__itemTreeDict) == 0: | |
2454 | quitAction2.setEnabled(False) |
|
2495 | quitAction2.setEnabled(False) | |
@@ -2493,7 +2534,8 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
2493 | # print i.row() |
|
2534 | # print i.row() | |
2494 |
|
2535 | |||
2495 | if action == quitAction3: |
|
2536 | if action == quitAction3: | |
2496 |
|
|
2537 | self.close() | |
|
2538 | return 0 | |||
2497 |
|
2539 | |||
2498 | def refreshProjectWindow(self, project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, set): |
|
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 | opObj = puObj.getOperationObj(name="selectChannels") |
|
2589 | opObj = puObj.getOperationObj(name="selectChannels") | |
|
2590 | ||||
|
2591 | if opObj == None: | |||
|
2592 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") | |||
|
2593 | ||||
2548 | if opObj == None: |
|
2594 | if opObj == None: | |
2549 | self.volOpChannel.clear() |
|
2595 | self.volOpChannel.clear() | |
2550 | self.volOpCebChannels.setCheckState(0) |
|
2596 | self.volOpCebChannels.setCheckState(0) | |
2551 |
|
||||
2552 | else: |
|
2597 | else: | |
2553 | value = opObj.getParameterValue(parameterName='channelList') |
|
2598 | channelEnabled = False | |
2554 |
|
|
2599 | try: | |
2555 | self.volOpChannel.setText(value) |
|
2600 | value = opObj.getParameterValue(parameterName='channelList') | |
2556 | self.volOpChannel.setEnabled(True) |
|
2601 | value = str(value)[1:-1] | |
2557 | self.volOpCebChannels.setCheckState(QtCore.Qt.Checked) |
|
2602 | channelEnabled = True | |
2558 |
|
2603 | channelMode = 0 | ||
2559 |
|
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 | opObj = puObj.getOperationObj(name="selectHeights") |
|
2620 | opObj = puObj.getOperationObj(name="selectHeights") | |
2561 | if opObj == None: |
|
2621 | if opObj == None: | |
2562 | self.volOpHeights.clear() |
|
2622 | self.volOpHeights.clear() | |
@@ -2811,15 +2871,35 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
2811 | self.specOpCebCrossSpectra.setCheckState(QtCore.Qt.Checked) |
|
2871 | self.specOpCebCrossSpectra.setCheckState(QtCore.Qt.Checked) | |
2812 |
|
2872 | |||
2813 | opObj = puObj.getOperationObj(name="selectChannels") |
|
2873 | opObj = puObj.getOperationObj(name="selectChannels") | |
|
2874 | ||||
|
2875 | if opObj == None: | |||
|
2876 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") | |||
|
2877 | ||||
2814 | if opObj == None: |
|
2878 | if opObj == None: | |
2815 | self.specOpChannel.clear() |
|
2879 | self.specOpChannel.clear() | |
2816 | self.specOpCebChannel.setCheckState(0) |
|
2880 | self.specOpCebChannel.setCheckState(0) | |
2817 |
else: |
|
2881 | else: | |
2818 | value = opObj.getParameterValue(parameterName='channelList') |
|
2882 | channelEnabled = False | |
2819 |
|
|
2883 | try: | |
2820 | self.specOpChannel.setText(value) |
|
2884 | value = opObj.getParameterValue(parameterName='channelList') | |
2821 | self.specOpChannel.setEnabled(True) |
|
2885 | value = str(value)[1:-1] | |
2822 | self.specOpCebChannel.setCheckState(QtCore.Qt.Checked) |
|
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 | opObj = puObj.getOperationObj(name="selectHeights") |
|
2904 | opObj = puObj.getOperationObj(name="selectHeights") | |
2825 | if opObj == None: |
|
2905 | if opObj == None: | |
@@ -3556,13 +3636,14 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
3556 | self.specGgraphChannelList.clear() |
|
3636 | self.specGgraphChannelList.clear() | |
3557 |
|
3637 | |||
3558 | def create_comm(self): |
|
3638 | def create_comm(self): | |
|
3639 | ||||
3559 | self.commCtrlPThread = CommCtrlProcessThread() |
|
3640 | self.commCtrlPThread = CommCtrlProcessThread() | |
3560 | self.commCtrlPThread.start() |
|
3641 | self.commCtrlPThread.start() | |
3561 |
|
3642 | |||
3562 |
def create_timer |
|
3643 | def create_updating_timer(self): | |
3563 | self.comm_data_timer = QtCore.QTimer(self) |
|
3644 | self.comm_data_timer = QtCore.QTimer(self) | |
3564 |
self.comm_data_timer.timeout.connect(self.on_comm_ |
|
3645 | self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) | |
3565 | self.comm_data_timer.start(10) |
|
3646 | self.comm_data_timer.start(1000) | |
3566 |
|
3647 | |||
3567 | def create_figure(self): |
|
3648 | def create_figure(self): | |
3568 | self.queue_plot = Queue.Queue() |
|
3649 | self.queue_plot = Queue.Queue() | |
@@ -3580,15 +3661,15 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
3580 | if not self.running: |
|
3661 | if not self.running: | |
3581 | app.quit() |
|
3662 | app.quit() | |
3582 |
|
3663 | |||
3583 | def on_comm_data_timer(self): |
|
3664 | # def on_comm_data_timer(self): | |
3584 | # lee el data_queue y la coloca en el queue de ploteo |
|
3665 | # # lee el data_queue y la coloca en el queue de ploteo | |
3585 | try: |
|
3666 | # try: | |
3586 | reply = self.commCtrlPThread.data_q.get(block=False) |
|
3667 | # reply = self.commCtrlPThread.data_q.get(block=False) | |
3587 | self.queue_plot.put(reply.data) |
|
3668 | # self.queue_plot.put(reply.data) | |
3588 |
|
3669 | # | ||
3589 | except Queue.Empty: |
|
3670 | # except Queue.Empty: | |
3590 | pass |
|
3671 | # pass | |
3591 |
|
3672 | |||
3592 | def createProjectView(self, id): |
|
3673 | def createProjectView(self, id): | |
3593 |
|
3674 | |||
3594 | self.create = False |
|
3675 | self.create = False | |
@@ -3812,7 +3893,10 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
3812 | if not procUnitConfObj: |
|
3893 | if not procUnitConfObj: | |
3813 | return |
|
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 | self.__puObjDict.pop(procUnitConfObj.getId()) |
|
3901 | self.__puObjDict.pop(procUnitConfObj.getId()) | |
3818 |
|
3902 | |||
@@ -3935,8 +4019,15 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
3935 | channel = value |
|
4019 | channel = value | |
3936 | self.bufferVoltage("Processing Unit", "Select Channel", channel) |
|
4020 | self.bufferVoltage("Processing Unit", "Select Channel", channel) | |
3937 |
|
4021 | |||
3938 |
|
4022 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") | ||
3939 |
|
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 | opObj = puObj.getOperationObj(name="selectHeights") |
|
4031 | opObj = puObj.getOperationObj(name="selectHeights") | |
3941 | if opObj == None: |
|
4032 | if opObj == None: | |
3942 | heights = None |
|
4033 | heights = None | |
@@ -4201,11 +4292,23 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
4201 | opObj = puObj.getOperationObj(name="selectChannels") |
|
4292 | opObj = puObj.getOperationObj(name="selectChannels") | |
4202 | if opObj == None: |
|
4293 | if opObj == None: | |
4203 | channel = None |
|
4294 | channel = None | |
4204 |
else: |
|
4295 | else: | |
4205 | value = opObj.getParameterValue(parameterName='channelList') |
|
4296 | try: | |
4206 | value = str(value)[1:-1] |
|
4297 | value = opObj.getParameterValue(parameterName='channelList') | |
4207 | channel = value |
|
4298 | value = str(value)[1:-1] | |
4208 | self.bufferSpectra("Processing Unit", "Channel", channel) |
|
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 | opObj = puObj.getOperationObj(name="selectHeights") |
|
4313 | opObj = puObj.getOperationObj(name="selectHeights") | |
4211 | if opObj == None: |
|
4314 | if opObj == None: | |
@@ -5262,6 +5365,9 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
5262 |
|
5365 | |||
5263 | def openProject(self): |
|
5366 | def openProject(self): | |
5264 |
|
5367 | |||
|
5368 | self.actionStart.setEnabled(False) | |||
|
5369 | self.actionStarToolbar.setEnabled(False) | |||
|
5370 | ||||
5265 | self.create = False |
|
5371 | self.create = False | |
5266 | self.frame_2.setEnabled(True) |
|
5372 | self.frame_2.setEnabled(True) | |
5267 | home = expanduser("~") |
|
5373 | home = expanduser("~") | |
@@ -5345,6 +5451,18 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
5345 | self.console.append("The selected xml file has been loaded successfully") |
|
5451 | self.console.append("The selected xml file has been loaded successfully") | |
5346 | # self.refreshPUWindow(datatype=datatype,puObj=puObj) |
|
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 | def playProject(self, ext=".xml"): |
|
5466 | def playProject(self, ext=".xml"): | |
5349 |
|
5467 | |||
5350 | projectObj = self.getSelectedProjectObj() |
|
5468 | projectObj = self.getSelectedProjectObj() | |
@@ -5369,21 +5487,14 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
5369 | self.actionStopToolbar.setEnabled(True) |
|
5487 | self.actionStopToolbar.setEnabled(True) | |
5370 |
|
5488 | |||
5371 | self.console.append("Please Wait...") |
|
5489 | self.console.append("Please Wait...") | |
5372 | # try: |
|
|||
5373 | self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PROCESS, filename)) |
|
5490 | self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PROCESS, filename)) | |
5374 | # # |
|
5491 | sleep(0.5) | |
5375 | # except: |
|
5492 | self.__initialized = True | |
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)) |
|
|||
5384 |
|
5493 | |||
5385 | def stopProject(self): |
|
5494 | def stopProject(self): | |
5386 |
|
5495 | |||
|
5496 | self.__initialized = False | |||
|
5497 | ||||
5387 | self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) |
|
5498 | self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) | |
5388 |
|
5499 | |||
5389 | self.actionStart.setEnabled(True) |
|
5500 | self.actionStart.setEnabled(True) | |
@@ -6029,15 +6140,23 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
6029 | sys.stderr = sys.__stderr__ |
|
6140 | sys.stderr = sys.__stderr__ | |
6030 |
|
6141 | |||
6031 | def normalOutputWritten(self, text): |
|
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 | def setParameter(self): |
|
6155 | def setParameter(self): | |
6036 |
|
6156 | |||
6037 | self.setWindowTitle("ROJ-Signal Chain") |
|
6157 | self.setWindowTitle("ROJ-Signal Chain") | |
6038 | self.setWindowIcon(QtGui.QIcon( os.path.join(FIGURES_PATH,"adn.jpg") )) |
|
6158 | self.setWindowIcon(QtGui.QIcon( os.path.join(FIGURES_PATH,"adn.jpg") )) | |
6039 | sys.stdout = ShowMeConsole(textWritten=self.normalOutputWritten) |
|
6159 | ||
6040 | # sys.stderr = ShowMeConsole(textWritten=self.normalOutputWritten) |
|
|||
6041 | self.tabWidgetProject.setEnabled(False) |
|
6160 | self.tabWidgetProject.setEnabled(False) | |
6042 | self.tabVoltage.setEnabled(False) |
|
6161 | self.tabVoltage.setEnabled(False) | |
6043 | self.tabSpectra.setEnabled(False) |
|
6162 | self.tabSpectra.setEnabled(False) | |
@@ -6204,6 +6323,9 class BasicWindow(QMainWindow, Ui_BasicWindow): | |||||
6204 | self.specGgraphDbsrange.setToolTip('Example: 30,170') |
|
6323 | self.specGgraphDbsrange.setToolTip('Example: 30,170') | |
6205 |
|
6324 | |||
6206 | self.specGraphPrefix.setToolTip('Example: EXPERIMENT_NAME') |
|
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 | class UnitProcessWindow(QMainWindow, Ui_UnitProcess): |
|
6331 | class UnitProcessWindow(QMainWindow, Ui_UnitProcess): |
@@ -1,6 +1,9 | |||||
1 | import threading |
|
1 | import threading | |
2 | import Queue |
|
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 | from schainpy.controller import Project |
|
8 | from schainpy.controller import Project | |
6 | from command import * |
|
9 | from command import * | |
@@ -49,6 +52,7 class CommCtrlProcessThread(threading.Thread): | |||||
49 | self.socketIO = None |
|
52 | self.socketIO = None | |
50 | self.mySocket = None |
|
53 | self.mySocket = None | |
51 |
|
54 | |||
|
55 | self.controllerObj = None | |||
52 |
|
56 | |||
53 | self.handlers = { |
|
57 | self.handlers = { | |
54 | ProcessCommand.PROCESS: self._handle_ioPROCESSTHREAD, |
|
58 | ProcessCommand.PROCESS: self._handle_ioPROCESSTHREAD, | |
@@ -68,7 +72,16 class CommCtrlProcessThread(threading.Thread): | |||||
68 | sleep(0.1) |
|
72 | sleep(0.1) | |
69 | continue |
|
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 | def _handle_ioPROCESSTHREAD(self, cmd): |
|
85 | def _handle_ioPROCESSTHREAD(self, cmd): | |
73 | filename = cmd.data |
|
86 | filename = cmd.data | |
74 | self.controllerObj = ControllerThread(filename=filename) |
|
87 | self.controllerObj = ControllerThread(filename=filename) | |
@@ -79,6 +92,8 class CommCtrlProcessThread(threading.Thread): | |||||
79 |
|
92 | |||
80 | def _handle_ioSTOP(self, cmd): |
|
93 | def _handle_ioSTOP(self, cmd): | |
81 | self.controllerObj.stop() |
|
94 | self.controllerObj.stop() | |
|
95 | self.controllerObj.join() | |||
|
96 | # print "Process thread finished" | |||
82 |
|
97 | |||
83 | def _handle_ioDATA(self, cmd): |
|
98 | def _handle_ioDATA(self, cmd): | |
84 | self.reply_q.put(self._success_reply_data(data=cmd.data)) |
|
99 | self.reply_q.put(self._success_reply_data(data=cmd.data)) |
@@ -79,5 +79,12 class AMISR: | |||||
79 | def isEmpty(self): |
|
79 | def isEmpty(self): | |
80 |
|
80 | |||
81 | return self.flagNoData |
|
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 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") No newline at end of file |
|
90 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") |
@@ -659,6 +659,8 class SpectraHeis(Spectra): | |||||
659 |
|
659 | |||
660 | pairsList = None |
|
660 | pairsList = None | |
661 |
|
661 | |||
|
662 | nCohInt = None | |||
|
663 | ||||
662 | nIncohInt = None |
|
664 | nIncohInt = None | |
663 |
|
665 | |||
664 | def __init__(self): |
|
666 | def __init__(self): | |
@@ -694,6 +696,10 class SpectraHeis(Spectra): | |||||
694 | self.blocksize = None |
|
696 | self.blocksize = None | |
695 |
|
697 | |||
696 | self.profileIndex = 0 |
|
698 | self.profileIndex = 0 | |
|
699 | ||||
|
700 | self.nCohInt = 1 | |||
|
701 | ||||
|
702 | self.nIncohInt = 1 | |||
697 |
|
703 | |||
698 | def getNormFactor(self): |
|
704 | def getNormFactor(self): | |
699 | pwcode = 1 |
|
705 | pwcode = 1 | |
@@ -713,7 +719,7 class SpectraHeis(Spectra): | |||||
713 | normFactor = property(getNormFactor, "I'm the 'getNormFactor' property.") |
|
719 | normFactor = property(getNormFactor, "I'm the 'getNormFactor' property.") | |
714 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
720 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
715 |
|
721 | |||
716 | class Fits: |
|
722 | class Fits(JROData): | |
717 |
|
723 | |||
718 | heightList = None |
|
724 | heightList = None | |
719 |
|
725 | |||
@@ -765,9 +771,9 class Fits: | |||||
765 |
|
771 | |||
766 | self.utctime = None |
|
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 | self.useLocalTime = True |
|
778 | self.useLocalTime = True | |
773 |
|
779 | |||
@@ -852,7 +858,9 class Fits: | |||||
852 |
|
858 | |||
853 | def getTimeInterval(self): |
|
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 | datatime = property(getDatatime, "I'm the 'datatime' property") |
|
865 | datatime = property(getDatatime, "I'm the 'datatime' property") | |
858 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") |
|
866 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") | |
@@ -1026,7 +1034,14 class Correlation(JROData): | |||||
1026 | noise = jspectra0[:,freq_dc,:] - jspectra[:,freq_dc,:] |
|
1034 | noise = jspectra0[:,freq_dc,:] - jspectra[:,freq_dc,:] | |
1027 |
|
1035 | |||
1028 | return noise |
|
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 | # pairsList = property(getPairsList, "I'm the 'pairsList' property.") |
|
1045 | # pairsList = property(getPairsList, "I'm the 'pairsList' property.") | |
1031 | # nPoints = property(getNPoints, "I'm the 'nPoints' property.") |
|
1046 | # nPoints = property(getNPoints, "I'm the 'nPoints' property.") | |
1032 | calculateVelocity = property(getCalculateVelocity, "I'm the 'calculateVelocity' property.") |
|
1047 | calculateVelocity = property(getCalculateVelocity, "I'm the 'calculateVelocity' property.") | |
@@ -1060,7 +1075,7 class Parameters(JROData): | |||||
1060 |
|
1075 | |||
1061 | noise = None #Noise Potency |
|
1076 | noise = None #Noise Potency | |
1062 |
|
1077 | |||
1063 | initUtcTime = None #Initial UTC time |
|
1078 | # initUtcTime = None #Initial UTC time | |
1064 |
|
1079 | |||
1065 | paramInterval = None #Time interval to calculate Parameters in seconds |
|
1080 | paramInterval = None #Time interval to calculate Parameters in seconds | |
1066 |
|
1081 | |||
@@ -1078,8 +1093,6 class Parameters(JROData): | |||||
1078 |
|
1093 | |||
1079 | data_output = None #Out signal |
|
1094 | data_output = None #Out signal | |
1080 |
|
1095 | |||
1081 |
|
||||
1082 |
|
||||
1083 | def __init__(self): |
|
1096 | def __init__(self): | |
1084 | ''' |
|
1097 | ''' | |
1085 | Constructor |
|
1098 | Constructor | |
@@ -1089,13 +1102,13 class Parameters(JROData): | |||||
1089 | self.systemHeaderObj = SystemHeader() |
|
1102 | self.systemHeaderObj = SystemHeader() | |
1090 |
|
1103 | |||
1091 | self.type = "Parameters" |
|
1104 | self.type = "Parameters" | |
1092 |
|
|
1105 | ||
1093 | def getTimeRange1(self): |
|
1106 | def getTimeRange1(self): | |
1094 |
|
1107 | |||
1095 | datatime = [] |
|
1108 | datatime = [] | |
1096 |
|
1109 | |||
1097 |
datatime.append(self. |
|
1110 | datatime.append(self.ltctime) | |
1098 |
datatime.append(self. |
|
1111 | datatime.append(self.ltctime + self.outputInterval - 1) | |
1099 |
|
1112 | |||
1100 | datatime = numpy.array(datatime) |
|
1113 | datatime = numpy.array(datatime) | |
1101 |
|
1114 |
@@ -102,42 +102,6 class Figure(Operation): | |||||
102 | xmax_sec = time.mktime(maxdt.timetuple()) |
|
102 | xmax_sec = time.mktime(maxdt.timetuple()) | |
103 |
|
103 | |||
104 | return xmin_sec, xmax_sec |
|
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 | def init(self, id, nplots, wintitle): |
|
106 | def init(self, id, nplots, wintitle): | |
143 |
|
107 | |||
@@ -284,9 +248,9 class Figure(Operation): | |||||
284 |
|
248 | |||
285 | raise ValueError, "This method is not implemented" |
|
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 | axesList = property(getAxesObjList) |
|
255 | axesList = property(getAxesObjList) | |
292 |
|
256 |
@@ -294,11 +294,12 class CrossSpectraPlot(Figure): | |||||
294 | raise ValueError, "Pair %s is not in dataOut.pairsList" %str(pair) |
|
294 | raise ValueError, "Pair %s is not in dataOut.pairsList" %str(pair) | |
295 | pairsIndexList.append(dataOut.pairsList.index(pair)) |
|
295 | pairsIndexList.append(dataOut.pairsList.index(pair)) | |
296 |
|
296 | |||
297 |
if pairsIndexList |
|
297 | if not pairsIndexList: | |
298 | return |
|
298 | return | |
299 |
|
299 | |||
300 | if len(pairsIndexList) > 4: |
|
300 | if len(pairsIndexList) > 4: | |
301 | pairsIndexList = pairsIndexList[0:4] |
|
301 | pairsIndexList = pairsIndexList[0:4] | |
|
302 | ||||
302 | factor = dataOut.normFactor |
|
303 | factor = dataOut.normFactor | |
303 | x = dataOut.getVelRange(1) |
|
304 | x = dataOut.getVelRange(1) | |
304 | y = dataOut.getHeiRange() |
|
305 | y = dataOut.getHeiRange() |
@@ -30,13 +30,23 def createFigure(id, wintitle, width, height, facecolor="w", show=True): | |||||
30 |
|
30 | |||
31 | return fig |
|
31 | return fig | |
32 |
|
32 | |||
33 | def closeFigure(show=False): |
|
33 | def closeFigure(show=False, fig=None): | |
34 |
|
34 | |||
35 | matplotlib.pyplot.ioff() |
|
35 | matplotlib.pyplot.ioff() | |
|
36 | matplotlib.pyplot.pause(0.1) | |||
|
37 | ||||
36 | if show: |
|
38 | if show: | |
37 | matplotlib.pyplot.show() |
|
39 | matplotlib.pyplot.show() | |
38 |
|
|
40 | ||
39 | matplotlib.pyplot.close() |
|
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 | return |
|
50 | return | |
41 |
|
51 | |||
42 | def saveFigure(fig, filename): |
|
52 | def saveFigure(fig, filename): | |
@@ -420,6 +430,6 def polar(iplot, x, y, xlabel='', ylabel='', title=''): | |||||
420 | def draw(fig): |
|
430 | def draw(fig): | |
421 |
|
431 | |||
422 | if type(fig) == 'int': |
|
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 | fig.canvas.draw() |
|
435 | fig.canvas.draw() |
@@ -15,6 +15,11 import numpy | |||||
15 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation |
|
15 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation | |
16 | from schainpy.model.data.jroamisr import AMISR |
|
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 | class RadacHeader(): |
|
23 | class RadacHeader(): | |
19 | def __init__(self, fp): |
|
24 | def __init__(self, fp): | |
20 | header = 'Raw11/Data/RadacHeader' |
|
25 | header = 'Raw11/Data/RadacHeader' | |
@@ -337,7 +342,7 class AMISRReader(ProcessingUnit): | |||||
337 | filename = self.filenameList[0] |
|
342 | filename = self.filenameList[0] | |
338 | while self.__filename_online == filename: |
|
343 | while self.__filename_online == filename: | |
339 | print 'waiting %d seconds to get a new file...'%(self.__waitForNewFile) |
|
344 | print 'waiting %d seconds to get a new file...'%(self.__waitForNewFile) | |
340 |
|
|
345 | sleep(self.__waitForNewFile) | |
341 | self.__selectDataForTimes(online=True) |
|
346 | self.__selectDataForTimes(online=True) | |
342 | filename = self.filenameList[0] |
|
347 | filename = self.filenameList[0] | |
343 |
|
348 |
@@ -384,6 +384,21 class FitsReader(ProcessingUnit): | |||||
384 |
|
384 | |||
385 | return 1 |
|
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 | def readHeader(self): |
|
402 | def readHeader(self): | |
388 | headerObj = self.fitsObj[0] |
|
403 | headerObj = self.fitsObj[0] | |
389 |
|
404 | |||
@@ -438,7 +453,7 class FitsReader(ProcessingUnit): | |||||
438 | return 0 |
|
453 | return 0 | |
439 |
|
454 | |||
440 | self.readHeader() |
|
455 | self.readHeader() | |
441 |
|
456 | self.__setValuesFromHeader() | ||
442 | self.nReadBlocks = 0 |
|
457 | self.nReadBlocks = 0 | |
443 | # self.blockIndex = 1 |
|
458 | # self.blockIndex = 1 | |
444 | return 1 |
|
459 | return 1 | |
@@ -695,15 +710,15 class FitsReader(ProcessingUnit): | |||||
695 | self.dataOut.data_header = self.data_header_dict |
|
710 | self.dataOut.data_header = self.data_header_dict | |
696 | self.dataOut.utctime = self.utc |
|
711 | self.dataOut.utctime = self.utc | |
697 |
|
712 | |||
698 | self.dataOut.header = self.header_dict |
|
713 | # self.dataOut.header = self.header_dict | |
699 | self.dataOut.expName = self.expName |
|
714 | # self.dataOut.expName = self.expName | |
700 | self.dataOut.nChannels = self.nChannels |
|
715 | # self.dataOut.nChannels = self.nChannels | |
701 | self.dataOut.timeZone = self.timeZone |
|
716 | # self.dataOut.timeZone = self.timeZone | |
702 | self.dataOut.dataBlocksPerFile = self.dataBlocksPerFile |
|
717 | # self.dataOut.dataBlocksPerFile = self.dataBlocksPerFile | |
703 | self.dataOut.comments = self.comments |
|
718 | # self.dataOut.comments = self.comments | |
704 | self.dataOut.timeInterval = self.timeInterval |
|
719 | # # self.dataOut.timeInterval = self.timeInterval | |
705 | self.dataOut.channelList = self.channelList |
|
720 | # self.dataOut.channelList = self.channelList | |
706 | self.dataOut.heightList = self.heightList |
|
721 | # self.dataOut.heightList = self.heightList | |
707 | self.dataOut.flagNoData = False |
|
722 | self.dataOut.flagNoData = False | |
708 |
|
723 | |||
709 | return self.dataOut.data |
|
724 | return self.dataOut.data |
@@ -16,6 +16,10 from model.data.jroheaderIO import RadarControllerHeader, SystemHeader | |||||
16 | from model.data.jrodata import Voltage |
|
16 | from model.data.jrodata import Voltage | |
17 | from model.proc.jroproc_base import ProcessingUnit, Operation |
|
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 | def isNumber(str): |
|
24 | def isNumber(str): | |
21 | """ |
|
25 | """ | |
@@ -506,7 +510,7 class HFReader(ProcessingUnit): | |||||
506 | filename = self.filenameList[0] |
|
510 | filename = self.filenameList[0] | |
507 | while self.filename_online == filename: |
|
511 | while self.filename_online == filename: | |
508 | print 'waiting %d seconds to get a new file...'%(self.__waitForNewFile) |
|
512 | print 'waiting %d seconds to get a new file...'%(self.__waitForNewFile) | |
509 |
|
|
513 | sleep(self.__waitForNewFile) | |
510 | #self.__findDataForDates(online=True) |
|
514 | #self.__findDataForDates(online=True) | |
511 | self.__selectDataForTimes(online=True) |
|
515 | self.__selectDataForTimes(online=True) | |
512 | filename = self.filenameList[0] |
|
516 | filename = self.filenameList[0] | |
@@ -518,12 +522,12 class HFReader(ProcessingUnit): | |||||
518 | print "%s is not the rigth size"%filename |
|
522 | print "%s is not the rigth size"%filename | |
519 | delay=2 |
|
523 | delay=2 | |
520 | print 'waiting %d seconds for delay...'%(delay) |
|
524 | print 'waiting %d seconds for delay...'%(delay) | |
521 |
|
|
525 | sleep(delay) | |
522 | sizeoffile=os.path.getsize(filename) |
|
526 | sizeoffile=os.path.getsize(filename) | |
523 | if sizeoffile<1670240: |
|
527 | if sizeoffile<1670240: | |
524 | delay |
|
528 | delay | |
525 | print 'waiting %d more seconds for delay...'%(delay) |
|
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 | self.profIndex = 0 |
|
15 | self.profIndex = 0 | |
16 | self.dataOut = Correlation() |
|
16 | self.dataOut = Correlation() | |
17 |
|
17 | |||
18 |
def __updateObjFrom |
|
18 | def __updateObjFromVoltage(self): | |
19 |
|
19 | |||
20 | self.dataOut.timeZone = self.dataIn.timeZone |
|
20 | self.dataOut.timeZone = self.dataIn.timeZone | |
21 | self.dataOut.dstFlag = self.dataIn.dstFlag |
|
21 | self.dataOut.dstFlag = self.dataIn.dstFlag | |
@@ -42,7 +42,7 class CorrelationProc(ProcessingUnit): | |||||
42 | self.dataOut.ippSeconds = self.dataIn.ippSeconds |
|
42 | self.dataOut.ippSeconds = self.dataIn.ippSeconds | |
43 | # self.dataOut.windowOfFilter = self.dataIn.windowOfFilter |
|
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 | def removeDC(self, jspectra): |
|
48 | def removeDC(self, jspectra): | |
@@ -189,7 +189,7 class CorrelationProc(ProcessingUnit): | |||||
189 | self.buffer = self.removeDC(self.buffer) |
|
189 | self.buffer = self.removeDC(self.buffer) | |
190 | #--------------------------------------------- |
|
190 | #--------------------------------------------- | |
191 | self.dataOut.data_volts = self.buffer |
|
191 | self.dataOut.data_volts = self.buffer | |
192 |
self.__updateObjFrom |
|
192 | self.__updateObjFromVoltage() | |
193 | self.dataOut.data_corr = numpy.zeros((len(pairsList), |
|
193 | self.dataOut.data_corr = numpy.zeros((len(pairsList), | |
194 | len(lagT),len(lagR), |
|
194 | len(lagT),len(lagR), | |
195 | self.dataIn.nHeights), |
|
195 | self.dataIn.nHeights), |
@@ -14,7 +14,7 class SpectraHeisProc(ProcessingUnit): | |||||
14 | # self.profIndex = 0 |
|
14 | # self.profIndex = 0 | |
15 | self.dataOut = SpectraHeis() |
|
15 | self.dataOut = SpectraHeis() | |
16 |
|
16 | |||
17 |
def __updateObjFrom |
|
17 | def __updateObjFromVoltage(self): | |
18 |
|
18 | |||
19 | self.dataOut.timeZone = self.dataIn.timeZone |
|
19 | self.dataOut.timeZone = self.dataIn.timeZone | |
20 | self.dataOut.dstFlag = self.dataIn.dstFlag |
|
20 | self.dataOut.dstFlag = self.dataIn.dstFlag | |
@@ -48,19 +48,23 class SpectraHeisProc(ProcessingUnit): | |||||
48 | # self.dataOut.ippSeconds= self.dataIn.ippSeconds |
|
48 | # self.dataOut.ippSeconds= self.dataIn.ippSeconds | |
49 | self.dataOut.windowOfFilter = self.dataIn.windowOfFilter |
|
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 | # self.dataOut.set=self.dataIn.set |
|
52 | # self.dataOut.set=self.dataIn.set | |
53 | # self.dataOut.deltaHeight=self.dataIn.deltaHeight |
|
53 | # self.dataOut.deltaHeight=self.dataIn.deltaHeight | |
54 |
|
54 | |||
55 |
|
55 | |||
56 | def __updateObjFromFits(self): |
|
56 | def __updateObjFromFits(self): | |
|
57 | ||||
57 | self.dataOut.utctime = self.dataIn.utctime |
|
58 | self.dataOut.utctime = self.dataIn.utctime | |
58 | self.dataOut.channelIndexList = self.dataIn.channelIndexList |
|
59 | self.dataOut.channelIndexList = self.dataIn.channelIndexList | |
59 |
|
60 | |||
60 | self.dataOut.channelList = self.dataIn.channelList |
|
61 | self.dataOut.channelList = self.dataIn.channelList | |
61 | self.dataOut.heightList = self.dataIn.heightList |
|
62 | self.dataOut.heightList = self.dataIn.heightList | |
62 | self.dataOut.data_spc = self.dataIn.data |
|
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 | self.dataOut.timeZone = self.dataIn.timeZone |
|
68 | self.dataOut.timeZone = self.dataIn.timeZone | |
65 | self.dataOut.useLocalTime = True |
|
69 | self.dataOut.useLocalTime = True | |
66 | # self.dataOut. |
|
70 | # self.dataOut. | |
@@ -87,7 +91,7 class SpectraHeisProc(ProcessingUnit): | |||||
87 | return |
|
91 | return | |
88 |
|
92 | |||
89 | if self.dataIn.type == "Voltage": |
|
93 | if self.dataIn.type == "Voltage": | |
90 |
self.__updateObjFrom |
|
94 | self.__updateObjFromVoltage() | |
91 | self.__getFft() |
|
95 | self.__getFft() | |
92 | self.dataOut.flagNoData = False |
|
96 | self.dataOut.flagNoData = False | |
93 |
|
97 |
@@ -1327,6 +1327,7 class WindProfiler(Operation): | |||||
1327 | return A1 |
|
1327 | return A1 | |
1328 |
|
1328 | |||
1329 | def __correctValues(self, heiRang, phi, velRadial, SNR): |
|
1329 | def __correctValues(self, heiRang, phi, velRadial, SNR): | |
|
1330 | ||||
1330 | listPhi = phi.tolist() |
|
1331 | listPhi = phi.tolist() | |
1331 | maxid = listPhi.index(max(listPhi)) |
|
1332 | maxid = listPhi.index(max(listPhi)) | |
1332 | minid = listPhi.index(min(listPhi)) |
|
1333 | minid = listPhi.index(min(listPhi)) | |
@@ -1615,14 +1616,19 class WindProfiler(Operation): | |||||
1615 | else: correctFactor = 1 |
|
1616 | else: correctFactor = 1 | |
1616 | if kwargs.has_key('channelList'): |
|
1617 | if kwargs.has_key('channelList'): | |
1617 | channelList = kwargs['channelList'] |
|
1618 | channelList = kwargs['channelList'] | |
1618 | if len(channelList) == 2: |
|
|||
1619 | horizontalOnly = True |
|
|||
1620 | arrayChannel = numpy.array(channelList) |
|
1619 | arrayChannel = numpy.array(channelList) | |
1621 | param = param[arrayChannel,:,:] |
|
1620 | param = param[arrayChannel,:,:] | |
1622 | theta_x = theta_x[arrayChannel] |
|
1621 | theta_x = theta_x[arrayChannel] | |
1623 | theta_y = theta_y[arrayChannel] |
|
1622 | theta_y = theta_y[arrayChannel] | |
1624 |
|
1623 | |||
1625 | velRadial0 = param[:,1,:] #Radial velocity |
|
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 | dataOut.data_output, dataOut.heightList, dataOut.data_SNR = self.techniqueDBS(velRadial0, theta_x, theta_y, azimuth, correctFactor, horizontalOnly, heightList, SNR) #DBS Function |
|
1632 | dataOut.data_output, dataOut.heightList, dataOut.data_SNR = self.techniqueDBS(velRadial0, theta_x, theta_y, azimuth, correctFactor, horizontalOnly, heightList, SNR) #DBS Function | |
1627 | dataOut.utctimeInit = dataOut.utctime |
|
1633 | dataOut.utctimeInit = dataOut.utctime | |
1628 | dataOut.outputInterval = dataOut.timeInterval |
|
1634 | dataOut.outputInterval = dataOut.timeInterval |
@@ -90,6 +90,11 class SpectraProc(ProcessingUnit): | |||||
90 | #calculo de cross-spectra |
|
90 | #calculo de cross-spectra | |
91 | cspc = numpy.zeros((self.dataOut.nPairs, self.dataOut.nFFTPoints, self.dataOut.nHeights), dtype='complex') |
|
91 | cspc = numpy.zeros((self.dataOut.nPairs, self.dataOut.nFFTPoints, self.dataOut.nHeights), dtype='complex') | |
92 | for pair in self.dataOut.pairsList: |
|
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 | cspc[pairIndex,:,:] = fft_volt[pair[0],:,:] * numpy.conjugate(fft_volt[pair[1],:,:]) |
|
98 | cspc[pairIndex,:,:] = fft_volt[pair[0],:,:] * numpy.conjugate(fft_volt[pair[1],:,:]) | |
94 | pairIndex += 1 |
|
99 | pairIndex += 1 | |
95 | blocksize += cspc.size |
|
100 | blocksize += cspc.size | |
@@ -166,7 +171,33 class SpectraProc(ProcessingUnit): | |||||
166 |
|
171 | |||
167 | return True |
|
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 | def selectChannels(self, channelList): |
|
202 | def selectChannels(self, channelList): | |
172 |
|
203 | |||
@@ -174,7 +205,8 class SpectraProc(ProcessingUnit): | |||||
174 |
|
205 | |||
175 | for channel in channelList: |
|
206 | for channel in channelList: | |
176 | if channel not in self.dataOut.channelList: |
|
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 | index = self.dataOut.channelList.index(channel) |
|
210 | index = self.dataOut.channelList.index(channel) | |
179 | channelIndexList.append(index) |
|
211 | channelIndexList.append(index) | |
180 |
|
212 | |||
@@ -198,17 +230,21 class SpectraProc(ProcessingUnit): | |||||
198 |
|
230 | |||
199 | for channelIndex in channelIndexList: |
|
231 | for channelIndex in channelIndexList: | |
200 | if channelIndex not in self.dataOut.channelIndexList: |
|
232 | if channelIndex not in self.dataOut.channelIndexList: | |
201 | print channelIndexList |
|
233 | raise ValueError, "Error selecting channels: The value %d in channelIndexList is not valid.\nAvailable channel indexes = " %(channelIndex, self.dataOut.channelIndexList) | |
202 | raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex |
|
|||
203 |
|
234 | |||
204 | # nChannels = len(channelIndexList) |
|
235 | # nChannels = len(channelIndexList) | |
205 |
|
236 | |||
206 | data_spc = self.dataOut.data_spc[channelIndexList,:] |
|
237 | data_spc = self.dataOut.data_spc[channelIndexList,:] | |
|
238 | data_dc = self.dataOut.data_dc[channelIndexList,:] | |||
207 |
|
239 | |||
208 | self.dataOut.data_spc = data_spc |
|
240 | self.dataOut.data_spc = data_spc | |
|
241 | self.dataOut.data_dc = data_dc | |||
|
242 | ||||
209 | self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] |
|
243 | self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] | |
210 | # self.dataOut.nChannels = nChannels |
|
244 | # self.dataOut.nChannels = nChannels | |
211 |
|
245 | |||
|
246 | self.__selectPairs(self.dataOut.channelList) | |||
|
247 | ||||
212 | return 1 |
|
248 | return 1 | |
213 |
|
249 | |||
214 | def selectHeights(self, minHei, maxHei): |
|
250 | def selectHeights(self, minHei, maxHei): | |
@@ -226,8 +262,12 class SpectraProc(ProcessingUnit): | |||||
226 | Return: |
|
262 | Return: | |
227 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 |
|
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): |
|
265 | ||
230 | raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) |
|
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 | if (maxHei > self.dataOut.heightList[-1]): |
|
272 | if (maxHei > self.dataOut.heightList[-1]): | |
233 | maxHei = self.dataOut.heightList[-1] |
|
273 | maxHei = self.dataOut.heightList[-1] | |
@@ -314,7 +354,7 class SpectraProc(ProcessingUnit): | |||||
314 | """ |
|
354 | """ | |
315 |
|
355 | |||
316 | if (minIndex < 0) or (minIndex > maxIndex): |
|
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 | if (maxIndex >= self.dataOut.nHeights): |
|
359 | if (maxIndex >= self.dataOut.nHeights): | |
320 | maxIndex = self.dataOut.nHeights-1 |
|
360 | maxIndex = self.dataOut.nHeights-1 |
@@ -34,7 +34,7 class VoltageProc(ProcessingUnit): | |||||
34 | self.dataOut.data = self.dataIn.data |
|
34 | self.dataOut.data = self.dataIn.data | |
35 | self.dataOut.utctime = self.dataIn.utctime |
|
35 | self.dataOut.utctime = self.dataIn.utctime | |
36 | self.dataOut.channelList = self.dataIn.channelList |
|
36 | self.dataOut.channelList = self.dataIn.channelList | |
37 | self.dataOut.timeInterval = self.dataIn.timeInterval |
|
37 | # self.dataOut.timeInterval = self.dataIn.timeInterval | |
38 | self.dataOut.heightList = self.dataIn.heightList |
|
38 | self.dataOut.heightList = self.dataIn.heightList | |
39 | self.dataOut.nProfiles = self.dataIn.nProfiles |
|
39 | self.dataOut.nProfiles = self.dataIn.nProfiles | |
40 |
|
40 | |||
@@ -68,7 +68,7 class VoltageProc(ProcessingUnit): | |||||
68 |
|
68 | |||
69 | for channel in channelList: |
|
69 | for channel in channelList: | |
70 | if channel not in self.dataOut.channelList: |
|
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 | index = self.dataOut.channelList.index(channel) |
|
73 | index = self.dataOut.channelList.index(channel) | |
74 | channelIndexList.append(index) |
|
74 | channelIndexList.append(index) | |
@@ -255,7 +255,7 class VoltageProc(ProcessingUnit): | |||||
255 | flip = self.flip |
|
255 | flip = self.flip | |
256 | profileList = range(self.dataOut.nProfiles) |
|
256 | profileList = range(self.dataOut.nProfiles) | |
257 |
|
257 | |||
258 |
if channelList |
|
258 | if not channelList: | |
259 | for thisProfile in profileList: |
|
259 | for thisProfile in profileList: | |
260 | data[:,thisProfile,:] = data[:,thisProfile,:]*flip |
|
260 | data[:,thisProfile,:] = data[:,thisProfile,:]*flip | |
261 | flip *= -1.0 |
|
261 | flip *= -1.0 | |
@@ -271,7 +271,7 class VoltageProc(ProcessingUnit): | |||||
271 | self.flip = flip |
|
271 | self.flip = flip | |
272 |
|
272 | |||
273 | else: |
|
273 | else: | |
274 |
if channelList |
|
274 | if not channelList: | |
275 | data[:,:] = data[:,:]*self.flip |
|
275 | data[:,:] = data[:,:]*self.flip | |
276 | else: |
|
276 | else: | |
277 | for thisChannel in channelList: |
|
277 | for thisChannel in channelList: |
General Comments 0
You need to be logged in to leave comments.
Login now