@@ -1,8 +1,15 | |||||
1 | VERSIONS: |
|
1 | VERSIONS: | |
2 |
|
2 | |||
3 | 2.1.2: |
|
3 | 2.1.2: | |
4 | -jroutils_ftp.py: Bug fixed, Any error sending file stopped the Server Thread |
|
4 | -jroutils_ftp.py: Bug fixed, Any error sending file stopped the Server Thread | |
5 | Server thread opens and closes remote server each time file list is sent |
|
5 | Server thread opens and closes remote server each time file list is sent | |
6 | -jroplot_spectra.py: Noise path was not being created saving noise data. |
|
6 | -jroplot_spectra.py: Noise path was not being created saving noise data. | |
7 | -jroIO_base.py: startTime can be greater than endTime |
|
7 | -jroIO_base.py: startTime can be greater than endTime | |
8 | -jroplot_heispectra.py: SpectraHeisScope was not showing the right channel |
|
8 | ||
|
9 | 2.1.3: | |||
|
10 | -jroplot_heispectra.py: SpectraHeisScope was not showing the right channels | |||
|
11 | -jroproc_voltage.py: Bug fixed selecting profiles (self.nProfiles took a wrong value), | |||
|
12 | Bug fixed selecting heights by block (selecting profiles instead heights) | |||
|
13 | -jroproc_voltage.py: New feature added: decoding data by block using FFT. | |||
|
14 | -jroIO_heispectra.py: Bug fixed in FitsReader. Using local Fits object instead schainpy.mode.data.jrodata.Fits object. | |||
|
15 | -jroIO_heispectra.py: Channel index list does not exist. No newline at end of file |
@@ -1,7 +1,7 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author $Author$ |
|
4 | @author $Author$ | |
5 | @version $Id$ |
|
5 | @version $Id$ | |
6 | ''' |
|
6 | ''' | |
7 |
__version__ = "2.1. |
|
7 | __version__ = "2.1.3" No newline at end of file |
@@ -1,1097 +1,1096 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on September , 2012 |
|
2 | Created on September , 2012 | |
3 | @author: |
|
3 | @author: | |
4 | ''' |
|
4 | ''' | |
5 | from xml.etree.ElementTree import Element, SubElement |
|
5 | from xml.etree.ElementTree import ElementTree, Element, SubElement, tostring | |
6 | from xml.etree import ElementTree as ET |
|
|||
7 | from xml.dom import minidom |
|
6 | from xml.dom import minidom | |
8 |
|
7 | |||
9 | from model import * |
|
8 | from model import * | |
10 |
|
9 | |||
11 | try: |
|
10 | try: | |
12 | from gevent import sleep |
|
11 | from gevent import sleep | |
13 | except: |
|
12 | except: | |
14 | from time import sleep |
|
13 | from time import sleep | |
15 |
|
14 | |||
16 | import ast |
|
15 | import ast | |
17 |
|
16 | |||
18 | def prettify(elem): |
|
17 | def prettify(elem): | |
19 | """Return a pretty-printed XML string for the Element. |
|
18 | """Return a pretty-printed XML string for the Element. | |
20 | """ |
|
19 | """ | |
21 |
rough_string = |
|
20 | rough_string = tostring(elem, 'utf-8') | |
22 | reparsed = minidom.parseString(rough_string) |
|
21 | reparsed = minidom.parseString(rough_string) | |
23 | return reparsed.toprettyxml(indent=" ") |
|
22 | return reparsed.toprettyxml(indent=" ") | |
24 |
|
23 | |||
25 | class ParameterConf(): |
|
24 | class ParameterConf(): | |
26 |
|
25 | |||
27 | id = None |
|
26 | id = None | |
28 | name = None |
|
27 | name = None | |
29 | value = None |
|
28 | value = None | |
30 | format = None |
|
29 | format = None | |
31 |
|
30 | |||
32 | __formated_value = None |
|
31 | __formated_value = None | |
33 |
|
32 | |||
34 | ELEMENTNAME = 'Parameter' |
|
33 | ELEMENTNAME = 'Parameter' | |
35 |
|
34 | |||
36 | def __init__(self): |
|
35 | def __init__(self): | |
37 |
|
36 | |||
38 | self.format = 'str' |
|
37 | self.format = 'str' | |
39 |
|
38 | |||
40 | def getElementName(self): |
|
39 | def getElementName(self): | |
41 |
|
40 | |||
42 | return self.ELEMENTNAME |
|
41 | return self.ELEMENTNAME | |
43 |
|
42 | |||
44 | def getValue(self): |
|
43 | def getValue(self): | |
45 |
|
44 | |||
46 | value = self.value |
|
45 | value = self.value | |
47 | format = self.format |
|
46 | format = self.format | |
48 |
|
47 | |||
49 | if self.__formated_value != None: |
|
48 | if self.__formated_value != None: | |
50 |
|
49 | |||
51 | return self.__formated_value |
|
50 | return self.__formated_value | |
52 |
|
51 | |||
53 | if format == 'str': |
|
52 | if format == 'str': | |
54 | self.__formated_value = str(value) |
|
53 | self.__formated_value = str(value) | |
55 | return self.__formated_value |
|
54 | return self.__formated_value | |
56 |
|
55 | |||
57 | if value == '': |
|
56 | if value == '': | |
58 | raise ValueError, "%s: This parameter value is empty" %self.name |
|
57 | raise ValueError, "%s: This parameter value is empty" %self.name | |
59 |
|
58 | |||
60 | if format == 'bool': |
|
59 | if format == 'bool': | |
61 | value = int(value) |
|
60 | value = int(value) | |
62 |
|
61 | |||
63 | if format == 'list': |
|
62 | if format == 'list': | |
64 | strList = value.split(',') |
|
63 | strList = value.split(',') | |
65 |
|
64 | |||
66 | self.__formated_value = strList |
|
65 | self.__formated_value = strList | |
67 |
|
66 | |||
68 | return self.__formated_value |
|
67 | return self.__formated_value | |
69 |
|
68 | |||
70 | if format == 'intlist': |
|
69 | if format == 'intlist': | |
71 | """ |
|
70 | """ | |
72 | Example: |
|
71 | Example: | |
73 | value = (0,1,2) |
|
72 | value = (0,1,2) | |
74 | """ |
|
73 | """ | |
75 | value = value.replace('(', '') |
|
74 | value = value.replace('(', '') | |
76 | value = value.replace(')', '') |
|
75 | value = value.replace(')', '') | |
77 |
|
76 | |||
78 | value = value.replace('[', '') |
|
77 | value = value.replace('[', '') | |
79 | value = value.replace(']', '') |
|
78 | value = value.replace(']', '') | |
80 |
|
79 | |||
81 | strList = value.split(',') |
|
80 | strList = value.split(',') | |
82 | intList = [int(float(x)) for x in strList] |
|
81 | intList = [int(float(x)) for x in strList] | |
83 |
|
82 | |||
84 | self.__formated_value = intList |
|
83 | self.__formated_value = intList | |
85 |
|
84 | |||
86 | return self.__formated_value |
|
85 | return self.__formated_value | |
87 |
|
86 | |||
88 | if format == 'floatlist': |
|
87 | if format == 'floatlist': | |
89 | """ |
|
88 | """ | |
90 | Example: |
|
89 | Example: | |
91 | value = (0.5, 1.4, 2.7) |
|
90 | value = (0.5, 1.4, 2.7) | |
92 | """ |
|
91 | """ | |
93 |
|
92 | |||
94 | value = value.replace('(', '') |
|
93 | value = value.replace('(', '') | |
95 | value = value.replace(')', '') |
|
94 | value = value.replace(')', '') | |
96 |
|
95 | |||
97 | value = value.replace('[', '') |
|
96 | value = value.replace('[', '') | |
98 | value = value.replace(']', '') |
|
97 | value = value.replace(']', '') | |
99 |
|
98 | |||
100 | strList = value.split(',') |
|
99 | strList = value.split(',') | |
101 | floatList = [float(x) for x in strList] |
|
100 | floatList = [float(x) for x in strList] | |
102 |
|
101 | |||
103 | self.__formated_value = floatList |
|
102 | self.__formated_value = floatList | |
104 |
|
103 | |||
105 | return self.__formated_value |
|
104 | return self.__formated_value | |
106 |
|
105 | |||
107 | if format == 'date': |
|
106 | if format == 'date': | |
108 | strList = value.split('/') |
|
107 | strList = value.split('/') | |
109 | intList = [int(x) for x in strList] |
|
108 | intList = [int(x) for x in strList] | |
110 | date = datetime.date(intList[0], intList[1], intList[2]) |
|
109 | date = datetime.date(intList[0], intList[1], intList[2]) | |
111 |
|
110 | |||
112 | self.__formated_value = date |
|
111 | self.__formated_value = date | |
113 |
|
112 | |||
114 | return self.__formated_value |
|
113 | return self.__formated_value | |
115 |
|
114 | |||
116 | if format == 'time': |
|
115 | if format == 'time': | |
117 | strList = value.split(':') |
|
116 | strList = value.split(':') | |
118 | intList = [int(x) for x in strList] |
|
117 | intList = [int(x) for x in strList] | |
119 | time = datetime.time(intList[0], intList[1], intList[2]) |
|
118 | time = datetime.time(intList[0], intList[1], intList[2]) | |
120 |
|
119 | |||
121 | self.__formated_value = time |
|
120 | self.__formated_value = time | |
122 |
|
121 | |||
123 | return self.__formated_value |
|
122 | return self.__formated_value | |
124 |
|
123 | |||
125 | if format == 'pairslist': |
|
124 | if format == 'pairslist': | |
126 | """ |
|
125 | """ | |
127 | Example: |
|
126 | Example: | |
128 | value = (0,1),(1,2) |
|
127 | value = (0,1),(1,2) | |
129 | """ |
|
128 | """ | |
130 |
|
129 | |||
131 | value = value.replace('(', '') |
|
130 | value = value.replace('(', '') | |
132 | value = value.replace(')', '') |
|
131 | value = value.replace(')', '') | |
133 |
|
132 | |||
134 | value = value.replace('[', '') |
|
133 | value = value.replace('[', '') | |
135 | value = value.replace(']', '') |
|
134 | value = value.replace(']', '') | |
136 |
|
135 | |||
137 | strList = value.split(',') |
|
136 | strList = value.split(',') | |
138 | intList = [int(item) for item in strList] |
|
137 | intList = [int(item) for item in strList] | |
139 | pairList = [] |
|
138 | pairList = [] | |
140 | for i in range(len(intList)/2): |
|
139 | for i in range(len(intList)/2): | |
141 | pairList.append((intList[i*2], intList[i*2 + 1])) |
|
140 | pairList.append((intList[i*2], intList[i*2 + 1])) | |
142 |
|
141 | |||
143 | self.__formated_value = pairList |
|
142 | self.__formated_value = pairList | |
144 |
|
143 | |||
145 | return self.__formated_value |
|
144 | return self.__formated_value | |
146 |
|
145 | |||
147 | if format == 'multilist': |
|
146 | if format == 'multilist': | |
148 | """ |
|
147 | """ | |
149 | Example: |
|
148 | Example: | |
150 | value = (0,1,2),(3,4,5) |
|
149 | value = (0,1,2),(3,4,5) | |
151 | """ |
|
150 | """ | |
152 | multiList = ast.literal_eval(value) |
|
151 | multiList = ast.literal_eval(value) | |
153 |
|
152 | |||
154 | if type(multiList[0]) == int: |
|
153 | if type(multiList[0]) == int: | |
155 | multiList = ast.literal_eval("(" + value + ")") |
|
154 | multiList = ast.literal_eval("(" + value + ")") | |
156 |
|
155 | |||
157 | self.__formated_value = multiList |
|
156 | self.__formated_value = multiList | |
158 |
|
157 | |||
159 | return self.__formated_value |
|
158 | return self.__formated_value | |
160 |
|
159 | |||
161 | format_func = eval(format) |
|
160 | format_func = eval(format) | |
162 |
|
161 | |||
163 | self.__formated_value = format_func(value) |
|
162 | self.__formated_value = format_func(value) | |
164 |
|
163 | |||
165 | return self.__formated_value |
|
164 | return self.__formated_value | |
166 |
|
165 | |||
167 | def updateId(self, new_id): |
|
166 | def updateId(self, new_id): | |
168 |
|
167 | |||
169 | self.id = str(new_id) |
|
168 | self.id = str(new_id) | |
170 |
|
169 | |||
171 | def setup(self, id, name, value, format='str'): |
|
170 | def setup(self, id, name, value, format='str'): | |
172 |
|
171 | |||
173 | self.id = str(id) |
|
172 | self.id = str(id) | |
174 | self.name = name |
|
173 | self.name = name | |
175 | self.value = str(value) |
|
174 | self.value = str(value) | |
176 | self.format = str.lower(format) |
|
175 | self.format = str.lower(format) | |
177 |
|
176 | |||
178 | try: |
|
177 | try: | |
179 | self.getValue() |
|
178 | self.getValue() | |
180 | except: |
|
179 | except: | |
181 | return 0 |
|
180 | return 0 | |
182 |
|
181 | |||
183 | return 1 |
|
182 | return 1 | |
184 |
|
183 | |||
185 | def update(self, name, value, format='str'): |
|
184 | def update(self, name, value, format='str'): | |
186 |
|
185 | |||
187 | self.name = name |
|
186 | self.name = name | |
188 | self.value = str(value) |
|
187 | self.value = str(value) | |
189 | self.format = format |
|
188 | self.format = format | |
190 |
|
189 | |||
191 | def makeXml(self, opElement): |
|
190 | def makeXml(self, opElement): | |
192 |
|
191 | |||
193 | parmElement = SubElement(opElement, self.ELEMENTNAME) |
|
192 | parmElement = SubElement(opElement, self.ELEMENTNAME) | |
194 | parmElement.set('id', str(self.id)) |
|
193 | parmElement.set('id', str(self.id)) | |
195 | parmElement.set('name', self.name) |
|
194 | parmElement.set('name', self.name) | |
196 | parmElement.set('value', self.value) |
|
195 | parmElement.set('value', self.value) | |
197 | parmElement.set('format', self.format) |
|
196 | parmElement.set('format', self.format) | |
198 |
|
197 | |||
199 | def readXml(self, parmElement): |
|
198 | def readXml(self, parmElement): | |
200 |
|
199 | |||
201 | self.id = parmElement.get('id') |
|
200 | self.id = parmElement.get('id') | |
202 | self.name = parmElement.get('name') |
|
201 | self.name = parmElement.get('name') | |
203 | self.value = parmElement.get('value') |
|
202 | self.value = parmElement.get('value') | |
204 | self.format = str.lower(parmElement.get('format')) |
|
203 | self.format = str.lower(parmElement.get('format')) | |
205 |
|
204 | |||
206 | #Compatible with old signal chain version |
|
205 | #Compatible with old signal chain version | |
207 | if self.format == 'int' and self.name == 'idfigure': |
|
206 | if self.format == 'int' and self.name == 'idfigure': | |
208 | self.name = 'id' |
|
207 | self.name = 'id' | |
209 |
|
208 | |||
210 | def printattr(self): |
|
209 | def printattr(self): | |
211 |
|
210 | |||
212 | print "Parameter[%s]: name = %s, value = %s, format = %s" %(self.id, self.name, self.value, self.format) |
|
211 | print "Parameter[%s]: name = %s, value = %s, format = %s" %(self.id, self.name, self.value, self.format) | |
213 |
|
212 | |||
214 | class OperationConf(): |
|
213 | class OperationConf(): | |
215 |
|
214 | |||
216 | id = None |
|
215 | id = None | |
217 | name = None |
|
216 | name = None | |
218 | priority = None |
|
217 | priority = None | |
219 | type = None |
|
218 | type = None | |
220 |
|
219 | |||
221 | parmConfObjList = [] |
|
220 | parmConfObjList = [] | |
222 |
|
221 | |||
223 | ELEMENTNAME = 'Operation' |
|
222 | ELEMENTNAME = 'Operation' | |
224 |
|
223 | |||
225 | def __init__(self): |
|
224 | def __init__(self): | |
226 |
|
225 | |||
227 | self.id = '0' |
|
226 | self.id = '0' | |
228 | self.name = None |
|
227 | self.name = None | |
229 | self.priority = None |
|
228 | self.priority = None | |
230 | self.type = 'self' |
|
229 | self.type = 'self' | |
231 |
|
230 | |||
232 |
|
231 | |||
233 | def __getNewId(self): |
|
232 | def __getNewId(self): | |
234 |
|
233 | |||
235 | return int(self.id)*10 + len(self.parmConfObjList) + 1 |
|
234 | return int(self.id)*10 + len(self.parmConfObjList) + 1 | |
236 |
|
235 | |||
237 | def updateId(self, new_id): |
|
236 | def updateId(self, new_id): | |
238 |
|
237 | |||
239 | self.id = str(new_id) |
|
238 | self.id = str(new_id) | |
240 |
|
239 | |||
241 | n = 1 |
|
240 | n = 1 | |
242 | for parmObj in self.parmConfObjList: |
|
241 | for parmObj in self.parmConfObjList: | |
243 |
|
242 | |||
244 | idParm = str(int(new_id)*10 + n) |
|
243 | idParm = str(int(new_id)*10 + n) | |
245 | parmObj.updateId(idParm) |
|
244 | parmObj.updateId(idParm) | |
246 |
|
245 | |||
247 | n += 1 |
|
246 | n += 1 | |
248 |
|
247 | |||
249 | def getElementName(self): |
|
248 | def getElementName(self): | |
250 |
|
249 | |||
251 | return self.ELEMENTNAME |
|
250 | return self.ELEMENTNAME | |
252 |
|
251 | |||
253 | def getParameterObjList(self): |
|
252 | def getParameterObjList(self): | |
254 |
|
253 | |||
255 | return self.parmConfObjList |
|
254 | return self.parmConfObjList | |
256 |
|
255 | |||
257 | def getParameterObj(self, parameterName): |
|
256 | def getParameterObj(self, parameterName): | |
258 |
|
257 | |||
259 | for parmConfObj in self.parmConfObjList: |
|
258 | for parmConfObj in self.parmConfObjList: | |
260 |
|
259 | |||
261 | if parmConfObj.name != parameterName: |
|
260 | if parmConfObj.name != parameterName: | |
262 | continue |
|
261 | continue | |
263 |
|
262 | |||
264 | return parmConfObj |
|
263 | return parmConfObj | |
265 |
|
264 | |||
266 | return None |
|
265 | return None | |
267 |
|
266 | |||
268 | def getParameterObjfromValue(self, parameterValue): |
|
267 | def getParameterObjfromValue(self, parameterValue): | |
269 |
|
268 | |||
270 | for parmConfObj in self.parmConfObjList: |
|
269 | for parmConfObj in self.parmConfObjList: | |
271 |
|
270 | |||
272 | if parmConfObj.getValue() != parameterValue: |
|
271 | if parmConfObj.getValue() != parameterValue: | |
273 | continue |
|
272 | continue | |
274 |
|
273 | |||
275 | return parmConfObj.getValue() |
|
274 | return parmConfObj.getValue() | |
276 |
|
275 | |||
277 | return None |
|
276 | return None | |
278 |
|
277 | |||
279 | def getParameterValue(self, parameterName): |
|
278 | def getParameterValue(self, parameterName): | |
280 |
|
279 | |||
281 | parameterObj = self.getParameterObj(parameterName) |
|
280 | parameterObj = self.getParameterObj(parameterName) | |
282 |
|
281 | |||
283 | # if not parameterObj: |
|
282 | # if not parameterObj: | |
284 | # return None |
|
283 | # return None | |
285 |
|
284 | |||
286 | value = parameterObj.getValue() |
|
285 | value = parameterObj.getValue() | |
287 |
|
286 | |||
288 | return value |
|
287 | return value | |
289 |
|
288 | |||
290 | def setup(self, id, name, priority, type): |
|
289 | def setup(self, id, name, priority, type): | |
291 |
|
290 | |||
292 | self.id = str(id) |
|
291 | self.id = str(id) | |
293 | self.name = name |
|
292 | self.name = name | |
294 | self.type = type |
|
293 | self.type = type | |
295 | self.priority = priority |
|
294 | self.priority = priority | |
296 |
|
295 | |||
297 | self.parmConfObjList = [] |
|
296 | self.parmConfObjList = [] | |
298 |
|
297 | |||
299 | def removeParameters(self): |
|
298 | def removeParameters(self): | |
300 |
|
299 | |||
301 | for obj in self.parmConfObjList: |
|
300 | for obj in self.parmConfObjList: | |
302 | del obj |
|
301 | del obj | |
303 |
|
302 | |||
304 | self.parmConfObjList = [] |
|
303 | self.parmConfObjList = [] | |
305 |
|
304 | |||
306 | def addParameter(self, name, value, format='str'): |
|
305 | def addParameter(self, name, value, format='str'): | |
307 |
|
306 | |||
308 | id = self.__getNewId() |
|
307 | id = self.__getNewId() | |
309 |
|
308 | |||
310 | parmConfObj = ParameterConf() |
|
309 | parmConfObj = ParameterConf() | |
311 | if not parmConfObj.setup(id, name, value, format): |
|
310 | if not parmConfObj.setup(id, name, value, format): | |
312 | return None |
|
311 | return None | |
313 |
|
312 | |||
314 | self.parmConfObjList.append(parmConfObj) |
|
313 | self.parmConfObjList.append(parmConfObj) | |
315 |
|
314 | |||
316 | return parmConfObj |
|
315 | return parmConfObj | |
317 |
|
316 | |||
318 | def changeParameter(self, name, value, format='str'): |
|
317 | def changeParameter(self, name, value, format='str'): | |
319 |
|
318 | |||
320 | parmConfObj = self.getParameterObj(name) |
|
319 | parmConfObj = self.getParameterObj(name) | |
321 | parmConfObj.update(name, value, format) |
|
320 | parmConfObj.update(name, value, format) | |
322 |
|
321 | |||
323 | return parmConfObj |
|
322 | return parmConfObj | |
324 |
|
323 | |||
325 | def makeXml(self, upElement): |
|
324 | def makeXml(self, upElement): | |
326 |
|
325 | |||
327 | opElement = SubElement(upElement, self.ELEMENTNAME) |
|
326 | opElement = SubElement(upElement, self.ELEMENTNAME) | |
328 | opElement.set('id', str(self.id)) |
|
327 | opElement.set('id', str(self.id)) | |
329 | opElement.set('name', self.name) |
|
328 | opElement.set('name', self.name) | |
330 | opElement.set('type', self.type) |
|
329 | opElement.set('type', self.type) | |
331 | opElement.set('priority', str(self.priority)) |
|
330 | opElement.set('priority', str(self.priority)) | |
332 |
|
331 | |||
333 | for parmConfObj in self.parmConfObjList: |
|
332 | for parmConfObj in self.parmConfObjList: | |
334 | parmConfObj.makeXml(opElement) |
|
333 | parmConfObj.makeXml(opElement) | |
335 |
|
334 | |||
336 | def readXml(self, opElement): |
|
335 | def readXml(self, opElement): | |
337 |
|
336 | |||
338 | self.id = opElement.get('id') |
|
337 | self.id = opElement.get('id') | |
339 | self.name = opElement.get('name') |
|
338 | self.name = opElement.get('name') | |
340 | self.type = opElement.get('type') |
|
339 | self.type = opElement.get('type') | |
341 | self.priority = opElement.get('priority') |
|
340 | self.priority = opElement.get('priority') | |
342 |
|
341 | |||
343 | #Compatible with old signal chain version |
|
342 | #Compatible with old signal chain version | |
344 | #Use of 'run' method instead 'init' |
|
343 | #Use of 'run' method instead 'init' | |
345 | if self.type == 'self' and self.name == 'init': |
|
344 | if self.type == 'self' and self.name == 'init': | |
346 | self.name = 'run' |
|
345 | self.name = 'run' | |
347 |
|
346 | |||
348 | self.parmConfObjList = [] |
|
347 | self.parmConfObjList = [] | |
349 |
|
348 | |||
350 | parmElementList = opElement.getiterator(ParameterConf().getElementName()) |
|
349 | parmElementList = opElement.getiterator(ParameterConf().getElementName()) | |
351 |
|
350 | |||
352 | for parmElement in parmElementList: |
|
351 | for parmElement in parmElementList: | |
353 | parmConfObj = ParameterConf() |
|
352 | parmConfObj = ParameterConf() | |
354 | parmConfObj.readXml(parmElement) |
|
353 | parmConfObj.readXml(parmElement) | |
355 |
|
354 | |||
356 | #Compatible with old signal chain version |
|
355 | #Compatible with old signal chain version | |
357 | #If an 'plot' OPERATION is found, changes name operation by the value of its type PARAMETER |
|
356 | #If an 'plot' OPERATION is found, changes name operation by the value of its type PARAMETER | |
358 | if self.type != 'self' and self.name == 'Plot': |
|
357 | if self.type != 'self' and self.name == 'Plot': | |
359 | if parmConfObj.format == 'str' and parmConfObj.name == 'type': |
|
358 | if parmConfObj.format == 'str' and parmConfObj.name == 'type': | |
360 | self.name = parmConfObj.value |
|
359 | self.name = parmConfObj.value | |
361 | continue |
|
360 | continue | |
362 |
|
361 | |||
363 | self.parmConfObjList.append(parmConfObj) |
|
362 | self.parmConfObjList.append(parmConfObj) | |
364 |
|
363 | |||
365 | def printattr(self): |
|
364 | def printattr(self): | |
366 |
|
365 | |||
367 | print "%s[%s]: name = %s, type = %s, priority = %s" %(self.ELEMENTNAME, |
|
366 | print "%s[%s]: name = %s, type = %s, priority = %s" %(self.ELEMENTNAME, | |
368 | self.id, |
|
367 | self.id, | |
369 | self.name, |
|
368 | self.name, | |
370 | self.type, |
|
369 | self.type, | |
371 | self.priority) |
|
370 | self.priority) | |
372 |
|
371 | |||
373 | for parmConfObj in self.parmConfObjList: |
|
372 | for parmConfObj in self.parmConfObjList: | |
374 | parmConfObj.printattr() |
|
373 | parmConfObj.printattr() | |
375 |
|
374 | |||
376 | def createObject(self): |
|
375 | def createObject(self): | |
377 |
|
376 | |||
378 | if self.type == 'self': |
|
377 | if self.type == 'self': | |
379 | raise ValueError, "This operation type cannot be created" |
|
378 | raise ValueError, "This operation type cannot be created" | |
380 |
|
379 | |||
381 | if self.type == 'external' or self.type == 'other': |
|
380 | if self.type == 'external' or self.type == 'other': | |
382 | className = eval(self.name) |
|
381 | className = eval(self.name) | |
383 | opObj = className() |
|
382 | opObj = className() | |
384 |
|
383 | |||
385 | return opObj |
|
384 | return opObj | |
386 |
|
385 | |||
387 | class ProcUnitConf(): |
|
386 | class ProcUnitConf(): | |
388 |
|
387 | |||
389 | id = None |
|
388 | id = None | |
390 | name = None |
|
389 | name = None | |
391 | datatype = None |
|
390 | datatype = None | |
392 | inputId = None |
|
391 | inputId = None | |
393 | parentId = None |
|
392 | parentId = None | |
394 |
|
393 | |||
395 | opConfObjList = [] |
|
394 | opConfObjList = [] | |
396 |
|
395 | |||
397 | procUnitObj = None |
|
396 | procUnitObj = None | |
398 | opObjList = [] |
|
397 | opObjList = [] | |
399 |
|
398 | |||
400 | ELEMENTNAME = 'ProcUnit' |
|
399 | ELEMENTNAME = 'ProcUnit' | |
401 |
|
400 | |||
402 | def __init__(self): |
|
401 | def __init__(self): | |
403 |
|
402 | |||
404 | self.id = None |
|
403 | self.id = None | |
405 | self.datatype = None |
|
404 | self.datatype = None | |
406 | self.name = None |
|
405 | self.name = None | |
407 | self.inputId = None |
|
406 | self.inputId = None | |
408 |
|
407 | |||
409 | self.opConfObjList = [] |
|
408 | self.opConfObjList = [] | |
410 |
|
409 | |||
411 | self.procUnitObj = None |
|
410 | self.procUnitObj = None | |
412 | self.opObjDict = {} |
|
411 | self.opObjDict = {} | |
413 |
|
412 | |||
414 | def __getPriority(self): |
|
413 | def __getPriority(self): | |
415 |
|
414 | |||
416 | return len(self.opConfObjList)+1 |
|
415 | return len(self.opConfObjList)+1 | |
417 |
|
416 | |||
418 | def __getNewId(self): |
|
417 | def __getNewId(self): | |
419 |
|
418 | |||
420 | return int(self.id)*10 + len(self.opConfObjList) + 1 |
|
419 | return int(self.id)*10 + len(self.opConfObjList) + 1 | |
421 |
|
420 | |||
422 | def getElementName(self): |
|
421 | def getElementName(self): | |
423 |
|
422 | |||
424 | return self.ELEMENTNAME |
|
423 | return self.ELEMENTNAME | |
425 |
|
424 | |||
426 | def getId(self): |
|
425 | def getId(self): | |
427 |
|
426 | |||
428 | return self.id |
|
427 | return self.id | |
429 |
|
428 | |||
430 | def updateId(self, new_id, parentId=parentId): |
|
429 | def updateId(self, new_id, parentId=parentId): | |
431 |
|
430 | |||
432 |
|
431 | |||
433 | new_id = int(parentId)*10 + (int(self.id) % 10) |
|
432 | new_id = int(parentId)*10 + (int(self.id) % 10) | |
434 | new_inputId = int(parentId)*10 + (int(self.inputId) % 10) |
|
433 | new_inputId = int(parentId)*10 + (int(self.inputId) % 10) | |
435 |
|
434 | |||
436 | #If this proc unit has not inputs |
|
435 | #If this proc unit has not inputs | |
437 | if self.inputId == '0': |
|
436 | if self.inputId == '0': | |
438 | new_inputId = 0 |
|
437 | new_inputId = 0 | |
439 |
|
438 | |||
440 | n = 1 |
|
439 | n = 1 | |
441 | for opConfObj in self.opConfObjList: |
|
440 | for opConfObj in self.opConfObjList: | |
442 |
|
441 | |||
443 | idOp = str(int(new_id)*10 + n) |
|
442 | idOp = str(int(new_id)*10 + n) | |
444 | opConfObj.updateId(idOp) |
|
443 | opConfObj.updateId(idOp) | |
445 |
|
444 | |||
446 | n += 1 |
|
445 | n += 1 | |
447 |
|
446 | |||
448 | self.parentId = str(parentId) |
|
447 | self.parentId = str(parentId) | |
449 | self.id = str(new_id) |
|
448 | self.id = str(new_id) | |
450 | self.inputId = str(new_inputId) |
|
449 | self.inputId = str(new_inputId) | |
451 |
|
450 | |||
452 |
|
451 | |||
453 | def getInputId(self): |
|
452 | def getInputId(self): | |
454 |
|
453 | |||
455 | return self.inputId |
|
454 | return self.inputId | |
456 |
|
455 | |||
457 | def getOperationObjList(self): |
|
456 | def getOperationObjList(self): | |
458 |
|
457 | |||
459 | return self.opConfObjList |
|
458 | return self.opConfObjList | |
460 |
|
459 | |||
461 | def getOperationObj(self, name=None): |
|
460 | def getOperationObj(self, name=None): | |
462 |
|
461 | |||
463 | for opConfObj in self.opConfObjList: |
|
462 | for opConfObj in self.opConfObjList: | |
464 |
|
463 | |||
465 | if opConfObj.name != name: |
|
464 | if opConfObj.name != name: | |
466 | continue |
|
465 | continue | |
467 |
|
466 | |||
468 | return opConfObj |
|
467 | return opConfObj | |
469 |
|
468 | |||
470 | return None |
|
469 | return None | |
471 |
|
470 | |||
472 | def getOpObjfromParamValue(self, value=None): |
|
471 | def getOpObjfromParamValue(self, value=None): | |
473 |
|
472 | |||
474 | for opConfObj in self.opConfObjList: |
|
473 | for opConfObj in self.opConfObjList: | |
475 | if opConfObj.getParameterObjfromValue(parameterValue=value) != value: |
|
474 | if opConfObj.getParameterObjfromValue(parameterValue=value) != value: | |
476 | continue |
|
475 | continue | |
477 | return opConfObj |
|
476 | return opConfObj | |
478 | return None |
|
477 | return None | |
479 |
|
478 | |||
480 | def getProcUnitObj(self): |
|
479 | def getProcUnitObj(self): | |
481 |
|
480 | |||
482 | return self.procUnitObj |
|
481 | return self.procUnitObj | |
483 |
|
482 | |||
484 | def setup(self, id, name, datatype, inputId, parentId=None): |
|
483 | def setup(self, id, name, datatype, inputId, parentId=None): | |
485 |
|
484 | |||
486 | #Compatible with old signal chain version |
|
485 | #Compatible with old signal chain version | |
487 | if datatype==None and name==None: |
|
486 | if datatype==None and name==None: | |
488 | raise ValueError, "datatype or name should be defined" |
|
487 | raise ValueError, "datatype or name should be defined" | |
489 |
|
488 | |||
490 | if name==None: |
|
489 | if name==None: | |
491 | if 'Proc' in datatype: |
|
490 | if 'Proc' in datatype: | |
492 | name = datatype |
|
491 | name = datatype | |
493 | else: |
|
492 | else: | |
494 | name = '%sProc' %(datatype) |
|
493 | name = '%sProc' %(datatype) | |
495 |
|
494 | |||
496 | if datatype==None: |
|
495 | if datatype==None: | |
497 | datatype = name.replace('Proc','') |
|
496 | datatype = name.replace('Proc','') | |
498 |
|
497 | |||
499 | self.id = str(id) |
|
498 | self.id = str(id) | |
500 | self.name = name |
|
499 | self.name = name | |
501 | self.datatype = datatype |
|
500 | self.datatype = datatype | |
502 | self.inputId = inputId |
|
501 | self.inputId = inputId | |
503 | self.parentId = parentId |
|
502 | self.parentId = parentId | |
504 |
|
503 | |||
505 | self.opConfObjList = [] |
|
504 | self.opConfObjList = [] | |
506 |
|
505 | |||
507 | self.addOperation(name='run', optype='self') |
|
506 | self.addOperation(name='run', optype='self') | |
508 |
|
507 | |||
509 | def removeOperations(self): |
|
508 | def removeOperations(self): | |
510 |
|
509 | |||
511 | for obj in self.opConfObjList: |
|
510 | for obj in self.opConfObjList: | |
512 | del obj |
|
511 | del obj | |
513 |
|
512 | |||
514 | self.opConfObjList = [] |
|
513 | self.opConfObjList = [] | |
515 | self.addOperation(name='run') |
|
514 | self.addOperation(name='run') | |
516 |
|
515 | |||
517 | def addParameter(self, **kwargs): |
|
516 | def addParameter(self, **kwargs): | |
518 | ''' |
|
517 | ''' | |
519 | Add parameters to "run" operation |
|
518 | Add parameters to "run" operation | |
520 | ''' |
|
519 | ''' | |
521 | opObj = self.opConfObjList[0] |
|
520 | opObj = self.opConfObjList[0] | |
522 |
|
521 | |||
523 | opObj.addParameter(**kwargs) |
|
522 | opObj.addParameter(**kwargs) | |
524 |
|
523 | |||
525 | return opObj |
|
524 | return opObj | |
526 |
|
525 | |||
527 | def addOperation(self, name, optype='self'): |
|
526 | def addOperation(self, name, optype='self'): | |
528 |
|
527 | |||
529 | id = self.__getNewId() |
|
528 | id = self.__getNewId() | |
530 | priority = self.__getPriority() |
|
529 | priority = self.__getPriority() | |
531 |
|
530 | |||
532 | opConfObj = OperationConf() |
|
531 | opConfObj = OperationConf() | |
533 | opConfObj.setup(id, name=name, priority=priority, type=optype) |
|
532 | opConfObj.setup(id, name=name, priority=priority, type=optype) | |
534 |
|
533 | |||
535 | self.opConfObjList.append(opConfObj) |
|
534 | self.opConfObjList.append(opConfObj) | |
536 |
|
535 | |||
537 | return opConfObj |
|
536 | return opConfObj | |
538 |
|
537 | |||
539 | def makeXml(self, procUnitElement): |
|
538 | def makeXml(self, procUnitElement): | |
540 |
|
539 | |||
541 | upElement = SubElement(procUnitElement, self.ELEMENTNAME) |
|
540 | upElement = SubElement(procUnitElement, self.ELEMENTNAME) | |
542 | upElement.set('id', str(self.id)) |
|
541 | upElement.set('id', str(self.id)) | |
543 | upElement.set('name', self.name) |
|
542 | upElement.set('name', self.name) | |
544 | upElement.set('datatype', self.datatype) |
|
543 | upElement.set('datatype', self.datatype) | |
545 | upElement.set('inputId', str(self.inputId)) |
|
544 | upElement.set('inputId', str(self.inputId)) | |
546 |
|
545 | |||
547 | for opConfObj in self.opConfObjList: |
|
546 | for opConfObj in self.opConfObjList: | |
548 | opConfObj.makeXml(upElement) |
|
547 | opConfObj.makeXml(upElement) | |
549 |
|
548 | |||
550 | def readXml(self, upElement): |
|
549 | def readXml(self, upElement): | |
551 |
|
550 | |||
552 | self.id = upElement.get('id') |
|
551 | self.id = upElement.get('id') | |
553 | self.name = upElement.get('name') |
|
552 | self.name = upElement.get('name') | |
554 | self.datatype = upElement.get('datatype') |
|
553 | self.datatype = upElement.get('datatype') | |
555 | self.inputId = upElement.get('inputId') |
|
554 | self.inputId = upElement.get('inputId') | |
556 |
|
555 | |||
557 | if self.ELEMENTNAME == "ReadUnit": |
|
556 | if self.ELEMENTNAME == "ReadUnit": | |
558 | self.datatype = self.datatype.replace("Reader", "") |
|
557 | self.datatype = self.datatype.replace("Reader", "") | |
559 |
|
558 | |||
560 | if self.ELEMENTNAME == "ProcUnit": |
|
559 | if self.ELEMENTNAME == "ProcUnit": | |
561 | self.datatype = self.datatype.replace("Proc", "") |
|
560 | self.datatype = self.datatype.replace("Proc", "") | |
562 |
|
561 | |||
563 | if self.inputId == 'None': |
|
562 | if self.inputId == 'None': | |
564 | self.inputId = '0' |
|
563 | self.inputId = '0' | |
565 |
|
564 | |||
566 | self.opConfObjList = [] |
|
565 | self.opConfObjList = [] | |
567 |
|
566 | |||
568 | opElementList = upElement.getiterator(OperationConf().getElementName()) |
|
567 | opElementList = upElement.getiterator(OperationConf().getElementName()) | |
569 |
|
568 | |||
570 | for opElement in opElementList: |
|
569 | for opElement in opElementList: | |
571 | opConfObj = OperationConf() |
|
570 | opConfObj = OperationConf() | |
572 | opConfObj.readXml(opElement) |
|
571 | opConfObj.readXml(opElement) | |
573 | self.opConfObjList.append(opConfObj) |
|
572 | self.opConfObjList.append(opConfObj) | |
574 |
|
573 | |||
575 | def printattr(self): |
|
574 | def printattr(self): | |
576 |
|
575 | |||
577 | print "%s[%s]: name = %s, datatype = %s, inputId = %s" %(self.ELEMENTNAME, |
|
576 | print "%s[%s]: name = %s, datatype = %s, inputId = %s" %(self.ELEMENTNAME, | |
578 | self.id, |
|
577 | self.id, | |
579 | self.name, |
|
578 | self.name, | |
580 | self.datatype, |
|
579 | self.datatype, | |
581 | self.inputId) |
|
580 | self.inputId) | |
582 |
|
581 | |||
583 | for opConfObj in self.opConfObjList: |
|
582 | for opConfObj in self.opConfObjList: | |
584 | opConfObj.printattr() |
|
583 | opConfObj.printattr() | |
585 |
|
584 | |||
586 | def createObjects(self): |
|
585 | def createObjects(self): | |
587 |
|
586 | |||
588 | className = eval(self.name) |
|
587 | className = eval(self.name) | |
589 | procUnitObj = className() |
|
588 | procUnitObj = className() | |
590 |
|
589 | |||
591 | for opConfObj in self.opConfObjList: |
|
590 | for opConfObj in self.opConfObjList: | |
592 |
|
591 | |||
593 | if opConfObj.type == 'self': |
|
592 | if opConfObj.type == 'self': | |
594 | continue |
|
593 | continue | |
595 |
|
594 | |||
596 | opObj = opConfObj.createObject() |
|
595 | opObj = opConfObj.createObject() | |
597 |
|
596 | |||
598 | self.opObjDict[opConfObj.id] = opObj |
|
597 | self.opObjDict[opConfObj.id] = opObj | |
599 | procUnitObj.addOperation(opObj, opConfObj.id) |
|
598 | procUnitObj.addOperation(opObj, opConfObj.id) | |
600 |
|
599 | |||
601 | self.procUnitObj = procUnitObj |
|
600 | self.procUnitObj = procUnitObj | |
602 |
|
601 | |||
603 | return procUnitObj |
|
602 | return procUnitObj | |
604 |
|
603 | |||
605 | def run(self): |
|
604 | def run(self): | |
606 |
|
605 | |||
607 | finalSts = False |
|
606 | finalSts = False | |
608 |
|
607 | |||
609 | for opConfObj in self.opConfObjList: |
|
608 | for opConfObj in self.opConfObjList: | |
610 |
|
609 | |||
611 | kwargs = {} |
|
610 | kwargs = {} | |
612 | for parmConfObj in opConfObj.getParameterObjList(): |
|
611 | for parmConfObj in opConfObj.getParameterObjList(): | |
613 | if opConfObj.name == 'run' and parmConfObj.name == 'datatype': |
|
612 | if opConfObj.name == 'run' and parmConfObj.name == 'datatype': | |
614 | continue |
|
613 | continue | |
615 |
|
614 | |||
616 | kwargs[parmConfObj.name] = parmConfObj.getValue() |
|
615 | kwargs[parmConfObj.name] = parmConfObj.getValue() | |
617 |
|
616 | |||
618 | #print "\tRunning the '%s' operation with %s" %(opConfObj.name, opConfObj.id) |
|
617 | #print "\tRunning the '%s' operation with %s" %(opConfObj.name, opConfObj.id) | |
619 | sts = self.procUnitObj.call(opType = opConfObj.type, |
|
618 | sts = self.procUnitObj.call(opType = opConfObj.type, | |
620 | opName = opConfObj.name, |
|
619 | opName = opConfObj.name, | |
621 | opId = opConfObj.id, |
|
620 | opId = opConfObj.id, | |
622 | **kwargs) |
|
621 | **kwargs) | |
623 | finalSts = finalSts or sts |
|
622 | finalSts = finalSts or sts | |
624 |
|
623 | |||
625 | return finalSts |
|
624 | return finalSts | |
626 |
|
625 | |||
627 | def close(self): |
|
626 | def close(self): | |
628 |
|
627 | |||
629 | for opConfObj in self.opConfObjList: |
|
628 | for opConfObj in self.opConfObjList: | |
630 | if opConfObj.type == 'self': |
|
629 | if opConfObj.type == 'self': | |
631 | continue |
|
630 | continue | |
632 |
|
631 | |||
633 | opObj = self.procUnitObj.getOperationObj(opConfObj.id) |
|
632 | opObj = self.procUnitObj.getOperationObj(opConfObj.id) | |
634 | opObj.close() |
|
633 | opObj.close() | |
635 |
|
634 | |||
636 | self.procUnitObj.close() |
|
635 | self.procUnitObj.close() | |
637 |
|
636 | |||
638 | return |
|
637 | return | |
639 |
|
638 | |||
640 | class ReadUnitConf(ProcUnitConf): |
|
639 | class ReadUnitConf(ProcUnitConf): | |
641 |
|
640 | |||
642 | path = None |
|
641 | path = None | |
643 | startDate = None |
|
642 | startDate = None | |
644 | endDate = None |
|
643 | endDate = None | |
645 | startTime = None |
|
644 | startTime = None | |
646 | endTime = None |
|
645 | endTime = None | |
647 |
|
646 | |||
648 | ELEMENTNAME = 'ReadUnit' |
|
647 | ELEMENTNAME = 'ReadUnit' | |
649 |
|
648 | |||
650 | def __init__(self): |
|
649 | def __init__(self): | |
651 |
|
650 | |||
652 | self.id = None |
|
651 | self.id = None | |
653 | self.datatype = None |
|
652 | self.datatype = None | |
654 | self.name = None |
|
653 | self.name = None | |
655 | self.inputId = None |
|
654 | self.inputId = None | |
656 |
|
655 | |||
657 | self.parentId = None |
|
656 | self.parentId = None | |
658 |
|
657 | |||
659 | self.opConfObjList = [] |
|
658 | self.opConfObjList = [] | |
660 | self.opObjList = [] |
|
659 | self.opObjList = [] | |
661 |
|
660 | |||
662 | def getElementName(self): |
|
661 | def getElementName(self): | |
663 |
|
662 | |||
664 | return self.ELEMENTNAME |
|
663 | return self.ELEMENTNAME | |
665 |
|
664 | |||
666 | def setup(self, id, name, datatype, path, startDate="", endDate="", startTime="", endTime="", parentId=None, **kwargs): |
|
665 | def setup(self, id, name, datatype, path, startDate="", endDate="", startTime="", endTime="", parentId=None, **kwargs): | |
667 |
|
666 | |||
668 | #Compatible with old signal chain version |
|
667 | #Compatible with old signal chain version | |
669 | if datatype==None and name==None: |
|
668 | if datatype==None and name==None: | |
670 | raise ValueError, "datatype or name should be defined" |
|
669 | raise ValueError, "datatype or name should be defined" | |
671 |
|
670 | |||
672 | if name==None: |
|
671 | if name==None: | |
673 | if 'Reader' in datatype: |
|
672 | if 'Reader' in datatype: | |
674 | name = datatype |
|
673 | name = datatype | |
675 | else: |
|
674 | else: | |
676 | name = '%sReader' %(datatype) |
|
675 | name = '%sReader' %(datatype) | |
677 |
|
676 | |||
678 | if datatype==None: |
|
677 | if datatype==None: | |
679 | datatype = name.replace('Reader','') |
|
678 | datatype = name.replace('Reader','') | |
680 |
|
679 | |||
681 | self.id = id |
|
680 | self.id = id | |
682 | self.name = name |
|
681 | self.name = name | |
683 | self.datatype = datatype |
|
682 | self.datatype = datatype | |
684 |
|
683 | |||
685 | self.path = path |
|
684 | self.path = path | |
686 | self.startDate = startDate |
|
685 | self.startDate = startDate | |
687 | self.endDate = endDate |
|
686 | self.endDate = endDate | |
688 | self.startTime = startTime |
|
687 | self.startTime = startTime | |
689 | self.endTime = endTime |
|
688 | self.endTime = endTime | |
690 |
|
689 | |||
691 | self.inputId = '0' |
|
690 | self.inputId = '0' | |
692 | self.parentId = parentId |
|
691 | self.parentId = parentId | |
693 |
|
692 | |||
694 | self.addRunOperation(**kwargs) |
|
693 | self.addRunOperation(**kwargs) | |
695 |
|
694 | |||
696 | def update(self, datatype, path, startDate, endDate, startTime, endTime, parentId=None, name=None, **kwargs): |
|
695 | def update(self, datatype, path, startDate, endDate, startTime, endTime, parentId=None, name=None, **kwargs): | |
697 |
|
696 | |||
698 | #Compatible with old signal chain version |
|
697 | #Compatible with old signal chain version | |
699 | if datatype==None and name==None: |
|
698 | if datatype==None and name==None: | |
700 | raise ValueError, "datatype or name should be defined" |
|
699 | raise ValueError, "datatype or name should be defined" | |
701 |
|
700 | |||
702 | if name==None: |
|
701 | if name==None: | |
703 | if 'Reader' in datatype: |
|
702 | if 'Reader' in datatype: | |
704 | name = datatype |
|
703 | name = datatype | |
705 | else: |
|
704 | else: | |
706 | name = '%sReader' %(datatype) |
|
705 | name = '%sReader' %(datatype) | |
707 |
|
706 | |||
708 | if datatype==None: |
|
707 | if datatype==None: | |
709 | datatype = name.replace('Reader','') |
|
708 | datatype = name.replace('Reader','') | |
710 |
|
709 | |||
711 | self.datatype = datatype |
|
710 | self.datatype = datatype | |
712 | self.name = name |
|
711 | self.name = name | |
713 | self.path = path |
|
712 | self.path = path | |
714 | self.startDate = startDate |
|
713 | self.startDate = startDate | |
715 | self.endDate = endDate |
|
714 | self.endDate = endDate | |
716 | self.startTime = startTime |
|
715 | self.startTime = startTime | |
717 | self.endTime = endTime |
|
716 | self.endTime = endTime | |
718 |
|
717 | |||
719 | self.inputId = '0' |
|
718 | self.inputId = '0' | |
720 | self.parentId = parentId |
|
719 | self.parentId = parentId | |
721 |
|
720 | |||
722 | self.updateRunOperation(**kwargs) |
|
721 | self.updateRunOperation(**kwargs) | |
723 |
|
722 | |||
724 | def addRunOperation(self, **kwargs): |
|
723 | def addRunOperation(self, **kwargs): | |
725 |
|
724 | |||
726 | opObj = self.addOperation(name = 'run', optype = 'self') |
|
725 | opObj = self.addOperation(name = 'run', optype = 'self') | |
727 |
|
726 | |||
728 | opObj.addParameter(name='datatype' , value=self.datatype, format='str') |
|
727 | opObj.addParameter(name='datatype' , value=self.datatype, format='str') | |
729 | opObj.addParameter(name='path' , value=self.path, format='str') |
|
728 | opObj.addParameter(name='path' , value=self.path, format='str') | |
730 | opObj.addParameter(name='startDate' , value=self.startDate, format='date') |
|
729 | opObj.addParameter(name='startDate' , value=self.startDate, format='date') | |
731 | opObj.addParameter(name='endDate' , value=self.endDate, format='date') |
|
730 | opObj.addParameter(name='endDate' , value=self.endDate, format='date') | |
732 | opObj.addParameter(name='startTime' , value=self.startTime, format='time') |
|
731 | opObj.addParameter(name='startTime' , value=self.startTime, format='time') | |
733 | opObj.addParameter(name='endTime' , value=self.endTime, format='time') |
|
732 | opObj.addParameter(name='endTime' , value=self.endTime, format='time') | |
734 |
|
733 | |||
735 | for key, value in kwargs.items(): |
|
734 | for key, value in kwargs.items(): | |
736 | opObj.addParameter(name=key, value=value, format=type(value).__name__) |
|
735 | opObj.addParameter(name=key, value=value, format=type(value).__name__) | |
737 |
|
736 | |||
738 | return opObj |
|
737 | return opObj | |
739 |
|
738 | |||
740 | def updateRunOperation(self, **kwargs): |
|
739 | def updateRunOperation(self, **kwargs): | |
741 |
|
740 | |||
742 | opObj = self.getOperationObj(name = 'run') |
|
741 | opObj = self.getOperationObj(name = 'run') | |
743 | opObj.removeParameters() |
|
742 | opObj.removeParameters() | |
744 |
|
743 | |||
745 | opObj.addParameter(name='datatype' , value=self.datatype, format='str') |
|
744 | opObj.addParameter(name='datatype' , value=self.datatype, format='str') | |
746 | opObj.addParameter(name='path' , value=self.path, format='str') |
|
745 | opObj.addParameter(name='path' , value=self.path, format='str') | |
747 | opObj.addParameter(name='startDate' , value=self.startDate, format='date') |
|
746 | opObj.addParameter(name='startDate' , value=self.startDate, format='date') | |
748 | opObj.addParameter(name='endDate' , value=self.endDate, format='date') |
|
747 | opObj.addParameter(name='endDate' , value=self.endDate, format='date') | |
749 | opObj.addParameter(name='startTime' , value=self.startTime, format='time') |
|
748 | opObj.addParameter(name='startTime' , value=self.startTime, format='time') | |
750 | opObj.addParameter(name='endTime' , value=self.endTime, format='time') |
|
749 | opObj.addParameter(name='endTime' , value=self.endTime, format='time') | |
751 |
|
750 | |||
752 | for key, value in kwargs.items(): |
|
751 | for key, value in kwargs.items(): | |
753 | opObj.addParameter(name=key, value=value, format=type(value).__name__) |
|
752 | opObj.addParameter(name=key, value=value, format=type(value).__name__) | |
754 |
|
753 | |||
755 | return opObj |
|
754 | return opObj | |
756 |
|
755 | |||
757 | class Project(): |
|
756 | class Project(): | |
758 |
|
757 | |||
759 | id = None |
|
758 | id = None | |
760 | name = None |
|
759 | name = None | |
761 | description = None |
|
760 | description = None | |
762 | # readUnitConfObjList = None |
|
761 | # readUnitConfObjList = None | |
763 | procUnitConfObjDict = None |
|
762 | procUnitConfObjDict = None | |
764 |
|
763 | |||
765 | ELEMENTNAME = 'Project' |
|
764 | ELEMENTNAME = 'Project' | |
766 |
|
765 | |||
767 | def __init__(self, control=None, dataq=None): |
|
766 | def __init__(self, control=None, dataq=None): | |
768 |
|
767 | |||
769 | self.id = None |
|
768 | self.id = None | |
770 | self.name = None |
|
769 | self.name = None | |
771 | self.description = None |
|
770 | self.description = None | |
772 |
|
771 | |||
773 | self.procUnitConfObjDict = {} |
|
772 | self.procUnitConfObjDict = {} | |
774 |
|
773 | |||
775 | #global data_q |
|
774 | #global data_q | |
776 | #data_q = dataq |
|
775 | #data_q = dataq | |
777 |
|
776 | |||
778 | if control==None: |
|
777 | if control==None: | |
779 | control = {'stop':False,'pause':False} |
|
778 | control = {'stop':False,'pause':False} | |
780 |
|
779 | |||
781 | self.control = control |
|
780 | self.control = control | |
782 |
|
781 | |||
783 | def __getNewId(self): |
|
782 | def __getNewId(self): | |
784 |
|
783 | |||
785 | id = int(self.id)*10 + len(self.procUnitConfObjDict) + 1 |
|
784 | id = int(self.id)*10 + len(self.procUnitConfObjDict) + 1 | |
786 |
|
785 | |||
787 | return str(id) |
|
786 | return str(id) | |
788 |
|
787 | |||
789 | def getElementName(self): |
|
788 | def getElementName(self): | |
790 |
|
789 | |||
791 | return self.ELEMENTNAME |
|
790 | return self.ELEMENTNAME | |
792 |
|
791 | |||
793 | def getId(self): |
|
792 | def getId(self): | |
794 |
|
793 | |||
795 | return self.id |
|
794 | return self.id | |
796 |
|
795 | |||
797 | def updateId(self, new_id): |
|
796 | def updateId(self, new_id): | |
798 |
|
797 | |||
799 | self.id = str(new_id) |
|
798 | self.id = str(new_id) | |
800 |
|
799 | |||
801 | keyList = self.procUnitConfObjDict.keys() |
|
800 | keyList = self.procUnitConfObjDict.keys() | |
802 | keyList.sort() |
|
801 | keyList.sort() | |
803 |
|
802 | |||
804 | n = 1 |
|
803 | n = 1 | |
805 | newProcUnitConfObjDict = {} |
|
804 | newProcUnitConfObjDict = {} | |
806 |
|
805 | |||
807 | for procKey in keyList: |
|
806 | for procKey in keyList: | |
808 |
|
807 | |||
809 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
808 | procUnitConfObj = self.procUnitConfObjDict[procKey] | |
810 | idProcUnit = str(int(self.id)*10 + n) |
|
809 | idProcUnit = str(int(self.id)*10 + n) | |
811 | procUnitConfObj.updateId(idProcUnit, parentId = self.id) |
|
810 | procUnitConfObj.updateId(idProcUnit, parentId = self.id) | |
812 |
|
811 | |||
813 | newProcUnitConfObjDict[idProcUnit] = procUnitConfObj |
|
812 | newProcUnitConfObjDict[idProcUnit] = procUnitConfObj | |
814 | n += 1 |
|
813 | n += 1 | |
815 |
|
814 | |||
816 | self.procUnitConfObjDict = newProcUnitConfObjDict |
|
815 | self.procUnitConfObjDict = newProcUnitConfObjDict | |
817 |
|
816 | |||
818 | def setup(self, id, name, description): |
|
817 | def setup(self, id, name, description): | |
819 |
|
818 | |||
820 | self.id = str(id) |
|
819 | self.id = str(id) | |
821 | self.name = name |
|
820 | self.name = name | |
822 | self.description = description |
|
821 | self.description = description | |
823 |
|
822 | |||
824 | def update(self, name, description): |
|
823 | def update(self, name, description): | |
825 |
|
824 | |||
826 | self.name = name |
|
825 | self.name = name | |
827 | self.description = description |
|
826 | self.description = description | |
828 |
|
827 | |||
829 | def addReadUnit(self, datatype=None, name=None, **kwargs): |
|
828 | def addReadUnit(self, datatype=None, name=None, **kwargs): | |
830 |
|
829 | |||
831 | idReadUnit = self.__getNewId() |
|
830 | idReadUnit = self.__getNewId() | |
832 |
|
831 | |||
833 | readUnitConfObj = ReadUnitConf() |
|
832 | readUnitConfObj = ReadUnitConf() | |
834 | readUnitConfObj.setup(idReadUnit, name, datatype, parentId=self.id, **kwargs) |
|
833 | readUnitConfObj.setup(idReadUnit, name, datatype, parentId=self.id, **kwargs) | |
835 |
|
834 | |||
836 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
835 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj | |
837 |
|
836 | |||
838 | return readUnitConfObj |
|
837 | return readUnitConfObj | |
839 |
|
838 | |||
840 | def addProcUnit(self, inputId='0', datatype=None, name=None): |
|
839 | def addProcUnit(self, inputId='0', datatype=None, name=None): | |
841 |
|
840 | |||
842 | idProcUnit = self.__getNewId() |
|
841 | idProcUnit = self.__getNewId() | |
843 |
|
842 | |||
844 | procUnitConfObj = ProcUnitConf() |
|
843 | procUnitConfObj = ProcUnitConf() | |
845 | procUnitConfObj.setup(idProcUnit, name, datatype, inputId, parentId=self.id) |
|
844 | procUnitConfObj.setup(idProcUnit, name, datatype, inputId, parentId=self.id) | |
846 |
|
845 | |||
847 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
846 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj | |
848 |
|
847 | |||
849 | return procUnitConfObj |
|
848 | return procUnitConfObj | |
850 |
|
849 | |||
851 | def removeProcUnit(self, id): |
|
850 | def removeProcUnit(self, id): | |
852 |
|
851 | |||
853 | if id in self.procUnitConfObjDict.keys(): |
|
852 | if id in self.procUnitConfObjDict.keys(): | |
854 | self.procUnitConfObjDict.pop(id) |
|
853 | self.procUnitConfObjDict.pop(id) | |
855 |
|
854 | |||
856 | def getReadUnitId(self): |
|
855 | def getReadUnitId(self): | |
857 |
|
856 | |||
858 | readUnitConfObj = self.getReadUnitObj() |
|
857 | readUnitConfObj = self.getReadUnitObj() | |
859 |
|
858 | |||
860 | return readUnitConfObj.id |
|
859 | return readUnitConfObj.id | |
861 |
|
860 | |||
862 | def getReadUnitObj(self): |
|
861 | def getReadUnitObj(self): | |
863 |
|
862 | |||
864 | for obj in self.procUnitConfObjDict.values(): |
|
863 | for obj in self.procUnitConfObjDict.values(): | |
865 | if obj.getElementName() == "ReadUnit": |
|
864 | if obj.getElementName() == "ReadUnit": | |
866 | return obj |
|
865 | return obj | |
867 |
|
866 | |||
868 | return None |
|
867 | return None | |
869 |
|
868 | |||
870 | def getProcUnitObj(self, id=None, name=None): |
|
869 | def getProcUnitObj(self, id=None, name=None): | |
871 |
|
870 | |||
872 | if id != None: |
|
871 | if id != None: | |
873 | return self.procUnitConfObjDict[id] |
|
872 | return self.procUnitConfObjDict[id] | |
874 |
|
873 | |||
875 | if name != None: |
|
874 | if name != None: | |
876 | return self.getProcUnitObjByName(name) |
|
875 | return self.getProcUnitObjByName(name) | |
877 |
|
876 | |||
878 | return None |
|
877 | return None | |
879 |
|
878 | |||
880 | def getProcUnitObjByName(self, name): |
|
879 | def getProcUnitObjByName(self, name): | |
881 |
|
880 | |||
882 | for obj in self.procUnitConfObjDict.values(): |
|
881 | for obj in self.procUnitConfObjDict.values(): | |
883 | if obj.name == name: |
|
882 | if obj.name == name: | |
884 | return obj |
|
883 | return obj | |
885 |
|
884 | |||
886 | return None |
|
885 | return None | |
887 |
|
886 | |||
888 | def procUnitItems(self): |
|
887 | def procUnitItems(self): | |
889 |
|
888 | |||
890 | return self.procUnitConfObjDict.items() |
|
889 | return self.procUnitConfObjDict.items() | |
891 |
|
890 | |||
892 | def makeXml(self): |
|
891 | def makeXml(self): | |
893 |
|
892 | |||
894 | projectElement = Element('Project') |
|
893 | projectElement = Element('Project') | |
895 | projectElement.set('id', str(self.id)) |
|
894 | projectElement.set('id', str(self.id)) | |
896 | projectElement.set('name', self.name) |
|
895 | projectElement.set('name', self.name) | |
897 | projectElement.set('description', self.description) |
|
896 | projectElement.set('description', self.description) | |
898 |
|
897 | |||
899 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
898 | for procUnitConfObj in self.procUnitConfObjDict.values(): | |
900 | procUnitConfObj.makeXml(projectElement) |
|
899 | procUnitConfObj.makeXml(projectElement) | |
901 |
|
900 | |||
902 | self.projectElement = projectElement |
|
901 | self.projectElement = projectElement | |
903 |
|
902 | |||
904 | def writeXml(self, filename): |
|
903 | def writeXml(self, filename): | |
905 |
|
904 | |||
906 | self.makeXml() |
|
905 | self.makeXml() | |
907 |
|
906 | |||
908 | #print prettify(self.projectElement) |
|
907 | #print prettify(self.projectElement) | |
909 |
|
908 | |||
910 | ElementTree(self.projectElement).write(filename, method='xml') |
|
909 | ElementTree(self.projectElement).write(filename, method='xml') | |
911 |
|
910 | |||
912 | def readXml(self, filename): |
|
911 | def readXml(self, filename): | |
913 |
|
912 | |||
914 | self.projectElement = None |
|
913 | self.projectElement = None | |
915 | self.procUnitConfObjDict = {} |
|
914 | self.procUnitConfObjDict = {} | |
916 |
|
915 | |||
917 | self.projectElement = ElementTree().parse(filename) |
|
916 | self.projectElement = ElementTree().parse(filename) | |
918 |
|
917 | |||
919 | self.project = self.projectElement.tag |
|
918 | self.project = self.projectElement.tag | |
920 |
|
919 | |||
921 | self.id = self.projectElement.get('id') |
|
920 | self.id = self.projectElement.get('id') | |
922 | self.name = self.projectElement.get('name') |
|
921 | self.name = self.projectElement.get('name') | |
923 | self.description = self.projectElement.get('description') |
|
922 | self.description = self.projectElement.get('description') | |
924 |
|
923 | |||
925 | readUnitElementList = self.projectElement.getiterator(ReadUnitConf().getElementName()) |
|
924 | readUnitElementList = self.projectElement.getiterator(ReadUnitConf().getElementName()) | |
926 |
|
925 | |||
927 | for readUnitElement in readUnitElementList: |
|
926 | for readUnitElement in readUnitElementList: | |
928 | readUnitConfObj = ReadUnitConf() |
|
927 | readUnitConfObj = ReadUnitConf() | |
929 | readUnitConfObj.readXml(readUnitElement) |
|
928 | readUnitConfObj.readXml(readUnitElement) | |
930 |
|
929 | |||
931 | if readUnitConfObj.parentId == None: |
|
930 | if readUnitConfObj.parentId == None: | |
932 | readUnitConfObj.parentId = self.id |
|
931 | readUnitConfObj.parentId = self.id | |
933 |
|
932 | |||
934 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
933 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj | |
935 |
|
934 | |||
936 | procUnitElementList = self.projectElement.getiterator(ProcUnitConf().getElementName()) |
|
935 | procUnitElementList = self.projectElement.getiterator(ProcUnitConf().getElementName()) | |
937 |
|
936 | |||
938 | for procUnitElement in procUnitElementList: |
|
937 | for procUnitElement in procUnitElementList: | |
939 | procUnitConfObj = ProcUnitConf() |
|
938 | procUnitConfObj = ProcUnitConf() | |
940 | procUnitConfObj.readXml(procUnitElement) |
|
939 | procUnitConfObj.readXml(procUnitElement) | |
941 |
|
940 | |||
942 | if procUnitConfObj.parentId == None: |
|
941 | if procUnitConfObj.parentId == None: | |
943 | procUnitConfObj.parentId = self.id |
|
942 | procUnitConfObj.parentId = self.id | |
944 |
|
943 | |||
945 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
944 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj | |
946 |
|
945 | |||
947 | def printattr(self): |
|
946 | def printattr(self): | |
948 |
|
947 | |||
949 | print "Project[%s]: name = %s, description = %s" %(self.id, |
|
948 | print "Project[%s]: name = %s, description = %s" %(self.id, | |
950 | self.name, |
|
949 | self.name, | |
951 | self.description) |
|
950 | self.description) | |
952 |
|
951 | |||
953 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
952 | for procUnitConfObj in self.procUnitConfObjDict.values(): | |
954 | procUnitConfObj.printattr() |
|
953 | procUnitConfObj.printattr() | |
955 |
|
954 | |||
956 | def createObjects(self): |
|
955 | def createObjects(self): | |
957 |
|
956 | |||
958 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
957 | for procUnitConfObj in self.procUnitConfObjDict.values(): | |
959 | procUnitConfObj.createObjects() |
|
958 | procUnitConfObj.createObjects() | |
960 |
|
959 | |||
961 | def __connect(self, objIN, thisObj): |
|
960 | def __connect(self, objIN, thisObj): | |
962 |
|
961 | |||
963 | thisObj.setInput(objIN.getOutputObj()) |
|
962 | thisObj.setInput(objIN.getOutputObj()) | |
964 |
|
963 | |||
965 | def connectObjects(self): |
|
964 | def connectObjects(self): | |
966 |
|
965 | |||
967 | for thisPUConfObj in self.procUnitConfObjDict.values(): |
|
966 | for thisPUConfObj in self.procUnitConfObjDict.values(): | |
968 |
|
967 | |||
969 | inputId = thisPUConfObj.getInputId() |
|
968 | inputId = thisPUConfObj.getInputId() | |
970 |
|
969 | |||
971 | if int(inputId) == 0: |
|
970 | if int(inputId) == 0: | |
972 | continue |
|
971 | continue | |
973 |
|
972 | |||
974 | #Get input object |
|
973 | #Get input object | |
975 | puConfINObj = self.procUnitConfObjDict[inputId] |
|
974 | puConfINObj = self.procUnitConfObjDict[inputId] | |
976 | puObjIN = puConfINObj.getProcUnitObj() |
|
975 | puObjIN = puConfINObj.getProcUnitObj() | |
977 |
|
976 | |||
978 | #Get current object |
|
977 | #Get current object | |
979 | thisPUObj = thisPUConfObj.getProcUnitObj() |
|
978 | thisPUObj = thisPUConfObj.getProcUnitObj() | |
980 |
|
979 | |||
981 | self.__connect(puObjIN, thisPUObj) |
|
980 | self.__connect(puObjIN, thisPUObj) | |
982 |
|
981 | |||
983 | def run(self): |
|
982 | def run(self): | |
984 |
|
983 | |||
985 |
|
984 | |||
986 | print "*"*50 |
|
985 | print "*"*50 | |
987 | print " Starting SIGNAL CHAIN PROCESSING " |
|
986 | print " Starting SIGNAL CHAIN PROCESSING " | |
988 | print "*"*50 |
|
987 | print "*"*50 | |
989 |
|
988 | |||
990 |
|
989 | |||
991 | keyList = self.procUnitConfObjDict.keys() |
|
990 | keyList = self.procUnitConfObjDict.keys() | |
992 | keyList.sort() |
|
991 | keyList.sort() | |
993 |
|
992 | |||
994 | while(True): |
|
993 | while(True): | |
995 |
|
994 | |||
996 | finalSts = False |
|
995 | finalSts = False | |
997 |
|
996 | |||
998 | for procKey in keyList: |
|
997 | for procKey in keyList: | |
999 | # print "Running the '%s' process with %s" %(procUnitConfObj.name, procUnitConfObj.id) |
|
998 | # print "Running the '%s' process with %s" %(procUnitConfObj.name, procUnitConfObj.id) | |
1000 |
|
999 | |||
1001 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
1000 | procUnitConfObj = self.procUnitConfObjDict[procKey] | |
1002 | sts = procUnitConfObj.run() |
|
1001 | sts = procUnitConfObj.run() | |
1003 | finalSts = finalSts or sts |
|
1002 | finalSts = finalSts or sts | |
1004 |
|
1003 | |||
1005 | #If every process unit finished so end process |
|
1004 | #If every process unit finished so end process | |
1006 | if not(finalSts): |
|
1005 | if not(finalSts): | |
1007 | print "Every process unit have finished" |
|
1006 | print "Every process unit have finished" | |
1008 | break |
|
1007 | break | |
1009 |
|
1008 | |||
1010 | if self.control['pause']: |
|
1009 | if self.control['pause']: | |
1011 | print "Process suspended" |
|
1010 | print "Process suspended" | |
1012 |
|
1011 | |||
1013 | while True: |
|
1012 | while True: | |
1014 | sleep(0.1) |
|
1013 | sleep(0.1) | |
1015 |
|
1014 | |||
1016 | if not self.control['pause']: |
|
1015 | if not self.control['pause']: | |
1017 | break |
|
1016 | break | |
1018 |
|
1017 | |||
1019 | if self.control['stop']: |
|
1018 | if self.control['stop']: | |
1020 | break |
|
1019 | break | |
1021 | print "Process reinitialized" |
|
1020 | print "Process reinitialized" | |
1022 |
|
1021 | |||
1023 | if self.control['stop']: |
|
1022 | if self.control['stop']: | |
1024 | # print "Process stopped" |
|
1023 | # print "Process stopped" | |
1025 | break |
|
1024 | break | |
1026 |
|
1025 | |||
1027 | #Closing every process |
|
1026 | #Closing every process | |
1028 | for procKey in keyList: |
|
1027 | for procKey in keyList: | |
1029 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
1028 | procUnitConfObj = self.procUnitConfObjDict[procKey] | |
1030 | procUnitConfObj.close() |
|
1029 | procUnitConfObj.close() | |
1031 |
|
1030 | |||
1032 | print "Process finished" |
|
1031 | print "Process finished" | |
1033 |
|
1032 | |||
1034 | def start(self, filename): |
|
1033 | def start(self, filename): | |
1035 |
|
1034 | |||
1036 | self.writeXml(filename) |
|
1035 | self.writeXml(filename) | |
1037 | self.readXml(filename) |
|
1036 | self.readXml(filename) | |
1038 |
|
1037 | |||
1039 | self.createObjects() |
|
1038 | self.createObjects() | |
1040 | self.connectObjects() |
|
1039 | self.connectObjects() | |
1041 | self.run() |
|
1040 | self.run() | |
1042 |
|
1041 | |||
1043 | if __name__ == '__main__': |
|
1042 | if __name__ == '__main__': | |
1044 |
|
1043 | |||
1045 | desc = "Segundo Test" |
|
1044 | desc = "Segundo Test" | |
1046 | filename = "schain.xml" |
|
1045 | filename = "schain.xml" | |
1047 |
|
1046 | |||
1048 | controllerObj = Project() |
|
1047 | controllerObj = Project() | |
1049 |
|
1048 | |||
1050 | controllerObj.setup(id = '191', name='test01', description=desc) |
|
1049 | controllerObj.setup(id = '191', name='test01', description=desc) | |
1051 |
|
1050 | |||
1052 | readUnitConfObj = controllerObj.addReadUnit(datatype='Voltage', |
|
1051 | readUnitConfObj = controllerObj.addReadUnit(datatype='Voltage', | |
1053 | path='data/rawdata/', |
|
1052 | path='data/rawdata/', | |
1054 | startDate='2011/01/01', |
|
1053 | startDate='2011/01/01', | |
1055 | endDate='2012/12/31', |
|
1054 | endDate='2012/12/31', | |
1056 | startTime='00:00:00', |
|
1055 | startTime='00:00:00', | |
1057 | endTime='23:59:59', |
|
1056 | endTime='23:59:59', | |
1058 | online=1, |
|
1057 | online=1, | |
1059 | walk=1) |
|
1058 | walk=1) | |
1060 |
|
1059 | |||
1061 | procUnitConfObj0 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) |
|
1060 | procUnitConfObj0 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) | |
1062 |
|
1061 | |||
1063 | opObj10 = procUnitConfObj0.addOperation(name='selectChannels') |
|
1062 | opObj10 = procUnitConfObj0.addOperation(name='selectChannels') | |
1064 | opObj10.addParameter(name='channelList', value='3,4,5', format='intlist') |
|
1063 | opObj10.addParameter(name='channelList', value='3,4,5', format='intlist') | |
1065 |
|
1064 | |||
1066 | opObj10 = procUnitConfObj0.addOperation(name='selectHeights') |
|
1065 | opObj10 = procUnitConfObj0.addOperation(name='selectHeights') | |
1067 | opObj10.addParameter(name='minHei', value='90', format='float') |
|
1066 | opObj10.addParameter(name='minHei', value='90', format='float') | |
1068 | opObj10.addParameter(name='maxHei', value='180', format='float') |
|
1067 | opObj10.addParameter(name='maxHei', value='180', format='float') | |
1069 |
|
1068 | |||
1070 | opObj12 = procUnitConfObj0.addOperation(name='CohInt', optype='external') |
|
1069 | opObj12 = procUnitConfObj0.addOperation(name='CohInt', optype='external') | |
1071 | opObj12.addParameter(name='n', value='10', format='int') |
|
1070 | opObj12.addParameter(name='n', value='10', format='int') | |
1072 |
|
1071 | |||
1073 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj0.getId()) |
|
1072 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj0.getId()) | |
1074 | procUnitConfObj1.addParameter(name='nFFTPoints', value='32', format='int') |
|
1073 | procUnitConfObj1.addParameter(name='nFFTPoints', value='32', format='int') | |
1075 | # procUnitConfObj1.addParameter(name='pairList', value='(0,1),(0,2),(1,2)', format='') |
|
1074 | # procUnitConfObj1.addParameter(name='pairList', value='(0,1),(0,2),(1,2)', format='') | |
1076 |
|
1075 | |||
1077 |
|
1076 | |||
1078 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external') |
|
1077 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external') | |
1079 | opObj11.addParameter(name='idfigure', value='1', format='int') |
|
1078 | opObj11.addParameter(name='idfigure', value='1', format='int') | |
1080 | opObj11.addParameter(name='wintitle', value='SpectraPlot0', format='str') |
|
1079 | opObj11.addParameter(name='wintitle', value='SpectraPlot0', format='str') | |
1081 | opObj11.addParameter(name='zmin', value='40', format='int') |
|
1080 | opObj11.addParameter(name='zmin', value='40', format='int') | |
1082 | opObj11.addParameter(name='zmax', value='90', format='int') |
|
1081 | opObj11.addParameter(name='zmax', value='90', format='int') | |
1083 | opObj11.addParameter(name='showprofile', value='1', format='int') |
|
1082 | opObj11.addParameter(name='showprofile', value='1', format='int') | |
1084 |
|
1083 | |||
1085 | print "Escribiendo el archivo XML" |
|
1084 | print "Escribiendo el archivo XML" | |
1086 |
|
1085 | |||
1087 | controllerObj.writeXml(filename) |
|
1086 | controllerObj.writeXml(filename) | |
1088 |
|
1087 | |||
1089 | print "Leyendo el archivo XML" |
|
1088 | print "Leyendo el archivo XML" | |
1090 | controllerObj.readXml(filename) |
|
1089 | controllerObj.readXml(filename) | |
1091 | #controllerObj.printattr() |
|
1090 | #controllerObj.printattr() | |
1092 |
|
1091 | |||
1093 | controllerObj.createObjects() |
|
1092 | controllerObj.createObjects() | |
1094 | controllerObj.connectObjects() |
|
1093 | controllerObj.connectObjects() | |
1095 | controllerObj.run() |
|
1094 | controllerObj.run() | |
1096 |
|
1095 | |||
1097 | No newline at end of file |
|
1096 |
@@ -1,5866 +1,5862 | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """ |
|
2 | """ | |
3 | Module implementing MainWindow. |
|
3 | Module implementing MainWindow. | |
4 | #+++++++++++++GUI V1++++++++++++++# |
|
4 | #+++++++++++++GUI V1++++++++++++++# | |
5 | @author: AlexanderValdezPortocarrero Γ±_Γ± |
|
5 | @author: AlexanderValdezPortocarrero Γ±_Γ± | |
6 | """ |
|
6 | """ | |
7 | import os, sys, time |
|
7 | import os, sys, time | |
8 | import datetime |
|
8 | import datetime | |
9 | import numpy |
|
9 | import numpy | |
10 | import Queue |
|
10 | import Queue | |
11 |
|
11 | |||
12 | from collections import OrderedDict |
|
12 | from collections import OrderedDict | |
13 | from os.path import expanduser |
|
13 | from os.path import expanduser | |
14 | from time import sleep |
|
14 | from time import sleep | |
15 | # from gevent import sleep |
|
15 | # from gevent import sleep | |
16 |
|
16 | |||
17 | import ast |
|
17 | import ast | |
18 |
|
18 | |||
19 | from PyQt4.QtGui import QMainWindow |
|
19 | from PyQt4.QtGui import QMainWindow | |
20 | from PyQt4.QtCore import pyqtSignature |
|
20 | from PyQt4.QtCore import pyqtSignature | |
21 | from PyQt4.QtCore import pyqtSignal |
|
21 | from PyQt4.QtCore import pyqtSignal | |
22 | from PyQt4 import QtCore |
|
22 | from PyQt4 import QtCore | |
23 | from PyQt4 import QtGui |
|
23 | from PyQt4 import QtGui | |
24 | # from PyQt4.QtCore import QThread |
|
24 | # from PyQt4.QtCore import QThread | |
25 | # from PyQt4.QtCore import QObject, SIGNAL |
|
25 | # from PyQt4.QtCore import QObject, SIGNAL | |
26 |
|
26 | |||
27 | from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess |
|
27 | from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess | |
28 | from schainpy.gui.viewer.ui_ftp import Ui_Ftp |
|
28 | from schainpy.gui.viewer.ui_ftp import Ui_Ftp | |
29 | from schainpy.gui.viewer.ui_mainwindow import Ui_BasicWindow |
|
29 | from schainpy.gui.viewer.ui_mainwindow import Ui_BasicWindow | |
30 | from schainpy.controller_api import ControllerThread |
|
30 | from schainpy.controller_api import ControllerThread | |
31 | from schainpy.controller import Project |
|
31 | from schainpy.controller import Project | |
32 |
|
32 | |||
33 | from propertiesViewModel import TreeModel, PropertyBuffer |
|
33 | from propertiesViewModel import TreeModel, PropertyBuffer | |
34 | from parametersModel import ProjectParms |
|
34 | from parametersModel import ProjectParms | |
35 |
|
35 | |||
36 | from schainpy.gui.figures import tools |
|
36 | from schainpy.gui.figures import tools | |
37 |
|
37 | |||
38 | FIGURES_PATH = tools.get_path() |
|
38 | FIGURES_PATH = tools.get_path() | |
39 | TEMPORAL_FILE = ".temp.xml" |
|
39 | TEMPORAL_FILE = ".temp.xml" | |
40 |
|
40 | |||
41 | def isRadarFile(file): |
|
41 | def isRadarFile(file): | |
42 | try: |
|
42 | try: | |
43 | year = int(file[1:5]) |
|
43 | year = int(file[1:5]) | |
44 | doy = int(file[5:8]) |
|
44 | doy = int(file[5:8]) | |
45 | set = int(file[8:11]) |
|
45 | set = int(file[8:11]) | |
46 | except: |
|
46 | except: | |
47 | return 0 |
|
47 | return 0 | |
48 |
|
48 | |||
49 | return 1 |
|
49 | return 1 | |
50 |
|
50 | |||
51 | def isRadarPath(path): |
|
51 | def isRadarPath(path): | |
52 | try: |
|
52 | try: | |
53 | year = int(path[1:5]) |
|
53 | year = int(path[1:5]) | |
54 | doy = int(path[5:8]) |
|
54 | doy = int(path[5:8]) | |
55 | except: |
|
55 | except: | |
56 | return 0 |
|
56 | return 0 | |
57 |
|
57 | |||
58 | return 1 |
|
58 | return 1 | |
59 |
|
59 | |||
60 | def isInt(value): |
|
60 | def isInt(value): | |
61 |
|
61 | |||
62 | try: |
|
62 | try: | |
63 | int(value) |
|
63 | int(value) | |
64 | except: |
|
64 | except: | |
65 | return 0 |
|
65 | return 0 | |
66 |
|
66 | |||
67 | return 1 |
|
67 | return 1 | |
68 |
|
68 | |||
69 | def isFloat(value): |
|
69 | def isFloat(value): | |
70 |
|
70 | |||
71 | try: |
|
71 | try: | |
72 | float(value) |
|
72 | float(value) | |
73 | except: |
|
73 | except: | |
74 | return 0 |
|
74 | return 0 | |
75 |
|
75 | |||
76 | return 1 |
|
76 | return 1 | |
77 |
|
77 | |||
78 | def isList(value): |
|
78 | def isList(value): | |
79 |
|
79 | |||
80 | x = ast.literal_eval(value) |
|
80 | x = ast.literal_eval(value) | |
81 |
|
81 | |||
82 | if type(x) in (tuple, list): |
|
82 | if type(x) in (tuple, list): | |
83 | return 1 |
|
83 | return 1 | |
84 |
|
84 | |||
85 | return 0 |
|
85 | return 0 | |
86 |
|
86 | |||
87 | class BasicWindow(QMainWindow, Ui_BasicWindow): |
|
87 | class BasicWindow(QMainWindow, Ui_BasicWindow): | |
88 | """ |
|
88 | """ | |
89 | """ |
|
89 | """ | |
90 | def __init__(self, parent=None): |
|
90 | def __init__(self, parent=None): | |
91 | """ |
|
91 | """ | |
92 |
|
92 | |||
93 | """ |
|
93 | """ | |
94 | QMainWindow.__init__(self, parent) |
|
94 | QMainWindow.__init__(self, parent) | |
95 | self.setupUi(self) |
|
95 | self.setupUi(self) | |
96 | self.__puObjDict = {} |
|
96 | self.__puObjDict = {} | |
97 | self.__itemTreeDict = {} |
|
97 | self.__itemTreeDict = {} | |
98 | self.readUnitConfObjList = [] |
|
98 | self.readUnitConfObjList = [] | |
99 | self.operObjList = [] |
|
99 | self.operObjList = [] | |
100 | self.projecObjView = None |
|
100 | self.projecObjView = None | |
101 | self.idProject = 0 |
|
101 | self.idProject = 0 | |
102 | # self.idImag = 0 |
|
102 | # self.idImag = 0 | |
103 |
|
103 | |||
104 | self.idImagscope = 0 |
|
104 | self.idImagscope = 0 | |
105 | self.idImagspectra = 0 |
|
105 | self.idImagspectra = 0 | |
106 | self.idImagcross = 0 |
|
106 | self.idImagcross = 0 | |
107 | self.idImagrti = 0 |
|
107 | self.idImagrti = 0 | |
108 | self.idImagcoherence = 0 |
|
108 | self.idImagcoherence = 0 | |
109 | self.idImagpower = 0 |
|
109 | self.idImagpower = 0 | |
110 | self.idImagrtinoise = 0 |
|
110 | self.idImagrtinoise = 0 | |
111 | self.idImagspectraHeis = 0 |
|
111 | self.idImagspectraHeis = 0 | |
112 | self.idImagrtiHeis = 0 |
|
112 | self.idImagrtiHeis = 0 | |
113 |
|
113 | |||
114 | self.dataPath = None |
|
114 | self.dataPath = None | |
115 | self.online = 0 |
|
115 | self.online = 0 | |
116 | self.walk = 0 |
|
116 | self.walk = 0 | |
117 | self.create = False |
|
117 | self.create = False | |
118 | self.selectedItemTree = None |
|
118 | self.selectedItemTree = None | |
119 | self.controllerThread = None |
|
119 | self.controllerThread = None | |
120 | # self.commCtrlPThread = None |
|
120 | # self.commCtrlPThread = None | |
121 | # self.create_figure() |
|
121 | # self.create_figure() | |
122 | self.temporalFTP = ftpBuffer() |
|
122 | self.temporalFTP = ftpBuffer() | |
123 | self.projectProperCaracteristica = [] |
|
123 | self.projectProperCaracteristica = [] | |
124 | self.projectProperPrincipal = [] |
|
124 | self.projectProperPrincipal = [] | |
125 | self.projectProperDescripcion = [] |
|
125 | self.projectProperDescripcion = [] | |
126 | self.volProperCaracteristica = [] |
|
126 | self.volProperCaracteristica = [] | |
127 | self.volProperPrincipal = [] |
|
127 | self.volProperPrincipal = [] | |
128 | self.volProperDescripcion = [] |
|
128 | self.volProperDescripcion = [] | |
129 | self.specProperCaracteristica = [] |
|
129 | self.specProperCaracteristica = [] | |
130 | self.specProperPrincipal = [] |
|
130 | self.specProperPrincipal = [] | |
131 | self.specProperDescripcion = [] |
|
131 | self.specProperDescripcion = [] | |
132 |
|
132 | |||
133 | self.specHeisProperCaracteristica = [] |
|
133 | self.specHeisProperCaracteristica = [] | |
134 | self.specHeisProperPrincipal = [] |
|
134 | self.specHeisProperPrincipal = [] | |
135 | self.specHeisProperDescripcion = [] |
|
135 | self.specHeisProperDescripcion = [] | |
136 |
|
136 | |||
137 | # self.pathWorkSpace = './' |
|
137 | # self.pathWorkSpace = './' | |
138 |
|
138 | |||
139 | self.__projectObjDict = {} |
|
139 | self.__projectObjDict = {} | |
140 | self.__operationObjDict = {} |
|
140 | self.__operationObjDict = {} | |
141 |
|
141 | |||
142 | self.__puLocalFolder2FTP = {} |
|
142 | self.__puLocalFolder2FTP = {} | |
143 | self.__enable = False |
|
143 | self.__enable = False | |
144 |
|
144 | |||
145 | # self.create_comm() |
|
145 | # self.create_comm() | |
146 | self.create_updating_timer() |
|
146 | self.create_updating_timer() | |
147 | self.setGUIStatus() |
|
147 | self.setGUIStatus() | |
148 |
|
148 | |||
149 | @pyqtSignature("") |
|
149 | @pyqtSignature("") | |
150 | def on_actionOpen_triggered(self): |
|
150 | def on_actionOpen_triggered(self): | |
151 | """ |
|
151 | """ | |
152 | Slot documentation goes here. |
|
152 | Slot documentation goes here. | |
153 | """ |
|
153 | """ | |
154 | self.openProject() |
|
154 | self.openProject() | |
155 |
|
155 | |||
156 | @pyqtSignature("") |
|
156 | @pyqtSignature("") | |
157 | def on_actionCreate_triggered(self): |
|
157 | def on_actionCreate_triggered(self): | |
158 | """ |
|
158 | """ | |
159 | Slot documentation goes here. |
|
159 | Slot documentation goes here. | |
160 | """ |
|
160 | """ | |
161 | self.setInputsProject_View() |
|
161 | self.setInputsProject_View() | |
162 | self.create = True |
|
162 | self.create = True | |
163 |
|
163 | |||
164 | @pyqtSignature("") |
|
164 | @pyqtSignature("") | |
165 | def on_actionSave_triggered(self): |
|
165 | def on_actionSave_triggered(self): | |
166 | """ |
|
166 | """ | |
167 | Slot documentation goes here. |
|
167 | Slot documentation goes here. | |
168 | """ |
|
168 | """ | |
169 | self.saveProject() |
|
169 | self.saveProject() | |
170 |
|
170 | |||
171 | @pyqtSignature("") |
|
171 | @pyqtSignature("") | |
172 | def on_actionClose_triggered(self): |
|
172 | def on_actionClose_triggered(self): | |
173 | """ |
|
173 | """ | |
174 | Slot documentation goes here. |
|
174 | Slot documentation goes here. | |
175 | """ |
|
175 | """ | |
176 | self.close() |
|
176 | self.close() | |
177 |
|
177 | |||
178 | @pyqtSignature("") |
|
178 | @pyqtSignature("") | |
179 | def on_actionStart_triggered(self): |
|
179 | def on_actionStart_triggered(self): | |
180 | """ |
|
180 | """ | |
181 | """ |
|
181 | """ | |
182 | self.playProject() |
|
182 | self.playProject() | |
183 |
|
183 | |||
184 | @pyqtSignature("") |
|
184 | @pyqtSignature("") | |
185 | def on_actionPause_triggered(self): |
|
185 | def on_actionPause_triggered(self): | |
186 | """ |
|
186 | """ | |
187 | """ |
|
187 | """ | |
188 | self.pauseProject() |
|
188 | self.pauseProject() | |
189 |
|
189 | |||
190 | @pyqtSignature("") |
|
190 | @pyqtSignature("") | |
191 | def on_actionStop_triggered(self): |
|
191 | def on_actionStop_triggered(self): | |
192 | """ |
|
192 | """ | |
193 | """ |
|
193 | """ | |
194 | self.stopProject() |
|
194 | self.stopProject() | |
195 |
|
195 | |||
196 | @pyqtSignature("") |
|
196 | @pyqtSignature("") | |
197 | def on_actionAbout_triggered(self): |
|
197 | def on_actionAbout_triggered(self): | |
198 | """ |
|
198 | """ | |
199 | """ |
|
199 | """ | |
200 | self.aboutEvent() |
|
200 | self.aboutEvent() | |
201 |
|
201 | |||
202 | @pyqtSignature("") |
|
202 | @pyqtSignature("") | |
203 | def on_actionFTP_triggered(self): |
|
203 | def on_actionFTP_triggered(self): | |
204 | """ |
|
204 | """ | |
205 | """ |
|
205 | """ | |
206 | self.configFTPWindowObj = Ftp(self) |
|
206 | self.configFTPWindowObj = Ftp(self) | |
207 |
|
207 | |||
208 | if not self.temporalFTP.create: |
|
208 | if not self.temporalFTP.create: | |
209 | self.temporalFTP.setwithoutconfiguration() |
|
209 | self.temporalFTP.setwithoutconfiguration() | |
210 |
|
210 | |||
211 | self.configFTPWindowObj.setParmsfromTemporal(self.temporalFTP.server, |
|
211 | self.configFTPWindowObj.setParmsfromTemporal(self.temporalFTP.server, | |
212 | self.temporalFTP.remotefolder, |
|
212 | self.temporalFTP.remotefolder, | |
213 | self.temporalFTP.username, |
|
213 | self.temporalFTP.username, | |
214 | self.temporalFTP.password, |
|
214 | self.temporalFTP.password, | |
215 | self.temporalFTP.ftp_wei, |
|
215 | self.temporalFTP.ftp_wei, | |
216 | self.temporalFTP.exp_code, |
|
216 | self.temporalFTP.exp_code, | |
217 | self.temporalFTP.sub_exp_code, |
|
217 | self.temporalFTP.sub_exp_code, | |
218 | self.temporalFTP.plot_pos) |
|
218 | self.temporalFTP.plot_pos) | |
219 |
|
219 | |||
220 | self.configFTPWindowObj.show() |
|
220 | self.configFTPWindowObj.show() | |
221 | self.configFTPWindowObj.closed.connect(self.createFTPConfig) |
|
221 | self.configFTPWindowObj.closed.connect(self.createFTPConfig) | |
222 |
|
222 | |||
223 | def createFTPConfig(self): |
|
223 | def createFTPConfig(self): | |
224 |
|
224 | |||
225 | if not self.configFTPWindowObj.create: |
|
225 | if not self.configFTPWindowObj.create: | |
226 | self.console.clear() |
|
226 | self.console.clear() | |
227 | self.console.append("There is no FTP configuration") |
|
227 | self.console.append("There is no FTP configuration") | |
228 | return |
|
228 | return | |
229 |
|
229 | |||
230 | self.console.append("Push Ok in Spectra view to Add FTP Configuration") |
|
230 | self.console.append("Push Ok in Spectra view to Add FTP Configuration") | |
231 |
|
231 | |||
232 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.configFTPWindowObj.getParmsFromFtpWindow() |
|
232 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.configFTPWindowObj.getParmsFromFtpWindow() | |
233 | self.temporalFTP.save(server=server, |
|
233 | self.temporalFTP.save(server=server, | |
234 | remotefolder=remotefolder, |
|
234 | remotefolder=remotefolder, | |
235 | username=username, |
|
235 | username=username, | |
236 | password=password, |
|
236 | password=password, | |
237 | ftp_wei=ftp_wei, |
|
237 | ftp_wei=ftp_wei, | |
238 | exp_code=exp_code, |
|
238 | exp_code=exp_code, | |
239 | sub_exp_code=sub_exp_code, |
|
239 | sub_exp_code=sub_exp_code, | |
240 | plot_pos=plot_pos) |
|
240 | plot_pos=plot_pos) | |
241 |
|
241 | |||
242 | @pyqtSignature("") |
|
242 | @pyqtSignature("") | |
243 | def on_actionOpenToolbar_triggered(self): |
|
243 | def on_actionOpenToolbar_triggered(self): | |
244 | """ |
|
244 | """ | |
245 | Slot documentation goes here. |
|
245 | Slot documentation goes here. | |
246 | """ |
|
246 | """ | |
247 | self.openProject() |
|
247 | self.openProject() | |
248 |
|
248 | |||
249 | @pyqtSignature("") |
|
249 | @pyqtSignature("") | |
250 | def on_actionCreateToolbar_triggered(self): |
|
250 | def on_actionCreateToolbar_triggered(self): | |
251 | """ |
|
251 | """ | |
252 | Slot documentation goes here. |
|
252 | Slot documentation goes here. | |
253 | """ |
|
253 | """ | |
254 | self.setInputsProject_View() |
|
254 | self.setInputsProject_View() | |
255 | self.create = True |
|
255 | self.create = True | |
256 |
|
256 | |||
257 | @pyqtSignature("") |
|
257 | @pyqtSignature("") | |
258 | def on_actionAddPU_triggered(self): |
|
258 | def on_actionAddPU_triggered(self): | |
259 | if len(self.__projectObjDict) == 0: |
|
259 | if len(self.__projectObjDict) == 0: | |
260 | outputstr = "First Create a Project then add Processing Unit" |
|
260 | outputstr = "First Create a Project then add Processing Unit" | |
261 | self.console.clear() |
|
261 | self.console.clear() | |
262 | self.console.append(outputstr) |
|
262 | self.console.append(outputstr) | |
263 | return 0 |
|
263 | return 0 | |
264 | else: |
|
264 | else: | |
265 | self.addPUWindow() |
|
265 | self.addPUWindow() | |
266 | self.console.clear() |
|
266 | self.console.clear() | |
267 | self.console.append("Please, Choose the type of Processing Unit") |
|
267 | self.console.append("Please, Choose the type of Processing Unit") | |
268 | self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") |
|
268 | self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") | |
269 | self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") |
|
269 | self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") | |
270 | self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") |
|
270 | self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") | |
271 |
|
271 | |||
272 |
|
272 | |||
273 | @pyqtSignature("") |
|
273 | @pyqtSignature("") | |
274 | def on_actionSaveToolbar_triggered(self): |
|
274 | def on_actionSaveToolbar_triggered(self): | |
275 | """ |
|
275 | """ | |
276 | Slot documentation goes here. |
|
276 | Slot documentation goes here. | |
277 | """ |
|
277 | """ | |
278 | self.saveProject() |
|
278 | self.saveProject() | |
279 |
|
279 | |||
280 | @pyqtSignature("") |
|
280 | @pyqtSignature("") | |
281 | def on_actionStarToolbar_triggered(self): |
|
281 | def on_actionStarToolbar_triggered(self): | |
282 | """ |
|
282 | """ | |
283 | Slot documentation goes here. |
|
283 | Slot documentation goes here. | |
284 | """ |
|
284 | """ | |
285 | self.playProject() |
|
285 | self.playProject() | |
286 |
|
286 | |||
287 | @pyqtSignature("") |
|
287 | @pyqtSignature("") | |
288 | def on_actionPauseToolbar_triggered(self): |
|
288 | def on_actionPauseToolbar_triggered(self): | |
289 |
|
289 | |||
290 | self.pauseProject() |
|
290 | self.pauseProject() | |
291 |
|
291 | |||
292 | @pyqtSignature("") |
|
292 | @pyqtSignature("") | |
293 | def on_actionStopToolbar_triggered(self): |
|
293 | def on_actionStopToolbar_triggered(self): | |
294 | """ |
|
294 | """ | |
295 | Slot documentation goes here. |
|
295 | Slot documentation goes here. | |
296 | """ |
|
296 | """ | |
297 | self.stopProject() |
|
297 | self.stopProject() | |
298 |
|
298 | |||
299 | @pyqtSignature("int") |
|
299 | @pyqtSignature("int") | |
300 | def on_proComReadMode_activated(self, index): |
|
300 | def on_proComReadMode_activated(self, index): | |
301 | """ |
|
301 | """ | |
302 | SELECCION DEL MODO DE LECTURA ON=1, OFF=0 |
|
302 | SELECCION DEL MODO DE LECTURA ON=1, OFF=0 | |
303 | """ |
|
303 | """ | |
304 | if index == 0: |
|
304 | if index == 0: | |
305 | self.online = 0 |
|
305 | self.online = 0 | |
306 | self.proDelay.setText("0") |
|
306 | self.proDelay.setText("0") | |
307 | self.proSet.setText("") |
|
307 | self.proSet.setText("") | |
308 | self.proSet.setEnabled(False) |
|
308 | self.proSet.setEnabled(False) | |
309 | self.proDelay.setEnabled(False) |
|
309 | self.proDelay.setEnabled(False) | |
310 | elif index == 1: |
|
310 | elif index == 1: | |
311 | self.online = 1 |
|
311 | self.online = 1 | |
312 | self.proSet.setText("") |
|
312 | self.proSet.setText("") | |
313 | self.proDelay.setText("5") |
|
313 | self.proDelay.setText("5") | |
314 | self.proSet.setEnabled(True) |
|
314 | self.proSet.setEnabled(True) | |
315 | self.proDelay.setEnabled(True) |
|
315 | self.proDelay.setEnabled(True) | |
316 |
|
316 | |||
317 | @pyqtSignature("int") |
|
317 | @pyqtSignature("int") | |
318 | def on_proComDataType_activated(self, index): |
|
318 | def on_proComDataType_activated(self, index): | |
319 | """ |
|
319 | """ | |
320 | Voltage or Spectra |
|
320 | Voltage or Spectra | |
321 | """ |
|
321 | """ | |
322 | self.labelSet.show() |
|
322 | self.labelSet.show() | |
323 | self.proSet.show() |
|
323 | self.proSet.show() | |
324 |
|
324 | |||
325 | self.labExpLabel.show() |
|
325 | self.labExpLabel.show() | |
326 | self.proExpLabel.show() |
|
326 | self.proExpLabel.show() | |
327 |
|
327 | |||
328 | self.labelIPPKm.hide() |
|
328 | self.labelIPPKm.hide() | |
329 | self.proIPPKm.hide() |
|
329 | self.proIPPKm.hide() | |
330 |
|
330 | |||
331 | if index == 0: |
|
331 | if index == 0: | |
332 | extension = '.r' |
|
332 | extension = '.r' | |
333 | elif index == 1: |
|
333 | elif index == 1: | |
334 | extension = '.pdata' |
|
334 | extension = '.pdata' | |
335 | elif index == 2: |
|
335 | elif index == 2: | |
336 | extension = '.fits' |
|
336 | extension = '.fits' | |
337 | elif index == 3: |
|
337 | elif index == 3: | |
338 | extension = '.hdf5' |
|
338 | extension = '.hdf5' | |
339 |
|
339 | |||
340 | self.labelIPPKm.show() |
|
340 | self.labelIPPKm.show() | |
341 | self.proIPPKm.show() |
|
341 | self.proIPPKm.show() | |
342 |
|
342 | |||
343 | self.labelSet.hide() |
|
343 | self.labelSet.hide() | |
344 | self.proSet.hide() |
|
344 | self.proSet.hide() | |
345 |
|
345 | |||
346 | self.labExpLabel.hide() |
|
346 | self.labExpLabel.hide() | |
347 | self.proExpLabel.hide() |
|
347 | self.proExpLabel.hide() | |
348 |
|
348 | |||
349 | self.proDataType.setText(extension) |
|
349 | self.proDataType.setText(extension) | |
350 |
|
350 | |||
351 | @pyqtSignature("int") |
|
351 | @pyqtSignature("int") | |
352 | def on_proComWalk_activated(self, index): |
|
352 | def on_proComWalk_activated(self, index): | |
353 | """ |
|
353 | """ | |
354 |
|
354 | |||
355 | """ |
|
355 | """ | |
356 | if index == 0: |
|
356 | if index == 0: | |
357 | self.walk = 0 |
|
357 | self.walk = 0 | |
358 | elif index == 1: |
|
358 | elif index == 1: | |
359 | self.walk = 1 |
|
359 | self.walk = 1 | |
360 |
|
360 | |||
361 | @pyqtSignature("") |
|
361 | @pyqtSignature("") | |
362 | def on_proToolPath_clicked(self): |
|
362 | def on_proToolPath_clicked(self): | |
363 | """ |
|
363 | """ | |
364 | Choose your path |
|
364 | Choose your path | |
365 | """ |
|
365 | """ | |
366 |
|
366 | |||
367 | current_dpath = './' |
|
367 | current_dpath = './' | |
368 | if self.dataPath: |
|
368 | if self.dataPath: | |
369 | current_dpath = self.dataPath |
|
369 | current_dpath = self.dataPath | |
370 |
|
370 | |||
371 | datapath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', current_dpath, QtGui.QFileDialog.ShowDirsOnly)) |
|
371 | datapath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', current_dpath, QtGui.QFileDialog.ShowDirsOnly)) | |
372 |
|
372 | |||
373 | #If it was canceled |
|
373 | #If it was canceled | |
374 | if not datapath: |
|
374 | if not datapath: | |
375 | return |
|
375 | return | |
376 |
|
376 | |||
377 | #If any change was done |
|
377 | #If any change was done | |
378 | if datapath == self.dataPath: |
|
378 | if datapath == self.dataPath: | |
379 | return |
|
379 | return | |
380 |
|
380 | |||
381 | self.proDataPath.setText(datapath) |
|
381 | self.proDataPath.setText(datapath) | |
382 |
|
382 | |||
383 | self.actionStart.setEnabled(False) |
|
383 | self.actionStart.setEnabled(False) | |
384 | self.actionStarToolbar.setEnabled(False) |
|
384 | self.actionStarToolbar.setEnabled(False) | |
385 | self.proOk.setEnabled(False) |
|
385 | self.proOk.setEnabled(False) | |
386 |
|
386 | |||
387 | self.proComStartDate.clear() |
|
387 | self.proComStartDate.clear() | |
388 | self.proComEndDate.clear() |
|
388 | self.proComEndDate.clear() | |
389 |
|
389 | |||
390 | if not os.path.exists(datapath): |
|
390 | if not os.path.exists(datapath): | |
391 |
|
391 | |||
392 | self.console.clear() |
|
392 | self.console.clear() | |
393 | self.console.append("Write a valid path") |
|
393 | self.console.append("Write a valid path") | |
394 | return |
|
394 | return | |
395 |
|
395 | |||
396 | self.dataPath = datapath |
|
396 | self.dataPath = datapath | |
397 |
|
397 | |||
398 | self.console.clear() |
|
398 | self.console.clear() | |
399 | self.console.append("Select the read mode and press 'load button'") |
|
399 | self.console.append("Select the read mode and press 'load button'") | |
400 |
|
400 | |||
401 |
|
401 | |||
402 | @pyqtSignature("") |
|
402 | @pyqtSignature("") | |
403 | def on_proLoadButton_clicked(self): |
|
403 | def on_proLoadButton_clicked(self): | |
404 |
|
404 | |||
405 | self.console.clear() |
|
405 | self.console.clear() | |
406 |
|
406 | |||
407 | # if not self.getSelectedProjectObj(): |
|
407 | # if not self.getSelectedProjectObj(): | |
408 | # self.console.append("Please select a project before load files") |
|
408 | # self.console.append("Please select a project before load files") | |
409 | # return |
|
409 | # return | |
410 |
|
410 | |||
411 | parameter_list = self.checkInputsProject() |
|
411 | parameter_list = self.checkInputsProject() | |
412 |
|
412 | |||
413 | if not parameter_list[0]: |
|
413 | if not parameter_list[0]: | |
414 | return |
|
414 | return | |
415 |
|
415 | |||
416 | parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set, expLabel = parameter_list |
|
416 | parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set, expLabel = parameter_list | |
417 |
|
417 | |||
418 | if read_mode == "Offline": |
|
418 | if read_mode == "Offline": | |
419 | self.proComStartDate.clear() |
|
419 | self.proComStartDate.clear() | |
420 | self.proComEndDate.clear() |
|
420 | self.proComEndDate.clear() | |
421 | self.proComStartDate.setEnabled(True) |
|
421 | self.proComStartDate.setEnabled(True) | |
422 | self.proComEndDate.setEnabled(True) |
|
422 | self.proComEndDate.setEnabled(True) | |
423 | self.proStartTime.setEnabled(True) |
|
423 | self.proStartTime.setEnabled(True) | |
424 | self.proEndTime.setEnabled(True) |
|
424 | self.proEndTime.setEnabled(True) | |
425 | self.frame_2.setEnabled(True) |
|
425 | self.frame_2.setEnabled(True) | |
426 |
|
426 | |||
427 | if read_mode == "Online": |
|
427 | if read_mode == "Online": | |
428 | self.proComStartDate.addItem("1960/01/30") |
|
428 | self.proComStartDate.addItem("1960/01/30") | |
429 | self.proComEndDate.addItem("2018/12/31") |
|
429 | self.proComEndDate.addItem("2018/12/31") | |
430 | self.proComStartDate.setEnabled(False) |
|
430 | self.proComStartDate.setEnabled(False) | |
431 | self.proComEndDate.setEnabled(False) |
|
431 | self.proComEndDate.setEnabled(False) | |
432 | self.proStartTime.setEnabled(False) |
|
432 | self.proStartTime.setEnabled(False) | |
433 | self.proEndTime.setEnabled(False) |
|
433 | self.proEndTime.setEnabled(False) | |
434 | self.frame_2.setEnabled(True) |
|
434 | self.frame_2.setEnabled(True) | |
435 |
|
435 | |||
436 | self.loadDays(data_path, ext, walk, expLabel) |
|
436 | self.loadDays(data_path, ext, walk, expLabel) | |
437 |
|
437 | |||
438 | @pyqtSignature("int") |
|
438 | @pyqtSignature("int") | |
439 | def on_proComStartDate_activated(self, index): |
|
439 | def on_proComStartDate_activated(self, index): | |
440 | """ |
|
440 | """ | |
441 | SELECCION DEL RANGO DE FECHAS -START DATE |
|
441 | SELECCION DEL RANGO DE FECHAS -START DATE | |
442 | """ |
|
442 | """ | |
443 | stopIndex = self.proComEndDate.count() - self.proComEndDate.currentIndex() - 1 |
|
443 | stopIndex = self.proComEndDate.count() - self.proComEndDate.currentIndex() - 1 | |
444 |
|
444 | |||
445 | self.proComEndDate.clear() |
|
445 | self.proComEndDate.clear() | |
446 | for i in self.dateList[index:]: |
|
446 | for i in self.dateList[index:]: | |
447 | self.proComEndDate.addItem(i) |
|
447 | self.proComEndDate.addItem(i) | |
448 |
|
448 | |||
449 | if self.proComEndDate.count() - stopIndex - 1 >= 0: |
|
449 | if self.proComEndDate.count() - stopIndex - 1 >= 0: | |
450 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - stopIndex - 1) |
|
450 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - stopIndex - 1) | |
451 | else: |
|
451 | else: | |
452 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - 1) |
|
452 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - 1) | |
453 |
|
453 | |||
454 | @pyqtSignature("int") |
|
454 | @pyqtSignature("int") | |
455 | def on_proComEndDate_activated(self, index): |
|
455 | def on_proComEndDate_activated(self, index): | |
456 | """ |
|
456 | """ | |
457 | SELECCION DEL RANGO DE FECHAS-END DATE |
|
457 | SELECCION DEL RANGO DE FECHAS-END DATE | |
458 | """ |
|
458 | """ | |
459 | pass |
|
459 | pass | |
460 |
|
460 | |||
461 | @pyqtSignature("") |
|
461 | @pyqtSignature("") | |
462 | def on_proOk_clicked(self): |
|
462 | def on_proOk_clicked(self): | |
463 | """ |
|
463 | """ | |
464 | AΓ±ade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml. |
|
464 | AΓ±ade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml. | |
465 | Prepara la configuraciΓ³n del diΓ‘grama del Arbol del treeView numero 2 |
|
465 | Prepara la configuraciΓ³n del diΓ‘grama del Arbol del treeView numero 2 | |
466 | """ |
|
466 | """ | |
467 |
|
467 | |||
468 | self.actionStart.setEnabled(False) |
|
468 | self.actionStart.setEnabled(False) | |
469 | self.actionStarToolbar.setEnabled(False) |
|
469 | self.actionStarToolbar.setEnabled(False) | |
470 |
|
470 | |||
471 | self.console.clear() |
|
471 | self.console.clear() | |
472 |
|
472 | |||
473 | if self.create: |
|
473 | if self.create: | |
474 |
|
474 | |||
475 | projectId = self.__getNewProjectId() |
|
475 | projectId = self.__getNewProjectId() | |
476 |
|
476 | |||
477 | if not projectId: |
|
477 | if not projectId: | |
478 | return 0 |
|
478 | return 0 | |
479 |
|
479 | |||
480 | projectObjView = self.createProjectView(projectId) |
|
480 | projectObjView = self.createProjectView(projectId) | |
481 |
|
481 | |||
482 | if not projectObjView: |
|
482 | if not projectObjView: | |
483 | return 0 |
|
483 | return 0 | |
484 |
|
484 | |||
485 | self.create = False |
|
485 | self.create = False | |
486 |
|
486 | |||
487 | readUnitObj = self.createReadUnitView(projectObjView) |
|
487 | readUnitObj = self.createReadUnitView(projectObjView) | |
488 |
|
488 | |||
489 | if not readUnitObj: |
|
489 | if not readUnitObj: | |
490 | return 0 |
|
490 | return 0 | |
491 |
|
491 | |||
492 | else: |
|
492 | else: | |
493 | projectObjView = self.updateProjectView() |
|
493 | projectObjView = self.updateProjectView() | |
494 |
|
494 | |||
495 | if not projectObjView: |
|
495 | if not projectObjView: | |
496 | return 0 |
|
496 | return 0 | |
497 |
|
497 | |||
498 | projectId = projectObjView.getId() |
|
498 | projectId = projectObjView.getId() | |
499 | idReadUnit = projectObjView.getReadUnitId() |
|
499 | idReadUnit = projectObjView.getReadUnitId() | |
500 | readUnitObj = self.updateReadUnitView(projectObjView, idReadUnit) |
|
500 | readUnitObj = self.updateReadUnitView(projectObjView, idReadUnit) | |
501 |
|
501 | |||
502 | if not readUnitObj: |
|
502 | if not readUnitObj: | |
503 | return 0 |
|
503 | return 0 | |
504 |
|
504 | |||
505 | self.__itemTreeDict[projectId].setText(projectObjView.name) |
|
505 | self.__itemTreeDict[projectId].setText(projectObjView.name) | |
506 | # Project Properties |
|
506 | # Project Properties | |
507 | self.refreshProjectProperties(projectObjView) |
|
507 | self.refreshProjectProperties(projectObjView) | |
508 | # Disable tabProject after finish the creation |
|
508 | # Disable tabProject after finish the creation | |
509 |
|
509 | |||
510 | self.actionStart.setEnabled(True) |
|
510 | self.actionStart.setEnabled(True) | |
511 | self.actionStarToolbar.setEnabled(True) |
|
511 | self.actionStarToolbar.setEnabled(True) | |
512 | self.console.clear() |
|
512 | self.console.clear() | |
513 | self.console.append("The project parameters were validated") |
|
513 | self.console.append("The project parameters were validated") | |
514 |
|
514 | |||
515 | return 1 |
|
515 | return 1 | |
516 |
|
516 | |||
517 | @pyqtSignature("") |
|
517 | @pyqtSignature("") | |
518 | def on_proClear_clicked(self): |
|
518 | def on_proClear_clicked(self): | |
519 |
|
519 | |||
520 | self.console.clear() |
|
520 | self.console.clear() | |
521 |
|
521 | |||
522 | @pyqtSignature("int") |
|
522 | @pyqtSignature("int") | |
523 | def on_volOpCebChannels_stateChanged(self, p0): |
|
523 | def on_volOpCebChannels_stateChanged(self, p0): | |
524 | """ |
|
524 | """ | |
525 | Check Box habilita operaciones de SelecciοΏ½n de Canales |
|
525 | Check Box habilita operaciones de SelecciοΏ½n de Canales | |
526 | """ |
|
526 | """ | |
527 | if p0 == 2: |
|
527 | if p0 == 2: | |
528 | self.volOpComChannels.setEnabled(True) |
|
528 | self.volOpComChannels.setEnabled(True) | |
529 | self.volOpChannel.setEnabled(True) |
|
529 | self.volOpChannel.setEnabled(True) | |
530 |
|
530 | |||
531 | if p0 == 0: |
|
531 | if p0 == 0: | |
532 | self.volOpComChannels.setEnabled(False) |
|
532 | self.volOpComChannels.setEnabled(False) | |
533 | self.volOpChannel.setEnabled(False) |
|
533 | self.volOpChannel.setEnabled(False) | |
534 | self.volOpChannel.clear() |
|
534 | self.volOpChannel.clear() | |
535 |
|
535 | |||
536 | @pyqtSignature("int") |
|
536 | @pyqtSignature("int") | |
537 | def on_volOpCebHeights_stateChanged(self, p0): |
|
537 | def on_volOpCebHeights_stateChanged(self, p0): | |
538 | """ |
|
538 | """ | |
539 | Check Box habilita operaciones de SelecciοΏ½n de Alturas |
|
539 | Check Box habilita operaciones de SelecciοΏ½n de Alturas | |
540 | """ |
|
540 | """ | |
541 | if p0 == 2: |
|
541 | if p0 == 2: | |
542 | self.volOpHeights.setEnabled(True) |
|
542 | self.volOpHeights.setEnabled(True) | |
543 | self.volOpComHeights.setEnabled(True) |
|
543 | self.volOpComHeights.setEnabled(True) | |
544 |
|
544 | |||
545 | if p0 == 0: |
|
545 | if p0 == 0: | |
546 | self.volOpHeights.setEnabled(False) |
|
546 | self.volOpHeights.setEnabled(False) | |
547 | self.volOpHeights.clear() |
|
547 | self.volOpHeights.clear() | |
548 | self.volOpComHeights.setEnabled(False) |
|
548 | self.volOpComHeights.setEnabled(False) | |
549 |
|
549 | |||
550 | @pyqtSignature("int") |
|
550 | @pyqtSignature("int") | |
551 | def on_volOpCebFilter_stateChanged(self, p0): |
|
551 | def on_volOpCebFilter_stateChanged(self, p0): | |
552 | """ |
|
552 | """ | |
553 | Name='Decoder', optype='other' |
|
553 | Name='Decoder', optype='other' | |
554 | """ |
|
554 | """ | |
555 | if p0 == 2: |
|
555 | if p0 == 2: | |
556 | self.volOpFilter.setEnabled(True) |
|
556 | self.volOpFilter.setEnabled(True) | |
557 |
|
557 | |||
558 | if p0 == 0: |
|
558 | if p0 == 0: | |
559 | self.volOpFilter.setEnabled(False) |
|
559 | self.volOpFilter.setEnabled(False) | |
560 | self.volOpFilter.clear() |
|
560 | self.volOpFilter.clear() | |
561 |
|
561 | |||
562 | @pyqtSignature("int") |
|
562 | @pyqtSignature("int") | |
563 | def on_volOpCebProfile_stateChanged(self, p0): |
|
563 | def on_volOpCebProfile_stateChanged(self, p0): | |
564 | """ |
|
564 | """ | |
565 | Check Box habilita ingreso del rango de Perfiles |
|
565 | Check Box habilita ingreso del rango de Perfiles | |
566 | """ |
|
566 | """ | |
567 | if p0 == 2: |
|
567 | if p0 == 2: | |
568 | self.volOpComProfile.setEnabled(True) |
|
568 | self.volOpComProfile.setEnabled(True) | |
569 | self.volOpProfile.setEnabled(True) |
|
569 | self.volOpProfile.setEnabled(True) | |
570 |
|
570 | |||
571 | if p0 == 0: |
|
571 | if p0 == 0: | |
572 | self.volOpComProfile.setEnabled(False) |
|
572 | self.volOpComProfile.setEnabled(False) | |
573 | self.volOpProfile.setEnabled(False) |
|
573 | self.volOpProfile.setEnabled(False) | |
574 | self.volOpProfile.clear() |
|
574 | self.volOpProfile.clear() | |
575 |
|
575 | |||
576 | @pyqtSignature("int") |
|
576 | @pyqtSignature("int") | |
577 | def on_volOpComProfile_activated(self, index): |
|
577 | def on_volOpComProfile_activated(self, index): | |
578 | """ |
|
578 | """ | |
579 | Check Box habilita ingreso del rango de Perfiles |
|
579 | Check Box habilita ingreso del rango de Perfiles | |
580 | """ |
|
580 | """ | |
581 | #Profile List |
|
581 | #Profile List | |
582 | if index == 0: |
|
582 | if index == 0: | |
583 | self.volOpProfile.setToolTip('List of selected profiles. Example: 0, 1, 2, 3, 4, 5, 6, 7') |
|
583 | self.volOpProfile.setToolTip('List of selected profiles. Example: 0, 1, 2, 3, 4, 5, 6, 7') | |
584 |
|
584 | |||
585 | #Profile Range |
|
585 | #Profile Range | |
586 | if index == 1: |
|
586 | if index == 1: | |
587 | self.volOpProfile.setToolTip('Minimum and maximum profile index. Example: 0, 7') |
|
587 | self.volOpProfile.setToolTip('Minimum and maximum profile index. Example: 0, 7') | |
588 |
|
588 | |||
589 | #Profile Range List |
|
589 | #Profile Range List | |
590 | if index == 2: |
|
590 | if index == 2: | |
591 | self.volOpProfile.setToolTip('List of profile ranges. Example: (0, 7), (12, 19), (100, 200)') |
|
591 | self.volOpProfile.setToolTip('List of profile ranges. Example: (0, 7), (12, 19), (100, 200)') | |
592 |
|
592 | |||
593 | @pyqtSignature("int") |
|
593 | @pyqtSignature("int") | |
594 | def on_volOpCebDecodification_stateChanged(self, p0): |
|
594 | def on_volOpCebDecodification_stateChanged(self, p0): | |
595 | """ |
|
595 | """ | |
596 | Check Box habilita |
|
596 | Check Box habilita | |
597 | """ |
|
597 | """ | |
598 | if p0 == 2: |
|
598 | if p0 == 2: | |
599 | self.volOpComCode.setEnabled(True) |
|
599 | self.volOpComCode.setEnabled(True) | |
600 | self.volOpComMode.setEnabled(True) |
|
600 | self.volOpComMode.setEnabled(True) | |
601 | if p0 == 0: |
|
601 | if p0 == 0: | |
602 | self.volOpComCode.setEnabled(False) |
|
602 | self.volOpComCode.setEnabled(False) | |
603 | self.volOpComMode.setEnabled(False) |
|
603 | self.volOpComMode.setEnabled(False) | |
604 |
|
604 | |||
605 | @pyqtSignature("int") |
|
605 | @pyqtSignature("int") | |
606 | def on_volOpComCode_activated(self, index): |
|
606 | def on_volOpComCode_activated(self, index): | |
607 | """ |
|
607 | """ | |
608 | Check Box habilita ingreso |
|
608 | Check Box habilita ingreso | |
609 | """ |
|
609 | """ | |
610 | if index == 13: |
|
610 | if index == 13: | |
611 | self.volOpCode.setEnabled(True) |
|
611 | self.volOpCode.setEnabled(True) | |
612 | else: |
|
612 | else: | |
613 | self.volOpCode.setEnabled(False) |
|
613 | self.volOpCode.setEnabled(False) | |
614 |
|
614 | |||
615 | if index == 0: |
|
615 | if index == 0: | |
616 | code = '' |
|
616 | code = '' | |
617 | self.volOpCode.setText(str(code)) |
|
617 | self.volOpCode.setText(str(code)) | |
618 | return |
|
618 | return | |
619 |
|
619 | |||
620 | if index == 1: |
|
620 | if index == 1: | |
621 | code = '(1,1,-1)' |
|
621 | code = '(1,1,-1)' | |
622 | nCode = '1' |
|
622 | nCode = '1' | |
623 | nBaud = '3' |
|
623 | nBaud = '3' | |
624 | if index == 2: |
|
624 | if index == 2: | |
625 | code = '(1,1,-1,1)' |
|
625 | code = '(1,1,-1,1)' | |
626 | nCode = '1' |
|
626 | nCode = '1' | |
627 | nBaud = '4' |
|
627 | nBaud = '4' | |
628 | if index == 3: |
|
628 | if index == 3: | |
629 | code = '(1,1,1,-1,1)' |
|
629 | code = '(1,1,1,-1,1)' | |
630 | nCode = '1' |
|
630 | nCode = '1' | |
631 | nBaud = '5' |
|
631 | nBaud = '5' | |
632 | if index == 4: |
|
632 | if index == 4: | |
633 | code = '(1,1,1,-1,-1,1,-1)' |
|
633 | code = '(1,1,1,-1,-1,1,-1)' | |
634 | nCode = '1' |
|
634 | nCode = '1' | |
635 | nBaud = '7' |
|
635 | nBaud = '7' | |
636 | if index == 5: |
|
636 | if index == 5: | |
637 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1)' |
|
637 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1)' | |
638 | nCode = '1' |
|
638 | nCode = '1' | |
639 | nBaud = '11' |
|
639 | nBaud = '11' | |
640 | if index == 6: |
|
640 | if index == 6: | |
641 | code = '(1,1,1,1,1,-1,-1,1,1,-1,1,-1,1)' |
|
641 | code = '(1,1,1,1,1,-1,-1,1,1,-1,1,-1,1)' | |
642 | nCode = '1' |
|
642 | nCode = '1' | |
643 | nBaud = '13' |
|
643 | nBaud = '13' | |
644 | if index == 7: |
|
644 | if index == 7: | |
645 | code = '(1,1,-1,-1,-1,1)' |
|
645 | code = '(1,1,-1,-1,-1,1)' | |
646 | nCode = '2' |
|
646 | nCode = '2' | |
647 | nBaud = '3' |
|
647 | nBaud = '3' | |
648 | if index == 8: |
|
648 | if index == 8: | |
649 | code = '(1,1,-1,1,-1,-1,1,-1)' |
|
649 | code = '(1,1,-1,1,-1,-1,1,-1)' | |
650 | nCode = '2' |
|
650 | nCode = '2' | |
651 | nBaud = '4' |
|
651 | nBaud = '4' | |
652 | if index == 9: |
|
652 | if index == 9: | |
653 | code = '(1,1,1,-1,1,-1,-1,-1,1,-1)' |
|
653 | code = '(1,1,1,-1,1,-1,-1,-1,1,-1)' | |
654 | nCode = '2' |
|
654 | nCode = '2' | |
655 | nBaud = '5' |
|
655 | nBaud = '5' | |
656 | if index == 10: |
|
656 | if index == 10: | |
657 | code = '(1,1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1)' |
|
657 | code = '(1,1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1)' | |
658 | nCode = '2' |
|
658 | nCode = '2' | |
659 | nBaud = '7' |
|
659 | nBaud = '7' | |
660 | if index == 11: |
|
660 | if index == 11: | |
661 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1 ,-1 ,-1 ,1 ,1,1,-1 ,1 ,1 ,-1 ,1)' |
|
661 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1 ,-1 ,-1 ,1 ,1,1,-1 ,1 ,1 ,-1 ,1)' | |
662 | nCode = '2' |
|
662 | nCode = '2' | |
663 | nBaud = '11' |
|
663 | nBaud = '11' | |
664 | if index == 12: |
|
664 | if index == 12: | |
665 | code = '(1,1,1,1,1,-1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1)' |
|
665 | code = '(1,1,1,1,1,-1,-1,1,1,-1,1,-1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,1,-1)' | |
666 | nCode = '2' |
|
666 | nCode = '2' | |
667 | nBaud = '13' |
|
667 | nBaud = '13' | |
668 |
|
668 | |||
669 | code = ast.literal_eval(code) |
|
669 | code = ast.literal_eval(code) | |
670 | nCode = int(nCode) |
|
670 | nCode = int(nCode) | |
671 | nBaud = int(nBaud) |
|
671 | nBaud = int(nBaud) | |
672 |
|
672 | |||
673 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() |
|
673 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() | |
674 |
|
674 | |||
675 | self.volOpCode.setText(str(code)) |
|
675 | self.volOpCode.setText(str(code)) | |
676 |
|
676 | |||
677 | @pyqtSignature("int") |
|
677 | @pyqtSignature("int") | |
678 | def on_volOpCebFlip_stateChanged(self, p0): |
|
678 | def on_volOpCebFlip_stateChanged(self, p0): | |
679 | """ |
|
679 | """ | |
680 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
680 | Check Box habilita ingresode del numero de Integraciones a realizar | |
681 | """ |
|
681 | """ | |
682 | if p0 == 2: |
|
682 | if p0 == 2: | |
683 | self.volOpFlip.setEnabled(True) |
|
683 | self.volOpFlip.setEnabled(True) | |
684 | if p0 == 0: |
|
684 | if p0 == 0: | |
685 | self.volOpFlip.setEnabled(False) |
|
685 | self.volOpFlip.setEnabled(False) | |
686 | self.volOpFlip.clear() |
|
686 | self.volOpFlip.clear() | |
687 |
|
687 | |||
688 | @pyqtSignature("int") |
|
688 | @pyqtSignature("int") | |
689 | def on_volOpCebCohInt_stateChanged(self, p0): |
|
689 | def on_volOpCebCohInt_stateChanged(self, p0): | |
690 | """ |
|
690 | """ | |
691 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
691 | Check Box habilita ingresode del numero de Integraciones a realizar | |
692 | """ |
|
692 | """ | |
693 | if p0 == 2: |
|
693 | if p0 == 2: | |
694 | self.volOpCohInt.setEnabled(True) |
|
694 | self.volOpCohInt.setEnabled(True) | |
695 | if p0 == 0: |
|
695 | if p0 == 0: | |
696 | self.volOpCohInt.setEnabled(False) |
|
696 | self.volOpCohInt.setEnabled(False) | |
697 | self.volOpCohInt.clear() |
|
697 | self.volOpCohInt.clear() | |
698 |
|
698 | |||
699 | @pyqtSignature("int") |
|
699 | @pyqtSignature("int") | |
700 | def on_volOpCebRadarfrequency_stateChanged(self, p0): |
|
700 | def on_volOpCebRadarfrequency_stateChanged(self, p0): | |
701 | """ |
|
701 | """ | |
702 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
702 | Check Box habilita ingresode del numero de Integraciones a realizar | |
703 | """ |
|
703 | """ | |
704 | if p0 == 2: |
|
704 | if p0 == 2: | |
705 | self.volOpRadarfrequency.setEnabled(True) |
|
705 | self.volOpRadarfrequency.setEnabled(True) | |
706 | if p0 == 0: |
|
706 | if p0 == 0: | |
707 | self.volOpRadarfrequency.clear() |
|
707 | self.volOpRadarfrequency.clear() | |
708 | self.volOpRadarfrequency.setEnabled(False) |
|
708 | self.volOpRadarfrequency.setEnabled(False) | |
709 |
|
709 | |||
710 | @pyqtSignature("") |
|
710 | @pyqtSignature("") | |
711 | def on_volOutputToolPath_clicked(self): |
|
711 | def on_volOutputToolPath_clicked(self): | |
712 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
712 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
713 | self.volOutputPath.setText(dirOutPath) |
|
713 | self.volOutputPath.setText(dirOutPath) | |
714 |
|
714 | |||
715 | @pyqtSignature("") |
|
715 | @pyqtSignature("") | |
716 | def on_specOutputToolPath_clicked(self): |
|
716 | def on_specOutputToolPath_clicked(self): | |
717 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
717 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
718 | self.specOutputPath.setText(dirOutPath) |
|
718 | self.specOutputPath.setText(dirOutPath) | |
719 |
|
719 | |||
720 | @pyqtSignature("") |
|
720 | @pyqtSignature("") | |
721 | def on_specHeisOutputToolPath_clicked(self): |
|
721 | def on_specHeisOutputToolPath_clicked(self): | |
722 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
722 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
723 | self.specHeisOutputPath.setText(dirOutPath) |
|
723 | self.specHeisOutputPath.setText(dirOutPath) | |
724 |
|
724 | |||
725 | @pyqtSignature("") |
|
725 | @pyqtSignature("") | |
726 | def on_specHeisOutputMetadaToolPath_clicked(self): |
|
726 | def on_specHeisOutputMetadaToolPath_clicked(self): | |
727 |
|
727 | |||
728 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) |
|
728 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) | |
729 | self.specHeisOutputMetada.setText(filename) |
|
729 | self.specHeisOutputMetada.setText(filename) | |
730 |
|
730 | |||
731 | @pyqtSignature("") |
|
731 | @pyqtSignature("") | |
732 | def on_volOpOk_clicked(self): |
|
732 | def on_volOpOk_clicked(self): | |
733 | """ |
|
733 | """ | |
734 | BUSCA EN LA LISTA DE OPERACIONES DEL TIPO VOLTAJE Y LES AοΏ½ADE EL PARAMETRO ADECUADO ESPERANDO LA ACEPTACION DEL USUARIO |
|
734 | BUSCA EN LA LISTA DE OPERACIONES DEL TIPO VOLTAJE Y LES AοΏ½ADE EL PARAMETRO ADECUADO ESPERANDO LA ACEPTACION DEL USUARIO | |
735 | PARA AGREGARLO AL ARCHIVO DE CONFIGURACION XML |
|
735 | PARA AGREGARLO AL ARCHIVO DE CONFIGURACION XML | |
736 | """ |
|
736 | """ | |
737 |
|
737 | |||
738 | checkPath = False |
|
738 | checkPath = False | |
739 |
|
739 | |||
740 | self.actionSaveToolbar.setEnabled(False) |
|
740 | self.actionSaveToolbar.setEnabled(False) | |
741 | self.actionStarToolbar.setEnabled(False) |
|
741 | self.actionStarToolbar.setEnabled(False) | |
742 |
|
742 | |||
743 | self.console.clear() |
|
743 | self.console.clear() | |
744 | self.console.append("Checking input parameters ...") |
|
744 | self.console.append("Checking input parameters ...") | |
745 |
|
745 | |||
746 | puObj = self.getSelectedItemObj() |
|
746 | puObj = self.getSelectedItemObj() | |
747 | puObj.removeOperations() |
|
747 | puObj.removeOperations() | |
748 |
|
748 | |||
749 | if self.volOpCebRadarfrequency.isChecked(): |
|
749 | if self.volOpCebRadarfrequency.isChecked(): | |
750 | value = str(self.volOpRadarfrequency.text()) |
|
750 | value = str(self.volOpRadarfrequency.text()) | |
751 | format = 'float' |
|
751 | format = 'float' | |
752 | name_operation = 'setRadarFrequency' |
|
752 | name_operation = 'setRadarFrequency' | |
753 | name_parameter = 'frequency' |
|
753 | name_parameter = 'frequency' | |
754 | if not value == "": |
|
754 | if not value == "": | |
755 | try: |
|
755 | try: | |
756 | radarfreq = float(self.volOpRadarfrequency.text())*1e6 |
|
756 | radarfreq = float(self.volOpRadarfrequency.text())*1e6 | |
757 | except: |
|
757 | except: | |
758 | self.console.clear() |
|
758 | self.console.clear() | |
759 | self.console.append("Invalid value '%s' for Radar Frequency" %value) |
|
759 | self.console.append("Invalid value '%s' for Radar Frequency" %value) | |
760 | return 0 |
|
760 | return 0 | |
761 |
|
761 | |||
762 | opObj = puObj.addOperation(name=name_operation) |
|
762 | opObj = puObj.addOperation(name=name_operation) | |
763 | if not opObj.addParameter(name=name_parameter, value=radarfreq, format=format): |
|
763 | if not opObj.addParameter(name=name_parameter, value=radarfreq, format=format): | |
764 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) |
|
764 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) | |
765 | return 0 |
|
765 | return 0 | |
766 |
|
766 | |||
767 | if self.volOpCebChannels.isChecked(): |
|
767 | if self.volOpCebChannels.isChecked(): | |
768 | value = str(self.volOpChannel.text()) |
|
768 | value = str(self.volOpChannel.text()) | |
769 |
|
769 | |||
770 | if value == "": |
|
770 | if value == "": | |
771 | print "Please fill channel list" |
|
771 | print "Please fill channel list" | |
772 | return 0 |
|
772 | return 0 | |
773 |
|
773 | |||
774 | format = 'intlist' |
|
774 | format = 'intlist' | |
775 | if self.volOpComChannels.currentIndex() == 0: |
|
775 | if self.volOpComChannels.currentIndex() == 0: | |
776 | name_operation = "selectChannels" |
|
776 | name_operation = "selectChannels" | |
777 | name_parameter = 'channelList' |
|
777 | name_parameter = 'channelList' | |
778 | else: |
|
778 | else: | |
779 | name_operation = "selectChannelsByIndex" |
|
779 | name_operation = "selectChannelsByIndex" | |
780 | name_parameter = 'channelIndexList' |
|
780 | name_parameter = 'channelIndexList' | |
781 |
|
781 | |||
782 | opObj = puObj.addOperation(name=name_operation) |
|
782 | opObj = puObj.addOperation(name=name_operation) | |
783 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
783 | if not opObj.addParameter(name=name_parameter, value=value, format=format): | |
784 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) |
|
784 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) | |
785 | return 0 |
|
785 | return 0 | |
786 |
|
786 | |||
787 | if self.volOpCebHeights.isChecked(): |
|
787 | if self.volOpCebHeights.isChecked(): | |
788 | value = str(self.volOpHeights.text()) |
|
788 | value = str(self.volOpHeights.text()) | |
789 |
|
789 | |||
790 | if value == "": |
|
790 | if value == "": | |
791 | print "Please fill height range" |
|
791 | print "Please fill height range" | |
792 | return 0 |
|
792 | return 0 | |
793 |
|
793 | |||
794 | valueList = value.split(',') |
|
794 | valueList = value.split(',') | |
795 | format = 'float' |
|
795 | format = 'float' | |
796 | if self.volOpComHeights.currentIndex() == 0: |
|
796 | if self.volOpComHeights.currentIndex() == 0: | |
797 | name_operation = 'selectHeights' |
|
797 | name_operation = 'selectHeights' | |
798 | name_parameter1 = 'minHei' |
|
798 | name_parameter1 = 'minHei' | |
799 | name_parameter2 = 'maxHei' |
|
799 | name_parameter2 = 'maxHei' | |
800 | else: |
|
800 | else: | |
801 | name_operation = 'selectHeightsByIndex' |
|
801 | name_operation = 'selectHeightsByIndex' | |
802 | name_parameter1 = 'minIndex' |
|
802 | name_parameter1 = 'minIndex' | |
803 | name_parameter2 = 'maxIndex' |
|
803 | name_parameter2 = 'maxIndex' | |
804 |
|
804 | |||
805 | opObj = puObj.addOperation(name=name_operation) |
|
805 | opObj = puObj.addOperation(name=name_operation) | |
806 | opObj.addParameter(name=name_parameter1, value=valueList[0], format=format) |
|
806 | opObj.addParameter(name=name_parameter1, value=valueList[0], format=format) | |
807 | opObj.addParameter(name=name_parameter2, value=valueList[1], format=format) |
|
807 | opObj.addParameter(name=name_parameter2, value=valueList[1], format=format) | |
808 |
|
808 | |||
809 | if self.volOpCebFilter.isChecked(): |
|
809 | if self.volOpCebFilter.isChecked(): | |
810 | value = str(self.volOpFilter.text()) |
|
810 | value = str(self.volOpFilter.text()) | |
811 | if value == "": |
|
811 | if value == "": | |
812 | print "Please fill filter value" |
|
812 | print "Please fill filter value" | |
813 | return 0 |
|
813 | return 0 | |
814 |
|
814 | |||
815 | format = 'int' |
|
815 | format = 'int' | |
816 | name_operation = 'filterByHeights' |
|
816 | name_operation = 'filterByHeights' | |
817 | name_parameter = 'window' |
|
817 | name_parameter = 'window' | |
818 | opObj = puObj.addOperation(name=name_operation) |
|
818 | opObj = puObj.addOperation(name=name_operation) | |
819 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
819 | if not opObj.addParameter(name=name_parameter, value=value, format=format): | |
820 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) |
|
820 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) | |
821 | return 0 |
|
821 | return 0 | |
822 |
|
822 | |||
823 | if self.volOpCebProfile.isChecked(): |
|
823 | if self.volOpCebProfile.isChecked(): | |
824 | value = str(self.volOpProfile.text()) |
|
824 | value = str(self.volOpProfile.text()) | |
825 |
|
825 | |||
826 | if value == "": |
|
826 | if value == "": | |
827 | print "Please fill profile value" |
|
827 | print "Please fill profile value" | |
828 | return 0 |
|
828 | return 0 | |
829 |
|
829 | |||
830 | format = 'intlist' |
|
830 | format = 'intlist' | |
831 | optype = 'other' |
|
831 | optype = 'other' | |
832 | name_operation = 'ProfileSelector' |
|
832 | name_operation = 'ProfileSelector' | |
833 | if self.volOpComProfile.currentIndex() == 0: |
|
833 | if self.volOpComProfile.currentIndex() == 0: | |
834 | name_parameter = 'profileList' |
|
834 | name_parameter = 'profileList' | |
835 | if self.volOpComProfile.currentIndex() == 1: |
|
835 | if self.volOpComProfile.currentIndex() == 1: | |
836 | name_parameter = 'profileRangeList' |
|
836 | name_parameter = 'profileRangeList' | |
837 | if self.volOpComProfile.currentIndex() == 2: |
|
837 | if self.volOpComProfile.currentIndex() == 2: | |
838 | name_parameter = 'rangeList' |
|
838 | name_parameter = 'rangeList' | |
839 |
|
839 | |||
840 | opObj = puObj.addOperation(name='ProfileSelector', optype='other') |
|
840 | opObj = puObj.addOperation(name='ProfileSelector', optype='other') | |
841 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
841 | if not opObj.addParameter(name=name_parameter, value=value, format=format): | |
842 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) |
|
842 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) | |
843 | return 0 |
|
843 | return 0 | |
844 |
|
844 | |||
845 | if self.volOpCebDecodification.isChecked(): |
|
845 | if self.volOpCebDecodification.isChecked(): | |
846 | name_operation = 'Decoder' |
|
846 | name_operation = 'Decoder' | |
847 | opObj = puObj.addOperation(name=name_operation, optype='other') |
|
847 | opObj = puObj.addOperation(name=name_operation, optype='other') | |
848 |
|
848 | |||
849 | #User defined |
|
849 | #User defined | |
850 | nBaud = None |
|
850 | nBaud = None | |
851 | nCode = None |
|
851 | nCode = None | |
852 |
|
852 | |||
853 | code = str(self.volOpCode.text()) |
|
853 | code = str(self.volOpCode.text()) | |
854 | try: |
|
854 | try: | |
855 | code_tmp = ast.literal_eval(code) |
|
855 | code_tmp = ast.literal_eval(code) | |
856 | except: |
|
856 | except: | |
857 | code_tmp = [] |
|
857 | code_tmp = [] | |
858 |
|
858 | |||
859 | if len(code_tmp) > 0: |
|
859 | if len(code_tmp) > 0: | |
860 |
|
860 | |||
861 | if type(code_tmp) not in (tuple, list): |
|
861 | if type(code_tmp) not in (tuple, list): | |
862 | self.console.append("Please write a right value for Code (Exmaple: [1,1,-1], [1,-1,1])") |
|
862 | self.console.append("Please write a right value for Code (Exmaple: [1,1,-1], [1,-1,1])") | |
863 | return 0 |
|
863 | return 0 | |
864 |
|
864 | |||
865 | if len(code_tmp) > 1 and type(code_tmp[0]) in (tuple, list): #[ [1,-1,1], [1,1,-1] ] |
|
865 | if len(code_tmp) > 1 and type(code_tmp[0]) in (tuple, list): #[ [1,-1,1], [1,1,-1] ] | |
866 | nBaud = len(code_tmp[0]) |
|
866 | nBaud = len(code_tmp[0]) | |
867 | nCode = len(code_tmp) |
|
867 | nCode = len(code_tmp) | |
868 | elif len(code_tmp) == 1 and type(code_tmp[0]) in (tuple, list): #[ [1,-1,1] ] |
|
868 | elif len(code_tmp) == 1 and type(code_tmp[0]) in (tuple, list): #[ [1,-1,1] ] | |
869 | nBaud = len(code_tmp[0]) |
|
869 | nBaud = len(code_tmp[0]) | |
870 | nCode = 1 |
|
870 | nCode = 1 | |
871 | elif type(code_tmp[0]) in (int, float): #[1,-1,1] or (1,-1,1) |
|
871 | elif type(code_tmp[0]) in (int, float): #[1,-1,1] or (1,-1,1) | |
872 | nBaud = len(code_tmp) |
|
872 | nBaud = len(code_tmp) | |
873 | nCode = 1 |
|
873 | nCode = 1 | |
874 | else: |
|
874 | else: | |
875 | self.console.append("Please write a right value for Code (Exmaple: [1,1,-1], [1,-1,1])") |
|
875 | self.console.append("Please write a right value for Code (Exmaple: [1,1,-1], [1,-1,1])") | |
876 | return 0 |
|
876 | return 0 | |
877 |
|
877 | |||
878 | if not nBaud or not nCode: |
|
878 | if not nBaud or not nCode: | |
879 | self.console.append("Please write a right value for Code") |
|
879 | self.console.append("Please write a right value for Code") | |
880 | return 0 |
|
880 | return 0 | |
881 |
|
881 | |||
882 | code = code.replace("(", "") |
|
882 | code = code.replace("(", "") | |
883 | code = code.replace(")", "") |
|
883 | code = code.replace(")", "") | |
884 | code = code.replace("[", "") |
|
884 | code = code.replace("[", "") | |
885 | code = code.replace("]", "") |
|
885 | code = code.replace("]", "") | |
886 |
|
886 | |||
887 | if not opObj.addParameter(name='code', value=code, format='intlist'): |
|
887 | if not opObj.addParameter(name='code', value=code, format='intlist'): | |
888 | self.console.append("Please write a right value for Code") |
|
888 | self.console.append("Please write a right value for Code") | |
889 | return 0 |
|
889 | return 0 | |
890 | if not opObj.addParameter(name='nCode', value=nCode, format='int'): |
|
890 | if not opObj.addParameter(name='nCode', value=nCode, format='int'): | |
891 | self.console.append("Please write a right value for Code") |
|
891 | self.console.append("Please write a right value for Code") | |
892 | return 0 |
|
892 | return 0 | |
893 | if not opObj.addParameter(name='nBaud', value=nBaud, format='int'): |
|
893 | if not opObj.addParameter(name='nBaud', value=nBaud, format='int'): | |
894 | self.console.append("Please write a right value for Code") |
|
894 | self.console.append("Please write a right value for Code") | |
895 | return 0 |
|
895 | return 0 | |
896 |
|
896 | |||
897 | name_parameter = 'mode' |
|
897 | name_parameter = 'mode' | |
898 | format = 'int' |
|
898 | format = 'int' | |
899 |
|
899 | |||
900 | value = str(self.volOpComMode.currentIndex()) |
|
900 | value = str(self.volOpComMode.currentIndex()) | |
901 |
|
901 | |||
902 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
902 | if not opObj.addParameter(name=name_parameter, value=value, format=format): | |
903 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) |
|
903 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) | |
904 | return 0 |
|
904 | return 0 | |
905 |
|
905 | |||
906 |
|
906 | |||
907 | if self.volOpCebFlip.isChecked(): |
|
907 | if self.volOpCebFlip.isChecked(): | |
908 | name_operation = 'deFlip' |
|
908 | name_operation = 'deFlip' | |
909 | optype = 'self' |
|
909 | optype = 'self' | |
910 |
|
910 | |||
911 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
911 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
912 |
|
912 | |||
913 | name_parameter = 'channelList' |
|
913 | name_parameter = 'channelList' | |
914 | format = 'intlist' |
|
914 | format = 'intlist' | |
915 | value = str(self.volOpFlip.text()) |
|
915 | value = str(self.volOpFlip.text()) | |
916 |
|
916 | |||
917 | if value != "": |
|
917 | if value != "": | |
918 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
918 | if not opObj.addParameter(name=name_parameter, value=value, format=format): | |
919 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) |
|
919 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) | |
920 | return 0 |
|
920 | return 0 | |
921 |
|
921 | |||
922 | if self.volOpCebCohInt.isChecked(): |
|
922 | if self.volOpCebCohInt.isChecked(): | |
923 | name_operation = 'CohInt' |
|
923 | name_operation = 'CohInt' | |
924 | optype = 'other' |
|
924 | optype = 'other' | |
925 | value = str(self.volOpCohInt.text()) |
|
925 | value = str(self.volOpCohInt.text()) | |
926 |
|
926 | |||
927 | if value == "": |
|
927 | if value == "": | |
928 | print "Please fill number of coherent integrations" |
|
928 | print "Please fill number of coherent integrations" | |
929 | return 0 |
|
929 | return 0 | |
930 |
|
930 | |||
931 | name_parameter = 'n' |
|
931 | name_parameter = 'n' | |
932 | format = 'float' |
|
932 | format = 'float' | |
933 |
|
933 | |||
934 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
934 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
935 |
|
935 | |||
936 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
936 | if not opObj.addParameter(name=name_parameter, value=value, format=format): | |
937 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) |
|
937 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) | |
938 | return 0 |
|
938 | return 0 | |
939 |
|
939 | |||
940 | if self.volGraphCebshow.isChecked(): |
|
940 | if self.volGraphCebshow.isChecked(): | |
941 | name_operation = 'Scope' |
|
941 | name_operation = 'Scope' | |
942 | optype = 'other' |
|
942 | optype = 'other' | |
943 | name_parameter = 'type' |
|
943 | name_parameter = 'type' | |
944 | value = 'Scope' |
|
944 | value = 'Scope' | |
945 | if self.idImagscope == 0: |
|
945 | if self.idImagscope == 0: | |
946 | self.idImagscope = 100 |
|
946 | self.idImagscope = 100 | |
947 | else: |
|
947 | else: | |
948 | self.idImagscope = self.idImagscope + 1 |
|
948 | self.idImagscope = self.idImagscope + 1 | |
949 |
|
949 | |||
950 | name_parameter1 = 'id' |
|
950 | name_parameter1 = 'id' | |
951 | value1 = int(self.idImagscope) |
|
951 | value1 = int(self.idImagscope) | |
952 | format1 = 'int' |
|
952 | format1 = 'int' | |
953 | format = 'str' |
|
953 | format = 'str' | |
954 |
|
954 | |||
955 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
955 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
956 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
956 | # opObj.addParameter(name=name_parameter, value=value, format=format) | |
957 | opObj.addParameter(name=name_parameter1, value=opObj.id, format=format1) |
|
957 | opObj.addParameter(name=name_parameter1, value=opObj.id, format=format1) | |
958 |
|
958 | |||
959 | channelList = str(self.volGraphChannelList.text()).replace(" ","") |
|
959 | channelList = str(self.volGraphChannelList.text()).replace(" ","") | |
960 | xvalue = str(self.volGraphfreqrange.text()).replace(" ","") |
|
960 | xvalue = str(self.volGraphfreqrange.text()).replace(" ","") | |
961 | yvalue = str(self.volGraphHeightrange.text()).replace(" ","") |
|
961 | yvalue = str(self.volGraphHeightrange.text()).replace(" ","") | |
962 |
|
962 | |||
963 | if channelList: |
|
963 | if channelList: | |
964 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
964 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
965 |
|
965 | |||
966 | if xvalue: |
|
966 | if xvalue: | |
967 | xvalueList = xvalue.split(',') |
|
967 | xvalueList = xvalue.split(',') | |
968 | try: |
|
968 | try: | |
969 | value0 = float(xvalueList[0]) |
|
969 | value0 = float(xvalueList[0]) | |
970 | value1 = float(xvalueList[1]) |
|
970 | value1 = float(xvalueList[1]) | |
971 | except: |
|
971 | except: | |
972 | return 0 |
|
972 | return 0 | |
973 | opObj.addParameter(name='xmin', value=value0, format='float') |
|
973 | opObj.addParameter(name='xmin', value=value0, format='float') | |
974 | opObj.addParameter(name='xmax', value=value1, format='float') |
|
974 | opObj.addParameter(name='xmax', value=value1, format='float') | |
975 |
|
975 | |||
976 |
|
976 | |||
977 | if not yvalue == "": |
|
977 | if not yvalue == "": | |
978 | yvalueList = yvalue.split(",") |
|
978 | yvalueList = yvalue.split(",") | |
979 | try: |
|
979 | try: | |
980 | value0 = int(yvalueList[0]) |
|
980 | value0 = int(yvalueList[0]) | |
981 | value1 = int(yvalueList[1]) |
|
981 | value1 = int(yvalueList[1]) | |
982 | except: |
|
982 | except: | |
983 | return 0 |
|
983 | return 0 | |
984 |
|
984 | |||
985 | opObj.addParameter(name='ymin', value=value0, format='int') |
|
985 | opObj.addParameter(name='ymin', value=value0, format='int') | |
986 | opObj.addParameter(name='ymax', value=value1, format='int') |
|
986 | opObj.addParameter(name='ymax', value=value1, format='int') | |
987 |
|
987 | |||
988 | if self.volGraphCebSave.isChecked(): |
|
988 | if self.volGraphCebSave.isChecked(): | |
989 | checkPath = True |
|
989 | checkPath = True | |
990 | opObj.addParameter(name='save', value='1', format='int') |
|
990 | opObj.addParameter(name='save', value='1', format='int') | |
991 | opObj.addParameter(name='figpath', value=str(self.volGraphPath.text()), format='str') |
|
991 | opObj.addParameter(name='figpath', value=str(self.volGraphPath.text()), format='str') | |
992 | value = str(self.volGraphPrefix.text()).replace(" ","") |
|
992 | value = str(self.volGraphPrefix.text()).replace(" ","") | |
993 | if value: |
|
993 | if value: | |
994 | opObj.addParameter(name='figfile', value=value, format='str') |
|
994 | opObj.addParameter(name='figfile', value=value, format='str') | |
995 |
|
995 | |||
996 | localfolder = None |
|
996 | localfolder = None | |
997 | if checkPath: |
|
997 | if checkPath: | |
998 | localfolder = str(self.volGraphPath.text()) |
|
998 | localfolder = str(self.volGraphPath.text()) | |
999 | if localfolder == '': |
|
999 | if localfolder == '': | |
1000 | self.console.clear() |
|
1000 | self.console.clear() | |
1001 | self.console.append("Graphic path should be defined") |
|
1001 | self.console.append("Graphic path should be defined") | |
1002 | return 0 |
|
1002 | return 0 | |
1003 |
|
1003 | |||
1004 | # if something happend |
|
1004 | # if something happend | |
1005 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Voltage') |
|
1005 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Voltage') | |
1006 | if parms_ok: |
|
1006 | if parms_ok: | |
1007 | name_operation = 'VoltageWriter' |
|
1007 | name_operation = 'VoltageWriter' | |
1008 | optype = 'other' |
|
1008 | optype = 'other' | |
1009 | name_parameter1 = 'path' |
|
1009 | name_parameter1 = 'path' | |
1010 | name_parameter2 = 'blocksPerFile' |
|
1010 | name_parameter2 = 'blocksPerFile' | |
1011 | name_parameter3 = 'profilesPerBlock' |
|
1011 | name_parameter3 = 'profilesPerBlock' | |
1012 | value1 = output_path |
|
1012 | value1 = output_path | |
1013 | value2 = blocksperfile |
|
1013 | value2 = blocksperfile | |
1014 | value3 = profilesperblock |
|
1014 | value3 = profilesperblock | |
1015 | format = "int" |
|
1015 | format = "int" | |
1016 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1016 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
1017 | opObj.addParameter(name=name_parameter1, value=value1) |
|
1017 | opObj.addParameter(name=name_parameter1, value=value1) | |
1018 | opObj.addParameter(name=name_parameter2, value=value2, format=format) |
|
1018 | opObj.addParameter(name=name_parameter2, value=value2, format=format) | |
1019 | opObj.addParameter(name=name_parameter3, value=value3, format=format) |
|
1019 | opObj.addParameter(name=name_parameter3, value=value3, format=format) | |
1020 |
|
1020 | |||
1021 | self.console.clear() |
|
1021 | self.console.clear() | |
1022 | try: |
|
1022 | try: | |
1023 | self.refreshPUProperties(puObj) |
|
1023 | self.refreshPUProperties(puObj) | |
1024 | except: |
|
1024 | except: | |
1025 | self.console.append("An error reading input parameters was found ...Check them!") |
|
1025 | self.console.append("An error reading input parameters was found ...Check them!") | |
1026 | return 0 |
|
1026 | return 0 | |
1027 |
|
1027 | |||
1028 | self.console.append("Save your project and press Play button to start signal processing") |
|
1028 | self.console.append("Save your project and press Play button to start signal processing") | |
1029 |
|
1029 | |||
1030 | self.actionSaveToolbar.setEnabled(True) |
|
1030 | self.actionSaveToolbar.setEnabled(True) | |
1031 | self.actionStarToolbar.setEnabled(True) |
|
1031 | self.actionStarToolbar.setEnabled(True) | |
1032 |
|
1032 | |||
1033 | return 1 |
|
1033 | return 1 | |
1034 |
|
1034 | |||
1035 | """ |
|
1035 | """ | |
1036 | Voltage Graph |
|
1036 | Voltage Graph | |
1037 | """ |
|
1037 | """ | |
1038 | @pyqtSignature("int") |
|
1038 | @pyqtSignature("int") | |
1039 | def on_volGraphCebSave_stateChanged(self, p0): |
|
1039 | def on_volGraphCebSave_stateChanged(self, p0): | |
1040 | """ |
|
1040 | """ | |
1041 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
1041 | Check Box habilita ingresode del numero de Integraciones a realizar | |
1042 | """ |
|
1042 | """ | |
1043 | if p0 == 2: |
|
1043 | if p0 == 2: | |
1044 | self.volGraphPath.setEnabled(True) |
|
1044 | self.volGraphPath.setEnabled(True) | |
1045 | self.volGraphPrefix.setEnabled(True) |
|
1045 | self.volGraphPrefix.setEnabled(True) | |
1046 | self.volGraphToolPath.setEnabled(True) |
|
1046 | self.volGraphToolPath.setEnabled(True) | |
1047 |
|
1047 | |||
1048 | if p0 == 0: |
|
1048 | if p0 == 0: | |
1049 | self.volGraphPath.setEnabled(False) |
|
1049 | self.volGraphPath.setEnabled(False) | |
1050 | self.volGraphPrefix.setEnabled(False) |
|
1050 | self.volGraphPrefix.setEnabled(False) | |
1051 | self.volGraphToolPath.setEnabled(False) |
|
1051 | self.volGraphToolPath.setEnabled(False) | |
1052 |
|
1052 | |||
1053 | @pyqtSignature("") |
|
1053 | @pyqtSignature("") | |
1054 | def on_volGraphToolPath_clicked(self): |
|
1054 | def on_volGraphToolPath_clicked(self): | |
1055 | """ |
|
1055 | """ | |
1056 | Donde se guardan los DATOS |
|
1056 | Donde se guardan los DATOS | |
1057 | """ |
|
1057 | """ | |
1058 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
1058 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
1059 | self.volGraphPath.setText(save_path) |
|
1059 | self.volGraphPath.setText(save_path) | |
1060 |
|
1060 | |||
1061 | if not os.path.exists(save_path): |
|
1061 | if not os.path.exists(save_path): | |
1062 | self.console.clear() |
|
1062 | self.console.clear() | |
1063 | self.console.append("Set a valid path") |
|
1063 | self.console.append("Set a valid path") | |
1064 | self.volGraphOk.setEnabled(False) |
|
1064 | self.volGraphOk.setEnabled(False) | |
1065 | return |
|
1065 | return | |
1066 |
|
1066 | |||
1067 | @pyqtSignature("int") |
|
1067 | @pyqtSignature("int") | |
1068 | def on_volGraphCebshow_stateChanged(self, p0): |
|
1068 | def on_volGraphCebshow_stateChanged(self, p0): | |
1069 | """ |
|
1069 | """ | |
1070 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
1070 | Check Box habilita ingresode del numero de Integraciones a realizar | |
1071 | """ |
|
1071 | """ | |
1072 | if p0 == 0: |
|
1072 | if p0 == 0: | |
1073 |
|
1073 | |||
1074 | self.volGraphChannelList.setEnabled(False) |
|
1074 | self.volGraphChannelList.setEnabled(False) | |
1075 | self.volGraphfreqrange.setEnabled(False) |
|
1075 | self.volGraphfreqrange.setEnabled(False) | |
1076 | self.volGraphHeightrange.setEnabled(False) |
|
1076 | self.volGraphHeightrange.setEnabled(False) | |
1077 | if p0 == 2: |
|
1077 | if p0 == 2: | |
1078 |
|
1078 | |||
1079 | self.volGraphChannelList.setEnabled(True) |
|
1079 | self.volGraphChannelList.setEnabled(True) | |
1080 | self.volGraphfreqrange.setEnabled(True) |
|
1080 | self.volGraphfreqrange.setEnabled(True) | |
1081 | self.volGraphHeightrange.setEnabled(True) |
|
1081 | self.volGraphHeightrange.setEnabled(True) | |
1082 |
|
1082 | |||
1083 | """ |
|
1083 | """ | |
1084 | Spectra operation |
|
1084 | Spectra operation | |
1085 | """ |
|
1085 | """ | |
1086 | @pyqtSignature("int") |
|
1086 | @pyqtSignature("int") | |
1087 | def on_specOpCebRadarfrequency_stateChanged(self, p0): |
|
1087 | def on_specOpCebRadarfrequency_stateChanged(self, p0): | |
1088 | """ |
|
1088 | """ | |
1089 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
1089 | Check Box habilita ingresode del numero de Integraciones a realizar | |
1090 | """ |
|
1090 | """ | |
1091 | if p0 == 2: |
|
1091 | if p0 == 2: | |
1092 | self.specOpRadarfrequency.setEnabled(True) |
|
1092 | self.specOpRadarfrequency.setEnabled(True) | |
1093 | if p0 == 0: |
|
1093 | if p0 == 0: | |
1094 | self.specOpRadarfrequency.clear() |
|
1094 | self.specOpRadarfrequency.clear() | |
1095 | self.specOpRadarfrequency.setEnabled(False) |
|
1095 | self.specOpRadarfrequency.setEnabled(False) | |
1096 |
|
1096 | |||
1097 |
|
1097 | |||
1098 | @pyqtSignature("int") |
|
1098 | @pyqtSignature("int") | |
1099 | def on_specOpCebCrossSpectra_stateChanged(self, p0): |
|
1099 | def on_specOpCebCrossSpectra_stateChanged(self, p0): | |
1100 | """ |
|
1100 | """ | |
1101 | Habilita la opcion de aοΏ½adir el parοΏ½metro CrossSpectra a la Unidad de Procesamiento . |
|
1101 | Habilita la opcion de aοΏ½adir el parοΏ½metro CrossSpectra a la Unidad de Procesamiento . | |
1102 | """ |
|
1102 | """ | |
1103 | if p0 == 2: |
|
1103 | if p0 == 2: | |
1104 | # self.specOpnFFTpoints.setEnabled(True) |
|
1104 | # self.specOpnFFTpoints.setEnabled(True) | |
1105 | self.specOppairsList.setEnabled(True) |
|
1105 | self.specOppairsList.setEnabled(True) | |
1106 | if p0 == 0: |
|
1106 | if p0 == 0: | |
1107 | # self.specOpnFFTpoints.setEnabled(False) |
|
1107 | # self.specOpnFFTpoints.setEnabled(False) | |
1108 | self.specOppairsList.setEnabled(False) |
|
1108 | self.specOppairsList.setEnabled(False) | |
1109 |
|
1109 | |||
1110 | @pyqtSignature("int") |
|
1110 | @pyqtSignature("int") | |
1111 | def on_specOpCebChannel_stateChanged(self, p0): |
|
1111 | def on_specOpCebChannel_stateChanged(self, p0): | |
1112 | """ |
|
1112 | """ | |
1113 | Habilita la opcion de aοΏ½adir el parοΏ½metro numero de Canales a la Unidad de Procesamiento . |
|
1113 | Habilita la opcion de aοΏ½adir el parοΏ½metro numero de Canales a la Unidad de Procesamiento . | |
1114 | """ |
|
1114 | """ | |
1115 | if p0 == 2: |
|
1115 | if p0 == 2: | |
1116 | self.specOpChannel.setEnabled(True) |
|
1116 | self.specOpChannel.setEnabled(True) | |
1117 | self.specOpComChannel.setEnabled(True) |
|
1117 | self.specOpComChannel.setEnabled(True) | |
1118 | if p0 == 0: |
|
1118 | if p0 == 0: | |
1119 | self.specOpChannel.setEnabled(False) |
|
1119 | self.specOpChannel.setEnabled(False) | |
1120 | self.specOpComChannel.setEnabled(False) |
|
1120 | self.specOpComChannel.setEnabled(False) | |
1121 |
|
1121 | |||
1122 | @pyqtSignature("int") |
|
1122 | @pyqtSignature("int") | |
1123 | def on_specOpCebHeights_stateChanged(self, p0): |
|
1123 | def on_specOpCebHeights_stateChanged(self, p0): | |
1124 | """ |
|
1124 | """ | |
1125 | Habilita la opcion de aοΏ½adir el parοΏ½metro de alturas a la Unidad de Procesamiento . |
|
1125 | Habilita la opcion de aοΏ½adir el parοΏ½metro de alturas a la Unidad de Procesamiento . | |
1126 | """ |
|
1126 | """ | |
1127 | if p0 == 2: |
|
1127 | if p0 == 2: | |
1128 | self.specOpComHeights.setEnabled(True) |
|
1128 | self.specOpComHeights.setEnabled(True) | |
1129 | self.specOpHeights.setEnabled(True) |
|
1129 | self.specOpHeights.setEnabled(True) | |
1130 | if p0 == 0: |
|
1130 | if p0 == 0: | |
1131 | self.specOpComHeights.setEnabled(False) |
|
1131 | self.specOpComHeights.setEnabled(False) | |
1132 | self.specOpHeights.setEnabled(False) |
|
1132 | self.specOpHeights.setEnabled(False) | |
1133 |
|
1133 | |||
1134 |
|
1134 | |||
1135 | @pyqtSignature("int") |
|
1135 | @pyqtSignature("int") | |
1136 | def on_specOpCebIncoherent_stateChanged(self, p0): |
|
1136 | def on_specOpCebIncoherent_stateChanged(self, p0): | |
1137 | """ |
|
1137 | """ | |
1138 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . |
|
1138 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . | |
1139 | """ |
|
1139 | """ | |
1140 | if p0 == 2: |
|
1140 | if p0 == 2: | |
1141 | self.specOpIncoherent.setEnabled(True) |
|
1141 | self.specOpIncoherent.setEnabled(True) | |
1142 | if p0 == 0: |
|
1142 | if p0 == 0: | |
1143 | self.specOpIncoherent.setEnabled(False) |
|
1143 | self.specOpIncoherent.setEnabled(False) | |
1144 |
|
1144 | |||
1145 | @pyqtSignature("int") |
|
1145 | @pyqtSignature("int") | |
1146 | def on_specOpCebRemoveDC_stateChanged(self, p0): |
|
1146 | def on_specOpCebRemoveDC_stateChanged(self, p0): | |
1147 | """ |
|
1147 | """ | |
1148 | Habilita la opcion de aοΏ½adir el parοΏ½metro remover DC a la Unidad de Procesamiento . |
|
1148 | Habilita la opcion de aοΏ½adir el parοΏ½metro remover DC a la Unidad de Procesamiento . | |
1149 | """ |
|
1149 | """ | |
1150 | if p0 == 2: |
|
1150 | if p0 == 2: | |
1151 | self.specOpComRemoveDC.setEnabled(True) |
|
1151 | self.specOpComRemoveDC.setEnabled(True) | |
1152 | if p0 == 0: |
|
1152 | if p0 == 0: | |
1153 | self.specOpComRemoveDC.setEnabled(False) |
|
1153 | self.specOpComRemoveDC.setEnabled(False) | |
1154 |
|
1154 | |||
1155 | @pyqtSignature("int") |
|
1155 | @pyqtSignature("int") | |
1156 | def on_specOpCebgetNoise_stateChanged(self, p0): |
|
1156 | def on_specOpCebgetNoise_stateChanged(self, p0): | |
1157 | """ |
|
1157 | """ | |
1158 | Habilita la opcion de aοΏ½adir la estimacion de ruido a la Unidad de Procesamiento . |
|
1158 | Habilita la opcion de aοΏ½adir la estimacion de ruido a la Unidad de Procesamiento . | |
1159 | """ |
|
1159 | """ | |
1160 | if p0 == 2: |
|
1160 | if p0 == 2: | |
1161 | self.specOpgetNoise.setEnabled(True) |
|
1161 | self.specOpgetNoise.setEnabled(True) | |
1162 |
|
1162 | |||
1163 | if p0 == 0: |
|
1163 | if p0 == 0: | |
1164 | self.specOpgetNoise.setEnabled(False) |
|
1164 | self.specOpgetNoise.setEnabled(False) | |
1165 |
|
1165 | |||
1166 | @pyqtSignature("") |
|
1166 | @pyqtSignature("") | |
1167 | def on_specOpOk_clicked(self): |
|
1167 | def on_specOpOk_clicked(self): | |
1168 | """ |
|
1168 | """ | |
1169 | AΓADE OPERACION SPECTRA |
|
1169 | AΓADE OPERACION SPECTRA | |
1170 | """ |
|
1170 | """ | |
1171 |
|
1171 | |||
1172 | addFTP = False |
|
1172 | addFTP = False | |
1173 | checkPath = False |
|
1173 | checkPath = False | |
1174 |
|
1174 | |||
1175 | self.actionSaveToolbar.setEnabled(False) |
|
1175 | self.actionSaveToolbar.setEnabled(False) | |
1176 | self.actionStarToolbar.setEnabled(False) |
|
1176 | self.actionStarToolbar.setEnabled(False) | |
1177 |
|
1177 | |||
1178 | self.console.clear() |
|
1178 | self.console.clear() | |
1179 | self.console.append("Checking input parameters ...") |
|
1179 | self.console.append("Checking input parameters ...") | |
1180 |
|
1180 | |||
1181 | projectObj = self.getSelectedProjectObj() |
|
1181 | projectObj = self.getSelectedProjectObj() | |
1182 |
|
1182 | |||
1183 | if not projectObj: |
|
1183 | if not projectObj: | |
1184 | self.console.append("Please select a project before update it") |
|
1184 | self.console.append("Please select a project before update it") | |
1185 | return |
|
1185 | return | |
1186 |
|
1186 | |||
1187 | puObj = self.getSelectedItemObj() |
|
1187 | puObj = self.getSelectedItemObj() | |
1188 |
|
1188 | |||
1189 | puObj.removeOperations() |
|
1189 | puObj.removeOperations() | |
1190 |
|
1190 | |||
1191 | if self.specOpCebRadarfrequency.isChecked(): |
|
1191 | if self.specOpCebRadarfrequency.isChecked(): | |
1192 | value = str(self.specOpRadarfrequency.text()) |
|
1192 | value = str(self.specOpRadarfrequency.text()) | |
1193 | format = 'float' |
|
1193 | format = 'float' | |
1194 | name_operation = 'setRadarFrequency' |
|
1194 | name_operation = 'setRadarFrequency' | |
1195 | name_parameter = 'frequency' |
|
1195 | name_parameter = 'frequency' | |
1196 |
|
1196 | |||
1197 | if not isFloat(value): |
|
1197 | if not isFloat(value): | |
1198 | self.console.clear() |
|
1198 | self.console.clear() | |
1199 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
1199 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) | |
1200 | return 0 |
|
1200 | return 0 | |
1201 |
|
1201 | |||
1202 | radarfreq = float(value)*1e6 |
|
1202 | radarfreq = float(value)*1e6 | |
1203 | opObj = puObj.addOperation(name=name_operation) |
|
1203 | opObj = puObj.addOperation(name=name_operation) | |
1204 | opObj.addParameter(name=name_parameter, value=radarfreq, format=format) |
|
1204 | opObj.addParameter(name=name_parameter, value=radarfreq, format=format) | |
1205 |
|
1205 | |||
1206 | inputId = puObj.getInputId() |
|
1206 | inputId = puObj.getInputId() | |
1207 | inputPuObj = projectObj.getProcUnitObj(inputId) |
|
1207 | inputPuObj = projectObj.getProcUnitObj(inputId) | |
1208 |
|
1208 | |||
1209 | if inputPuObj.datatype == 'Voltage' or inputPuObj.datatype == 'USRP': |
|
1209 | if inputPuObj.datatype == 'Voltage' or inputPuObj.datatype == 'USRP': | |
1210 |
|
1210 | |||
1211 | value = str(self.specOpnFFTpoints.text()) |
|
1211 | value = str(self.specOpnFFTpoints.text()) | |
1212 |
|
1212 | |||
1213 | if not isInt(value): |
|
1213 | if not isInt(value): | |
1214 | self.console.append("Invalid value '%s' for '%s'" %(value, 'nFFTPoints')) |
|
1214 | self.console.append("Invalid value '%s' for '%s'" %(value, 'nFFTPoints')) | |
1215 | return 0 |
|
1215 | return 0 | |
1216 |
|
1216 | |||
1217 | puObj.addParameter(name='nFFTPoints', value=value, format='int') |
|
1217 | puObj.addParameter(name='nFFTPoints', value=value, format='int') | |
1218 |
|
1218 | |||
1219 | value = str(self.specOpProfiles.text()) |
|
1219 | value = str(self.specOpProfiles.text()) | |
1220 | if not isInt(value): |
|
1220 | if not isInt(value): | |
1221 | self.console.append("Please write a value on Profiles field") |
|
1221 | self.console.append("Please write a value on Profiles field") | |
1222 | else: |
|
1222 | else: | |
1223 | puObj.addParameter(name='nProfiles', value=value, format='int') |
|
1223 | puObj.addParameter(name='nProfiles', value=value, format='int') | |
1224 |
|
1224 | |||
1225 | value = str(self.specOpippFactor.text()) |
|
1225 | value = str(self.specOpippFactor.text()) | |
1226 | if not isInt(value): |
|
1226 | if not isInt(value): | |
1227 | self.console.append("Please write a value on IppFactor field") |
|
1227 | self.console.append("Please write a value on IppFactor field") | |
1228 | else: |
|
1228 | else: | |
1229 | puObj.addParameter(name='ippFactor' , value=value , format='int') |
|
1229 | puObj.addParameter(name='ippFactor' , value=value , format='int') | |
1230 |
|
1230 | |||
1231 | if self.specOpCebCrossSpectra.isChecked(): |
|
1231 | if self.specOpCebCrossSpectra.isChecked(): | |
1232 | name_parameter = 'pairsList' |
|
1232 | name_parameter = 'pairsList' | |
1233 | format = 'pairslist' |
|
1233 | format = 'pairslist' | |
1234 | value = str(self.specOppairsList.text()) |
|
1234 | value = str(self.specOppairsList.text()) | |
1235 |
|
1235 | |||
1236 | if value == "": |
|
1236 | if value == "": | |
1237 | print "Please fill the pairs list field" |
|
1237 | print "Please fill the pairs list field" | |
1238 | return 0 |
|
1238 | return 0 | |
1239 |
|
1239 | |||
1240 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
1240 | if not opObj.addParameter(name=name_parameter, value=value, format=format): | |
1241 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) |
|
1241 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) | |
1242 | return 0 |
|
1242 | return 0 | |
1243 |
|
1243 | |||
1244 | if self.specOpCebHeights.isChecked(): |
|
1244 | if self.specOpCebHeights.isChecked(): | |
1245 | value = str(self.specOpHeights.text()) |
|
1245 | value = str(self.specOpHeights.text()) | |
1246 |
|
1246 | |||
1247 | if value == "": |
|
1247 | if value == "": | |
1248 | self.console.append("Empty value for '%s'" %(value, "Height range")) |
|
1248 | self.console.append("Empty value for '%s'" %(value, "Height range")) | |
1249 | return 0 |
|
1249 | return 0 | |
1250 |
|
1250 | |||
1251 | valueList = value.split(',') |
|
1251 | valueList = value.split(',') | |
1252 | format = 'float' |
|
1252 | format = 'float' | |
1253 | value0 = valueList[0] |
|
1253 | value0 = valueList[0] | |
1254 | value1 = valueList[1] |
|
1254 | value1 = valueList[1] | |
1255 |
|
1255 | |||
1256 | if not isFloat(value0) or not isFloat(value1): |
|
1256 | if not isFloat(value0) or not isFloat(value1): | |
1257 | self.console.append("Invalid value '%s' for '%s'" %(value, "Height range")) |
|
1257 | self.console.append("Invalid value '%s' for '%s'" %(value, "Height range")) | |
1258 | return 0 |
|
1258 | return 0 | |
1259 |
|
1259 | |||
1260 | if self.specOpComHeights.currentIndex() == 0: |
|
1260 | if self.specOpComHeights.currentIndex() == 0: | |
1261 | name_operation = 'selectHeights' |
|
1261 | name_operation = 'selectHeights' | |
1262 | name_parameter1 = 'minHei' |
|
1262 | name_parameter1 = 'minHei' | |
1263 | name_parameter2 = 'maxHei' |
|
1263 | name_parameter2 = 'maxHei' | |
1264 | else: |
|
1264 | else: | |
1265 | name_operation = 'selectHeightsByIndex' |
|
1265 | name_operation = 'selectHeightsByIndex' | |
1266 | name_parameter1 = 'minIndex' |
|
1266 | name_parameter1 = 'minIndex' | |
1267 | name_parameter2 = 'maxIndex' |
|
1267 | name_parameter2 = 'maxIndex' | |
1268 |
|
1268 | |||
1269 | opObj = puObj.addOperation(name=name_operation) |
|
1269 | opObj = puObj.addOperation(name=name_operation) | |
1270 | opObj.addParameter(name=name_parameter1, value=value0, format=format) |
|
1270 | opObj.addParameter(name=name_parameter1, value=value0, format=format) | |
1271 | opObj.addParameter(name=name_parameter2, value=value1, format=format) |
|
1271 | opObj.addParameter(name=name_parameter2, value=value1, format=format) | |
1272 |
|
1272 | |||
1273 | if self.specOpCebChannel.isChecked(): |
|
1273 | if self.specOpCebChannel.isChecked(): | |
1274 |
|
1274 | |||
1275 | if self.specOpComChannel.currentIndex() == 0: |
|
1275 | if self.specOpComChannel.currentIndex() == 0: | |
1276 | name_operation = "selectChannels" |
|
1276 | name_operation = "selectChannels" | |
1277 | name_parameter = 'channelList' |
|
1277 | name_parameter = 'channelList' | |
1278 | else: |
|
1278 | else: | |
1279 | name_operation = "selectChannelsByIndex" |
|
1279 | name_operation = "selectChannelsByIndex" | |
1280 | name_parameter = 'channelIndexList' |
|
1280 | name_parameter = 'channelIndexList' | |
1281 |
|
1281 | |||
1282 | format = 'intlist' |
|
1282 | format = 'intlist' | |
1283 | value = str(self.specOpChannel.text()) |
|
1283 | value = str(self.specOpChannel.text()) | |
1284 |
|
1284 | |||
1285 | if value == "": |
|
1285 | if value == "": | |
1286 | print "Please fill channel list" |
|
1286 | print "Please fill channel list" | |
1287 | return 0 |
|
1287 | return 0 | |
1288 |
|
1288 | |||
1289 | if not isList(value): |
|
1289 | if not isList(value): | |
1290 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
1290 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) | |
1291 | return 0 |
|
1291 | return 0 | |
1292 |
|
1292 | |||
1293 | opObj = puObj.addOperation(name=name_operation) |
|
1293 | opObj = puObj.addOperation(name=name_operation) | |
1294 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1294 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
1295 |
|
1295 | |||
1296 | if self.specOpCebIncoherent.isChecked(): |
|
1296 | if self.specOpCebIncoherent.isChecked(): | |
1297 |
|
1297 | |||
1298 | name_operation = 'IncohInt' |
|
1298 | name_operation = 'IncohInt' | |
1299 | optype = 'other' |
|
1299 | optype = 'other' | |
1300 |
|
1300 | |||
1301 | if self.specOpCobIncInt.currentIndex() == 0: |
|
1301 | if self.specOpCobIncInt.currentIndex() == 0: | |
1302 | name_parameter = 'timeInterval' |
|
1302 | name_parameter = 'timeInterval' | |
1303 | format = 'float' |
|
1303 | format = 'float' | |
1304 | else: |
|
1304 | else: | |
1305 | name_parameter = 'n' |
|
1305 | name_parameter = 'n' | |
1306 | format = 'float' |
|
1306 | format = 'float' | |
1307 |
|
1307 | |||
1308 | value = str(self.specOpIncoherent.text()) |
|
1308 | value = str(self.specOpIncoherent.text()) | |
1309 |
|
1309 | |||
1310 | if value == "": |
|
1310 | if value == "": | |
1311 | print "Please fill Incoherent integration value" |
|
1311 | print "Please fill Incoherent integration value" | |
1312 | return 0 |
|
1312 | return 0 | |
1313 |
|
1313 | |||
1314 | if not isFloat(value): |
|
1314 | if not isFloat(value): | |
1315 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
1315 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) | |
1316 | return 0 |
|
1316 | return 0 | |
1317 |
|
1317 | |||
1318 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1318 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
1319 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1319 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
1320 |
|
1320 | |||
1321 | if self.specOpCebRemoveDC.isChecked(): |
|
1321 | if self.specOpCebRemoveDC.isChecked(): | |
1322 | name_operation = 'removeDC' |
|
1322 | name_operation = 'removeDC' | |
1323 | name_parameter = 'mode' |
|
1323 | name_parameter = 'mode' | |
1324 | format = 'int' |
|
1324 | format = 'int' | |
1325 | if self.specOpComRemoveDC.currentIndex() == 0: |
|
1325 | if self.specOpComRemoveDC.currentIndex() == 0: | |
1326 | value = 1 |
|
1326 | value = 1 | |
1327 | else: |
|
1327 | else: | |
1328 | value = 2 |
|
1328 | value = 2 | |
1329 | opObj = puObj.addOperation(name=name_operation) |
|
1329 | opObj = puObj.addOperation(name=name_operation) | |
1330 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1330 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
1331 |
|
1331 | |||
1332 | if self.specOpCebRemoveInt.isChecked(): |
|
1332 | if self.specOpCebRemoveInt.isChecked(): | |
1333 | name_operation = 'removeInterference' |
|
1333 | name_operation = 'removeInterference' | |
1334 | opObj = puObj.addOperation(name=name_operation) |
|
1334 | opObj = puObj.addOperation(name=name_operation) | |
1335 |
|
1335 | |||
1336 |
|
1336 | |||
1337 | if self.specOpCebgetNoise.isChecked(): |
|
1337 | if self.specOpCebgetNoise.isChecked(): | |
1338 | value = str(self.specOpgetNoise.text()) |
|
1338 | value = str(self.specOpgetNoise.text()) | |
1339 | valueList = value.split(',') |
|
1339 | valueList = value.split(',') | |
1340 | format = 'float' |
|
1340 | format = 'float' | |
1341 | name_operation = "getNoise" |
|
1341 | name_operation = "getNoise" | |
1342 | opObj = puObj.addOperation(name=name_operation) |
|
1342 | opObj = puObj.addOperation(name=name_operation) | |
1343 |
|
1343 | |||
1344 | if not value == '': |
|
1344 | if not value == '': | |
1345 | valueList = value.split(',') |
|
1345 | valueList = value.split(',') | |
1346 | length = len(valueList) |
|
1346 | length = len(valueList) | |
1347 | if length == 1: |
|
1347 | if length == 1: | |
1348 | try: |
|
1348 | try: | |
1349 | value1 = float(valueList[0]) |
|
1349 | value1 = float(valueList[0]) | |
1350 | except: |
|
1350 | except: | |
1351 | self.console.clear() |
|
1351 | self.console.clear() | |
1352 | self.console.append("Please Write correct parameter Get Noise") |
|
1352 | self.console.append("Please Write correct parameter Get Noise") | |
1353 | return 0 |
|
1353 | return 0 | |
1354 | name1 = 'minHei' |
|
1354 | name1 = 'minHei' | |
1355 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1355 | opObj.addParameter(name=name1, value=value1, format=format) | |
1356 | elif length == 2: |
|
1356 | elif length == 2: | |
1357 | try: |
|
1357 | try: | |
1358 | value1 = float(valueList[0]) |
|
1358 | value1 = float(valueList[0]) | |
1359 | value2 = float(valueList[1]) |
|
1359 | value2 = float(valueList[1]) | |
1360 | except: |
|
1360 | except: | |
1361 | self.console.clear() |
|
1361 | self.console.clear() | |
1362 | self.console.append("Please Write corrects parameter Get Noise") |
|
1362 | self.console.append("Please Write corrects parameter Get Noise") | |
1363 | return 0 |
|
1363 | return 0 | |
1364 | name1 = 'minHei' |
|
1364 | name1 = 'minHei' | |
1365 | name2 = 'maxHei' |
|
1365 | name2 = 'maxHei' | |
1366 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1366 | opObj.addParameter(name=name1, value=value1, format=format) | |
1367 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1367 | opObj.addParameter(name=name2, value=value2, format=format) | |
1368 |
|
1368 | |||
1369 | elif length == 3: |
|
1369 | elif length == 3: | |
1370 | try: |
|
1370 | try: | |
1371 | value1 = float(valueList[0]) |
|
1371 | value1 = float(valueList[0]) | |
1372 | value2 = float(valueList[1]) |
|
1372 | value2 = float(valueList[1]) | |
1373 | value3 = float(valueList[2]) |
|
1373 | value3 = float(valueList[2]) | |
1374 | except: |
|
1374 | except: | |
1375 | self.console.clear() |
|
1375 | self.console.clear() | |
1376 | self.console.append("Please Write corrects parameter Get Noise") |
|
1376 | self.console.append("Please Write corrects parameter Get Noise") | |
1377 | return 0 |
|
1377 | return 0 | |
1378 | name1 = 'minHei' |
|
1378 | name1 = 'minHei' | |
1379 | name2 = 'maxHei' |
|
1379 | name2 = 'maxHei' | |
1380 | name3 = 'minVel' |
|
1380 | name3 = 'minVel' | |
1381 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1381 | opObj.addParameter(name=name1, value=value1, format=format) | |
1382 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1382 | opObj.addParameter(name=name2, value=value2, format=format) | |
1383 | opObj.addParameter(name=name3, value=value3, format=format) |
|
1383 | opObj.addParameter(name=name3, value=value3, format=format) | |
1384 |
|
1384 | |||
1385 | elif length == 4: |
|
1385 | elif length == 4: | |
1386 | try: |
|
1386 | try: | |
1387 | value1 = float(valueList[0]) |
|
1387 | value1 = float(valueList[0]) | |
1388 | value2 = float(valueList[1]) |
|
1388 | value2 = float(valueList[1]) | |
1389 | value3 = float(valueList[2]) |
|
1389 | value3 = float(valueList[2]) | |
1390 | value4 = float(valueList[3]) |
|
1390 | value4 = float(valueList[3]) | |
1391 | except: |
|
1391 | except: | |
1392 | self.console.clear() |
|
1392 | self.console.clear() | |
1393 | self.console.append("Please Write corrects parameter Get Noise") |
|
1393 | self.console.append("Please Write corrects parameter Get Noise") | |
1394 | return 0 |
|
1394 | return 0 | |
1395 | name1 = 'minHei' |
|
1395 | name1 = 'minHei' | |
1396 | name2 = 'maxHei' |
|
1396 | name2 = 'maxHei' | |
1397 | name3 = 'minVel' |
|
1397 | name3 = 'minVel' | |
1398 | name4 = 'maxVel' |
|
1398 | name4 = 'maxVel' | |
1399 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1399 | opObj.addParameter(name=name1, value=value1, format=format) | |
1400 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1400 | opObj.addParameter(name=name2, value=value2, format=format) | |
1401 | opObj.addParameter(name=name3, value=value3, format=format) |
|
1401 | opObj.addParameter(name=name3, value=value3, format=format) | |
1402 | opObj.addParameter(name=name4, value=value4, format=format) |
|
1402 | opObj.addParameter(name=name4, value=value4, format=format) | |
1403 |
|
1403 | |||
1404 | elif length > 4: |
|
1404 | elif length > 4: | |
1405 | self.console.clear() |
|
1405 | self.console.clear() | |
1406 | self.console.append("Get Noise Operation only accepts 4 parameters") |
|
1406 | self.console.append("Get Noise Operation only accepts 4 parameters") | |
1407 | return 0 |
|
1407 | return 0 | |
1408 |
|
1408 | |||
1409 | channelList = str(self.specGgraphChannelList.text()).replace(" ","") |
|
1409 | channelList = str(self.specGgraphChannelList.text()).replace(" ","") | |
1410 | vel_range = str(self.specGgraphFreq.text()).replace(" ","") |
|
1410 | vel_range = str(self.specGgraphFreq.text()).replace(" ","") | |
1411 | hei_range = str(self.specGgraphHeight.text()).replace(" ","") |
|
1411 | hei_range = str(self.specGgraphHeight.text()).replace(" ","") | |
1412 | db_range = str(self.specGgraphDbsrange.text()).replace(" ","") |
|
1412 | db_range = str(self.specGgraphDbsrange.text()).replace(" ","") | |
1413 |
|
1413 | |||
1414 | trange = str(self.specGgraphTminTmax.text()).replace(" ","") |
|
1414 | trange = str(self.specGgraphTminTmax.text()).replace(" ","") | |
1415 | magrange = str(self.specGgraphmagnitud.text()).replace(" ","") |
|
1415 | magrange = str(self.specGgraphmagnitud.text()).replace(" ","") | |
1416 | phaserange = str(self.specGgraphPhase.text()).replace(" ","") |
|
1416 | phaserange = str(self.specGgraphPhase.text()).replace(" ","") | |
1417 | # timerange = str(self.specGgraphTimeRange.text()).replace(" ","") |
|
1417 | # timerange = str(self.specGgraphTimeRange.text()).replace(" ","") | |
1418 |
|
1418 | |||
1419 | figpath = str(self.specGraphPath.text()) |
|
1419 | figpath = str(self.specGraphPath.text()) | |
1420 | figfile = str(self.specGraphPrefix.text()).replace(" ","") |
|
1420 | figfile = str(self.specGraphPrefix.text()).replace(" ","") | |
1421 | try: |
|
1421 | try: | |
1422 | wrperiod = int(str(self.specGgraphftpratio.text()).replace(" ","")) |
|
1422 | wrperiod = int(str(self.specGgraphftpratio.text()).replace(" ","")) | |
1423 | except: |
|
1423 | except: | |
1424 | wrperiod = None |
|
1424 | wrperiod = None | |
1425 |
|
1425 | |||
1426 | #-----Spectra Plot----- |
|
1426 | #-----Spectra Plot----- | |
1427 | if self.specGraphCebSpectraplot.isChecked(): |
|
1427 | if self.specGraphCebSpectraplot.isChecked(): | |
1428 |
|
1428 | |||
1429 | opObj = puObj.addOperation(name='SpectraPlot', optype='other') |
|
1429 | opObj = puObj.addOperation(name='SpectraPlot', optype='other') | |
1430 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1430 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
1431 |
|
1431 | |||
1432 | if not channelList == '': |
|
1432 | if not channelList == '': | |
1433 |
|
1433 | |||
1434 | if not isList(channelList): |
|
1434 | if not isList(channelList): | |
1435 | self.console.append("Invalid channelList") |
|
1435 | self.console.append("Invalid channelList") | |
1436 | return 0 |
|
1436 | return 0 | |
1437 |
|
1437 | |||
1438 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1438 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
1439 |
|
1439 | |||
1440 | if not vel_range == '': |
|
1440 | if not vel_range == '': | |
1441 | xvalueList = vel_range.split(',') |
|
1441 | xvalueList = vel_range.split(',') | |
1442 | try: |
|
1442 | try: | |
1443 | value1 = float(xvalueList[0]) |
|
1443 | value1 = float(xvalueList[0]) | |
1444 | value2 = float(xvalueList[1]) |
|
1444 | value2 = float(xvalueList[1]) | |
1445 | except: |
|
1445 | except: | |
1446 | self.console.clear() |
|
1446 | self.console.clear() | |
1447 | self.console.append("Invalid velocity/frequency range") |
|
1447 | self.console.append("Invalid velocity/frequency range") | |
1448 | return 0 |
|
1448 | return 0 | |
1449 |
|
1449 | |||
1450 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1450 | opObj.addParameter(name='xmin', value=value1, format='float') | |
1451 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1451 | opObj.addParameter(name='xmax', value=value2, format='float') | |
1452 |
|
1452 | |||
1453 | if not hei_range == '': |
|
1453 | if not hei_range == '': | |
1454 | yvalueList = hei_range.split(",") |
|
1454 | yvalueList = hei_range.split(",") | |
1455 | try: |
|
1455 | try: | |
1456 | value1 = float(yvalueList[0]) |
|
1456 | value1 = float(yvalueList[0]) | |
1457 | value2 = float(yvalueList[1]) |
|
1457 | value2 = float(yvalueList[1]) | |
1458 | except: |
|
1458 | except: | |
1459 | self.console.clear() |
|
1459 | self.console.clear() | |
1460 | self.console.append("Invalid height range") |
|
1460 | self.console.append("Invalid height range") | |
1461 | return 0 |
|
1461 | return 0 | |
1462 |
|
1462 | |||
1463 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1463 | opObj.addParameter(name='ymin', value=value1, format='float') | |
1464 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1464 | opObj.addParameter(name='ymax', value=value2, format='float') | |
1465 |
|
1465 | |||
1466 | if not db_range == '': |
|
1466 | if not db_range == '': | |
1467 | zvalueList = db_range.split(",") |
|
1467 | zvalueList = db_range.split(",") | |
1468 | try: |
|
1468 | try: | |
1469 | value1 = float(zvalueList[0]) |
|
1469 | value1 = float(zvalueList[0]) | |
1470 | value2 = float(zvalueList[1]) |
|
1470 | value2 = float(zvalueList[1]) | |
1471 | except: |
|
1471 | except: | |
1472 | self.console.clear() |
|
1472 | self.console.clear() | |
1473 | self.console.append("Invalid db range") |
|
1473 | self.console.append("Invalid db range") | |
1474 | return 0 |
|
1474 | return 0 | |
1475 |
|
1475 | |||
1476 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1476 | opObj.addParameter(name='zmin', value=value1, format='float') | |
1477 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1477 | opObj.addParameter(name='zmax', value=value2, format='float') | |
1478 |
|
1478 | |||
1479 | if self.specGraphSaveSpectra.isChecked(): |
|
1479 | if self.specGraphSaveSpectra.isChecked(): | |
1480 | checkPath = True |
|
1480 | checkPath = True | |
1481 | opObj.addParameter(name='save', value=1 , format='bool') |
|
1481 | opObj.addParameter(name='save', value=1 , format='bool') | |
1482 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1482 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
1483 | if figfile: |
|
1483 | if figfile: | |
1484 | opObj.addParameter(name='figfile', value=figfile, format='str') |
|
1484 | opObj.addParameter(name='figfile', value=figfile, format='str') | |
1485 | if wrperiod: |
|
1485 | if wrperiod: | |
1486 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1486 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
1487 |
|
1487 | |||
1488 | if self.specGraphftpSpectra.isChecked(): |
|
1488 | if self.specGraphftpSpectra.isChecked(): | |
1489 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1489 | opObj.addParameter(name='ftp', value='1', format='int') | |
1490 | self.addFTPConf2Operation(puObj, opObj) |
|
1490 | self.addFTPConf2Operation(puObj, opObj) | |
1491 | addFTP = True |
|
1491 | addFTP = True | |
1492 |
|
1492 | |||
1493 | if self.specGraphCebCrossSpectraplot.isChecked(): |
|
1493 | if self.specGraphCebCrossSpectraplot.isChecked(): | |
1494 |
|
1494 | |||
1495 | opObj = puObj.addOperation(name='CrossSpectraPlot', optype='other') |
|
1495 | opObj = puObj.addOperation(name='CrossSpectraPlot', optype='other') | |
1496 | # opObj.addParameter(name='power_cmap', value='jet', format='str') |
|
1496 | # opObj.addParameter(name='power_cmap', value='jet', format='str') | |
1497 | # opObj.addParameter(name='coherence_cmap', value='jet', format='str') |
|
1497 | # opObj.addParameter(name='coherence_cmap', value='jet', format='str') | |
1498 | # opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') |
|
1498 | # opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') | |
1499 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1499 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
1500 |
|
1500 | |||
1501 | if not vel_range == '': |
|
1501 | if not vel_range == '': | |
1502 | xvalueList = vel_range.split(',') |
|
1502 | xvalueList = vel_range.split(',') | |
1503 | try: |
|
1503 | try: | |
1504 | value1 = float(xvalueList[0]) |
|
1504 | value1 = float(xvalueList[0]) | |
1505 | value2 = float(xvalueList[1]) |
|
1505 | value2 = float(xvalueList[1]) | |
1506 | except: |
|
1506 | except: | |
1507 | self.console.clear() |
|
1507 | self.console.clear() | |
1508 | self.console.append("Invalid velocity/frequency range") |
|
1508 | self.console.append("Invalid velocity/frequency range") | |
1509 | return 0 |
|
1509 | return 0 | |
1510 |
|
1510 | |||
1511 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1511 | opObj.addParameter(name='xmin', value=value1, format='float') | |
1512 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1512 | opObj.addParameter(name='xmax', value=value2, format='float') | |
1513 |
|
1513 | |||
1514 | if not hei_range == '': |
|
1514 | if not hei_range == '': | |
1515 | yvalueList = hei_range.split(",") |
|
1515 | yvalueList = hei_range.split(",") | |
1516 | try: |
|
1516 | try: | |
1517 | value1 = float(yvalueList[0]) |
|
1517 | value1 = float(yvalueList[0]) | |
1518 | value2 = float(yvalueList[1]) |
|
1518 | value2 = float(yvalueList[1]) | |
1519 | except: |
|
1519 | except: | |
1520 | self.console.clear() |
|
1520 | self.console.clear() | |
1521 | self.console.append("Invalid height range") |
|
1521 | self.console.append("Invalid height range") | |
1522 | return 0 |
|
1522 | return 0 | |
1523 |
|
1523 | |||
1524 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1524 | opObj.addParameter(name='ymin', value=value1, format='float') | |
1525 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1525 | opObj.addParameter(name='ymax', value=value2, format='float') | |
1526 |
|
1526 | |||
1527 | if not db_range == '': |
|
1527 | if not db_range == '': | |
1528 | zvalueList = db_range.split(",") |
|
1528 | zvalueList = db_range.split(",") | |
1529 | try: |
|
1529 | try: | |
1530 | value1 = float(zvalueList[0]) |
|
1530 | value1 = float(zvalueList[0]) | |
1531 | value2 = float(zvalueList[1]) |
|
1531 | value2 = float(zvalueList[1]) | |
1532 | except: |
|
1532 | except: | |
1533 | self.console.clear() |
|
1533 | self.console.clear() | |
1534 | self.console.append("Invalid db range") |
|
1534 | self.console.append("Invalid db range") | |
1535 | return 0 |
|
1535 | return 0 | |
1536 |
|
1536 | |||
1537 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1537 | opObj.addParameter(name='zmin', value=value1, format='float') | |
1538 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1538 | opObj.addParameter(name='zmax', value=value2, format='float') | |
1539 |
|
1539 | |||
1540 | if not magrange == '': |
|
1540 | if not magrange == '': | |
1541 | zvalueList = magrange.split(",") |
|
1541 | zvalueList = magrange.split(",") | |
1542 | try: |
|
1542 | try: | |
1543 | value1 = float(zvalueList[0]) |
|
1543 | value1 = float(zvalueList[0]) | |
1544 | value2 = float(zvalueList[1]) |
|
1544 | value2 = float(zvalueList[1]) | |
1545 | except: |
|
1545 | except: | |
1546 | self.console.clear() |
|
1546 | self.console.clear() | |
1547 | self.console.append("Invalid magnitude range") |
|
1547 | self.console.append("Invalid magnitude range") | |
1548 | return 0 |
|
1548 | return 0 | |
1549 |
|
1549 | |||
1550 | opObj.addParameter(name='coh_min', value=value1, format='float') |
|
1550 | opObj.addParameter(name='coh_min', value=value1, format='float') | |
1551 | opObj.addParameter(name='coh_max', value=value2, format='float') |
|
1551 | opObj.addParameter(name='coh_max', value=value2, format='float') | |
1552 |
|
1552 | |||
1553 | if not phaserange == '': |
|
1553 | if not phaserange == '': | |
1554 | zvalueList = phaserange.split(",") |
|
1554 | zvalueList = phaserange.split(",") | |
1555 | try: |
|
1555 | try: | |
1556 | value1 = float(zvalueList[0]) |
|
1556 | value1 = float(zvalueList[0]) | |
1557 | value2 = float(zvalueList[1]) |
|
1557 | value2 = float(zvalueList[1]) | |
1558 | except: |
|
1558 | except: | |
1559 | self.console.clear() |
|
1559 | self.console.clear() | |
1560 | self.console.append("Invalid phase range") |
|
1560 | self.console.append("Invalid phase range") | |
1561 | return 0 |
|
1561 | return 0 | |
1562 |
|
1562 | |||
1563 | opObj.addParameter(name='phase_min', value=value1, format='float') |
|
1563 | opObj.addParameter(name='phase_min', value=value1, format='float') | |
1564 | opObj.addParameter(name='phase_max', value=value2, format='float') |
|
1564 | opObj.addParameter(name='phase_max', value=value2, format='float') | |
1565 |
|
1565 | |||
1566 | if self.specGraphSaveCross.isChecked(): |
|
1566 | if self.specGraphSaveCross.isChecked(): | |
1567 | checkPath = True |
|
1567 | checkPath = True | |
1568 | opObj.addParameter(name='save', value='1', format='bool') |
|
1568 | opObj.addParameter(name='save', value='1', format='bool') | |
1569 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1569 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
1570 | if figfile: |
|
1570 | if figfile: | |
1571 | opObj.addParameter(name='figfile', value=figfile, format='str') |
|
1571 | opObj.addParameter(name='figfile', value=figfile, format='str') | |
1572 | if wrperiod: |
|
1572 | if wrperiod: | |
1573 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1573 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
1574 |
|
1574 | |||
1575 | if self.specGraphftpCross.isChecked(): |
|
1575 | if self.specGraphftpCross.isChecked(): | |
1576 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1576 | opObj.addParameter(name='ftp', value='1', format='int') | |
1577 | self.addFTPConf2Operation(puObj, opObj) |
|
1577 | self.addFTPConf2Operation(puObj, opObj) | |
1578 | addFTP = True |
|
1578 | addFTP = True | |
1579 |
|
1579 | |||
1580 | if self.specGraphCebRTIplot.isChecked(): |
|
1580 | if self.specGraphCebRTIplot.isChecked(): | |
1581 |
|
1581 | |||
1582 | opObj = puObj.addOperation(name='RTIPlot', optype='other') |
|
1582 | opObj = puObj.addOperation(name='RTIPlot', optype='other') | |
1583 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1583 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
1584 |
|
1584 | |||
1585 | if not channelList == '': |
|
1585 | if not channelList == '': | |
1586 | if not isList(channelList): |
|
1586 | if not isList(channelList): | |
1587 | self.console.append("Invalid channelList") |
|
1587 | self.console.append("Invalid channelList") | |
1588 | return 0 |
|
1588 | return 0 | |
1589 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1589 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
1590 |
|
1590 | |||
1591 | if not trange == '': |
|
1591 | if not trange == '': | |
1592 | xvalueList = trange.split(',') |
|
1592 | xvalueList = trange.split(',') | |
1593 | try: |
|
1593 | try: | |
1594 | value1 = float(xvalueList[0]) |
|
1594 | value1 = float(xvalueList[0]) | |
1595 | value2 = float(xvalueList[1]) |
|
1595 | value2 = float(xvalueList[1]) | |
1596 | except: |
|
1596 | except: | |
1597 | self.console.clear() |
|
1597 | self.console.clear() | |
1598 | self.console.append("Invalid time range") |
|
1598 | self.console.append("Invalid time range") | |
1599 | return 0 |
|
1599 | return 0 | |
1600 |
|
1600 | |||
1601 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1601 | opObj.addParameter(name='xmin', value=value1, format='float') | |
1602 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1602 | opObj.addParameter(name='xmax', value=value2, format='float') | |
1603 |
|
1603 | |||
1604 | # if not timerange == '': |
|
1604 | # if not timerange == '': | |
1605 | # try: |
|
1605 | # try: | |
1606 | # timerange = float(timerange) |
|
1606 | # timerange = float(timerange) | |
1607 | # except: |
|
1607 | # except: | |
1608 | # self.console.clear() |
|
1608 | # self.console.clear() | |
1609 | # self.console.append("Invalid time range") |
|
1609 | # self.console.append("Invalid time range") | |
1610 | # return 0 |
|
1610 | # return 0 | |
1611 | # |
|
1611 | # | |
1612 | # opObj.addParameter(name='timerange', value=timerange, format='float') |
|
1612 | # opObj.addParameter(name='timerange', value=timerange, format='float') | |
1613 |
|
1613 | |||
1614 | if not hei_range == '': |
|
1614 | if not hei_range == '': | |
1615 | yvalueList = hei_range.split(",") |
|
1615 | yvalueList = hei_range.split(",") | |
1616 | try: |
|
1616 | try: | |
1617 | value1 = float(yvalueList[0]) |
|
1617 | value1 = float(yvalueList[0]) | |
1618 | value2 = float(yvalueList[1]) |
|
1618 | value2 = float(yvalueList[1]) | |
1619 | except: |
|
1619 | except: | |
1620 | self.console.clear() |
|
1620 | self.console.clear() | |
1621 | self.console.append("Invalid height range") |
|
1621 | self.console.append("Invalid height range") | |
1622 | return 0 |
|
1622 | return 0 | |
1623 |
|
1623 | |||
1624 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1624 | opObj.addParameter(name='ymin', value=value1, format='float') | |
1625 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1625 | opObj.addParameter(name='ymax', value=value2, format='float') | |
1626 |
|
1626 | |||
1627 | if not db_range == '': |
|
1627 | if not db_range == '': | |
1628 | zvalueList = db_range.split(",") |
|
1628 | zvalueList = db_range.split(",") | |
1629 | try: |
|
1629 | try: | |
1630 | value1 = float(zvalueList[0]) |
|
1630 | value1 = float(zvalueList[0]) | |
1631 | value2 = float(zvalueList[1]) |
|
1631 | value2 = float(zvalueList[1]) | |
1632 | except: |
|
1632 | except: | |
1633 | self.console.clear() |
|
1633 | self.console.clear() | |
1634 | self.console.append("Invalid db range") |
|
1634 | self.console.append("Invalid db range") | |
1635 | return 0 |
|
1635 | return 0 | |
1636 |
|
1636 | |||
1637 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1637 | opObj.addParameter(name='zmin', value=value1, format='float') | |
1638 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1638 | opObj.addParameter(name='zmax', value=value2, format='float') | |
1639 |
|
1639 | |||
1640 | if self.specGraphSaveRTIplot.isChecked(): |
|
1640 | if self.specGraphSaveRTIplot.isChecked(): | |
1641 | checkPath = True |
|
1641 | checkPath = True | |
1642 | opObj.addParameter(name='save', value='1', format='bool') |
|
1642 | opObj.addParameter(name='save', value='1', format='bool') | |
1643 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1643 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
1644 | if figfile: |
|
1644 | if figfile: | |
1645 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1645 | opObj.addParameter(name='figfile', value=value, format='str') | |
1646 | if wrperiod: |
|
1646 | if wrperiod: | |
1647 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1647 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
1648 |
|
1648 | |||
1649 | if self.specGraphftpRTIplot.isChecked(): |
|
1649 | if self.specGraphftpRTIplot.isChecked(): | |
1650 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1650 | opObj.addParameter(name='ftp', value='1', format='int') | |
1651 | self.addFTPConf2Operation(puObj, opObj) |
|
1651 | self.addFTPConf2Operation(puObj, opObj) | |
1652 | addFTP = True |
|
1652 | addFTP = True | |
1653 |
|
1653 | |||
1654 | if self.specGraphCebCoherencmap.isChecked(): |
|
1654 | if self.specGraphCebCoherencmap.isChecked(): | |
1655 |
|
1655 | |||
1656 | opObj = puObj.addOperation(name='CoherenceMap', optype='other') |
|
1656 | opObj = puObj.addOperation(name='CoherenceMap', optype='other') | |
1657 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1657 | # opObj.addParameter(name=name_parameter, value=value, format=format) | |
1658 | # opObj.addParameter(name='coherence_cmap', value='jet', format='str') |
|
1658 | # opObj.addParameter(name='coherence_cmap', value='jet', format='str') | |
1659 | # opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') |
|
1659 | # opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') | |
1660 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1660 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
1661 |
|
1661 | |||
1662 | # if not timerange == '': |
|
1662 | # if not timerange == '': | |
1663 | # try: |
|
1663 | # try: | |
1664 | # timerange = int(timerange) |
|
1664 | # timerange = int(timerange) | |
1665 | # except: |
|
1665 | # except: | |
1666 | # self.console.clear() |
|
1666 | # self.console.clear() | |
1667 | # self.console.append("Invalid time range") |
|
1667 | # self.console.append("Invalid time range") | |
1668 | # return 0 |
|
1668 | # return 0 | |
1669 | # |
|
1669 | # | |
1670 | # opObj.addParameter(name='timerange', value=timerange, format='int') |
|
1670 | # opObj.addParameter(name='timerange', value=timerange, format='int') | |
1671 |
|
1671 | |||
1672 | if not trange == '': |
|
1672 | if not trange == '': | |
1673 | xvalueList = trange.split(',') |
|
1673 | xvalueList = trange.split(',') | |
1674 | try: |
|
1674 | try: | |
1675 | value1 = float(xvalueList[0]) |
|
1675 | value1 = float(xvalueList[0]) | |
1676 | value2 = float(xvalueList[1]) |
|
1676 | value2 = float(xvalueList[1]) | |
1677 | except: |
|
1677 | except: | |
1678 | self.console.clear() |
|
1678 | self.console.clear() | |
1679 | self.console.append("Invalid time range") |
|
1679 | self.console.append("Invalid time range") | |
1680 | return 0 |
|
1680 | return 0 | |
1681 |
|
1681 | |||
1682 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1682 | opObj.addParameter(name='xmin', value=value1, format='float') | |
1683 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1683 | opObj.addParameter(name='xmax', value=value2, format='float') | |
1684 |
|
1684 | |||
1685 | if not hei_range == '': |
|
1685 | if not hei_range == '': | |
1686 | yvalueList = hei_range.split(",") |
|
1686 | yvalueList = hei_range.split(",") | |
1687 | try: |
|
1687 | try: | |
1688 | value1 = float(yvalueList[0]) |
|
1688 | value1 = float(yvalueList[0]) | |
1689 | value2 = float(yvalueList[1]) |
|
1689 | value2 = float(yvalueList[1]) | |
1690 | except: |
|
1690 | except: | |
1691 | self.console.clear() |
|
1691 | self.console.clear() | |
1692 | self.console.append("Invalid height range") |
|
1692 | self.console.append("Invalid height range") | |
1693 | return 0 |
|
1693 | return 0 | |
1694 |
|
1694 | |||
1695 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1695 | opObj.addParameter(name='ymin', value=value1, format='float') | |
1696 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1696 | opObj.addParameter(name='ymax', value=value2, format='float') | |
1697 |
|
1697 | |||
1698 | if not magrange == '': |
|
1698 | if not magrange == '': | |
1699 | zvalueList = magrange.split(",") |
|
1699 | zvalueList = magrange.split(",") | |
1700 | try: |
|
1700 | try: | |
1701 | value1 = float(zvalueList[0]) |
|
1701 | value1 = float(zvalueList[0]) | |
1702 | value2 = float(zvalueList[1]) |
|
1702 | value2 = float(zvalueList[1]) | |
1703 | except: |
|
1703 | except: | |
1704 | self.console.clear() |
|
1704 | self.console.clear() | |
1705 | self.console.append("Invalid magnitude range") |
|
1705 | self.console.append("Invalid magnitude range") | |
1706 | return 0 |
|
1706 | return 0 | |
1707 |
|
1707 | |||
1708 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1708 | opObj.addParameter(name='zmin', value=value1, format='float') | |
1709 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1709 | opObj.addParameter(name='zmax', value=value2, format='float') | |
1710 |
|
1710 | |||
1711 | if not phaserange == '': |
|
1711 | if not phaserange == '': | |
1712 | zvalueList = phaserange.split(",") |
|
1712 | zvalueList = phaserange.split(",") | |
1713 | try: |
|
1713 | try: | |
1714 | value1 = float(zvalueList[0]) |
|
1714 | value1 = float(zvalueList[0]) | |
1715 | value2 = float(zvalueList[1]) |
|
1715 | value2 = float(zvalueList[1]) | |
1716 | except: |
|
1716 | except: | |
1717 | self.console.clear() |
|
1717 | self.console.clear() | |
1718 | self.console.append("Invalid phase range") |
|
1718 | self.console.append("Invalid phase range") | |
1719 | return 0 |
|
1719 | return 0 | |
1720 |
|
1720 | |||
1721 | opObj.addParameter(name='phase_min', value=value1, format='float') |
|
1721 | opObj.addParameter(name='phase_min', value=value1, format='float') | |
1722 | opObj.addParameter(name='phase_max', value=value2, format='float') |
|
1722 | opObj.addParameter(name='phase_max', value=value2, format='float') | |
1723 |
|
1723 | |||
1724 | if self.specGraphSaveCoherencemap.isChecked(): |
|
1724 | if self.specGraphSaveCoherencemap.isChecked(): | |
1725 | checkPath = True |
|
1725 | checkPath = True | |
1726 | opObj.addParameter(name='save', value='1', format='bool') |
|
1726 | opObj.addParameter(name='save', value='1', format='bool') | |
1727 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1727 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
1728 | if figfile: |
|
1728 | if figfile: | |
1729 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1729 | opObj.addParameter(name='figfile', value=value, format='str') | |
1730 | if wrperiod: |
|
1730 | if wrperiod: | |
1731 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1731 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
1732 |
|
1732 | |||
1733 | if self.specGraphftpCoherencemap.isChecked(): |
|
1733 | if self.specGraphftpCoherencemap.isChecked(): | |
1734 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1734 | opObj.addParameter(name='ftp', value='1', format='int') | |
1735 | self.addFTPConf2Operation(puObj, opObj) |
|
1735 | self.addFTPConf2Operation(puObj, opObj) | |
1736 | addFTP = True |
|
1736 | addFTP = True | |
1737 |
|
1737 | |||
1738 | if self.specGraphPowerprofile.isChecked(): |
|
1738 | if self.specGraphPowerprofile.isChecked(): | |
1739 |
|
1739 | |||
1740 | opObj = puObj.addOperation(name='PowerProfilePlot', optype='other') |
|
1740 | opObj = puObj.addOperation(name='PowerProfilePlot', optype='other') | |
1741 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1741 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
1742 |
|
1742 | |||
1743 | if not channelList == '': |
|
1743 | if not channelList == '': | |
1744 | if not isList(channelList): |
|
1744 | if not isList(channelList): | |
1745 | self.console.append("Invalid channelList") |
|
1745 | self.console.append("Invalid channelList") | |
1746 | return 0 |
|
1746 | return 0 | |
1747 |
|
1747 | |||
1748 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1748 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
1749 |
|
1749 | |||
1750 | if not db_range == '': |
|
1750 | if not db_range == '': | |
1751 | xvalueList = db_range.split(',') |
|
1751 | xvalueList = db_range.split(',') | |
1752 | try: |
|
1752 | try: | |
1753 | value1 = float(xvalueList[0]) |
|
1753 | value1 = float(xvalueList[0]) | |
1754 | value2 = float(xvalueList[1]) |
|
1754 | value2 = float(xvalueList[1]) | |
1755 | except: |
|
1755 | except: | |
1756 | self.console.clear() |
|
1756 | self.console.clear() | |
1757 | self.console.append("Invalid db range") |
|
1757 | self.console.append("Invalid db range") | |
1758 | return 0 |
|
1758 | return 0 | |
1759 |
|
1759 | |||
1760 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1760 | opObj.addParameter(name='xmin', value=value1, format='float') | |
1761 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1761 | opObj.addParameter(name='xmax', value=value2, format='float') | |
1762 |
|
1762 | |||
1763 | if not hei_range == '': |
|
1763 | if not hei_range == '': | |
1764 | yvalueList = hei_range.split(",") |
|
1764 | yvalueList = hei_range.split(",") | |
1765 | try: |
|
1765 | try: | |
1766 | value1 = float(yvalueList[0]) |
|
1766 | value1 = float(yvalueList[0]) | |
1767 | value2 = float(yvalueList[1]) |
|
1767 | value2 = float(yvalueList[1]) | |
1768 | except: |
|
1768 | except: | |
1769 | self.console.clear() |
|
1769 | self.console.clear() | |
1770 | self.console.append("Invalid height range") |
|
1770 | self.console.append("Invalid height range") | |
1771 | return 0 |
|
1771 | return 0 | |
1772 |
|
1772 | |||
1773 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1773 | opObj.addParameter(name='ymin', value=value1, format='float') | |
1774 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1774 | opObj.addParameter(name='ymax', value=value2, format='float') | |
1775 |
|
1775 | |||
1776 | if self.specGraphSavePowerprofile.isChecked(): |
|
1776 | if self.specGraphSavePowerprofile.isChecked(): | |
1777 | checkPath = True |
|
1777 | checkPath = True | |
1778 | opObj.addParameter(name='save', value='1', format='bool') |
|
1778 | opObj.addParameter(name='save', value='1', format='bool') | |
1779 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1779 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
1780 | if figfile: |
|
1780 | if figfile: | |
1781 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1781 | opObj.addParameter(name='figfile', value=value, format='str') | |
1782 | if wrperiod: |
|
1782 | if wrperiod: | |
1783 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1783 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
1784 |
|
1784 | |||
1785 | if self.specGraphftpPowerprofile.isChecked(): |
|
1785 | if self.specGraphftpPowerprofile.isChecked(): | |
1786 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1786 | opObj.addParameter(name='ftp', value='1', format='int') | |
1787 | self.addFTPConf2Operation(puObj, opObj) |
|
1787 | self.addFTPConf2Operation(puObj, opObj) | |
1788 | addFTP = True |
|
1788 | addFTP = True | |
1789 | # rti noise |
|
1789 | # rti noise | |
1790 |
|
1790 | |||
1791 | if self.specGraphCebRTInoise.isChecked(): |
|
1791 | if self.specGraphCebRTInoise.isChecked(): | |
1792 |
|
1792 | |||
1793 | opObj = puObj.addOperation(name='Noise', optype='other') |
|
1793 | opObj = puObj.addOperation(name='Noise', optype='other') | |
1794 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1794 | opObj.addParameter(name='id', value=opObj.id, format='int') | |
1795 |
|
1795 | |||
1796 | if not channelList == '': |
|
1796 | if not channelList == '': | |
1797 | if not isList(channelList): |
|
1797 | if not isList(channelList): | |
1798 | self.console.append("Invalid channelList") |
|
1798 | self.console.append("Invalid channelList") | |
1799 | return 0 |
|
1799 | return 0 | |
1800 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1800 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
1801 |
|
1801 | |||
1802 | # if not timerange == '': |
|
1802 | # if not timerange == '': | |
1803 | # try: |
|
1803 | # try: | |
1804 | # timerange = float(timerange) |
|
1804 | # timerange = float(timerange) | |
1805 | # except: |
|
1805 | # except: | |
1806 | # self.console.clear() |
|
1806 | # self.console.clear() | |
1807 | # self.console.append("Invalid time range") |
|
1807 | # self.console.append("Invalid time range") | |
1808 | # return 0 |
|
1808 | # return 0 | |
1809 | # |
|
1809 | # | |
1810 | # opObj.addParameter(name='timerange', value=timerange, format='float') |
|
1810 | # opObj.addParameter(name='timerange', value=timerange, format='float') | |
1811 |
|
1811 | |||
1812 | if not trange == '': |
|
1812 | if not trange == '': | |
1813 | xvalueList = trange.split(',') |
|
1813 | xvalueList = trange.split(',') | |
1814 | try: |
|
1814 | try: | |
1815 | value1 = float(xvalueList[0]) |
|
1815 | value1 = float(xvalueList[0]) | |
1816 | value2 = float(xvalueList[1]) |
|
1816 | value2 = float(xvalueList[1]) | |
1817 | except: |
|
1817 | except: | |
1818 | self.console.clear() |
|
1818 | self.console.clear() | |
1819 | self.console.append("Invalid time range") |
|
1819 | self.console.append("Invalid time range") | |
1820 | return 0 |
|
1820 | return 0 | |
1821 |
|
1821 | |||
1822 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1822 | opObj.addParameter(name='xmin', value=value1, format='float') | |
1823 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1823 | opObj.addParameter(name='xmax', value=value2, format='float') | |
1824 |
|
1824 | |||
1825 | if not db_range == '': |
|
1825 | if not db_range == '': | |
1826 | yvalueList = db_range.split(",") |
|
1826 | yvalueList = db_range.split(",") | |
1827 | try: |
|
1827 | try: | |
1828 | value1 = float(yvalueList[0]) |
|
1828 | value1 = float(yvalueList[0]) | |
1829 | value2 = float(yvalueList[1]) |
|
1829 | value2 = float(yvalueList[1]) | |
1830 | except: |
|
1830 | except: | |
1831 | self.console.clear() |
|
1831 | self.console.clear() | |
1832 | self.console.append("Invalid db range") |
|
1832 | self.console.append("Invalid db range") | |
1833 | return 0 |
|
1833 | return 0 | |
1834 |
|
1834 | |||
1835 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1835 | opObj.addParameter(name='ymin', value=value1, format='float') | |
1836 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1836 | opObj.addParameter(name='ymax', value=value2, format='float') | |
1837 |
|
1837 | |||
1838 | if self.specGraphSaveRTInoise.isChecked(): |
|
1838 | if self.specGraphSaveRTInoise.isChecked(): | |
1839 | checkPath = True |
|
1839 | checkPath = True | |
1840 | opObj.addParameter(name='save', value='1', format='bool') |
|
1840 | opObj.addParameter(name='save', value='1', format='bool') | |
1841 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1841 | opObj.addParameter(name='figpath', value=figpath, format='str') | |
1842 | if figfile: |
|
1842 | if figfile: | |
1843 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1843 | opObj.addParameter(name='figfile', value=value, format='str') | |
1844 | if wrperiod: |
|
1844 | if wrperiod: | |
1845 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1845 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') | |
1846 |
|
1846 | |||
1847 | # test_ftp |
|
1847 | # test_ftp | |
1848 | if self.specGraphftpRTInoise.isChecked(): |
|
1848 | if self.specGraphftpRTInoise.isChecked(): | |
1849 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1849 | opObj.addParameter(name='ftp', value='1', format='int') | |
1850 | self.addFTPConf2Operation(puObj, opObj) |
|
1850 | self.addFTPConf2Operation(puObj, opObj) | |
1851 | addFTP = True |
|
1851 | addFTP = True | |
1852 |
|
1852 | |||
1853 | if checkPath: |
|
1853 | if checkPath: | |
1854 | if not figpath: |
|
1854 | if not figpath: | |
1855 | self.console.clear() |
|
1855 | self.console.clear() | |
1856 | self.console.append("Graphic path should be defined") |
|
1856 | self.console.append("Graphic path should be defined") | |
1857 | return 0 |
|
1857 | return 0 | |
1858 |
|
1858 | |||
1859 | if addFTP and not figpath: |
|
1859 | if addFTP and not figpath: | |
1860 | self.console.clear() |
|
1860 | self.console.clear() | |
1861 | self.console.append("You have to save the plots before sending them to FTP Server") |
|
1861 | self.console.append("You have to save the plots before sending them to FTP Server") | |
1862 | return 0 |
|
1862 | return 0 | |
1863 |
|
1863 | |||
1864 | # if something happend |
|
1864 | # if something happend | |
1865 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Spectra') |
|
1865 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Spectra') | |
1866 | if parms_ok: |
|
1866 | if parms_ok: | |
1867 | opObj = puObj.addOperation(name='SpectraWriter', optype='other') |
|
1867 | opObj = puObj.addOperation(name='SpectraWriter', optype='other') | |
1868 | opObj.addParameter(name='path', value=output_path) |
|
1868 | opObj.addParameter(name='path', value=output_path) | |
1869 | opObj.addParameter(name='blocksPerFile', value=blocksperfile, format='int') |
|
1869 | opObj.addParameter(name='blocksPerFile', value=blocksperfile, format='int') | |
1870 |
|
1870 | |||
1871 | self.console.clear() |
|
1871 | self.console.clear() | |
1872 | try: |
|
1872 | try: | |
1873 | self.refreshPUProperties(puObj) |
|
1873 | self.refreshPUProperties(puObj) | |
1874 | except: |
|
1874 | except: | |
1875 | self.console.append("An error reading input parameters was found ... Check them!") |
|
1875 | self.console.append("An error reading input parameters was found ... Check them!") | |
1876 | return 0 |
|
1876 | return 0 | |
1877 |
|
1877 | |||
1878 | self.console.append("Save your project and press Play button to start signal processing") |
|
1878 | self.console.append("Save your project and press Play button to start signal processing") | |
1879 |
|
1879 | |||
1880 | self.actionSaveToolbar.setEnabled(True) |
|
1880 | self.actionSaveToolbar.setEnabled(True) | |
1881 | self.actionStarToolbar.setEnabled(True) |
|
1881 | self.actionStarToolbar.setEnabled(True) | |
1882 |
|
1882 | |||
1883 | return 1 |
|
1883 | return 1 | |
1884 |
|
1884 | |||
1885 | """ |
|
1885 | """ | |
1886 | Spectra Graph |
|
1886 | Spectra Graph | |
1887 | """ |
|
1887 | """ | |
1888 | @pyqtSignature("int") |
|
1888 | @pyqtSignature("int") | |
1889 | def on_specGraphCebSpectraplot_stateChanged(self, p0): |
|
1889 | def on_specGraphCebSpectraplot_stateChanged(self, p0): | |
1890 |
|
1890 | |||
1891 | self.__checkSpecGraphFilters() |
|
1891 | self.__checkSpecGraphFilters() | |
1892 |
|
1892 | |||
1893 |
|
1893 | |||
1894 | @pyqtSignature("int") |
|
1894 | @pyqtSignature("int") | |
1895 | def on_specGraphCebCrossSpectraplot_stateChanged(self, p0): |
|
1895 | def on_specGraphCebCrossSpectraplot_stateChanged(self, p0): | |
1896 |
|
1896 | |||
1897 | self.__checkSpecGraphFilters() |
|
1897 | self.__checkSpecGraphFilters() | |
1898 |
|
1898 | |||
1899 | @pyqtSignature("int") |
|
1899 | @pyqtSignature("int") | |
1900 | def on_specGraphCebRTIplot_stateChanged(self, p0): |
|
1900 | def on_specGraphCebRTIplot_stateChanged(self, p0): | |
1901 |
|
1901 | |||
1902 | self.__checkSpecGraphFilters() |
|
1902 | self.__checkSpecGraphFilters() | |
1903 |
|
1903 | |||
1904 |
|
1904 | |||
1905 | @pyqtSignature("int") |
|
1905 | @pyqtSignature("int") | |
1906 | def on_specGraphCebRTInoise_stateChanged(self, p0): |
|
1906 | def on_specGraphCebRTInoise_stateChanged(self, p0): | |
1907 |
|
1907 | |||
1908 | self.__checkSpecGraphFilters() |
|
1908 | self.__checkSpecGraphFilters() | |
1909 |
|
1909 | |||
1910 |
|
1910 | |||
1911 | @pyqtSignature("int") |
|
1911 | @pyqtSignature("int") | |
1912 | def on_specGraphCebCoherencmap_stateChanged(self, p0): |
|
1912 | def on_specGraphCebCoherencmap_stateChanged(self, p0): | |
1913 |
|
1913 | |||
1914 | self.__checkSpecGraphFilters() |
|
1914 | self.__checkSpecGraphFilters() | |
1915 |
|
1915 | |||
1916 | @pyqtSignature("int") |
|
1916 | @pyqtSignature("int") | |
1917 | def on_specGraphPowerprofile_stateChanged(self, p0): |
|
1917 | def on_specGraphPowerprofile_stateChanged(self, p0): | |
1918 |
|
1918 | |||
1919 | self.__checkSpecGraphFilters() |
|
1919 | self.__checkSpecGraphFilters() | |
1920 |
|
1920 | |||
1921 | @pyqtSignature("int") |
|
1921 | @pyqtSignature("int") | |
1922 | def on_specGraphPhase_stateChanged(self, p0): |
|
1922 | def on_specGraphPhase_stateChanged(self, p0): | |
1923 |
|
1923 | |||
1924 | self.__checkSpecGraphFilters() |
|
1924 | self.__checkSpecGraphFilters() | |
1925 |
|
1925 | |||
1926 | @pyqtSignature("int") |
|
1926 | @pyqtSignature("int") | |
1927 | def on_specGraphSaveSpectra_stateChanged(self, p0): |
|
1927 | def on_specGraphSaveSpectra_stateChanged(self, p0): | |
1928 | """ |
|
1928 | """ | |
1929 | """ |
|
1929 | """ | |
1930 | self.__checkSpecGraphSaving() |
|
1930 | self.__checkSpecGraphSaving() | |
1931 |
|
1931 | |||
1932 | @pyqtSignature("int") |
|
1932 | @pyqtSignature("int") | |
1933 | def on_specGraphSaveCross_stateChanged(self, p0): |
|
1933 | def on_specGraphSaveCross_stateChanged(self, p0): | |
1934 |
|
1934 | |||
1935 | self.__checkSpecGraphSaving() |
|
1935 | self.__checkSpecGraphSaving() | |
1936 |
|
1936 | |||
1937 | @pyqtSignature("int") |
|
1937 | @pyqtSignature("int") | |
1938 | def on_specGraphSaveRTIplot_stateChanged(self, p0): |
|
1938 | def on_specGraphSaveRTIplot_stateChanged(self, p0): | |
1939 |
|
1939 | |||
1940 | self.__checkSpecGraphSaving() |
|
1940 | self.__checkSpecGraphSaving() | |
1941 |
|
1941 | |||
1942 | @pyqtSignature("int") |
|
1942 | @pyqtSignature("int") | |
1943 | def on_specGraphSaveRTInoise_stateChanged(self, p0): |
|
1943 | def on_specGraphSaveRTInoise_stateChanged(self, p0): | |
1944 |
|
1944 | |||
1945 | self.__checkSpecGraphSaving() |
|
1945 | self.__checkSpecGraphSaving() | |
1946 |
|
1946 | |||
1947 | @pyqtSignature("int") |
|
1947 | @pyqtSignature("int") | |
1948 | def on_specGraphSaveCoherencemap_stateChanged(self, p0): |
|
1948 | def on_specGraphSaveCoherencemap_stateChanged(self, p0): | |
1949 |
|
1949 | |||
1950 | self.__checkSpecGraphSaving() |
|
1950 | self.__checkSpecGraphSaving() | |
1951 |
|
1951 | |||
1952 | @pyqtSignature("int") |
|
1952 | @pyqtSignature("int") | |
1953 | def on_specGraphSavePowerprofile_stateChanged(self, p0): |
|
1953 | def on_specGraphSavePowerprofile_stateChanged(self, p0): | |
1954 |
|
1954 | |||
1955 | self.__checkSpecGraphSaving() |
|
1955 | self.__checkSpecGraphSaving() | |
1956 |
|
1956 | |||
1957 | @pyqtSignature("int") |
|
1957 | @pyqtSignature("int") | |
1958 | def on_specGraphftpSpectra_stateChanged(self, p0): |
|
1958 | def on_specGraphftpSpectra_stateChanged(self, p0): | |
1959 | """ |
|
1959 | """ | |
1960 | """ |
|
1960 | """ | |
1961 | self.__checkSpecGraphFTP() |
|
1961 | self.__checkSpecGraphFTP() | |
1962 |
|
1962 | |||
1963 |
|
1963 | |||
1964 | @pyqtSignature("int") |
|
1964 | @pyqtSignature("int") | |
1965 | def on_specGraphftpCross_stateChanged(self, p0): |
|
1965 | def on_specGraphftpCross_stateChanged(self, p0): | |
1966 |
|
1966 | |||
1967 | self.__checkSpecGraphFTP() |
|
1967 | self.__checkSpecGraphFTP() | |
1968 |
|
1968 | |||
1969 | @pyqtSignature("int") |
|
1969 | @pyqtSignature("int") | |
1970 | def on_specGraphftpRTIplot_stateChanged(self, p0): |
|
1970 | def on_specGraphftpRTIplot_stateChanged(self, p0): | |
1971 |
|
1971 | |||
1972 | self.__checkSpecGraphFTP() |
|
1972 | self.__checkSpecGraphFTP() | |
1973 |
|
1973 | |||
1974 | @pyqtSignature("int") |
|
1974 | @pyqtSignature("int") | |
1975 | def on_specGraphftpRTInoise_stateChanged(self, p0): |
|
1975 | def on_specGraphftpRTInoise_stateChanged(self, p0): | |
1976 |
|
1976 | |||
1977 | self.__checkSpecGraphFTP() |
|
1977 | self.__checkSpecGraphFTP() | |
1978 |
|
1978 | |||
1979 | @pyqtSignature("int") |
|
1979 | @pyqtSignature("int") | |
1980 | def on_specGraphftpCoherencemap_stateChanged(self, p0): |
|
1980 | def on_specGraphftpCoherencemap_stateChanged(self, p0): | |
1981 |
|
1981 | |||
1982 | self.__checkSpecGraphFTP() |
|
1982 | self.__checkSpecGraphFTP() | |
1983 |
|
1983 | |||
1984 | @pyqtSignature("int") |
|
1984 | @pyqtSignature("int") | |
1985 | def on_specGraphftpPowerprofile_stateChanged(self, p0): |
|
1985 | def on_specGraphftpPowerprofile_stateChanged(self, p0): | |
1986 |
|
1986 | |||
1987 | self.__checkSpecGraphFTP() |
|
1987 | self.__checkSpecGraphFTP() | |
1988 |
|
1988 | |||
1989 | @pyqtSignature("") |
|
1989 | @pyqtSignature("") | |
1990 | def on_specGraphToolPath_clicked(self): |
|
1990 | def on_specGraphToolPath_clicked(self): | |
1991 | """ |
|
1991 | """ | |
1992 | """ |
|
1992 | """ | |
1993 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
1993 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
1994 | self.specGraphPath.setText(save_path) |
|
1994 | self.specGraphPath.setText(save_path) | |
1995 | if not os.path.exists(save_path): |
|
1995 | if not os.path.exists(save_path): | |
1996 | self.console.clear() |
|
1996 | self.console.clear() | |
1997 | self.console.append("Write a valid path") |
|
1997 | self.console.append("Write a valid path") | |
1998 | return |
|
1998 | return | |
1999 |
|
1999 | |||
2000 | @pyqtSignature("") |
|
2000 | @pyqtSignature("") | |
2001 | def on_specGraphClear_clicked(self): |
|
2001 | def on_specGraphClear_clicked(self): | |
2002 | return |
|
2002 | return | |
2003 |
|
2003 | |||
2004 | @pyqtSignature("") |
|
2004 | @pyqtSignature("") | |
2005 | def on_specHeisGraphToolPath_clicked(self): |
|
2005 | def on_specHeisGraphToolPath_clicked(self): | |
2006 | """ |
|
2006 | """ | |
2007 | """ |
|
2007 | """ | |
2008 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
2008 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
2009 | self.specHeisGraphPath.setText(save_path) |
|
2009 | self.specHeisGraphPath.setText(save_path) | |
2010 | if not os.path.exists(save_path): |
|
2010 | if not os.path.exists(save_path): | |
2011 | self.console.clear() |
|
2011 | self.console.clear() | |
2012 | self.console.append("Write a valid path") |
|
2012 | self.console.append("Write a valid path") | |
2013 | return |
|
2013 | return | |
2014 |
|
2014 | |||
2015 | @pyqtSignature("int") |
|
2015 | @pyqtSignature("int") | |
2016 | def on_specHeisOpCebIncoherent_stateChanged(self, p0): |
|
2016 | def on_specHeisOpCebIncoherent_stateChanged(self, p0): | |
2017 | """ |
|
2017 | """ | |
2018 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . |
|
2018 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . | |
2019 | """ |
|
2019 | """ | |
2020 | if p0 == 2: |
|
2020 | if p0 == 2: | |
2021 | self.specHeisOpIncoherent.setEnabled(True) |
|
2021 | self.specHeisOpIncoherent.setEnabled(True) | |
2022 | self.specHeisOpCobIncInt.setEnabled(True) |
|
2022 | self.specHeisOpCobIncInt.setEnabled(True) | |
2023 | if p0 == 0: |
|
2023 | if p0 == 0: | |
2024 | self.specHeisOpIncoherent.setEnabled(False) |
|
2024 | self.specHeisOpIncoherent.setEnabled(False) | |
2025 | self.specHeisOpCobIncInt.setEnabled(False) |
|
2025 | self.specHeisOpCobIncInt.setEnabled(False) | |
2026 |
|
2026 | |||
2027 | @pyqtSignature("") |
|
2027 | @pyqtSignature("") | |
2028 | def on_specHeisOpOk_clicked(self): |
|
2028 | def on_specHeisOpOk_clicked(self): | |
2029 | """ |
|
2029 | """ | |
2030 | AΓADE OPERACION SPECTRAHEIS |
|
2030 | AΓADE OPERACION SPECTRAHEIS | |
2031 | """ |
|
2031 | """ | |
2032 | addFTP = False |
|
2032 | addFTP = False | |
2033 | checkPath = False |
|
2033 | checkPath = False | |
2034 |
|
2034 | |||
2035 | self.actionSaveToolbar.setEnabled(False) |
|
2035 | self.actionSaveToolbar.setEnabled(False) | |
2036 | self.actionStarToolbar.setEnabled(False) |
|
2036 | self.actionStarToolbar.setEnabled(False) | |
2037 |
|
2037 | |||
2038 | self.console.clear() |
|
2038 | self.console.clear() | |
2039 | self.console.append("Checking input parameters ...") |
|
2039 | self.console.append("Checking input parameters ...") | |
2040 |
|
2040 | |||
2041 | puObj = self.getSelectedItemObj() |
|
2041 | puObj = self.getSelectedItemObj() | |
2042 | puObj.removeOperations() |
|
2042 | puObj.removeOperations() | |
2043 |
|
2043 | |||
2044 | if self.specHeisOpCebIncoherent.isChecked(): |
|
2044 | if self.specHeisOpCebIncoherent.isChecked(): | |
2045 | value = str(self.specHeisOpIncoherent.text()) |
|
2045 | value = str(self.specHeisOpIncoherent.text()) | |
2046 | name_operation = 'IncohInt4SpectraHeis' |
|
2046 | name_operation = 'IncohInt4SpectraHeis' | |
2047 | optype = 'other' |
|
2047 | optype = 'other' | |
2048 |
|
2048 | |||
2049 | name_parameter = 'timeInterval' |
|
2049 | name_parameter = 'timeInterval' | |
2050 | format = 'float' |
|
2050 | format = 'float' | |
2051 |
|
2051 | |||
2052 | if self.specOpCobIncInt.currentIndex() == 0: |
|
2052 | if self.specOpCobIncInt.currentIndex() == 0: | |
2053 | name_parameter = 'timeInterval' |
|
2053 | name_parameter = 'timeInterval' | |
2054 | format = 'float' |
|
2054 | format = 'float' | |
2055 |
|
2055 | |||
2056 | if not isFloat(value): |
|
2056 | if not isFloat(value): | |
2057 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
2057 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) | |
2058 | return 0 |
|
2058 | return 0 | |
2059 |
|
2059 | |||
2060 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2060 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
2061 |
|
2061 | |||
2062 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
2062 | if not opObj.addParameter(name=name_parameter, value=value, format=format): | |
2063 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
2063 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) | |
2064 | return 0 |
|
2064 | return 0 | |
2065 |
|
2065 | |||
2066 | channelList = str(self.specHeisGgraphChannelList.text()) |
|
2066 | channelList = str(self.specHeisGgraphChannelList.text()) | |
2067 | freq_range = str(self.specHeisGgraphXminXmax.text()) |
|
2067 | freq_range = str(self.specHeisGgraphXminXmax.text()) | |
2068 | power_range = str(self.specHeisGgraphYminYmax.text()) |
|
2068 | power_range = str(self.specHeisGgraphYminYmax.text()) | |
2069 | time_range = str(self.specHeisGgraphTminTmax.text()) |
|
2069 | time_range = str(self.specHeisGgraphTminTmax.text()) | |
2070 | timerange = str(self.specHeisGgraphTimeRange.text()) |
|
2070 | timerange = str(self.specHeisGgraphTimeRange.text()) | |
2071 |
|
2071 | |||
2072 | # ---- Spectra Plot----- |
|
2072 | # ---- Spectra Plot----- | |
2073 | if self.specHeisGraphCebSpectraplot.isChecked(): |
|
2073 | if self.specHeisGraphCebSpectraplot.isChecked(): | |
2074 |
|
2074 | |||
2075 | name_operation = 'SpectraHeisScope' |
|
2075 | name_operation = 'SpectraHeisScope' | |
2076 | optype = 'other' |
|
2076 | optype = 'other' | |
2077 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2077 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
2078 |
|
2078 | |||
2079 | name_parameter = 'id' |
|
2079 | name_parameter = 'id' | |
2080 | format = 'int' |
|
2080 | format = 'int' | |
2081 | value = opObj.id |
|
2081 | value = opObj.id | |
2082 |
|
2082 | |||
2083 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
2083 | if not opObj.addParameter(name=name_parameter, value=value, format=format): | |
2084 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
2084 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) | |
2085 | return 0 |
|
2085 | return 0 | |
2086 |
|
2086 | |||
2087 | if not (channelList == ''): |
|
2087 | if not (channelList == ''): | |
2088 | name_parameter = 'channelList' |
|
2088 | name_parameter = 'channelList' | |
2089 | format = 'intlist' |
|
2089 | format = 'intlist' | |
2090 |
|
2090 | |||
2091 | if not isList(channelList): |
|
2091 | if not isList(channelList): | |
2092 | self.console.append("Invalid value '%s' for '%s'" %(channelList, name_parameter)) |
|
2092 | self.console.append("Invalid value '%s' for '%s'" %(channelList, name_parameter)) | |
2093 | return 0 |
|
2093 | return 0 | |
2094 |
|
2094 | |||
2095 | opObj.addParameter(name=name_parameter, value=channelList, format=format) |
|
2095 | opObj.addParameter(name=name_parameter, value=channelList, format=format) | |
2096 |
|
2096 | |||
2097 | if not freq_range == '': |
|
2097 | if not freq_range == '': | |
2098 | xvalueList = freq_range.split(',') |
|
2098 | xvalueList = freq_range.split(',') | |
2099 |
|
2099 | |||
2100 | if len(xvalueList) != 2: |
|
2100 | if len(xvalueList) != 2: | |
2101 | self.console.append("Invalid value '%s' for '%s'" %(freq_range, "xrange")) |
|
2101 | self.console.append("Invalid value '%s' for '%s'" %(freq_range, "xrange")) | |
2102 | return 0 |
|
2102 | return 0 | |
2103 |
|
2103 | |||
2104 | value1 = xvalueList[0] |
|
2104 | value1 = xvalueList[0] | |
2105 | value2 = xvalueList[1] |
|
2105 | value2 = xvalueList[1] | |
2106 |
|
2106 | |||
2107 | if not isFloat(value1) or not isFloat(value2): |
|
2107 | if not isFloat(value1) or not isFloat(value2): | |
2108 | self.console.append("Invalid value '%s' for '%s'" %(freq_range, "xrange")) |
|
2108 | self.console.append("Invalid value '%s' for '%s'" %(freq_range, "xrange")) | |
2109 | return 0 |
|
2109 | return 0 | |
2110 |
|
2110 | |||
2111 | name1 = 'xmin' |
|
2111 | name1 = 'xmin' | |
2112 | name2 = 'xmax' |
|
2112 | name2 = 'xmax' | |
2113 | format = 'float' |
|
2113 | format = 'float' | |
2114 |
|
2114 | |||
2115 | opObj.addParameter(name=name1, value=value1, format=format) |
|
2115 | opObj.addParameter(name=name1, value=value1, format=format) | |
2116 | opObj.addParameter(name=name2, value=value2, format=format) |
|
2116 | opObj.addParameter(name=name2, value=value2, format=format) | |
2117 |
|
2117 | |||
2118 | #------specHeisGgraphYmin-Ymax--- |
|
2118 | #------specHeisGgraphYmin-Ymax--- | |
2119 | if not power_range == '': |
|
2119 | if not power_range == '': | |
2120 | yvalueList = power_range.split(",") |
|
2120 | yvalueList = power_range.split(",") | |
2121 |
|
2121 | |||
2122 | if len(yvalueList) != 2: |
|
2122 | if len(yvalueList) != 2: | |
2123 | self.console.append("Invalid value '%s' for '%s'" %(power_range, "xrange")) |
|
2123 | self.console.append("Invalid value '%s' for '%s'" %(power_range, "xrange")) | |
2124 | return 0 |
|
2124 | return 0 | |
2125 |
|
2125 | |||
2126 | value1 = yvalueList[0] |
|
2126 | value1 = yvalueList[0] | |
2127 | value2 = yvalueList[1] |
|
2127 | value2 = yvalueList[1] | |
2128 |
|
2128 | |||
2129 | if not isFloat(value1) or not isFloat(value2): |
|
2129 | if not isFloat(value1) or not isFloat(value2): | |
2130 | self.console.append("Invalid value '%s' for '%s'" %(power_range, "yrange")) |
|
2130 | self.console.append("Invalid value '%s' for '%s'" %(power_range, "yrange")) | |
2131 | return 0 |
|
2131 | return 0 | |
2132 |
|
2132 | |||
2133 | name1 = 'ymin' |
|
2133 | name1 = 'ymin' | |
2134 | name2 = 'ymax' |
|
2134 | name2 = 'ymax' | |
2135 | format = 'float' |
|
2135 | format = 'float' | |
2136 | opObj.addParameter(name=name1, value=value1, format=format) |
|
2136 | opObj.addParameter(name=name1, value=value1, format=format) | |
2137 | opObj.addParameter(name=name2, value=value2, format=format) |
|
2137 | opObj.addParameter(name=name2, value=value2, format=format) | |
2138 |
|
2138 | |||
2139 | if self.specHeisGraphSaveSpectra.isChecked(): |
|
2139 | if self.specHeisGraphSaveSpectra.isChecked(): | |
2140 | checkPath = True |
|
2140 | checkPath = True | |
2141 | name_parameter1 = 'save' |
|
2141 | name_parameter1 = 'save' | |
2142 | name_parameter2 = 'figpath' |
|
2142 | name_parameter2 = 'figpath' | |
2143 | name_parameter3 = 'figfile' |
|
2143 | name_parameter3 = 'figfile' | |
2144 | value1 = '1' |
|
2144 | value1 = '1' | |
2145 | value2 = str(self.specHeisGraphPath.text()) |
|
2145 | value2 = str(self.specHeisGraphPath.text()) | |
2146 | value3 = str(self.specHeisGraphPrefix.text()) |
|
2146 | value3 = str(self.specHeisGraphPrefix.text()) | |
2147 | format1 = 'bool' |
|
2147 | format1 = 'bool' | |
2148 | format2 = 'str' |
|
2148 | format2 = 'str' | |
2149 | opObj.addParameter(name=name_parameter1, value=value1 , format=format1) |
|
2149 | opObj.addParameter(name=name_parameter1, value=value1 , format=format1) | |
2150 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) |
|
2150 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) | |
2151 | if not value3 == "": |
|
2151 | if not value3 == "": | |
2152 | try: |
|
2152 | try: | |
2153 | value3 = str(self.specHeisGraphPrefix.text()) |
|
2153 | value3 = str(self.specHeisGraphPrefix.text()) | |
2154 | except: |
|
2154 | except: | |
2155 | self.console.clear() |
|
2155 | self.console.clear() | |
2156 | self.console.append("Please Write prefix") |
|
2156 | self.console.append("Please Write prefix") | |
2157 | return 0 |
|
2157 | return 0 | |
2158 | opObj.addParameter(name='figfile', value=str(self.specHeisGraphPrefix.text()), format='str') |
|
2158 | opObj.addParameter(name='figfile', value=str(self.specHeisGraphPrefix.text()), format='str') | |
2159 |
|
2159 | |||
2160 | # opObj.addParameter(name=name_parameter3, value=value3, format=format2) |
|
2160 | # opObj.addParameter(name=name_parameter3, value=value3, format=format2) | |
2161 | # opObj.addParameter(name='wr_period', value='5',format='int') |
|
2161 | # opObj.addParameter(name='wr_period', value='5',format='int') | |
2162 |
|
2162 | |||
2163 | if self.specHeisGraphftpSpectra.isChecked(): |
|
2163 | if self.specHeisGraphftpSpectra.isChecked(): | |
2164 | opObj.addParameter(name='ftp', value='1', format='int') |
|
2164 | opObj.addParameter(name='ftp', value='1', format='int') | |
2165 | self.addFTPConf2Operation(puObj, opObj) |
|
2165 | self.addFTPConf2Operation(puObj, opObj) | |
2166 | addFTP = True |
|
2166 | addFTP = True | |
2167 |
|
2167 | |||
2168 | if self.specHeisGraphCebRTIplot.isChecked(): |
|
2168 | if self.specHeisGraphCebRTIplot.isChecked(): | |
2169 | name_operation = 'RTIfromSpectraHeis' |
|
2169 | name_operation = 'RTIfromSpectraHeis' | |
2170 | optype = 'other' |
|
2170 | optype = 'other' | |
2171 |
|
2171 | |||
2172 | name_parameter = 'id' |
|
2172 | name_parameter = 'id' | |
2173 | format = 'int' |
|
2173 | format = 'int' | |
2174 |
|
2174 | |||
2175 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2175 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
2176 | value = opObj.id |
|
2176 | value = opObj.id | |
2177 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
2177 | opObj.addParameter(name=name_parameter, value=value, format=format) | |
2178 |
|
2178 | |||
2179 | if not channelList == '': |
|
2179 | if not channelList == '': | |
2180 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
2180 | opObj.addParameter(name='channelList', value=channelList, format='intlist') | |
2181 |
|
2181 | |||
2182 | if not time_range == '': |
|
2182 | if not time_range == '': | |
2183 | xvalueList = time_range.split(',') |
|
2183 | xvalueList = time_range.split(',') | |
2184 | try: |
|
2184 | try: | |
2185 | value = float(xvalueList[0]) |
|
2185 | value = float(xvalueList[0]) | |
2186 | value = float(xvalueList[1]) |
|
2186 | value = float(xvalueList[1]) | |
2187 | except: |
|
2187 | except: | |
2188 | return 0 |
|
2188 | return 0 | |
2189 | format = 'float' |
|
2189 | format = 'float' | |
2190 | opObj.addParameter(name='xmin', value=xvalueList[0], format=format) |
|
2190 | opObj.addParameter(name='xmin', value=xvalueList[0], format=format) | |
2191 | opObj.addParameter(name='xmax', value=xvalueList[1], format=format) |
|
2191 | opObj.addParameter(name='xmax', value=xvalueList[1], format=format) | |
2192 |
|
2192 | |||
2193 | if not timerange == '': |
|
2193 | if not timerange == '': | |
2194 | format = 'int' |
|
2194 | format = 'int' | |
2195 | try: |
|
2195 | try: | |
2196 | timerange = int(timerange) |
|
2196 | timerange = int(timerange) | |
2197 | except: |
|
2197 | except: | |
2198 | return 0 |
|
2198 | return 0 | |
2199 | opObj.addParameter(name='timerange', value=timerange, format=format) |
|
2199 | opObj.addParameter(name='timerange', value=timerange, format=format) | |
2200 |
|
2200 | |||
2201 |
|
2201 | |||
2202 | if not power_range == '': |
|
2202 | if not power_range == '': | |
2203 | yvalueList = power_range.split(",") |
|
2203 | yvalueList = power_range.split(",") | |
2204 | try: |
|
2204 | try: | |
2205 | value = float(yvalueList[0]) |
|
2205 | value = float(yvalueList[0]) | |
2206 | value = float(yvalueList[1]) |
|
2206 | value = float(yvalueList[1]) | |
2207 | except: |
|
2207 | except: | |
2208 | return 0 |
|
2208 | return 0 | |
2209 |
|
2209 | |||
2210 | format = 'float' |
|
2210 | format = 'float' | |
2211 | opObj.addParameter(name='ymin', value=yvalueList[0], format=format) |
|
2211 | opObj.addParameter(name='ymin', value=yvalueList[0], format=format) | |
2212 | opObj.addParameter(name='ymax', value=yvalueList[1], format=format) |
|
2212 | opObj.addParameter(name='ymax', value=yvalueList[1], format=format) | |
2213 |
|
2213 | |||
2214 | if self.specHeisGraphSaveRTIplot.isChecked(): |
|
2214 | if self.specHeisGraphSaveRTIplot.isChecked(): | |
2215 | checkPath = True |
|
2215 | checkPath = True | |
2216 | opObj.addParameter(name='save', value='1', format='bool') |
|
2216 | opObj.addParameter(name='save', value='1', format='bool') | |
2217 | opObj.addParameter(name='figpath', value=str(self.specHeisGraphPath.text()), format='str') |
|
2217 | opObj.addParameter(name='figpath', value=str(self.specHeisGraphPath.text()), format='str') | |
2218 | value = str(self.specHeisGraphPrefix.text()) |
|
2218 | value = str(self.specHeisGraphPrefix.text()) | |
2219 | if not value == "": |
|
2219 | if not value == "": | |
2220 | try: |
|
2220 | try: | |
2221 | value = str(self.specHeisGraphPrefix.text()) |
|
2221 | value = str(self.specHeisGraphPrefix.text()) | |
2222 | except: |
|
2222 | except: | |
2223 | self.console.clear() |
|
2223 | self.console.clear() | |
2224 | self.console.append("Please Write prefix") |
|
2224 | self.console.append("Please Write prefix") | |
2225 | return 0 |
|
2225 | return 0 | |
2226 | opObj.addParameter(name='figfile', value=value, format='str') |
|
2226 | opObj.addParameter(name='figfile', value=value, format='str') | |
2227 |
|
2227 | |||
2228 | # test_ftp |
|
2228 | # test_ftp | |
2229 | if self.specHeisGraphftpRTIplot.isChecked(): |
|
2229 | if self.specHeisGraphftpRTIplot.isChecked(): | |
2230 | opObj.addParameter(name='ftp', value='1', format='int') |
|
2230 | opObj.addParameter(name='ftp', value='1', format='int') | |
2231 | self.addFTPConf2Operation(puObj, opObj) |
|
2231 | self.addFTPConf2Operation(puObj, opObj) | |
2232 | addFTP = True |
|
2232 | addFTP = True | |
2233 |
|
2233 | |||
2234 | localfolder = None |
|
2234 | localfolder = None | |
2235 | if checkPath: |
|
2235 | if checkPath: | |
2236 | localfolder = str(self.specHeisGraphPath.text()) |
|
2236 | localfolder = str(self.specHeisGraphPath.text()) | |
2237 | if localfolder == '': |
|
2237 | if localfolder == '': | |
2238 | self.console.clear() |
|
2238 | self.console.clear() | |
2239 | self.console.append("Graphic path should be defined") |
|
2239 | self.console.append("Graphic path should be defined") | |
2240 | return 0 |
|
2240 | return 0 | |
2241 |
|
2241 | |||
2242 | if addFTP and not localfolder: |
|
2242 | if addFTP and not localfolder: | |
2243 | self.console.clear() |
|
2243 | self.console.clear() | |
2244 | self.console.append("You should save plots before send them to FTP Server") |
|
2244 | self.console.append("You should save plots before send them to FTP Server") | |
2245 | return 0 |
|
2245 | return 0 | |
2246 |
|
2246 | |||
2247 | # if something happened |
|
2247 | # if something happened | |
2248 | parms_ok, output_path, blocksperfile, metada = self.checkInputsPUSave(datatype='SpectraHeis') |
|
2248 | parms_ok, output_path, blocksperfile, metadata_file = self.checkInputsPUSave(datatype='SpectraHeis') | |
2249 | if parms_ok: |
|
2249 | if parms_ok: | |
2250 | name_operation = 'FitsWriter' |
|
2250 | name_operation = 'FitsWriter' | |
2251 | optype = 'other' |
|
2251 | optype = 'other' | |
2252 | name_parameter1 = 'path' |
|
2252 | name_parameter1 = 'path' | |
2253 | name_parameter2 = 'dataBlocksPerFile' |
|
2253 | name_parameter2 = 'dataBlocksPerFile' | |
2254 | name_parameter3 = 'metadatafile' |
|
2254 | name_parameter3 = 'metadatafile' | |
2255 | value1 = output_path |
|
2255 | value1 = output_path | |
2256 | value2 = blocksperfile |
|
2256 | value2 = blocksperfile | |
2257 | value3 = metada |
|
2257 | value3 = metadata_file | |
2258 | format2 = "int" |
|
2258 | format2 = "int" | |
2259 | format3 = "str" |
|
2259 | format3 = "str" | |
2260 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2260 | opObj = puObj.addOperation(name=name_operation, optype=optype) | |
|
2261 | ||||
2261 | opObj.addParameter(name=name_parameter1, value=value1) |
|
2262 | opObj.addParameter(name=name_parameter1, value=value1) | |
2262 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) |
|
2263 | ||
2263 | opObj.addParameter(name=name_parameter3, value=value3, format=format3) |
|
2264 | if blocksperfile: | |
|
2265 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) | |||
|
2266 | ||||
|
2267 | if metadata_file: | |||
|
2268 | opObj.addParameter(name=name_parameter3, value=value3, format=format3) | |||
2264 |
|
2269 | |||
2265 | self.console.clear() |
|
2270 | self.console.clear() | |
2266 | try: |
|
2271 | try: | |
2267 | self.refreshPUProperties(puObj) |
|
2272 | self.refreshPUProperties(puObj) | |
2268 | except: |
|
2273 | except: | |
2269 | self.console.append("An error reading input parameters was found ... Check them!") |
|
2274 | self.console.append("An error reading input parameters was found ... Check them!") | |
2270 | return 0 |
|
2275 | return 0 | |
2271 |
|
2276 | |||
2272 | self.console.append("Save your project and press Play button to start signal processing") |
|
2277 | self.console.append("Save your project and press Play button to start signal processing") | |
2273 |
|
2278 | |||
2274 | self.actionSaveToolbar.setEnabled(True) |
|
2279 | self.actionSaveToolbar.setEnabled(True) | |
2275 | self.actionStarToolbar.setEnabled(True) |
|
2280 | self.actionStarToolbar.setEnabled(True) | |
2276 |
|
2281 | |||
2277 | return 1 |
|
2282 | return 1 | |
2278 | @pyqtSignature("int") |
|
2283 | @pyqtSignature("int") | |
2279 | def on_specHeisGraphCebSpectraplot_stateChanged(self, p0): |
|
2284 | def on_specHeisGraphCebSpectraplot_stateChanged(self, p0): | |
2280 |
|
2285 | |||
2281 | if p0 == 2: |
|
2286 | if p0 == 2: | |
2282 | self.specHeisGgraphChannelList.setEnabled(True) |
|
2287 | self.specHeisGgraphChannelList.setEnabled(True) | |
2283 | self.specHeisGgraphXminXmax.setEnabled(True) |
|
2288 | self.specHeisGgraphXminXmax.setEnabled(True) | |
2284 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
2289 | self.specHeisGgraphYminYmax.setEnabled(True) | |
2285 | if p0 == 0: |
|
2290 | if p0 == 0: | |
2286 | self.specHeisGgraphXminXmax.setEnabled(False) |
|
2291 | self.specHeisGgraphXminXmax.setEnabled(False) | |
2287 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
2292 | self.specHeisGgraphYminYmax.setEnabled(False) | |
2288 |
|
2293 | |||
2289 | @pyqtSignature("int") |
|
2294 | @pyqtSignature("int") | |
2290 | def on_specHeisGraphCebRTIplot_stateChanged(self, p0): |
|
2295 | def on_specHeisGraphCebRTIplot_stateChanged(self, p0): | |
2291 |
|
2296 | |||
2292 | if p0 == 2: |
|
2297 | if p0 == 2: | |
2293 | self.specHeisGgraphChannelList.setEnabled(True) |
|
2298 | self.specHeisGgraphChannelList.setEnabled(True) | |
2294 | self.specHeisGgraphTminTmax.setEnabled(True) |
|
2299 | self.specHeisGgraphTminTmax.setEnabled(True) | |
2295 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
2300 | self.specHeisGgraphYminYmax.setEnabled(True) | |
2296 | self.specHeisGgraphTimeRange.setEnabled(True) |
|
2301 | self.specHeisGgraphTimeRange.setEnabled(True) | |
2297 |
|
2302 | |||
2298 | if p0 == 0: |
|
2303 | if p0 == 0: | |
2299 | self.specHeisGgraphTminTmax.setEnabled(False) |
|
2304 | self.specHeisGgraphTminTmax.setEnabled(False) | |
2300 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
2305 | self.specHeisGgraphYminYmax.setEnabled(False) | |
2301 | self.specHeisGgraphTimeRange.setEnabled(False) |
|
2306 | self.specHeisGgraphTimeRange.setEnabled(False) | |
2302 |
|
2307 | |||
2303 | @pyqtSignature("int") |
|
2308 | @pyqtSignature("int") | |
2304 | def on_specHeisGraphSaveSpectra_stateChanged(self, p0): |
|
2309 | def on_specHeisGraphSaveSpectra_stateChanged(self, p0): | |
2305 | """ |
|
2310 | """ | |
2306 | """ |
|
2311 | """ | |
2307 | if p0 == 2: |
|
2312 | if p0 == 2: | |
2308 | self.specHeisGraphPath.setEnabled(True) |
|
2313 | self.specHeisGraphPath.setEnabled(True) | |
2309 | self.specHeisGraphPrefix.setEnabled(True) |
|
2314 | self.specHeisGraphPrefix.setEnabled(True) | |
2310 | self.specHeisGraphToolPath.setEnabled(True) |
|
2315 | self.specHeisGraphToolPath.setEnabled(True) | |
2311 | if p0 == 0: |
|
2316 | if p0 == 0: | |
2312 | self.specHeisGraphPath.setEnabled(False) |
|
2317 | self.specHeisGraphPath.setEnabled(False) | |
2313 | self.specHeisGraphPrefix.setEnabled(False) |
|
2318 | self.specHeisGraphPrefix.setEnabled(False) | |
2314 | self.specHeisGraphToolPath.setEnabled(False) |
|
2319 | self.specHeisGraphToolPath.setEnabled(False) | |
2315 |
|
2320 | |||
2316 | @pyqtSignature("int") |
|
2321 | @pyqtSignature("int") | |
2317 | def on_specHeisGraphSaveRTIplot_stateChanged(self, p0): |
|
2322 | def on_specHeisGraphSaveRTIplot_stateChanged(self, p0): | |
2318 | if p0 == 2: |
|
2323 | if p0 == 2: | |
2319 | self.specHeisGraphPath.setEnabled(True) |
|
2324 | self.specHeisGraphPath.setEnabled(True) | |
2320 | self.specHeisGraphPrefix.setEnabled(True) |
|
2325 | self.specHeisGraphPrefix.setEnabled(True) | |
2321 | self.specHeisGraphToolPath.setEnabled(True) |
|
2326 | self.specHeisGraphToolPath.setEnabled(True) | |
2322 |
|
2327 | |||
2323 | @pyqtSignature("int") |
|
2328 | @pyqtSignature("int") | |
2324 | def on_specHeisGraphftpSpectra_stateChanged(self, p0): |
|
2329 | def on_specHeisGraphftpSpectra_stateChanged(self, p0): | |
2325 | """ |
|
2330 | """ | |
2326 | """ |
|
2331 | """ | |
2327 | if p0 == 2: |
|
2332 | if p0 == 2: | |
2328 | self.specHeisGgraphftpratio.setEnabled(True) |
|
2333 | self.specHeisGgraphftpratio.setEnabled(True) | |
2329 |
|
2334 | |||
2330 | if p0 == 0: |
|
2335 | if p0 == 0: | |
2331 | self.specHeisGgraphftpratio.setEnabled(False) |
|
2336 | self.specHeisGgraphftpratio.setEnabled(False) | |
2332 |
|
2337 | |||
2333 | @pyqtSignature("int") |
|
2338 | @pyqtSignature("int") | |
2334 | def on_specHeisGraphftpRTIplot_stateChanged(self, p0): |
|
2339 | def on_specHeisGraphftpRTIplot_stateChanged(self, p0): | |
2335 | if p0 == 2: |
|
2340 | if p0 == 2: | |
2336 | self.specHeisGgraphftpratio.setEnabled(True) |
|
2341 | self.specHeisGgraphftpratio.setEnabled(True) | |
2337 |
|
2342 | |||
2338 | @pyqtSignature("") |
|
2343 | @pyqtSignature("") | |
2339 | def on_specHeisGraphClear_clicked(self): |
|
2344 | def on_specHeisGraphClear_clicked(self): | |
2340 | pass |
|
2345 | pass | |
2341 |
|
2346 | |||
2342 | def __checkSpecGraphSaving(self): |
|
2347 | def __checkSpecGraphSaving(self): | |
2343 |
|
2348 | |||
2344 | enable = False |
|
2349 | enable = False | |
2345 |
|
2350 | |||
2346 | if self.specGraphSaveSpectra.checkState(): |
|
2351 | if self.specGraphSaveSpectra.checkState(): | |
2347 | enable = True |
|
2352 | enable = True | |
2348 |
|
2353 | |||
2349 | if self.specGraphSaveCross.checkState(): |
|
2354 | if self.specGraphSaveCross.checkState(): | |
2350 | enable = True |
|
2355 | enable = True | |
2351 |
|
2356 | |||
2352 | if self.specGraphSaveRTIplot.checkState(): |
|
2357 | if self.specGraphSaveRTIplot.checkState(): | |
2353 | enable = True |
|
2358 | enable = True | |
2354 |
|
2359 | |||
2355 | if self.specGraphSaveCoherencemap.checkState(): |
|
2360 | if self.specGraphSaveCoherencemap.checkState(): | |
2356 | enable = True |
|
2361 | enable = True | |
2357 |
|
2362 | |||
2358 | if self.specGraphSavePowerprofile.checkState(): |
|
2363 | if self.specGraphSavePowerprofile.checkState(): | |
2359 | enable = True |
|
2364 | enable = True | |
2360 |
|
2365 | |||
2361 | if self.specGraphSaveRTInoise.checkState(): |
|
2366 | if self.specGraphSaveRTInoise.checkState(): | |
2362 | enable = True |
|
2367 | enable = True | |
2363 |
|
2368 | |||
2364 | self.specGraphPath.setEnabled(enable) |
|
2369 | self.specGraphPath.setEnabled(enable) | |
2365 | self.specGraphPrefix.setEnabled(enable) |
|
2370 | self.specGraphPrefix.setEnabled(enable) | |
2366 | self.specGraphToolPath.setEnabled(enable) |
|
2371 | self.specGraphToolPath.setEnabled(enable) | |
2367 |
|
2372 | |||
2368 | self.specGgraphftpratio.setEnabled(enable) |
|
2373 | self.specGgraphftpratio.setEnabled(enable) | |
2369 |
|
2374 | |||
2370 | def __checkSpecGraphFTP(self): |
|
2375 | def __checkSpecGraphFTP(self): | |
2371 |
|
2376 | |||
2372 | enable = False |
|
2377 | enable = False | |
2373 |
|
2378 | |||
2374 | if self.specGraphftpSpectra.checkState(): |
|
2379 | if self.specGraphftpSpectra.checkState(): | |
2375 | enable = True |
|
2380 | enable = True | |
2376 |
|
2381 | |||
2377 | if self.specGraphftpCross.checkState(): |
|
2382 | if self.specGraphftpCross.checkState(): | |
2378 | enable = True |
|
2383 | enable = True | |
2379 |
|
2384 | |||
2380 | if self.specGraphftpRTIplot.checkState(): |
|
2385 | if self.specGraphftpRTIplot.checkState(): | |
2381 | enable = True |
|
2386 | enable = True | |
2382 |
|
2387 | |||
2383 | if self.specGraphftpCoherencemap.checkState(): |
|
2388 | if self.specGraphftpCoherencemap.checkState(): | |
2384 | enable = True |
|
2389 | enable = True | |
2385 |
|
2390 | |||
2386 | if self.specGraphftpPowerprofile.checkState(): |
|
2391 | if self.specGraphftpPowerprofile.checkState(): | |
2387 | enable = True |
|
2392 | enable = True | |
2388 |
|
2393 | |||
2389 | if self.specGraphftpRTInoise.checkState(): |
|
2394 | if self.specGraphftpRTInoise.checkState(): | |
2390 | enable = True |
|
2395 | enable = True | |
2391 |
|
2396 | |||
2392 | # self.specGgraphftpratio.setEnabled(enable) |
|
2397 | # self.specGgraphftpratio.setEnabled(enable) | |
2393 |
|
2398 | |||
2394 | def __checkSpecGraphFilters(self): |
|
2399 | def __checkSpecGraphFilters(self): | |
2395 |
|
2400 | |||
2396 | freq = False |
|
2401 | freq = False | |
2397 | height = False |
|
2402 | height = False | |
2398 | db = False |
|
2403 | db = False | |
2399 | time = False |
|
2404 | time = False | |
2400 | magnitud = False |
|
2405 | magnitud = False | |
2401 | phase = False |
|
2406 | phase = False | |
2402 | channelList = False |
|
2407 | channelList = False | |
2403 |
|
2408 | |||
2404 | if self.specGraphCebSpectraplot.checkState(): |
|
2409 | if self.specGraphCebSpectraplot.checkState(): | |
2405 | freq = True |
|
2410 | freq = True | |
2406 | height = True |
|
2411 | height = True | |
2407 | db = True |
|
2412 | db = True | |
2408 | channelList = True |
|
2413 | channelList = True | |
2409 |
|
2414 | |||
2410 | if self.specGraphCebCrossSpectraplot.checkState(): |
|
2415 | if self.specGraphCebCrossSpectraplot.checkState(): | |
2411 | freq = True |
|
2416 | freq = True | |
2412 | height = True |
|
2417 | height = True | |
2413 | db = True |
|
2418 | db = True | |
2414 | magnitud = True |
|
2419 | magnitud = True | |
2415 | phase = True |
|
2420 | phase = True | |
2416 |
|
2421 | |||
2417 | if self.specGraphCebRTIplot.checkState(): |
|
2422 | if self.specGraphCebRTIplot.checkState(): | |
2418 | height = True |
|
2423 | height = True | |
2419 | db = True |
|
2424 | db = True | |
2420 | time = True |
|
2425 | time = True | |
2421 | channelList = True |
|
2426 | channelList = True | |
2422 |
|
2427 | |||
2423 | if self.specGraphCebCoherencmap.checkState(): |
|
2428 | if self.specGraphCebCoherencmap.checkState(): | |
2424 | height = True |
|
2429 | height = True | |
2425 | time = True |
|
2430 | time = True | |
2426 | magnitud = True |
|
2431 | magnitud = True | |
2427 | phase = True |
|
2432 | phase = True | |
2428 |
|
2433 | |||
2429 | if self.specGraphPowerprofile.checkState(): |
|
2434 | if self.specGraphPowerprofile.checkState(): | |
2430 | height = True |
|
2435 | height = True | |
2431 | db = True |
|
2436 | db = True | |
2432 | channelList = True |
|
2437 | channelList = True | |
2433 |
|
2438 | |||
2434 | if self.specGraphCebRTInoise.checkState(): |
|
2439 | if self.specGraphCebRTInoise.checkState(): | |
2435 | db = True |
|
2440 | db = True | |
2436 | time = True |
|
2441 | time = True | |
2437 | channelList = True |
|
2442 | channelList = True | |
2438 |
|
2443 | |||
2439 |
|
2444 | |||
2440 | self.specGgraphFreq.setEnabled(freq) |
|
2445 | self.specGgraphFreq.setEnabled(freq) | |
2441 | self.specGgraphHeight.setEnabled(height) |
|
2446 | self.specGgraphHeight.setEnabled(height) | |
2442 | self.specGgraphDbsrange.setEnabled(db) |
|
2447 | self.specGgraphDbsrange.setEnabled(db) | |
2443 | self.specGgraphTminTmax.setEnabled(time) |
|
2448 | self.specGgraphTminTmax.setEnabled(time) | |
2444 |
|
2449 | |||
2445 | self.specGgraphmagnitud.setEnabled(magnitud) |
|
2450 | self.specGgraphmagnitud.setEnabled(magnitud) | |
2446 | self.specGgraphPhase.setEnabled(phase) |
|
2451 | self.specGgraphPhase.setEnabled(phase) | |
2447 | self.specGgraphChannelList.setEnabled(channelList) |
|
2452 | self.specGgraphChannelList.setEnabled(channelList) | |
2448 |
|
2453 | |||
2449 | def __getParmsFromProjectWindow(self): |
|
2454 | def __getParmsFromProjectWindow(self): | |
2450 | """ |
|
2455 | """ | |
2451 | Check Inputs Project: |
|
2456 | Check Inputs Project: | |
2452 | - project_name |
|
2457 | - project_name | |
2453 | - datatype |
|
2458 | - datatype | |
2454 | - ext |
|
2459 | - ext | |
2455 | - data_path |
|
2460 | - data_path | |
2456 | - readmode |
|
2461 | - readmode | |
2457 | - delay |
|
2462 | - delay | |
2458 | - set |
|
2463 | - set | |
2459 | - walk |
|
2464 | - walk | |
2460 | """ |
|
2465 | """ | |
2461 | parms_ok = True |
|
2466 | parms_ok = True | |
2462 |
|
2467 | |||
2463 | project_name = str(self.proName.text()) |
|
2468 | project_name = str(self.proName.text()) | |
2464 |
|
2469 | |||
2465 | if project_name == '' or project_name == None: |
|
2470 | if project_name == '' or project_name == None: | |
2466 | outputstr = "Enter a project Name" |
|
2471 | outputstr = "Enter a project Name" | |
2467 | self.console.append(outputstr) |
|
2472 | self.console.append(outputstr) | |
2468 | parms_ok = False |
|
2473 | parms_ok = False | |
2469 | project_name = None |
|
2474 | project_name = None | |
2470 |
|
2475 | |||
2471 | description = str(self.proDescription.toPlainText()) |
|
2476 | description = str(self.proDescription.toPlainText()) | |
2472 |
|
2477 | |||
2473 | datatype = str(self.proComDataType.currentText()) |
|
2478 | datatype = str(self.proComDataType.currentText()) | |
2474 |
|
2479 | |||
2475 | ext = str(self.proDataType.text()) |
|
2480 | ext = str(self.proDataType.text()) | |
2476 |
|
2481 | |||
2477 | dpath = str(self.proDataPath.text()) |
|
2482 | dpath = str(self.proDataPath.text()) | |
2478 |
|
2483 | |||
2479 | if dpath == '': |
|
2484 | if dpath == '': | |
2480 | outputstr = 'Datapath is empty' |
|
2485 | outputstr = 'Datapath is empty' | |
2481 | self.console.append(outputstr) |
|
2486 | self.console.append(outputstr) | |
2482 | parms_ok = False |
|
2487 | parms_ok = False | |
2483 | dpath = None |
|
2488 | dpath = None | |
2484 |
|
2489 | |||
2485 | if dpath != None: |
|
2490 | if dpath != None: | |
2486 | if not os.path.isdir(dpath): |
|
2491 | if not os.path.isdir(dpath): | |
2487 | outputstr = 'Datapath (%s) does not exist' % dpath |
|
2492 | outputstr = 'Datapath (%s) does not exist' % dpath | |
2488 | self.console.append(outputstr) |
|
2493 | self.console.append(outputstr) | |
2489 | parms_ok = False |
|
2494 | parms_ok = False | |
2490 | dpath = None |
|
2495 | dpath = None | |
2491 |
|
2496 | |||
2492 | online = int(self.proComReadMode.currentIndex()) |
|
2497 | online = int(self.proComReadMode.currentIndex()) | |
2493 |
|
2498 | |||
2494 | delay = None |
|
2499 | delay = None | |
2495 | if online==1: |
|
2500 | if online==1: | |
2496 | try: |
|
2501 | try: | |
2497 | delay = int(str(self.proDelay.text())) |
|
2502 | delay = int(str(self.proDelay.text())) | |
2498 | except: |
|
2503 | except: | |
2499 | outputstr = 'Delay value (%s) must be a integer number' %str(self.proDelay.text()) |
|
2504 | outputstr = 'Delay value (%s) must be a integer number' %str(self.proDelay.text()) | |
2500 | self.console.append(outputstr) |
|
2505 | self.console.append(outputstr) | |
2501 | parms_ok = False |
|
2506 | parms_ok = False | |
2502 |
|
2507 | |||
2503 |
|
2508 | |||
2504 | set = None |
|
2509 | set = None | |
2505 | value = str(self.proSet.text()) |
|
2510 | value = str(self.proSet.text()) | |
2506 | try: |
|
2511 | try: | |
2507 | set = int(value) |
|
2512 | set = int(value) | |
2508 | except: |
|
2513 | except: | |
2509 | pass |
|
2514 | pass | |
2510 |
|
2515 | |||
2511 | ippKm = None |
|
2516 | ippKm = None | |
2512 |
|
2517 | |||
2513 | value = str(self.proIPPKm.text()) |
|
2518 | value = str(self.proIPPKm.text()) | |
2514 |
|
2519 | |||
2515 | try: |
|
2520 | try: | |
2516 | ippKm = float(value) |
|
2521 | ippKm = float(value) | |
2517 | except: |
|
2522 | except: | |
2518 | if datatype=="USRP": |
|
2523 | if datatype=="USRP": | |
2519 | outputstr = 'IPP value "%s" must be a float number' % str(self.proIPPKm.text()) |
|
2524 | outputstr = 'IPP value "%s" must be a float number' % str(self.proIPPKm.text()) | |
2520 | self.console.append(outputstr) |
|
2525 | self.console.append(outputstr) | |
2521 | parms_ok = False |
|
2526 | parms_ok = False | |
2522 |
|
2527 | |||
2523 | walk = int(self.proComWalk.currentIndex()) |
|
2528 | walk = int(self.proComWalk.currentIndex()) | |
2524 | expLabel = str(self.proExpLabel.text()) |
|
2529 | expLabel = str(self.proExpLabel.text()) | |
2525 |
|
2530 | |||
2526 | startDate = str(self.proComStartDate.currentText()) |
|
2531 | startDate = str(self.proComStartDate.currentText()) | |
2527 | endDate = str(self.proComEndDate.currentText()) |
|
2532 | endDate = str(self.proComEndDate.currentText()) | |
2528 |
|
2533 | |||
2529 | # startDateList = startDate.split("/") |
|
2534 | # startDateList = startDate.split("/") | |
2530 | # endDateList = endDate.split("/") |
|
2535 | # endDateList = endDate.split("/") | |
2531 | # |
|
2536 | # | |
2532 | # startDate = datetime.date(int(startDateList[0]), int(startDateList[1]), int(startDateList[2])) |
|
2537 | # startDate = datetime.date(int(startDateList[0]), int(startDateList[1]), int(startDateList[2])) | |
2533 | # endDate = datetime.date(int(endDateList[0]), int(endDateList[1]), int(endDateList[2])) |
|
2538 | # endDate = datetime.date(int(endDateList[0]), int(endDateList[1]), int(endDateList[2])) | |
2534 |
|
2539 | |||
2535 | startTime = self.proStartTime.time() |
|
2540 | startTime = self.proStartTime.time() | |
2536 | endTime = self.proEndTime.time() |
|
2541 | endTime = self.proEndTime.time() | |
2537 |
|
2542 | |||
2538 | startTime = str(startTime.toString("H:m:s")) |
|
2543 | startTime = str(startTime.toString("H:m:s")) | |
2539 | endTime = str(endTime.toString("H:m:s")) |
|
2544 | endTime = str(endTime.toString("H:m:s")) | |
2540 |
|
2545 | |||
2541 | projectParms = ProjectParms() |
|
2546 | projectParms = ProjectParms() | |
2542 |
|
2547 | |||
2543 | projectParms.name = project_name |
|
2548 | projectParms.name = project_name | |
2544 | projectParms.description = description |
|
2549 | projectParms.description = description | |
2545 | projectParms.datatype = datatype |
|
2550 | projectParms.datatype = datatype | |
2546 | projectParms.ext = ext |
|
2551 | projectParms.ext = ext | |
2547 | projectParms.dpath = dpath |
|
2552 | projectParms.dpath = dpath | |
2548 | projectParms.online = online |
|
2553 | projectParms.online = online | |
2549 | projectParms.startDate = startDate |
|
2554 | projectParms.startDate = startDate | |
2550 | projectParms.endDate = endDate |
|
2555 | projectParms.endDate = endDate | |
2551 | projectParms.startTime = startTime |
|
2556 | projectParms.startTime = startTime | |
2552 | projectParms.endTime = endTime |
|
2557 | projectParms.endTime = endTime | |
2553 | projectParms.delay = delay |
|
2558 | projectParms.delay = delay | |
2554 | projectParms.walk = walk |
|
2559 | projectParms.walk = walk | |
2555 | projectParms.expLabel = expLabel |
|
2560 | projectParms.expLabel = expLabel | |
2556 | projectParms.set = set |
|
2561 | projectParms.set = set | |
2557 | projectParms.ippKm = ippKm |
|
2562 | projectParms.ippKm = ippKm | |
2558 | projectParms.parmsOk = parms_ok |
|
2563 | projectParms.parmsOk = parms_ok | |
2559 |
|
2564 | |||
2560 | return projectParms |
|
2565 | return projectParms | |
2561 |
|
2566 | |||
2562 |
|
2567 | |||
2563 | def __getParmsFromProjectObj(self, projectObjView): |
|
2568 | def __getParmsFromProjectObj(self, projectObjView): | |
2564 |
|
2569 | |||
2565 | parms_ok = True |
|
2570 | parms_ok = True | |
2566 |
|
2571 | |||
2567 | project_name, description = projectObjView.name, projectObjView.description |
|
2572 | project_name, description = projectObjView.name, projectObjView.description | |
2568 |
|
2573 | |||
2569 | readUnitObj = projectObjView.getReadUnitObj() |
|
2574 | readUnitObj = projectObjView.getReadUnitObj() | |
2570 | datatype = readUnitObj.datatype |
|
2575 | datatype = readUnitObj.datatype | |
2571 |
|
2576 | |||
2572 | operationObj = readUnitObj.getOperationObj(name='run') |
|
2577 | operationObj = readUnitObj.getOperationObj(name='run') | |
2573 |
|
2578 | |||
2574 | dpath = operationObj.getParameterValue(parameterName='path') |
|
2579 | dpath = operationObj.getParameterValue(parameterName='path') | |
2575 | startDate = operationObj.getParameterValue(parameterName='startDate') |
|
2580 | startDate = operationObj.getParameterValue(parameterName='startDate') | |
2576 | endDate = operationObj.getParameterValue(parameterName='endDate') |
|
2581 | endDate = operationObj.getParameterValue(parameterName='endDate') | |
2577 |
|
2582 | |||
2578 | startDate = startDate.strftime("%Y/%m/%d") |
|
2583 | startDate = startDate.strftime("%Y/%m/%d") | |
2579 | endDate = endDate.strftime("%Y/%m/%d") |
|
2584 | endDate = endDate.strftime("%Y/%m/%d") | |
2580 |
|
2585 | |||
2581 | startTime = operationObj.getParameterValue(parameterName='startTime') |
|
2586 | startTime = operationObj.getParameterValue(parameterName='startTime') | |
2582 | endTime = operationObj.getParameterValue(parameterName='endTime') |
|
2587 | endTime = operationObj.getParameterValue(parameterName='endTime') | |
2583 |
|
2588 | |||
2584 | startTime = startTime.strftime("%H:%M:%S") |
|
2589 | startTime = startTime.strftime("%H:%M:%S") | |
2585 | endTime = endTime.strftime("%H:%M:%S") |
|
2590 | endTime = endTime.strftime("%H:%M:%S") | |
2586 |
|
2591 | |||
2587 | online = 0 |
|
2592 | online = 0 | |
2588 | try: |
|
2593 | try: | |
2589 | online = operationObj.getParameterValue(parameterName='online') |
|
2594 | online = operationObj.getParameterValue(parameterName='online') | |
2590 | except: |
|
2595 | except: | |
2591 | pass |
|
2596 | pass | |
2592 |
|
2597 | |||
2593 | delay = '' |
|
2598 | delay = '' | |
2594 | try: |
|
2599 | try: | |
2595 | delay = operationObj.getParameterValue(parameterName='delay') |
|
2600 | delay = operationObj.getParameterValue(parameterName='delay') | |
2596 | except: |
|
2601 | except: | |
2597 | pass |
|
2602 | pass | |
2598 |
|
2603 | |||
2599 | walk = 0 |
|
2604 | walk = 0 | |
2600 | try: |
|
2605 | try: | |
2601 | walk = operationObj.getParameterValue(parameterName='walk') |
|
2606 | walk = operationObj.getParameterValue(parameterName='walk') | |
2602 | except: |
|
2607 | except: | |
2603 | pass |
|
2608 | pass | |
2604 |
|
2609 | |||
2605 | set = '' |
|
2610 | set = '' | |
2606 | try: |
|
2611 | try: | |
2607 | set = operationObj.getParameterValue(parameterName='set') |
|
2612 | set = operationObj.getParameterValue(parameterName='set') | |
2608 | except: |
|
2613 | except: | |
2609 | pass |
|
2614 | pass | |
2610 |
|
2615 | |||
2611 | expLabel = '' |
|
2616 | expLabel = '' | |
2612 | try: |
|
2617 | try: | |
2613 | expLabel = operationObj.getParameterValue(parameterName='expLabel') |
|
2618 | expLabel = operationObj.getParameterValue(parameterName='expLabel') | |
2614 | except: |
|
2619 | except: | |
2615 | pass |
|
2620 | pass | |
2616 |
|
2621 | |||
2617 | ippKm = '' |
|
2622 | ippKm = '' | |
2618 | if datatype.lower() == 'usrp': |
|
2623 | if datatype.lower() == 'usrp': | |
2619 | try: |
|
2624 | try: | |
2620 | ippKm = operationObj.getParameterValue(parameterName='ippKm') |
|
2625 | ippKm = operationObj.getParameterValue(parameterName='ippKm') | |
2621 | except: |
|
2626 | except: | |
2622 | pass |
|
2627 | pass | |
2623 |
|
2628 | |||
2624 | projectParms = ProjectParms() |
|
2629 | projectParms = ProjectParms() | |
2625 |
|
2630 | |||
2626 | projectParms.name = project_name |
|
2631 | projectParms.name = project_name | |
2627 | projectParms.description = description |
|
2632 | projectParms.description = description | |
2628 | projectParms.datatype = datatype |
|
2633 | projectParms.datatype = datatype | |
2629 | projectParms.ext = None |
|
2634 | projectParms.ext = None | |
2630 | projectParms.dpath = dpath |
|
2635 | projectParms.dpath = dpath | |
2631 | projectParms.online = online |
|
2636 | projectParms.online = online | |
2632 | projectParms.startDate = startDate |
|
2637 | projectParms.startDate = startDate | |
2633 | projectParms.endDate = endDate |
|
2638 | projectParms.endDate = endDate | |
2634 | projectParms.startTime = startTime |
|
2639 | projectParms.startTime = startTime | |
2635 | projectParms.endTime = endTime |
|
2640 | projectParms.endTime = endTime | |
2636 | projectParms.delay=delay |
|
2641 | projectParms.delay=delay | |
2637 | projectParms.walk=walk |
|
2642 | projectParms.walk=walk | |
2638 | projectParms.set=set |
|
2643 | projectParms.set=set | |
2639 | projectParms.ippKm=ippKm |
|
2644 | projectParms.ippKm=ippKm | |
2640 | projectParms.expLabel = expLabel |
|
2645 | projectParms.expLabel = expLabel | |
2641 | projectParms.parmsOk=parms_ok |
|
2646 | projectParms.parmsOk=parms_ok | |
2642 |
|
2647 | |||
2643 | return projectParms |
|
2648 | return projectParms | |
2644 |
|
2649 | |||
2645 | def refreshProjectWindow(self, projectObjView): |
|
2650 | def refreshProjectWindow(self, projectObjView): | |
2646 |
|
2651 | |||
2647 | projectParms = self.__getParmsFromProjectObj(projectObjView) |
|
2652 | projectParms = self.__getParmsFromProjectObj(projectObjView) | |
2648 |
|
2653 | |||
2649 | index = projectParms.getDatatypeIndex() |
|
2654 | index = projectParms.getDatatypeIndex() | |
2650 |
|
2655 | |||
2651 | self.proName.setText(projectParms.name) |
|
2656 | self.proName.setText(projectParms.name) | |
2652 | self.proDescription.clear() |
|
2657 | self.proDescription.clear() | |
2653 | self.proDescription.append(projectParms.description) |
|
2658 | self.proDescription.append(projectParms.description) | |
2654 |
|
2659 | |||
2655 | self.on_proComDataType_activated(index=index) |
|
2660 | self.on_proComDataType_activated(index=index) | |
2656 | self.proDataPath.setText(projectParms.dpath) |
|
2661 | self.proDataPath.setText(projectParms.dpath) | |
2657 | self.proComDataType.setCurrentIndex(index) |
|
2662 | self.proComDataType.setCurrentIndex(index) | |
2658 | self.proComReadMode.setCurrentIndex(projectParms.online) |
|
2663 | self.proComReadMode.setCurrentIndex(projectParms.online) | |
2659 | self.proDelay.setText(str(projectParms.delay)) |
|
2664 | self.proDelay.setText(str(projectParms.delay)) | |
2660 | self.proSet.setText(str(projectParms.set)) |
|
2665 | self.proSet.setText(str(projectParms.set)) | |
2661 | self.proIPPKm.setText(str(projectParms.ippKm)) |
|
2666 | self.proIPPKm.setText(str(projectParms.ippKm)) | |
2662 | self.proComWalk.setCurrentIndex(projectParms.walk) |
|
2667 | self.proComWalk.setCurrentIndex(projectParms.walk) | |
2663 | self.proExpLabel.setText(str(projectParms.expLabel).strip()) |
|
2668 | self.proExpLabel.setText(str(projectParms.expLabel).strip()) | |
2664 |
|
2669 | |||
2665 | dateList = self.loadDays(data_path = projectParms.dpath, |
|
2670 | dateList = self.loadDays(data_path = projectParms.dpath, | |
2666 | ext = projectParms.getExt(), |
|
2671 | ext = projectParms.getExt(), | |
2667 | walk = projectParms.walk, |
|
2672 | walk = projectParms.walk, | |
2668 | expLabel = projectParms.expLabel) |
|
2673 | expLabel = projectParms.expLabel) | |
2669 |
|
2674 | |||
2670 | try: |
|
2675 | try: | |
2671 | startDateIndex = dateList.index(projectParms.startDate) |
|
2676 | startDateIndex = dateList.index(projectParms.startDate) | |
2672 | except: |
|
2677 | except: | |
2673 | startDateIndex = 0 |
|
2678 | startDateIndex = 0 | |
2674 |
|
2679 | |||
2675 | try: |
|
2680 | try: | |
2676 | endDateIndex = dateList.index(projectParms.endDate) |
|
2681 | endDateIndex = dateList.index(projectParms.endDate) | |
2677 | except: |
|
2682 | except: | |
2678 | endDateIndex = int(self.proComEndDate.count()-1) |
|
2683 | endDateIndex = int(self.proComEndDate.count()-1) | |
2679 |
|
2684 | |||
2680 | self.proComStartDate.setCurrentIndex(startDateIndex) |
|
2685 | self.proComStartDate.setCurrentIndex(startDateIndex) | |
2681 | self.proComEndDate.setCurrentIndex(endDateIndex) |
|
2686 | self.proComEndDate.setCurrentIndex(endDateIndex) | |
2682 |
|
2687 | |||
2683 | startlist = projectParms.startTime.split(":") |
|
2688 | startlist = projectParms.startTime.split(":") | |
2684 | endlist = projectParms.endTime.split(":") |
|
2689 | endlist = projectParms.endTime.split(":") | |
2685 |
|
2690 | |||
2686 | self.time.setHMS(int(startlist[0]), int(startlist[1]), int(startlist[2])) |
|
2691 | self.time.setHMS(int(startlist[0]), int(startlist[1]), int(startlist[2])) | |
2687 | self.proStartTime.setTime(self.time) |
|
2692 | self.proStartTime.setTime(self.time) | |
2688 |
|
2693 | |||
2689 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
2694 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) | |
2690 | self.proEndTime.setTime(self.time) |
|
2695 | self.proEndTime.setTime(self.time) | |
2691 |
|
2696 | |||
2692 |
|
2697 | |||
2693 | def __refreshVoltageWindow(self, puObj): |
|
2698 | def __refreshVoltageWindow(self, puObj): | |
2694 |
|
2699 | |||
2695 | opObj = puObj.getOperationObj(name='setRadarFrequency') |
|
2700 | opObj = puObj.getOperationObj(name='setRadarFrequency') | |
2696 | if opObj == None: |
|
2701 | if opObj == None: | |
2697 | self.volOpRadarfrequency.clear() |
|
2702 | self.volOpRadarfrequency.clear() | |
2698 | self.volOpCebRadarfrequency.setCheckState(0) |
|
2703 | self.volOpCebRadarfrequency.setCheckState(0) | |
2699 | else: |
|
2704 | else: | |
2700 | value = opObj.getParameterValue(parameterName='frequency') |
|
2705 | value = opObj.getParameterValue(parameterName='frequency') | |
2701 | value = str(float(value)/1e6) |
|
2706 | value = str(float(value)/1e6) | |
2702 | self.volOpRadarfrequency.setText(value) |
|
2707 | self.volOpRadarfrequency.setText(value) | |
2703 | self.volOpRadarfrequency.setEnabled(True) |
|
2708 | self.volOpRadarfrequency.setEnabled(True) | |
2704 | self.volOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) |
|
2709 | self.volOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) | |
2705 |
|
2710 | |||
2706 | opObj = puObj.getOperationObj(name="selectChannels") |
|
2711 | opObj = puObj.getOperationObj(name="selectChannels") | |
2707 |
|
2712 | |||
2708 | if opObj == None: |
|
2713 | if opObj == None: | |
2709 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") |
|
2714 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") | |
2710 |
|
2715 | |||
2711 | if opObj == None: |
|
2716 | if opObj == None: | |
2712 | self.volOpChannel.clear() |
|
2717 | self.volOpChannel.clear() | |
2713 | self.volOpCebChannels.setCheckState(0) |
|
2718 | self.volOpCebChannels.setCheckState(0) | |
2714 | else: |
|
2719 | else: | |
2715 | channelEnabled = False |
|
2720 | channelEnabled = False | |
2716 | try: |
|
2721 | try: | |
2717 | value = opObj.getParameterValue(parameterName='channelList') |
|
2722 | value = opObj.getParameterValue(parameterName='channelList') | |
2718 | value = str(value)[1:-1] |
|
2723 | value = str(value)[1:-1] | |
2719 | channelEnabled = True |
|
2724 | channelEnabled = True | |
2720 | channelMode = 0 |
|
2725 | channelMode = 0 | |
2721 | except: |
|
2726 | except: | |
2722 | pass |
|
2727 | pass | |
2723 | try: |
|
2728 | try: | |
2724 | value = opObj.getParameterValue(parameterName='channelIndexList') |
|
2729 | value = opObj.getParameterValue(parameterName='channelIndexList') | |
2725 | value = str(value)[1:-1] |
|
2730 | value = str(value)[1:-1] | |
2726 | channelEnabled = True |
|
2731 | channelEnabled = True | |
2727 | channelMode = 1 |
|
2732 | channelMode = 1 | |
2728 | except: |
|
2733 | except: | |
2729 | pass |
|
2734 | pass | |
2730 |
|
2735 | |||
2731 | if channelEnabled: |
|
2736 | if channelEnabled: | |
2732 | self.volOpChannel.setText(value) |
|
2737 | self.volOpChannel.setText(value) | |
2733 | self.volOpChannel.setEnabled(True) |
|
2738 | self.volOpChannel.setEnabled(True) | |
2734 | self.volOpCebChannels.setCheckState(QtCore.Qt.Checked) |
|
2739 | self.volOpCebChannels.setCheckState(QtCore.Qt.Checked) | |
2735 | self.volOpComChannels.setCurrentIndex(channelMode) |
|
2740 | self.volOpComChannels.setCurrentIndex(channelMode) | |
2736 |
|
2741 | |||
2737 | opObj = puObj.getOperationObj(name="selectHeights") |
|
2742 | opObj = puObj.getOperationObj(name="selectHeights") | |
2738 | if opObj == None: |
|
2743 | if opObj == None: | |
2739 | self.volOpHeights.clear() |
|
2744 | self.volOpHeights.clear() | |
2740 | self.volOpCebHeights.setCheckState(0) |
|
2745 | self.volOpCebHeights.setCheckState(0) | |
2741 | else: |
|
2746 | else: | |
2742 | value1 = int(opObj.getParameterValue(parameterName='minHei')) |
|
2747 | value1 = int(opObj.getParameterValue(parameterName='minHei')) | |
2743 | value1 = str(value1) |
|
2748 | value1 = str(value1) | |
2744 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) |
|
2749 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) | |
2745 | value2 = str(value2) |
|
2750 | value2 = str(value2) | |
2746 | value = value1 + "," + value2 |
|
2751 | value = value1 + "," + value2 | |
2747 | self.volOpHeights.setText(value) |
|
2752 | self.volOpHeights.setText(value) | |
2748 | self.volOpHeights.setEnabled(True) |
|
2753 | self.volOpHeights.setEnabled(True) | |
2749 | self.volOpCebHeights.setCheckState(QtCore.Qt.Checked) |
|
2754 | self.volOpCebHeights.setCheckState(QtCore.Qt.Checked) | |
2750 |
|
2755 | |||
2751 | opObj = puObj.getOperationObj(name="filterByHeights") |
|
2756 | opObj = puObj.getOperationObj(name="filterByHeights") | |
2752 | if opObj == None: |
|
2757 | if opObj == None: | |
2753 | self.volOpFilter.clear() |
|
2758 | self.volOpFilter.clear() | |
2754 | self.volOpCebFilter.setCheckState(0) |
|
2759 | self.volOpCebFilter.setCheckState(0) | |
2755 | else: |
|
2760 | else: | |
2756 | value = opObj.getParameterValue(parameterName='window') |
|
2761 | value = opObj.getParameterValue(parameterName='window') | |
2757 | value = str(value) |
|
2762 | value = str(value) | |
2758 | self.volOpFilter.setText(value) |
|
2763 | self.volOpFilter.setText(value) | |
2759 | self.volOpFilter.setEnabled(True) |
|
2764 | self.volOpFilter.setEnabled(True) | |
2760 | self.volOpCebFilter.setCheckState(QtCore.Qt.Checked) |
|
2765 | self.volOpCebFilter.setCheckState(QtCore.Qt.Checked) | |
2761 |
|
2766 | |||
2762 | opObj = puObj.getOperationObj(name="ProfileSelector") |
|
2767 | opObj = puObj.getOperationObj(name="ProfileSelector") | |
2763 | if opObj == None: |
|
2768 | if opObj == None: | |
2764 | self.volOpProfile.clear() |
|
2769 | self.volOpProfile.clear() | |
2765 | self.volOpCebProfile.setCheckState(0) |
|
2770 | self.volOpCebProfile.setCheckState(0) | |
2766 | else: |
|
2771 | else: | |
2767 | for parmObj in opObj.getParameterObjList(): |
|
2772 | for parmObj in opObj.getParameterObjList(): | |
2768 |
|
2773 | |||
2769 | if parmObj.name == "profileList": |
|
2774 | if parmObj.name == "profileList": | |
2770 | value = parmObj.getValue() |
|
2775 | value = parmObj.getValue() | |
2771 | value = str(value)[1:-1] |
|
2776 | value = str(value)[1:-1] | |
2772 | self.volOpProfile.setText(value) |
|
2777 | self.volOpProfile.setText(value) | |
2773 | self.volOpProfile.setEnabled(True) |
|
2778 | self.volOpProfile.setEnabled(True) | |
2774 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2779 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) | |
2775 | self.volOpComProfile.setCurrentIndex(0) |
|
2780 | self.volOpComProfile.setCurrentIndex(0) | |
2776 |
|
2781 | |||
2777 | if parmObj.name == "profileRangeList": |
|
2782 | if parmObj.name == "profileRangeList": | |
2778 | value = parmObj.getValue() |
|
2783 | value = parmObj.getValue() | |
2779 | value = str(value)[1:-1] |
|
2784 | value = str(value)[1:-1] | |
2780 | self.volOpProfile.setText(value) |
|
2785 | self.volOpProfile.setText(value) | |
2781 | self.volOpProfile.setEnabled(True) |
|
2786 | self.volOpProfile.setEnabled(True) | |
2782 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2787 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) | |
2783 | self.volOpComProfile.setCurrentIndex(1) |
|
2788 | self.volOpComProfile.setCurrentIndex(1) | |
2784 |
|
2789 | |||
2785 | if parmObj.name == "rangeList": |
|
2790 | if parmObj.name == "rangeList": | |
2786 | value = parmObj.getValue() |
|
2791 | value = parmObj.getValue() | |
2787 | value = str(value)[1:-1] |
|
2792 | value = str(value)[1:-1] | |
2788 | self.volOpProfile.setText(value) |
|
2793 | self.volOpProfile.setText(value) | |
2789 | self.volOpProfile.setEnabled(True) |
|
2794 | self.volOpProfile.setEnabled(True) | |
2790 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2795 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) | |
2791 | self.volOpComProfile.setCurrentIndex(2) |
|
2796 | self.volOpComProfile.setCurrentIndex(2) | |
2792 |
|
2797 | |||
2793 | opObj = puObj.getOperationObj(name="Decoder") |
|
2798 | opObj = puObj.getOperationObj(name="Decoder") | |
2794 | self.volOpCode.setText("") |
|
2799 | self.volOpCode.setText("") | |
2795 | if opObj == None: |
|
2800 | if opObj == None: | |
2796 | self.volOpCebDecodification.setCheckState(0) |
|
2801 | self.volOpCebDecodification.setCheckState(0) | |
2797 | else: |
|
2802 | else: | |
2798 | self.volOpCebDecodification.setCheckState(QtCore.Qt.Checked) |
|
2803 | self.volOpCebDecodification.setCheckState(QtCore.Qt.Checked) | |
2799 |
|
2804 | |||
2800 | parmObj = opObj.getParameterObj('code') |
|
2805 | parmObj = opObj.getParameterObj('code') | |
2801 |
|
2806 | |||
2802 | if parmObj == None: |
|
2807 | if parmObj == None: | |
2803 | self.volOpComCode.setCurrentIndex(0) |
|
2808 | self.volOpComCode.setCurrentIndex(0) | |
2804 | else: |
|
2809 | else: | |
2805 |
|
2810 | |||
2806 | parmObj1 = opObj.getParameterObj('nCode') |
|
2811 | parmObj1 = opObj.getParameterObj('nCode') | |
2807 | parmObj2 = opObj.getParameterObj('nBaud') |
|
2812 | parmObj2 = opObj.getParameterObj('nBaud') | |
2808 |
|
2813 | |||
2809 | if parmObj1 == None or parmObj2 == None: |
|
2814 | if parmObj1 == None or parmObj2 == None: | |
2810 | self.volOpComCode.setCurrentIndex(0) |
|
2815 | self.volOpComCode.setCurrentIndex(0) | |
2811 | else: |
|
2816 | else: | |
2812 | code = ast.literal_eval(str(parmObj.getValue())) |
|
2817 | code = ast.literal_eval(str(parmObj.getValue())) | |
2813 | nCode = parmObj1.getValue() |
|
2818 | nCode = parmObj1.getValue() | |
2814 | nBaud = parmObj2.getValue() |
|
2819 | nBaud = parmObj2.getValue() | |
2815 |
|
2820 | |||
2816 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() |
|
2821 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() | |
2817 |
|
2822 | |||
2818 | #User defined by default |
|
2823 | #User defined by default | |
2819 | self.volOpComCode.setCurrentIndex(13) |
|
2824 | self.volOpComCode.setCurrentIndex(13) | |
2820 | self.volOpCode.setText(str(code)) |
|
2825 | self.volOpCode.setText(str(code)) | |
2821 |
|
2826 | |||
2822 | if nCode == 1: |
|
2827 | if nCode == 1: | |
2823 | if nBaud == 3: |
|
2828 | if nBaud == 3: | |
2824 | self.volOpComCode.setCurrentIndex(1) |
|
2829 | self.volOpComCode.setCurrentIndex(1) | |
2825 | if nBaud == 4: |
|
2830 | if nBaud == 4: | |
2826 | self.volOpComCode.setCurrentIndex(2) |
|
2831 | self.volOpComCode.setCurrentIndex(2) | |
2827 | if nBaud == 5: |
|
2832 | if nBaud == 5: | |
2828 | self.volOpComCode.setCurrentIndex(3) |
|
2833 | self.volOpComCode.setCurrentIndex(3) | |
2829 | if nBaud == 7: |
|
2834 | if nBaud == 7: | |
2830 | self.volOpComCode.setCurrentIndex(4) |
|
2835 | self.volOpComCode.setCurrentIndex(4) | |
2831 | if nBaud == 11: |
|
2836 | if nBaud == 11: | |
2832 | self.volOpComCode.setCurrentIndex(5) |
|
2837 | self.volOpComCode.setCurrentIndex(5) | |
2833 | if nBaud == 13: |
|
2838 | if nBaud == 13: | |
2834 | self.volOpComCode.setCurrentIndex(6) |
|
2839 | self.volOpComCode.setCurrentIndex(6) | |
2835 |
|
2840 | |||
2836 | if nCode == 2: |
|
2841 | if nCode == 2: | |
2837 | if nBaud == 3: |
|
2842 | if nBaud == 3: | |
2838 | self.volOpComCode.setCurrentIndex(7) |
|
2843 | self.volOpComCode.setCurrentIndex(7) | |
2839 | if nBaud == 4: |
|
2844 | if nBaud == 4: | |
2840 | self.volOpComCode.setCurrentIndex(8) |
|
2845 | self.volOpComCode.setCurrentIndex(8) | |
2841 | if nBaud == 5: |
|
2846 | if nBaud == 5: | |
2842 | self.volOpComCode.setCurrentIndex(9) |
|
2847 | self.volOpComCode.setCurrentIndex(9) | |
2843 | if nBaud == 7: |
|
2848 | if nBaud == 7: | |
2844 | self.volOpComCode.setCurrentIndex(10) |
|
2849 | self.volOpComCode.setCurrentIndex(10) | |
2845 | if nBaud == 11: |
|
2850 | if nBaud == 11: | |
2846 | self.volOpComCode.setCurrentIndex(11) |
|
2851 | self.volOpComCode.setCurrentIndex(11) | |
2847 | if nBaud == 13: |
|
2852 | if nBaud == 13: | |
2848 | self.volOpComCode.setCurrentIndex(12) |
|
2853 | self.volOpComCode.setCurrentIndex(12) | |
2849 |
|
2854 | |||
2850 |
|
2855 | |||
2851 | opObj = puObj.getOperationObj(name="deFlip") |
|
2856 | opObj = puObj.getOperationObj(name="deFlip") | |
2852 | if opObj == None: |
|
2857 | if opObj == None: | |
2853 | self.volOpFlip.clear() |
|
2858 | self.volOpFlip.clear() | |
2854 | self.volOpFlip.setEnabled(False) |
|
2859 | self.volOpFlip.setEnabled(False) | |
2855 | self.volOpCebFlip.setCheckState(0) |
|
2860 | self.volOpCebFlip.setCheckState(0) | |
2856 | else: |
|
2861 | else: | |
2857 | try: |
|
2862 | try: | |
2858 | value = opObj.getParameterValue(parameterName='channelList') |
|
2863 | value = opObj.getParameterValue(parameterName='channelList') | |
2859 | value = str(value)[1:-1] |
|
2864 | value = str(value)[1:-1] | |
2860 | except: |
|
2865 | except: | |
2861 | value = "" |
|
2866 | value = "" | |
2862 |
|
2867 | |||
2863 | self.volOpFlip.setText(value) |
|
2868 | self.volOpFlip.setText(value) | |
2864 | self.volOpFlip.setEnabled(True) |
|
2869 | self.volOpFlip.setEnabled(True) | |
2865 | self.volOpCebFlip.setCheckState(QtCore.Qt.Checked) |
|
2870 | self.volOpCebFlip.setCheckState(QtCore.Qt.Checked) | |
2866 |
|
2871 | |||
2867 | opObj = puObj.getOperationObj(name="CohInt") |
|
2872 | opObj = puObj.getOperationObj(name="CohInt") | |
2868 | if opObj == None: |
|
2873 | if opObj == None: | |
2869 | self.volOpCohInt.clear() |
|
2874 | self.volOpCohInt.clear() | |
2870 | self.volOpCebCohInt.setCheckState(0) |
|
2875 | self.volOpCebCohInt.setCheckState(0) | |
2871 | else: |
|
2876 | else: | |
2872 | value = opObj.getParameterValue(parameterName='n') |
|
2877 | value = opObj.getParameterValue(parameterName='n') | |
2873 | self.volOpCohInt.setText(str(value)) |
|
2878 | self.volOpCohInt.setText(str(value)) | |
2874 | self.volOpCohInt.setEnabled(True) |
|
2879 | self.volOpCohInt.setEnabled(True) | |
2875 | self.volOpCebCohInt.setCheckState(QtCore.Qt.Checked) |
|
2880 | self.volOpCebCohInt.setCheckState(QtCore.Qt.Checked) | |
2876 |
|
2881 | |||
2877 | opObj = puObj.getOperationObj(name='Scope') |
|
2882 | opObj = puObj.getOperationObj(name='Scope') | |
2878 | if opObj == None: |
|
2883 | if opObj == None: | |
2879 | self.volGraphCebshow.setCheckState(0) |
|
2884 | self.volGraphCebshow.setCheckState(0) | |
2880 | else: |
|
2885 | else: | |
2881 | self.volGraphCebshow.setCheckState(QtCore.Qt.Checked) |
|
2886 | self.volGraphCebshow.setCheckState(QtCore.Qt.Checked) | |
2882 |
|
2887 | |||
2883 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
2888 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
2884 |
|
2889 | |||
2885 | if parmObj == None: |
|
2890 | if parmObj == None: | |
2886 | self.volGraphChannelList.clear() |
|
2891 | self.volGraphChannelList.clear() | |
2887 | else: |
|
2892 | else: | |
2888 | value = parmObj.getValue() |
|
2893 | value = parmObj.getValue() | |
2889 | value = str(value) |
|
2894 | value = str(value) | |
2890 | self.volGraphChannelList.setText(value) |
|
2895 | self.volGraphChannelList.setText(value) | |
2891 | self.volOpProfile.setEnabled(True) |
|
2896 | self.volOpProfile.setEnabled(True) | |
2892 |
|
2897 | |||
2893 | parmObj1 = opObj.getParameterObj(parameterName='xmin') |
|
2898 | parmObj1 = opObj.getParameterObj(parameterName='xmin') | |
2894 | parmObj2 = opObj.getParameterObj(parameterName='xmax') |
|
2899 | parmObj2 = opObj.getParameterObj(parameterName='xmax') | |
2895 |
|
2900 | |||
2896 | if parmObj1 == None or parmObj2 ==None: |
|
2901 | if parmObj1 == None or parmObj2 ==None: | |
2897 | self.volGraphfreqrange.clear() |
|
2902 | self.volGraphfreqrange.clear() | |
2898 | else: |
|
2903 | else: | |
2899 | value1 = parmObj1.getValue() |
|
2904 | value1 = parmObj1.getValue() | |
2900 | value1 = str(value1) |
|
2905 | value1 = str(value1) | |
2901 | value2 = parmObj2.getValue() |
|
2906 | value2 = parmObj2.getValue() | |
2902 | value2 = str(value2) |
|
2907 | value2 = str(value2) | |
2903 | value = value1 + "," + value2 |
|
2908 | value = value1 + "," + value2 | |
2904 | self.volGraphfreqrange.setText(value) |
|
2909 | self.volGraphfreqrange.setText(value) | |
2905 |
|
2910 | |||
2906 | parmObj1 = opObj.getParameterObj(parameterName='ymin') |
|
2911 | parmObj1 = opObj.getParameterObj(parameterName='ymin') | |
2907 | parmObj2 = opObj.getParameterObj(parameterName='ymax') |
|
2912 | parmObj2 = opObj.getParameterObj(parameterName='ymax') | |
2908 |
|
2913 | |||
2909 | if parmObj1 == None or parmObj2 ==None: |
|
2914 | if parmObj1 == None or parmObj2 ==None: | |
2910 | self.volGraphHeightrange.clear() |
|
2915 | self.volGraphHeightrange.clear() | |
2911 | else: |
|
2916 | else: | |
2912 | value1 = parmObj1.getValue() |
|
2917 | value1 = parmObj1.getValue() | |
2913 | value1 = str(value1) |
|
2918 | value1 = str(value1) | |
2914 | value2 = parmObj2.getValue() |
|
2919 | value2 = parmObj2.getValue() | |
2915 | value2 = str(value2) |
|
2920 | value2 = str(value2) | |
2916 | value = value1 + "," + value2 |
|
2921 | value = value1 + "," + value2 | |
2917 | value2 = str(value2) |
|
2922 | value2 = str(value2) | |
2918 | self.volGraphHeightrange.setText(value) |
|
2923 | self.volGraphHeightrange.setText(value) | |
2919 |
|
2924 | |||
2920 | parmObj = opObj.getParameterObj(parameterName='save') |
|
2925 | parmObj = opObj.getParameterObj(parameterName='save') | |
2921 |
|
2926 | |||
2922 | if parmObj == None: |
|
2927 | if parmObj == None: | |
2923 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) |
|
2928 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) | |
2924 | else: |
|
2929 | else: | |
2925 | value = parmObj.getValue() |
|
2930 | value = parmObj.getValue() | |
2926 | if int(value): |
|
2931 | if int(value): | |
2927 | self.volGraphCebSave.setCheckState(QtCore.Qt.Checked) |
|
2932 | self.volGraphCebSave.setCheckState(QtCore.Qt.Checked) | |
2928 | else: |
|
2933 | else: | |
2929 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) |
|
2934 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) | |
2930 |
|
2935 | |||
2931 | parmObj = opObj.getParameterObj(parameterName='figpath') |
|
2936 | parmObj = opObj.getParameterObj(parameterName='figpath') | |
2932 | if parmObj == None: |
|
2937 | if parmObj == None: | |
2933 | self.volGraphPath.clear() |
|
2938 | self.volGraphPath.clear() | |
2934 | else: |
|
2939 | else: | |
2935 | value = parmObj.getValue() |
|
2940 | value = parmObj.getValue() | |
2936 | path = str(value) |
|
2941 | path = str(value) | |
2937 | self.volGraphPath.setText(path) |
|
2942 | self.volGraphPath.setText(path) | |
2938 |
|
2943 | |||
2939 | parmObj = opObj.getParameterObj(parameterName='figfile') |
|
2944 | parmObj = opObj.getParameterObj(parameterName='figfile') | |
2940 | if parmObj == None: |
|
2945 | if parmObj == None: | |
2941 | self.volGraphPrefix.clear() |
|
2946 | self.volGraphPrefix.clear() | |
2942 | else: |
|
2947 | else: | |
2943 | value = parmObj.getValue() |
|
2948 | value = parmObj.getValue() | |
2944 | figfile = str(value) |
|
2949 | figfile = str(value) | |
2945 | self.volGraphPrefix.setText(figfile) |
|
2950 | self.volGraphPrefix.setText(figfile) | |
2946 |
|
2951 | |||
2947 | # outputVoltageWrite |
|
2952 | # outputVoltageWrite | |
2948 | opObj = puObj.getOperationObj(name='VoltageWriter') |
|
2953 | opObj = puObj.getOperationObj(name='VoltageWriter') | |
2949 |
|
2954 | |||
2950 | if opObj == None: |
|
2955 | if opObj == None: | |
2951 | self.volOutputPath.clear() |
|
2956 | self.volOutputPath.clear() | |
2952 | self.volOutputblocksperfile.clear() |
|
2957 | self.volOutputblocksperfile.clear() | |
2953 | self.volOutputprofilesperblock.clear() |
|
2958 | self.volOutputprofilesperblock.clear() | |
2954 | else: |
|
2959 | else: | |
2955 | parmObj = opObj.getParameterObj(parameterName='path') |
|
2960 | parmObj = opObj.getParameterObj(parameterName='path') | |
2956 | if parmObj == None: |
|
2961 | if parmObj == None: | |
2957 | self.volOutputPath.clear() |
|
2962 | self.volOutputPath.clear() | |
2958 | else: |
|
2963 | else: | |
2959 | value = parmObj.getValue() |
|
2964 | value = parmObj.getValue() | |
2960 | path = str(value) |
|
2965 | path = str(value) | |
2961 | self.volOutputPath.setText(path) |
|
2966 | self.volOutputPath.setText(path) | |
2962 |
|
2967 | |||
2963 | parmObj = opObj.getParameterObj(parameterName='blocksPerFile') |
|
2968 | parmObj = opObj.getParameterObj(parameterName='blocksPerFile') | |
2964 | if parmObj == None: |
|
2969 | if parmObj == None: | |
2965 | self.volOutputblocksperfile.clear() |
|
2970 | self.volOutputblocksperfile.clear() | |
2966 | else: |
|
2971 | else: | |
2967 | value = parmObj.getValue() |
|
2972 | value = parmObj.getValue() | |
2968 | blocksperfile = str(value) |
|
2973 | blocksperfile = str(value) | |
2969 | self.volOutputblocksperfile.setText(blocksperfile) |
|
2974 | self.volOutputblocksperfile.setText(blocksperfile) | |
2970 |
|
2975 | |||
2971 | parmObj = opObj.getParameterObj(parameterName='profilesPerBlock') |
|
2976 | parmObj = opObj.getParameterObj(parameterName='profilesPerBlock') | |
2972 | if parmObj == None: |
|
2977 | if parmObj == None: | |
2973 | self.volOutputprofilesperblock.clear() |
|
2978 | self.volOutputprofilesperblock.clear() | |
2974 | else: |
|
2979 | else: | |
2975 | value = parmObj.getValue() |
|
2980 | value = parmObj.getValue() | |
2976 | profilesPerBlock = str(value) |
|
2981 | profilesPerBlock = str(value) | |
2977 | self.volOutputprofilesperblock.setText(profilesPerBlock) |
|
2982 | self.volOutputprofilesperblock.setText(profilesPerBlock) | |
2978 |
|
2983 | |||
2979 | return |
|
2984 | return | |
2980 |
|
2985 | |||
2981 | def __refreshSpectraWindow(self, puObj): |
|
2986 | def __refreshSpectraWindow(self, puObj): | |
2982 |
|
2987 | |||
2983 | inputId = puObj.getInputId() |
|
2988 | inputId = puObj.getInputId() | |
2984 | inputPUObj = self.__puObjDict[inputId] |
|
2989 | inputPUObj = self.__puObjDict[inputId] | |
2985 |
|
2990 | |||
2986 | if inputPUObj.datatype == 'Voltage': |
|
2991 | if inputPUObj.datatype == 'Voltage': | |
2987 | self.specOpnFFTpoints.setEnabled(True) |
|
2992 | self.specOpnFFTpoints.setEnabled(True) | |
2988 | self.specOpProfiles.setEnabled(True) |
|
2993 | self.specOpProfiles.setEnabled(True) | |
2989 | self.specOpippFactor.setEnabled(True) |
|
2994 | self.specOpippFactor.setEnabled(True) | |
2990 | else: |
|
2995 | else: | |
2991 | self.specOpnFFTpoints.setEnabled(False) |
|
2996 | self.specOpnFFTpoints.setEnabled(False) | |
2992 | self.specOpProfiles.setEnabled(False) |
|
2997 | self.specOpProfiles.setEnabled(False) | |
2993 | self.specOpippFactor.setEnabled(False) |
|
2998 | self.specOpippFactor.setEnabled(False) | |
2994 |
|
2999 | |||
2995 | opObj = puObj.getOperationObj(name='setRadarFrequency') |
|
3000 | opObj = puObj.getOperationObj(name='setRadarFrequency') | |
2996 | if opObj == None: |
|
3001 | if opObj == None: | |
2997 | self.specOpRadarfrequency.clear() |
|
3002 | self.specOpRadarfrequency.clear() | |
2998 | self.specOpCebRadarfrequency.setCheckState(0) |
|
3003 | self.specOpCebRadarfrequency.setCheckState(0) | |
2999 | else: |
|
3004 | else: | |
3000 | value = opObj.getParameterValue(parameterName='frequency') |
|
3005 | value = opObj.getParameterValue(parameterName='frequency') | |
3001 | value = str(float(value)/1e6) |
|
3006 | value = str(float(value)/1e6) | |
3002 | self.specOpRadarfrequency.setText(value) |
|
3007 | self.specOpRadarfrequency.setText(value) | |
3003 | self.specOpRadarfrequency.setEnabled(True) |
|
3008 | self.specOpRadarfrequency.setEnabled(True) | |
3004 | self.specOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) |
|
3009 | self.specOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) | |
3005 |
|
3010 | |||
3006 | opObj = puObj.getOperationObj(name="run") |
|
3011 | opObj = puObj.getOperationObj(name="run") | |
3007 | if opObj == None: |
|
3012 | if opObj == None: | |
3008 | self.specOpnFFTpoints.clear() |
|
3013 | self.specOpnFFTpoints.clear() | |
3009 | self.specOpProfiles.clear() |
|
3014 | self.specOpProfiles.clear() | |
3010 | self.specOpippFactor.clear() |
|
3015 | self.specOpippFactor.clear() | |
3011 | else: |
|
3016 | else: | |
3012 | parmObj = opObj.getParameterObj(parameterName='nFFTPoints') |
|
3017 | parmObj = opObj.getParameterObj(parameterName='nFFTPoints') | |
3013 | if parmObj == None: |
|
3018 | if parmObj == None: | |
3014 | self.specOpnFFTpoints.clear() |
|
3019 | self.specOpnFFTpoints.clear() | |
3015 | else: |
|
3020 | else: | |
3016 | self.specOpnFFTpoints.setEnabled(True) |
|
3021 | self.specOpnFFTpoints.setEnabled(True) | |
3017 | value = opObj.getParameterValue(parameterName='nFFTPoints') |
|
3022 | value = opObj.getParameterValue(parameterName='nFFTPoints') | |
3018 | self.specOpnFFTpoints.setText(str(value)) |
|
3023 | self.specOpnFFTpoints.setText(str(value)) | |
3019 |
|
3024 | |||
3020 | parmObj = opObj.getParameterObj(parameterName='nProfiles') |
|
3025 | parmObj = opObj.getParameterObj(parameterName='nProfiles') | |
3021 | if parmObj == None: |
|
3026 | if parmObj == None: | |
3022 | self.specOpProfiles.clear() |
|
3027 | self.specOpProfiles.clear() | |
3023 | else: |
|
3028 | else: | |
3024 | self.specOpProfiles.setEnabled(True) |
|
3029 | self.specOpProfiles.setEnabled(True) | |
3025 | value = opObj.getParameterValue(parameterName='nProfiles') |
|
3030 | value = opObj.getParameterValue(parameterName='nProfiles') | |
3026 | self.specOpProfiles.setText(str(value)) |
|
3031 | self.specOpProfiles.setText(str(value)) | |
3027 |
|
3032 | |||
3028 | parmObj = opObj.getParameterObj(parameterName='ippFactor') |
|
3033 | parmObj = opObj.getParameterObj(parameterName='ippFactor') | |
3029 | if parmObj == None: |
|
3034 | if parmObj == None: | |
3030 | self.specOpippFactor.clear() |
|
3035 | self.specOpippFactor.clear() | |
3031 | else: |
|
3036 | else: | |
3032 | self.specOpippFactor.setEnabled(True) |
|
3037 | self.specOpippFactor.setEnabled(True) | |
3033 | value = opObj.getParameterValue(parameterName='ippFactor') |
|
3038 | value = opObj.getParameterValue(parameterName='ippFactor') | |
3034 | self.specOpippFactor.setText(str(value)) |
|
3039 | self.specOpippFactor.setText(str(value)) | |
3035 |
|
3040 | |||
3036 | opObj = puObj.getOperationObj(name="run") |
|
3041 | opObj = puObj.getOperationObj(name="run") | |
3037 | if opObj == None: |
|
3042 | if opObj == None: | |
3038 | self.specOppairsList.clear() |
|
3043 | self.specOppairsList.clear() | |
3039 | self.specOpCebCrossSpectra.setCheckState(0) |
|
3044 | self.specOpCebCrossSpectra.setCheckState(0) | |
3040 | else: |
|
3045 | else: | |
3041 | parmObj = opObj.getParameterObj(parameterName='pairsList') |
|
3046 | parmObj = opObj.getParameterObj(parameterName='pairsList') | |
3042 | if parmObj == None: |
|
3047 | if parmObj == None: | |
3043 | self.specOppairsList.clear() |
|
3048 | self.specOppairsList.clear() | |
3044 | self.specOpCebCrossSpectra.setCheckState(0) |
|
3049 | self.specOpCebCrossSpectra.setCheckState(0) | |
3045 | else: |
|
3050 | else: | |
3046 | value = opObj.getParameterValue(parameterName='pairsList') |
|
3051 | value = opObj.getParameterValue(parameterName='pairsList') | |
3047 | value = str(value)[1:-1] |
|
3052 | value = str(value)[1:-1] | |
3048 | self.specOppairsList.setText(str(value)) |
|
3053 | self.specOppairsList.setText(str(value)) | |
3049 | self.specOppairsList.setEnabled(True) |
|
3054 | self.specOppairsList.setEnabled(True) | |
3050 | self.specOpCebCrossSpectra.setCheckState(QtCore.Qt.Checked) |
|
3055 | self.specOpCebCrossSpectra.setCheckState(QtCore.Qt.Checked) | |
3051 |
|
3056 | |||
3052 | opObj = puObj.getOperationObj(name="selectChannels") |
|
3057 | opObj = puObj.getOperationObj(name="selectChannels") | |
3053 |
|
3058 | |||
3054 | if opObj == None: |
|
3059 | if opObj == None: | |
3055 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") |
|
3060 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") | |
3056 |
|
3061 | |||
3057 | if opObj == None: |
|
3062 | if opObj == None: | |
3058 | self.specOpChannel.clear() |
|
3063 | self.specOpChannel.clear() | |
3059 | self.specOpCebChannel.setCheckState(0) |
|
3064 | self.specOpCebChannel.setCheckState(0) | |
3060 | else: |
|
3065 | else: | |
3061 | channelEnabled = False |
|
3066 | channelEnabled = False | |
3062 | try: |
|
3067 | try: | |
3063 | value = opObj.getParameterValue(parameterName='channelList') |
|
3068 | value = opObj.getParameterValue(parameterName='channelList') | |
3064 | value = str(value)[1:-1] |
|
3069 | value = str(value)[1:-1] | |
3065 | channelEnabled = True |
|
3070 | channelEnabled = True | |
3066 | channelMode = 0 |
|
3071 | channelMode = 0 | |
3067 | except: |
|
3072 | except: | |
3068 | pass |
|
3073 | pass | |
3069 | try: |
|
3074 | try: | |
3070 | value = opObj.getParameterValue(parameterName='channelIndexList') |
|
3075 | value = opObj.getParameterValue(parameterName='channelIndexList') | |
3071 | value = str(value)[1:-1] |
|
3076 | value = str(value)[1:-1] | |
3072 | channelEnabled = True |
|
3077 | channelEnabled = True | |
3073 | channelMode = 1 |
|
3078 | channelMode = 1 | |
3074 | except: |
|
3079 | except: | |
3075 | pass |
|
3080 | pass | |
3076 |
|
3081 | |||
3077 | if channelEnabled: |
|
3082 | if channelEnabled: | |
3078 | self.specOpChannel.setText(value) |
|
3083 | self.specOpChannel.setText(value) | |
3079 | self.specOpChannel.setEnabled(True) |
|
3084 | self.specOpChannel.setEnabled(True) | |
3080 | self.specOpCebChannel.setCheckState(QtCore.Qt.Checked) |
|
3085 | self.specOpCebChannel.setCheckState(QtCore.Qt.Checked) | |
3081 | self.specOpComChannel.setCurrentIndex(channelMode) |
|
3086 | self.specOpComChannel.setCurrentIndex(channelMode) | |
3082 |
|
3087 | |||
3083 | opObj = puObj.getOperationObj(name="selectHeights") |
|
3088 | opObj = puObj.getOperationObj(name="selectHeights") | |
3084 | if opObj == None: |
|
3089 | if opObj == None: | |
3085 | self.specOpHeights.clear() |
|
3090 | self.specOpHeights.clear() | |
3086 | self.specOpCebHeights.setCheckState(0) |
|
3091 | self.specOpCebHeights.setCheckState(0) | |
3087 | else: |
|
3092 | else: | |
3088 | value1 = int(opObj.getParameterValue(parameterName='minHei')) |
|
3093 | value1 = int(opObj.getParameterValue(parameterName='minHei')) | |
3089 | value1 = str(value1) |
|
3094 | value1 = str(value1) | |
3090 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) |
|
3095 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) | |
3091 | value2 = str(value2) |
|
3096 | value2 = str(value2) | |
3092 | value = value1 + "," + value2 |
|
3097 | value = value1 + "," + value2 | |
3093 | self.specOpHeights.setText(value) |
|
3098 | self.specOpHeights.setText(value) | |
3094 | self.specOpHeights.setEnabled(True) |
|
3099 | self.specOpHeights.setEnabled(True) | |
3095 | self.specOpCebHeights.setCheckState(QtCore.Qt.Checked) |
|
3100 | self.specOpCebHeights.setCheckState(QtCore.Qt.Checked) | |
3096 |
|
3101 | |||
3097 | opObj = puObj.getOperationObj(name="IncohInt") |
|
3102 | opObj = puObj.getOperationObj(name="IncohInt") | |
3098 | if opObj == None: |
|
3103 | if opObj == None: | |
3099 | self.specOpIncoherent.clear() |
|
3104 | self.specOpIncoherent.clear() | |
3100 | self.specOpCebIncoherent.setCheckState(0) |
|
3105 | self.specOpCebIncoherent.setCheckState(0) | |
3101 | else: |
|
3106 | else: | |
3102 | for parmObj in opObj.getParameterObjList(): |
|
3107 | for parmObj in opObj.getParameterObjList(): | |
3103 | if parmObj.name == 'timeInterval': |
|
3108 | if parmObj.name == 'timeInterval': | |
3104 | value = opObj.getParameterValue(parameterName='timeInterval') |
|
3109 | value = opObj.getParameterValue(parameterName='timeInterval') | |
3105 | value = float(value) |
|
3110 | value = float(value) | |
3106 | self.specOpIncoherent.setText(str(value)) |
|
3111 | self.specOpIncoherent.setText(str(value)) | |
3107 | self.specOpIncoherent.setEnabled(True) |
|
3112 | self.specOpIncoherent.setEnabled(True) | |
3108 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3113 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) | |
3109 | self.specOpCobIncInt.setCurrentIndex(0) |
|
3114 | self.specOpCobIncInt.setCurrentIndex(0) | |
3110 |
|
3115 | |||
3111 | if parmObj.name == 'n': |
|
3116 | if parmObj.name == 'n': | |
3112 | value = opObj.getParameterValue(parameterName='n') |
|
3117 | value = opObj.getParameterValue(parameterName='n') | |
3113 | value = float(value) |
|
3118 | value = float(value) | |
3114 | self.specOpIncoherent.setText(str(value)) |
|
3119 | self.specOpIncoherent.setText(str(value)) | |
3115 | self.specOpIncoherent.setEnabled(True) |
|
3120 | self.specOpIncoherent.setEnabled(True) | |
3116 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3121 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) | |
3117 | self.specOpCobIncInt.setCurrentIndex(1) |
|
3122 | self.specOpCobIncInt.setCurrentIndex(1) | |
3118 |
|
3123 | |||
3119 | opObj = puObj.getOperationObj(name="removeDC") |
|
3124 | opObj = puObj.getOperationObj(name="removeDC") | |
3120 | if opObj == None: |
|
3125 | if opObj == None: | |
3121 | self.specOpCebRemoveDC.setCheckState(0) |
|
3126 | self.specOpCebRemoveDC.setCheckState(0) | |
3122 | else: |
|
3127 | else: | |
3123 | self.specOpCebRemoveDC.setCheckState(QtCore.Qt.Checked) |
|
3128 | self.specOpCebRemoveDC.setCheckState(QtCore.Qt.Checked) | |
3124 | value = opObj.getParameterValue(parameterName='mode') |
|
3129 | value = opObj.getParameterValue(parameterName='mode') | |
3125 | if value == 1: |
|
3130 | if value == 1: | |
3126 | self.specOpComRemoveDC.setCurrentIndex(0) |
|
3131 | self.specOpComRemoveDC.setCurrentIndex(0) | |
3127 | elif value == 2: |
|
3132 | elif value == 2: | |
3128 | self.specOpComRemoveDC.setCurrentIndex(1) |
|
3133 | self.specOpComRemoveDC.setCurrentIndex(1) | |
3129 |
|
3134 | |||
3130 | opObj = puObj.getOperationObj(name="removeInterference") |
|
3135 | opObj = puObj.getOperationObj(name="removeInterference") | |
3131 | if opObj == None: |
|
3136 | if opObj == None: | |
3132 | self.specOpCebRemoveInt.setCheckState(0) |
|
3137 | self.specOpCebRemoveInt.setCheckState(0) | |
3133 | else: |
|
3138 | else: | |
3134 | self.specOpCebRemoveInt.setCheckState(QtCore.Qt.Checked) |
|
3139 | self.specOpCebRemoveInt.setCheckState(QtCore.Qt.Checked) | |
3135 |
|
3140 | |||
3136 | opObj = puObj.getOperationObj(name='getNoise') |
|
3141 | opObj = puObj.getOperationObj(name='getNoise') | |
3137 | if opObj == None: |
|
3142 | if opObj == None: | |
3138 | self.specOpCebgetNoise.setCheckState(0) |
|
3143 | self.specOpCebgetNoise.setCheckState(0) | |
3139 | self.specOpgetNoise.clear() |
|
3144 | self.specOpgetNoise.clear() | |
3140 | else: |
|
3145 | else: | |
3141 | self.specOpCebgetNoise.setCheckState(QtCore.Qt.Checked) |
|
3146 | self.specOpCebgetNoise.setCheckState(QtCore.Qt.Checked) | |
3142 | parmObj = opObj.getParameterObj(parameterName='minHei') |
|
3147 | parmObj = opObj.getParameterObj(parameterName='minHei') | |
3143 | if parmObj == None: |
|
3148 | if parmObj == None: | |
3144 | self.specOpgetNoise.clear() |
|
3149 | self.specOpgetNoise.clear() | |
3145 | value1 = None |
|
3150 | value1 = None | |
3146 | else: |
|
3151 | else: | |
3147 | value1 = opObj.getParameterValue(parameterName='minHei') |
|
3152 | value1 = opObj.getParameterValue(parameterName='minHei') | |
3148 | value1 = str(value1) |
|
3153 | value1 = str(value1) | |
3149 | parmObj = opObj.getParameterObj(parameterName='maxHei') |
|
3154 | parmObj = opObj.getParameterObj(parameterName='maxHei') | |
3150 | if parmObj == None: |
|
3155 | if parmObj == None: | |
3151 | value2 = None |
|
3156 | value2 = None | |
3152 | value = value1 |
|
3157 | value = value1 | |
3153 | self.specOpgetNoise.setText(value) |
|
3158 | self.specOpgetNoise.setText(value) | |
3154 | self.specOpgetNoise.setEnabled(True) |
|
3159 | self.specOpgetNoise.setEnabled(True) | |
3155 | else: |
|
3160 | else: | |
3156 | value2 = opObj.getParameterValue(parameterName='maxHei') |
|
3161 | value2 = opObj.getParameterValue(parameterName='maxHei') | |
3157 | value2 = str(value2) |
|
3162 | value2 = str(value2) | |
3158 | parmObj = opObj.getParameterObj(parameterName='minVel') |
|
3163 | parmObj = opObj.getParameterObj(parameterName='minVel') | |
3159 | if parmObj == None: |
|
3164 | if parmObj == None: | |
3160 | value3 = None |
|
3165 | value3 = None | |
3161 | value = value1 + "," + value2 |
|
3166 | value = value1 + "," + value2 | |
3162 | self.specOpgetNoise.setText(value) |
|
3167 | self.specOpgetNoise.setText(value) | |
3163 | self.specOpgetNoise.setEnabled(True) |
|
3168 | self.specOpgetNoise.setEnabled(True) | |
3164 | else: |
|
3169 | else: | |
3165 | value3 = opObj.getParameterValue(parameterName='minVel') |
|
3170 | value3 = opObj.getParameterValue(parameterName='minVel') | |
3166 | value3 = str(value3) |
|
3171 | value3 = str(value3) | |
3167 | parmObj = opObj.getParameterObj(parameterName='maxVel') |
|
3172 | parmObj = opObj.getParameterObj(parameterName='maxVel') | |
3168 | if parmObj == None: |
|
3173 | if parmObj == None: | |
3169 | value4 = None |
|
3174 | value4 = None | |
3170 | value = value1 + "," + value2 + "," + value3 |
|
3175 | value = value1 + "," + value2 + "," + value3 | |
3171 | self.specOpgetNoise.setText(value) |
|
3176 | self.specOpgetNoise.setText(value) | |
3172 | self.specOpgetNoise.setEnabled(True) |
|
3177 | self.specOpgetNoise.setEnabled(True) | |
3173 | else: |
|
3178 | else: | |
3174 | value4 = opObj.getParameterValue(parameterName='maxVel') |
|
3179 | value4 = opObj.getParameterValue(parameterName='maxVel') | |
3175 | value4 = str(value4) |
|
3180 | value4 = str(value4) | |
3176 | value = value1 + "," + value2 + "," + value3 + ',' + value4 |
|
3181 | value = value1 + "," + value2 + "," + value3 + ',' + value4 | |
3177 | self.specOpgetNoise.setText(value) |
|
3182 | self.specOpgetNoise.setText(value) | |
3178 | self.specOpgetNoise.setEnabled(True) |
|
3183 | self.specOpgetNoise.setEnabled(True) | |
3179 |
|
3184 | |||
3180 | self.specGraphPath.clear() |
|
3185 | self.specGraphPath.clear() | |
3181 | self.specGraphPrefix.clear() |
|
3186 | self.specGraphPrefix.clear() | |
3182 | self.specGgraphFreq.clear() |
|
3187 | self.specGgraphFreq.clear() | |
3183 | self.specGgraphHeight.clear() |
|
3188 | self.specGgraphHeight.clear() | |
3184 | self.specGgraphDbsrange.clear() |
|
3189 | self.specGgraphDbsrange.clear() | |
3185 | self.specGgraphmagnitud.clear() |
|
3190 | self.specGgraphmagnitud.clear() | |
3186 | self.specGgraphPhase.clear() |
|
3191 | self.specGgraphPhase.clear() | |
3187 | self.specGgraphChannelList.clear() |
|
3192 | self.specGgraphChannelList.clear() | |
3188 | self.specGgraphTminTmax.clear() |
|
3193 | self.specGgraphTminTmax.clear() | |
3189 | self.specGgraphTimeRange.clear() |
|
3194 | self.specGgraphTimeRange.clear() | |
3190 | self.specGgraphftpratio.clear() |
|
3195 | self.specGgraphftpratio.clear() | |
3191 |
|
3196 | |||
3192 | opObj = puObj.getOperationObj(name='SpectraPlot') |
|
3197 | opObj = puObj.getOperationObj(name='SpectraPlot') | |
3193 |
|
3198 | |||
3194 | if opObj == None: |
|
3199 | if opObj == None: | |
3195 | self.specGraphCebSpectraplot.setCheckState(0) |
|
3200 | self.specGraphCebSpectraplot.setCheckState(0) | |
3196 | self.specGraphSaveSpectra.setCheckState(0) |
|
3201 | self.specGraphSaveSpectra.setCheckState(0) | |
3197 | self.specGraphftpSpectra.setCheckState(0) |
|
3202 | self.specGraphftpSpectra.setCheckState(0) | |
3198 | else: |
|
3203 | else: | |
3199 | operationSpectraPlot = "Enable" |
|
3204 | operationSpectraPlot = "Enable" | |
3200 | self.specGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3205 | self.specGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) | |
3201 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3206 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
3202 | if parmObj == None: |
|
3207 | if parmObj == None: | |
3203 | self.specGgraphChannelList.clear() |
|
3208 | self.specGgraphChannelList.clear() | |
3204 | else: |
|
3209 | else: | |
3205 | value = opObj.getParameterValue(parameterName='channelList') |
|
3210 | value = opObj.getParameterValue(parameterName='channelList') | |
3206 | channelListSpectraPlot = str(value)[1:-1] |
|
3211 | channelListSpectraPlot = str(value)[1:-1] | |
3207 | self.specGgraphChannelList.setText(channelListSpectraPlot) |
|
3212 | self.specGgraphChannelList.setText(channelListSpectraPlot) | |
3208 | self.specGgraphChannelList.setEnabled(True) |
|
3213 | self.specGgraphChannelList.setEnabled(True) | |
3209 |
|
3214 | |||
3210 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3215 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3211 | if parmObj == None: |
|
3216 | if parmObj == None: | |
3212 | self.specGgraphFreq.clear() |
|
3217 | self.specGgraphFreq.clear() | |
3213 | else: |
|
3218 | else: | |
3214 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3219 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3215 | value1 = str(value1) |
|
3220 | value1 = str(value1) | |
3216 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3221 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3217 | value2 = str(value2) |
|
3222 | value2 = str(value2) | |
3218 | value = value1 + "," + value2 |
|
3223 | value = value1 + "," + value2 | |
3219 | self.specGgraphFreq.setText(value) |
|
3224 | self.specGgraphFreq.setText(value) | |
3220 | self.specGgraphFreq.setEnabled(True) |
|
3225 | self.specGgraphFreq.setEnabled(True) | |
3221 |
|
3226 | |||
3222 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3227 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3223 | if parmObj == None: |
|
3228 | if parmObj == None: | |
3224 | self.specGgraphHeight.clear() |
|
3229 | self.specGgraphHeight.clear() | |
3225 | else: |
|
3230 | else: | |
3226 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3231 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3227 | value1 = str(value1) |
|
3232 | value1 = str(value1) | |
3228 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3233 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3229 | value2 = str(value2) |
|
3234 | value2 = str(value2) | |
3230 | value = value1 + "," + value2 |
|
3235 | value = value1 + "," + value2 | |
3231 | self.specGgraphHeight.setText(value) |
|
3236 | self.specGgraphHeight.setText(value) | |
3232 | self.specGgraphHeight.setEnabled(True) |
|
3237 | self.specGgraphHeight.setEnabled(True) | |
3233 |
|
3238 | |||
3234 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3239 | parmObj = opObj.getParameterObj(parameterName='zmin') | |
3235 | if parmObj == None: |
|
3240 | if parmObj == None: | |
3236 | self.specGgraphDbsrange.clear() |
|
3241 | self.specGgraphDbsrange.clear() | |
3237 | else: |
|
3242 | else: | |
3238 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3243 | value1 = opObj.getParameterValue(parameterName='zmin') | |
3239 | value1 = str(value1) |
|
3244 | value1 = str(value1) | |
3240 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3245 | value2 = opObj.getParameterValue(parameterName='zmax') | |
3241 | value2 = str(value2) |
|
3246 | value2 = str(value2) | |
3242 | value = value1 + "," + value2 |
|
3247 | value = value1 + "," + value2 | |
3243 | self.specGgraphDbsrange.setText(value) |
|
3248 | self.specGgraphDbsrange.setText(value) | |
3244 | self.specGgraphDbsrange.setEnabled(True) |
|
3249 | self.specGgraphDbsrange.setEnabled(True) | |
3245 |
|
3250 | |||
3246 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3251 | parmObj = opObj.getParameterObj(parameterName="save") | |
3247 | if parmObj == None: |
|
3252 | if parmObj == None: | |
3248 | self.specGraphSaveSpectra.setCheckState(0) |
|
3253 | self.specGraphSaveSpectra.setCheckState(0) | |
3249 | else: |
|
3254 | else: | |
3250 | self.specGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) |
|
3255 | self.specGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) | |
3251 |
|
3256 | |||
3252 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3257 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3253 | if parmObj == None: |
|
3258 | if parmObj == None: | |
3254 | self.specGraphftpSpectra.setCheckState(0) |
|
3259 | self.specGraphftpSpectra.setCheckState(0) | |
3255 | else: |
|
3260 | else: | |
3256 | self.specGraphftpSpectra.setCheckState(QtCore.Qt.Checked) |
|
3261 | self.specGraphftpSpectra.setCheckState(QtCore.Qt.Checked) | |
3257 |
|
3262 | |||
3258 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3263 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3259 | if parmObj: |
|
3264 | if parmObj: | |
3260 | value = parmObj.getValue() |
|
3265 | value = parmObj.getValue() | |
3261 | self.specGraphPath.setText(value) |
|
3266 | self.specGraphPath.setText(value) | |
3262 |
|
3267 | |||
3263 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3268 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3264 | if parmObj: |
|
3269 | if parmObj: | |
3265 | value = parmObj.getValue() |
|
3270 | value = parmObj.getValue() | |
3266 | self.specGgraphftpratio.setText(str(value)) |
|
3271 | self.specGgraphftpratio.setText(str(value)) | |
3267 |
|
3272 | |||
3268 | opObj = puObj.getOperationObj(name='CrossSpectraPlot') |
|
3273 | opObj = puObj.getOperationObj(name='CrossSpectraPlot') | |
3269 |
|
3274 | |||
3270 | if opObj == None: |
|
3275 | if opObj == None: | |
3271 | self.specGraphCebCrossSpectraplot.setCheckState(0) |
|
3276 | self.specGraphCebCrossSpectraplot.setCheckState(0) | |
3272 | self.specGraphSaveCross.setCheckState(0) |
|
3277 | self.specGraphSaveCross.setCheckState(0) | |
3273 | self.specGraphftpCross.setCheckState(0) |
|
3278 | self.specGraphftpCross.setCheckState(0) | |
3274 | else: |
|
3279 | else: | |
3275 | operationCrossSpectraPlot = "Enable" |
|
3280 | operationCrossSpectraPlot = "Enable" | |
3276 | self.specGraphCebCrossSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3281 | self.specGraphCebCrossSpectraplot.setCheckState(QtCore.Qt.Checked) | |
3277 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3282 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3278 | if parmObj == None: |
|
3283 | if parmObj == None: | |
3279 | self.specGgraphFreq.clear() |
|
3284 | self.specGgraphFreq.clear() | |
3280 | else: |
|
3285 | else: | |
3281 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3286 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3282 | value1 = str(value1) |
|
3287 | value1 = str(value1) | |
3283 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3288 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3284 | value2 = str(value2) |
|
3289 | value2 = str(value2) | |
3285 | value = value1 + "," + value2 |
|
3290 | value = value1 + "," + value2 | |
3286 | self.specGgraphFreq.setText(value) |
|
3291 | self.specGgraphFreq.setText(value) | |
3287 | self.specGgraphFreq.setEnabled(True) |
|
3292 | self.specGgraphFreq.setEnabled(True) | |
3288 |
|
3293 | |||
3289 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3294 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3290 | if parmObj == None: |
|
3295 | if parmObj == None: | |
3291 | self.specGgraphHeight.clear() |
|
3296 | self.specGgraphHeight.clear() | |
3292 | else: |
|
3297 | else: | |
3293 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3298 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3294 | value1 = str(value1) |
|
3299 | value1 = str(value1) | |
3295 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3300 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3296 | value2 = str(value2) |
|
3301 | value2 = str(value2) | |
3297 | value = value1 + "," + value2 |
|
3302 | value = value1 + "," + value2 | |
3298 | self.specGgraphHeight.setText(value) |
|
3303 | self.specGgraphHeight.setText(value) | |
3299 | self.specGgraphHeight.setEnabled(True) |
|
3304 | self.specGgraphHeight.setEnabled(True) | |
3300 |
|
3305 | |||
3301 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3306 | parmObj = opObj.getParameterObj(parameterName='zmin') | |
3302 | if parmObj == None: |
|
3307 | if parmObj == None: | |
3303 | self.specGgraphDbsrange.clear() |
|
3308 | self.specGgraphDbsrange.clear() | |
3304 | else: |
|
3309 | else: | |
3305 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3310 | value1 = opObj.getParameterValue(parameterName='zmin') | |
3306 | value1 = str(value1) |
|
3311 | value1 = str(value1) | |
3307 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3312 | value2 = opObj.getParameterValue(parameterName='zmax') | |
3308 | value2 = str(value2) |
|
3313 | value2 = str(value2) | |
3309 | value = value1 + "," + value2 |
|
3314 | value = value1 + "," + value2 | |
3310 | self.specGgraphDbsrange.setText(value) |
|
3315 | self.specGgraphDbsrange.setText(value) | |
3311 | self.specGgraphDbsrange.setEnabled(True) |
|
3316 | self.specGgraphDbsrange.setEnabled(True) | |
3312 |
|
3317 | |||
3313 | parmObj = opObj.getParameterObj(parameterName='coh_min') |
|
3318 | parmObj = opObj.getParameterObj(parameterName='coh_min') | |
3314 | if parmObj == None: |
|
3319 | if parmObj == None: | |
3315 | self.specGgraphmagnitud.clear() |
|
3320 | self.specGgraphmagnitud.clear() | |
3316 | else: |
|
3321 | else: | |
3317 | value1 = opObj.getParameterValue(parameterName='coh_min') |
|
3322 | value1 = opObj.getParameterValue(parameterName='coh_min') | |
3318 | value1 = str(value1) |
|
3323 | value1 = str(value1) | |
3319 | value2 = opObj.getParameterValue(parameterName='coh_max') |
|
3324 | value2 = opObj.getParameterValue(parameterName='coh_max') | |
3320 | value2 = str(value2) |
|
3325 | value2 = str(value2) | |
3321 | value = value1 + "," + value2 |
|
3326 | value = value1 + "," + value2 | |
3322 | self.specGgraphmagnitud.setText(value) |
|
3327 | self.specGgraphmagnitud.setText(value) | |
3323 | self.specGgraphmagnitud.setEnabled(True) |
|
3328 | self.specGgraphmagnitud.setEnabled(True) | |
3324 |
|
3329 | |||
3325 | parmObj = opObj.getParameterObj(parameterName='phase_min') |
|
3330 | parmObj = opObj.getParameterObj(parameterName='phase_min') | |
3326 | if parmObj == None: |
|
3331 | if parmObj == None: | |
3327 | self.specGgraphPhase.clear() |
|
3332 | self.specGgraphPhase.clear() | |
3328 | else: |
|
3333 | else: | |
3329 | value1 = opObj.getParameterValue(parameterName='phase_min') |
|
3334 | value1 = opObj.getParameterValue(parameterName='phase_min') | |
3330 | value1 = str(value1) |
|
3335 | value1 = str(value1) | |
3331 | value2 = opObj.getParameterValue(parameterName='phase_max') |
|
3336 | value2 = opObj.getParameterValue(parameterName='phase_max') | |
3332 | value2 = str(value2) |
|
3337 | value2 = str(value2) | |
3333 | value = value1 + "," + value2 |
|
3338 | value = value1 + "," + value2 | |
3334 | self.specGgraphPhase.setText(value) |
|
3339 | self.specGgraphPhase.setText(value) | |
3335 | self.specGgraphPhase.setEnabled(True) |
|
3340 | self.specGgraphPhase.setEnabled(True) | |
3336 |
|
3341 | |||
3337 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3342 | parmObj = opObj.getParameterObj(parameterName="save") | |
3338 | if parmObj == None: |
|
3343 | if parmObj == None: | |
3339 | self.specGraphSaveCross.setCheckState(0) |
|
3344 | self.specGraphSaveCross.setCheckState(0) | |
3340 | else: |
|
3345 | else: | |
3341 | self.specGraphSaveCross.setCheckState(QtCore.Qt.Checked) |
|
3346 | self.specGraphSaveCross.setCheckState(QtCore.Qt.Checked) | |
3342 |
|
3347 | |||
3343 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3348 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3344 | if parmObj == None: |
|
3349 | if parmObj == None: | |
3345 | self.specGraphftpCross.setCheckState(0) |
|
3350 | self.specGraphftpCross.setCheckState(0) | |
3346 | else: |
|
3351 | else: | |
3347 | self.specGraphftpCross.setCheckState(QtCore.Qt.Checked) |
|
3352 | self.specGraphftpCross.setCheckState(QtCore.Qt.Checked) | |
3348 |
|
3353 | |||
3349 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3354 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3350 | if parmObj: |
|
3355 | if parmObj: | |
3351 | value = parmObj.getValue() |
|
3356 | value = parmObj.getValue() | |
3352 | self.specGraphPath.setText(value) |
|
3357 | self.specGraphPath.setText(value) | |
3353 |
|
3358 | |||
3354 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3359 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3355 | if parmObj: |
|
3360 | if parmObj: | |
3356 | value = parmObj.getValue() |
|
3361 | value = parmObj.getValue() | |
3357 | self.specGgraphftpratio.setText(str(value)) |
|
3362 | self.specGgraphftpratio.setText(str(value)) | |
3358 |
|
3363 | |||
3359 | opObj = puObj.getOperationObj(name='RTIPlot') |
|
3364 | opObj = puObj.getOperationObj(name='RTIPlot') | |
3360 |
|
3365 | |||
3361 | if opObj == None: |
|
3366 | if opObj == None: | |
3362 | self.specGraphCebRTIplot.setCheckState(0) |
|
3367 | self.specGraphCebRTIplot.setCheckState(0) | |
3363 | self.specGraphSaveRTIplot.setCheckState(0) |
|
3368 | self.specGraphSaveRTIplot.setCheckState(0) | |
3364 | self.specGraphftpRTIplot.setCheckState(0) |
|
3369 | self.specGraphftpRTIplot.setCheckState(0) | |
3365 | else: |
|
3370 | else: | |
3366 | self.specGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3371 | self.specGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) | |
3367 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3372 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
3368 | if parmObj == None: |
|
3373 | if parmObj == None: | |
3369 | self.specGgraphChannelList.clear() |
|
3374 | self.specGgraphChannelList.clear() | |
3370 | else: |
|
3375 | else: | |
3371 | value = opObj.getParameterValue(parameterName='channelList') |
|
3376 | value = opObj.getParameterValue(parameterName='channelList') | |
3372 | channelListRTIPlot = str(value)[1:-1] |
|
3377 | channelListRTIPlot = str(value)[1:-1] | |
3373 | self.specGgraphChannelList.setText(channelListRTIPlot) |
|
3378 | self.specGgraphChannelList.setText(channelListRTIPlot) | |
3374 | self.specGgraphChannelList.setEnabled(True) |
|
3379 | self.specGgraphChannelList.setEnabled(True) | |
3375 |
|
3380 | |||
3376 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3381 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3377 | if parmObj == None: |
|
3382 | if parmObj == None: | |
3378 | self.specGgraphTminTmax.clear() |
|
3383 | self.specGgraphTminTmax.clear() | |
3379 | else: |
|
3384 | else: | |
3380 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3385 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3381 | value1 = str(value1) |
|
3386 | value1 = str(value1) | |
3382 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3387 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3383 | value2 = str(value2) |
|
3388 | value2 = str(value2) | |
3384 | value = value1 + "," + value2 |
|
3389 | value = value1 + "," + value2 | |
3385 | self.specGgraphTminTmax.setText(value) |
|
3390 | self.specGgraphTminTmax.setText(value) | |
3386 | self.specGgraphTminTmax.setEnabled(True) |
|
3391 | self.specGgraphTminTmax.setEnabled(True) | |
3387 |
|
3392 | |||
3388 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3393 | parmObj = opObj.getParameterObj(parameterName='timerange') | |
3389 | if parmObj == None: |
|
3394 | if parmObj == None: | |
3390 | self.specGgraphTimeRange.clear() |
|
3395 | self.specGgraphTimeRange.clear() | |
3391 | else: |
|
3396 | else: | |
3392 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3397 | value1 = opObj.getParameterValue(parameterName='timerange') | |
3393 | value1 = str(value1) |
|
3398 | value1 = str(value1) | |
3394 | self.specGgraphTimeRange.setText(value1) |
|
3399 | self.specGgraphTimeRange.setText(value1) | |
3395 | self.specGgraphTimeRange.setEnabled(True) |
|
3400 | self.specGgraphTimeRange.setEnabled(True) | |
3396 |
|
3401 | |||
3397 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3402 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3398 | if parmObj == None: |
|
3403 | if parmObj == None: | |
3399 | self.specGgraphHeight.clear() |
|
3404 | self.specGgraphHeight.clear() | |
3400 | else: |
|
3405 | else: | |
3401 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3406 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3402 | value1 = str(value1) |
|
3407 | value1 = str(value1) | |
3403 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3408 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3404 | value2 = str(value2) |
|
3409 | value2 = str(value2) | |
3405 | value = value1 + "," + value2 |
|
3410 | value = value1 + "," + value2 | |
3406 | self.specGgraphHeight.setText(value) |
|
3411 | self.specGgraphHeight.setText(value) | |
3407 | self.specGgraphHeight.setEnabled(True) |
|
3412 | self.specGgraphHeight.setEnabled(True) | |
3408 |
|
3413 | |||
3409 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3414 | parmObj = opObj.getParameterObj(parameterName='zmin') | |
3410 | if parmObj == None: |
|
3415 | if parmObj == None: | |
3411 | self.specGgraphDbsrange.clear() |
|
3416 | self.specGgraphDbsrange.clear() | |
3412 | else: |
|
3417 | else: | |
3413 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3418 | value1 = opObj.getParameterValue(parameterName='zmin') | |
3414 | value1 = str(value1) |
|
3419 | value1 = str(value1) | |
3415 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3420 | value2 = opObj.getParameterValue(parameterName='zmax') | |
3416 | value2 = str(value2) |
|
3421 | value2 = str(value2) | |
3417 | value = value1 + "," + value2 |
|
3422 | value = value1 + "," + value2 | |
3418 | self.specGgraphDbsrange.setText(value) |
|
3423 | self.specGgraphDbsrange.setText(value) | |
3419 | self.specGgraphDbsrange.setEnabled(True) |
|
3424 | self.specGgraphDbsrange.setEnabled(True) | |
3420 |
|
3425 | |||
3421 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3426 | parmObj = opObj.getParameterObj(parameterName="save") | |
3422 | if parmObj == None: |
|
3427 | if parmObj == None: | |
3423 | self.specGraphSaveRTIplot.setCheckState(0) |
|
3428 | self.specGraphSaveRTIplot.setCheckState(0) | |
3424 | else: |
|
3429 | else: | |
3425 | self.specGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3430 | self.specGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) | |
3426 |
|
3431 | |||
3427 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3432 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3428 | if parmObj == None: |
|
3433 | if parmObj == None: | |
3429 | self.specGraphftpRTIplot.setCheckState(0) |
|
3434 | self.specGraphftpRTIplot.setCheckState(0) | |
3430 | else: |
|
3435 | else: | |
3431 | self.specGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3436 | self.specGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) | |
3432 |
|
3437 | |||
3433 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3438 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3434 | if parmObj: |
|
3439 | if parmObj: | |
3435 | value = parmObj.getValue() |
|
3440 | value = parmObj.getValue() | |
3436 | self.specGraphPath.setText(value) |
|
3441 | self.specGraphPath.setText(value) | |
3437 |
|
3442 | |||
3438 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3443 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3439 | if parmObj: |
|
3444 | if parmObj: | |
3440 | value = parmObj.getValue() |
|
3445 | value = parmObj.getValue() | |
3441 | self.specGgraphftpratio.setText(str(value)) |
|
3446 | self.specGgraphftpratio.setText(str(value)) | |
3442 |
|
3447 | |||
3443 | opObj = puObj.getOperationObj(name='CoherenceMap') |
|
3448 | opObj = puObj.getOperationObj(name='CoherenceMap') | |
3444 |
|
3449 | |||
3445 | if opObj == None: |
|
3450 | if opObj == None: | |
3446 | self.specGraphCebCoherencmap.setCheckState(0) |
|
3451 | self.specGraphCebCoherencmap.setCheckState(0) | |
3447 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
3452 | self.specGraphSaveCoherencemap.setCheckState(0) | |
3448 | self.specGraphftpCoherencemap.setCheckState(0) |
|
3453 | self.specGraphftpCoherencemap.setCheckState(0) | |
3449 | else: |
|
3454 | else: | |
3450 | operationCoherenceMap = "Enable" |
|
3455 | operationCoherenceMap = "Enable" | |
3451 | self.specGraphCebCoherencmap.setCheckState(QtCore.Qt.Checked) |
|
3456 | self.specGraphCebCoherencmap.setCheckState(QtCore.Qt.Checked) | |
3452 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3457 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3453 | if parmObj == None: |
|
3458 | if parmObj == None: | |
3454 | self.specGgraphTminTmax.clear() |
|
3459 | self.specGgraphTminTmax.clear() | |
3455 | else: |
|
3460 | else: | |
3456 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3461 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3457 | value1 = str(value1) |
|
3462 | value1 = str(value1) | |
3458 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3463 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3459 | value2 = str(value2) |
|
3464 | value2 = str(value2) | |
3460 | value = value1 + "," + value2 |
|
3465 | value = value1 + "," + value2 | |
3461 | self.specGgraphTminTmax.setText(value) |
|
3466 | self.specGgraphTminTmax.setText(value) | |
3462 | self.specGgraphTminTmax.setEnabled(True) |
|
3467 | self.specGgraphTminTmax.setEnabled(True) | |
3463 |
|
3468 | |||
3464 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3469 | parmObj = opObj.getParameterObj(parameterName='timerange') | |
3465 | if parmObj == None: |
|
3470 | if parmObj == None: | |
3466 | self.specGgraphTimeRange.clear() |
|
3471 | self.specGgraphTimeRange.clear() | |
3467 | else: |
|
3472 | else: | |
3468 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3473 | value1 = opObj.getParameterValue(parameterName='timerange') | |
3469 | value1 = str(value1) |
|
3474 | value1 = str(value1) | |
3470 | self.specGgraphTimeRange.setText(value1) |
|
3475 | self.specGgraphTimeRange.setText(value1) | |
3471 | self.specGgraphTimeRange.setEnabled(True) |
|
3476 | self.specGgraphTimeRange.setEnabled(True) | |
3472 |
|
3477 | |||
3473 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3478 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3474 | if parmObj == None: |
|
3479 | if parmObj == None: | |
3475 | self.specGgraphHeight.clear() |
|
3480 | self.specGgraphHeight.clear() | |
3476 | else: |
|
3481 | else: | |
3477 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3482 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3478 | value1 = str(value1) |
|
3483 | value1 = str(value1) | |
3479 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3484 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3480 | value2 = str(value2) |
|
3485 | value2 = str(value2) | |
3481 | value = value1 + "," + value2 |
|
3486 | value = value1 + "," + value2 | |
3482 | self.specGgraphHeight.setText(value) |
|
3487 | self.specGgraphHeight.setText(value) | |
3483 | self.specGgraphHeight.setEnabled(True) |
|
3488 | self.specGgraphHeight.setEnabled(True) | |
3484 |
|
3489 | |||
3485 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3490 | parmObj = opObj.getParameterObj(parameterName='zmin') | |
3486 | if parmObj == None: |
|
3491 | if parmObj == None: | |
3487 | self.specGgraphmagnitud.clear() |
|
3492 | self.specGgraphmagnitud.clear() | |
3488 | else: |
|
3493 | else: | |
3489 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3494 | value1 = opObj.getParameterValue(parameterName='zmin') | |
3490 | value1 = str(value1) |
|
3495 | value1 = str(value1) | |
3491 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3496 | value2 = opObj.getParameterValue(parameterName='zmax') | |
3492 | value2 = str(value2) |
|
3497 | value2 = str(value2) | |
3493 | value = value1 + "," + value2 |
|
3498 | value = value1 + "," + value2 | |
3494 | self.specGgraphmagnitud.setText(value) |
|
3499 | self.specGgraphmagnitud.setText(value) | |
3495 | self.specGgraphmagnitud.setEnabled(True) |
|
3500 | self.specGgraphmagnitud.setEnabled(True) | |
3496 |
|
3501 | |||
3497 | parmObj = opObj.getParameterObj(parameterName='coh_min') |
|
3502 | parmObj = opObj.getParameterObj(parameterName='coh_min') | |
3498 | if parmObj == None: |
|
3503 | if parmObj == None: | |
3499 | self.specGgraphmagnitud.clear() |
|
3504 | self.specGgraphmagnitud.clear() | |
3500 | else: |
|
3505 | else: | |
3501 | value1 = opObj.getParameterValue(parameterName='coh_min') |
|
3506 | value1 = opObj.getParameterValue(parameterName='coh_min') | |
3502 | value1 = str(value1) |
|
3507 | value1 = str(value1) | |
3503 | value2 = opObj.getParameterValue(parameterName='coh_max') |
|
3508 | value2 = opObj.getParameterValue(parameterName='coh_max') | |
3504 | value2 = str(value2) |
|
3509 | value2 = str(value2) | |
3505 | value = value1 + "," + value2 |
|
3510 | value = value1 + "," + value2 | |
3506 | self.specGgraphmagnitud.setText(value) |
|
3511 | self.specGgraphmagnitud.setText(value) | |
3507 | self.specGgraphmagnitud.setEnabled(True) |
|
3512 | self.specGgraphmagnitud.setEnabled(True) | |
3508 |
|
3513 | |||
3509 | parmObj = opObj.getParameterObj(parameterName='phase_min') |
|
3514 | parmObj = opObj.getParameterObj(parameterName='phase_min') | |
3510 | if parmObj == None: |
|
3515 | if parmObj == None: | |
3511 | self.specGgraphPhase.clear() |
|
3516 | self.specGgraphPhase.clear() | |
3512 | else: |
|
3517 | else: | |
3513 | value1 = opObj.getParameterValue(parameterName='phase_min') |
|
3518 | value1 = opObj.getParameterValue(parameterName='phase_min') | |
3514 | value1 = str(value1) |
|
3519 | value1 = str(value1) | |
3515 | value2 = opObj.getParameterValue(parameterName='phase_max') |
|
3520 | value2 = opObj.getParameterValue(parameterName='phase_max') | |
3516 | value2 = str(value2) |
|
3521 | value2 = str(value2) | |
3517 | value = value1 + "," + value2 |
|
3522 | value = value1 + "," + value2 | |
3518 | self.specGgraphPhase.setText(value) |
|
3523 | self.specGgraphPhase.setText(value) | |
3519 | self.specGgraphPhase.setEnabled(True) |
|
3524 | self.specGgraphPhase.setEnabled(True) | |
3520 |
|
3525 | |||
3521 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3526 | parmObj = opObj.getParameterObj(parameterName="save") | |
3522 | if parmObj == None: |
|
3527 | if parmObj == None: | |
3523 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
3528 | self.specGraphSaveCoherencemap.setCheckState(0) | |
3524 | else: |
|
3529 | else: | |
3525 | self.specGraphSaveCoherencemap.setCheckState(QtCore.Qt.Checked) |
|
3530 | self.specGraphSaveCoherencemap.setCheckState(QtCore.Qt.Checked) | |
3526 |
|
3531 | |||
3527 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3532 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3528 | if parmObj == None: |
|
3533 | if parmObj == None: | |
3529 | self.specGraphftpCoherencemap.setCheckState(0) |
|
3534 | self.specGraphftpCoherencemap.setCheckState(0) | |
3530 | else: |
|
3535 | else: | |
3531 | self.specGraphftpCoherencemap.setCheckState(QtCore.Qt.Checked) |
|
3536 | self.specGraphftpCoherencemap.setCheckState(QtCore.Qt.Checked) | |
3532 |
|
3537 | |||
3533 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3538 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3534 | if parmObj: |
|
3539 | if parmObj: | |
3535 | value = parmObj.getValue() |
|
3540 | value = parmObj.getValue() | |
3536 | self.specGraphPath.setText(value) |
|
3541 | self.specGraphPath.setText(value) | |
3537 |
|
3542 | |||
3538 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3543 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3539 | if parmObj: |
|
3544 | if parmObj: | |
3540 | value = parmObj.getValue() |
|
3545 | value = parmObj.getValue() | |
3541 | self.specGgraphftpratio.setText(str(value)) |
|
3546 | self.specGgraphftpratio.setText(str(value)) | |
3542 |
|
3547 | |||
3543 | opObj = puObj.getOperationObj(name='PowerProfilePlot') |
|
3548 | opObj = puObj.getOperationObj(name='PowerProfilePlot') | |
3544 |
|
3549 | |||
3545 | if opObj == None: |
|
3550 | if opObj == None: | |
3546 | self.specGraphPowerprofile.setCheckState(0) |
|
3551 | self.specGraphPowerprofile.setCheckState(0) | |
3547 | self.specGraphSavePowerprofile.setCheckState(0) |
|
3552 | self.specGraphSavePowerprofile.setCheckState(0) | |
3548 | self.specGraphftpPowerprofile.setCheckState(0) |
|
3553 | self.specGraphftpPowerprofile.setCheckState(0) | |
3549 | operationPowerProfilePlot = "Disabled" |
|
3554 | operationPowerProfilePlot = "Disabled" | |
3550 | channelList = None |
|
3555 | channelList = None | |
3551 | freq_vel = None |
|
3556 | freq_vel = None | |
3552 | heightsrange = None |
|
3557 | heightsrange = None | |
3553 | else: |
|
3558 | else: | |
3554 | operationPowerProfilePlot = "Enable" |
|
3559 | operationPowerProfilePlot = "Enable" | |
3555 | self.specGraphPowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3560 | self.specGraphPowerprofile.setCheckState(QtCore.Qt.Checked) | |
3556 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3561 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3557 | if parmObj == None: |
|
3562 | if parmObj == None: | |
3558 | self.specGgraphDbsrange.clear() |
|
3563 | self.specGgraphDbsrange.clear() | |
3559 | else: |
|
3564 | else: | |
3560 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3565 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3561 | value1 = str(value1) |
|
3566 | value1 = str(value1) | |
3562 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3567 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3563 | value2 = str(value2) |
|
3568 | value2 = str(value2) | |
3564 | value = value1 + "," + value2 |
|
3569 | value = value1 + "," + value2 | |
3565 | self.specGgraphDbsrange.setText(value) |
|
3570 | self.specGgraphDbsrange.setText(value) | |
3566 | self.specGgraphDbsrange.setEnabled(True) |
|
3571 | self.specGgraphDbsrange.setEnabled(True) | |
3567 |
|
3572 | |||
3568 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3573 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3569 | if parmObj == None: |
|
3574 | if parmObj == None: | |
3570 | self.specGgraphHeight.clear() |
|
3575 | self.specGgraphHeight.clear() | |
3571 | else: |
|
3576 | else: | |
3572 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3577 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3573 | value1 = str(value1) |
|
3578 | value1 = str(value1) | |
3574 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3579 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3575 | value2 = str(value2) |
|
3580 | value2 = str(value2) | |
3576 | value = value1 + "," + value2 |
|
3581 | value = value1 + "," + value2 | |
3577 | self.specGgraphHeight.setText(value) |
|
3582 | self.specGgraphHeight.setText(value) | |
3578 | self.specGgraphHeight.setEnabled(True) |
|
3583 | self.specGgraphHeight.setEnabled(True) | |
3579 |
|
3584 | |||
3580 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3585 | parmObj = opObj.getParameterObj(parameterName="save") | |
3581 | if parmObj == None: |
|
3586 | if parmObj == None: | |
3582 | self.specGraphSavePowerprofile.setCheckState(0) |
|
3587 | self.specGraphSavePowerprofile.setCheckState(0) | |
3583 | else: |
|
3588 | else: | |
3584 | self.specGraphSavePowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3589 | self.specGraphSavePowerprofile.setCheckState(QtCore.Qt.Checked) | |
3585 |
|
3590 | |||
3586 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3591 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3587 | if parmObj == None: |
|
3592 | if parmObj == None: | |
3588 | self.specGraphftpPowerprofile.setCheckState(0) |
|
3593 | self.specGraphftpPowerprofile.setCheckState(0) | |
3589 | else: |
|
3594 | else: | |
3590 | self.specGraphftpPowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3595 | self.specGraphftpPowerprofile.setCheckState(QtCore.Qt.Checked) | |
3591 |
|
3596 | |||
3592 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3597 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3593 | if parmObj: |
|
3598 | if parmObj: | |
3594 | value = parmObj.getValue() |
|
3599 | value = parmObj.getValue() | |
3595 | self.specGraphPath.setText(value) |
|
3600 | self.specGraphPath.setText(value) | |
3596 |
|
3601 | |||
3597 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3602 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3598 | if parmObj: |
|
3603 | if parmObj: | |
3599 | value = parmObj.getValue() |
|
3604 | value = parmObj.getValue() | |
3600 | self.specGgraphftpratio.setText(str(value)) |
|
3605 | self.specGgraphftpratio.setText(str(value)) | |
3601 |
|
3606 | |||
3602 | opObj = puObj.getOperationObj(name='Noise') |
|
3607 | opObj = puObj.getOperationObj(name='Noise') | |
3603 |
|
3608 | |||
3604 | if opObj == None: |
|
3609 | if opObj == None: | |
3605 | self.specGraphCebRTInoise.setCheckState(0) |
|
3610 | self.specGraphCebRTInoise.setCheckState(0) | |
3606 | self.specGraphSaveRTInoise.setCheckState(0) |
|
3611 | self.specGraphSaveRTInoise.setCheckState(0) | |
3607 | self.specGraphftpRTInoise.setCheckState(0) |
|
3612 | self.specGraphftpRTInoise.setCheckState(0) | |
3608 | else: |
|
3613 | else: | |
3609 | self.specGraphCebRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3614 | self.specGraphCebRTInoise.setCheckState(QtCore.Qt.Checked) | |
3610 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3615 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
3611 | if parmObj == None: |
|
3616 | if parmObj == None: | |
3612 | self.specGgraphChannelList.clear() |
|
3617 | self.specGgraphChannelList.clear() | |
3613 | else: |
|
3618 | else: | |
3614 | value = opObj.getParameterValue(parameterName='channelList') |
|
3619 | value = opObj.getParameterValue(parameterName='channelList') | |
3615 | channelListRTINoise = str(value)[1:-1] |
|
3620 | channelListRTINoise = str(value)[1:-1] | |
3616 | self.specGgraphChannelList.setText(channelListRTINoise) |
|
3621 | self.specGgraphChannelList.setText(channelListRTINoise) | |
3617 | self.specGgraphChannelList.setEnabled(True) |
|
3622 | self.specGgraphChannelList.setEnabled(True) | |
3618 |
|
3623 | |||
3619 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3624 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3620 | if parmObj == None: |
|
3625 | if parmObj == None: | |
3621 | self.specGgraphTminTmax.clear() |
|
3626 | self.specGgraphTminTmax.clear() | |
3622 | else: |
|
3627 | else: | |
3623 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3628 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3624 | value1 = str(value1) |
|
3629 | value1 = str(value1) | |
3625 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3630 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3626 | value2 = str(value2) |
|
3631 | value2 = str(value2) | |
3627 | value = value1 + "," + value2 |
|
3632 | value = value1 + "," + value2 | |
3628 | self.specGgraphTminTmax.setText(value) |
|
3633 | self.specGgraphTminTmax.setText(value) | |
3629 | self.specGgraphTminTmax.setEnabled(True) |
|
3634 | self.specGgraphTminTmax.setEnabled(True) | |
3630 |
|
3635 | |||
3631 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3636 | parmObj = opObj.getParameterObj(parameterName='timerange') | |
3632 | if parmObj == None: |
|
3637 | if parmObj == None: | |
3633 | self.specGgraphTimeRange.clear() |
|
3638 | self.specGgraphTimeRange.clear() | |
3634 | else: |
|
3639 | else: | |
3635 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3640 | value1 = opObj.getParameterValue(parameterName='timerange') | |
3636 | value1 = str(value1) |
|
3641 | value1 = str(value1) | |
3637 | self.specGgraphTimeRange.setText(value1) |
|
3642 | self.specGgraphTimeRange.setText(value1) | |
3638 | self.specGgraphTimeRange.setEnabled(True) |
|
3643 | self.specGgraphTimeRange.setEnabled(True) | |
3639 |
|
3644 | |||
3640 |
|
3645 | |||
3641 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3646 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3642 | if parmObj == None: |
|
3647 | if parmObj == None: | |
3643 | self.specGgraphDbsrange.clear() |
|
3648 | self.specGgraphDbsrange.clear() | |
3644 | else: |
|
3649 | else: | |
3645 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3650 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3646 | value1 = str(value1) |
|
3651 | value1 = str(value1) | |
3647 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3652 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3648 | value2 = str(value2) |
|
3653 | value2 = str(value2) | |
3649 | value = value1 + "," + value2 |
|
3654 | value = value1 + "," + value2 | |
3650 | self.specGgraphDbsrange.setText(value) |
|
3655 | self.specGgraphDbsrange.setText(value) | |
3651 | self.specGgraphDbsrange.setEnabled(True) |
|
3656 | self.specGgraphDbsrange.setEnabled(True) | |
3652 |
|
3657 | |||
3653 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3658 | parmObj = opObj.getParameterObj(parameterName="save") | |
3654 | if parmObj == None: |
|
3659 | if parmObj == None: | |
3655 | self.specGraphSaveRTInoise.setCheckState(0) |
|
3660 | self.specGraphSaveRTInoise.setCheckState(0) | |
3656 | else: |
|
3661 | else: | |
3657 | self.specGraphSaveRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3662 | self.specGraphSaveRTInoise.setCheckState(QtCore.Qt.Checked) | |
3658 |
|
3663 | |||
3659 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3664 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3660 | if parmObj == None: |
|
3665 | if parmObj == None: | |
3661 | self.specGraphftpRTInoise.setCheckState(0) |
|
3666 | self.specGraphftpRTInoise.setCheckState(0) | |
3662 | else: |
|
3667 | else: | |
3663 | self.specGraphftpRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3668 | self.specGraphftpRTInoise.setCheckState(QtCore.Qt.Checked) | |
3664 |
|
3669 | |||
3665 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3670 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3666 | if parmObj: |
|
3671 | if parmObj: | |
3667 | value = parmObj.getValue() |
|
3672 | value = parmObj.getValue() | |
3668 | self.specGraphPath.setText(value) |
|
3673 | self.specGraphPath.setText(value) | |
3669 |
|
3674 | |||
3670 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3675 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3671 | if parmObj: |
|
3676 | if parmObj: | |
3672 | value = parmObj.getValue() |
|
3677 | value = parmObj.getValue() | |
3673 | self.specGgraphftpratio.setText(str(value)) |
|
3678 | self.specGgraphftpratio.setText(str(value)) | |
3674 |
|
3679 | |||
3675 | opObj = puObj.getOperationObj(name='SpectraWriter') |
|
3680 | opObj = puObj.getOperationObj(name='SpectraWriter') | |
3676 | if opObj == None: |
|
3681 | if opObj == None: | |
3677 | self.specOutputPath.clear() |
|
3682 | self.specOutputPath.clear() | |
3678 | self.specOutputblocksperfile.clear() |
|
3683 | self.specOutputblocksperfile.clear() | |
3679 | else: |
|
3684 | else: | |
3680 | value = opObj.getParameterObj(parameterName='path') |
|
3685 | value = opObj.getParameterObj(parameterName='path') | |
3681 | if value == None: |
|
3686 | if value == None: | |
3682 | self.specOutputPath.clear() |
|
3687 | self.specOutputPath.clear() | |
3683 | else: |
|
3688 | else: | |
3684 | value = opObj.getParameterValue(parameterName='path') |
|
3689 | value = opObj.getParameterValue(parameterName='path') | |
3685 | path = str(value) |
|
3690 | path = str(value) | |
3686 | self.specOutputPath.setText(path) |
|
3691 | self.specOutputPath.setText(path) | |
3687 | value = opObj.getParameterObj(parameterName='blocksPerFile') |
|
3692 | value = opObj.getParameterObj(parameterName='blocksPerFile') | |
3688 | if value == None: |
|
3693 | if value == None: | |
3689 | self.specOutputblocksperfile.clear() |
|
3694 | self.specOutputblocksperfile.clear() | |
3690 | else: |
|
3695 | else: | |
3691 | value = opObj.getParameterValue(parameterName='blocksPerFile') |
|
3696 | value = opObj.getParameterValue(parameterName='blocksPerFile') | |
3692 | blocksperfile = str(value) |
|
3697 | blocksperfile = str(value) | |
3693 | self.specOutputblocksperfile.setText(blocksperfile) |
|
3698 | self.specOutputblocksperfile.setText(blocksperfile) | |
3694 |
|
3699 | |||
3695 | return |
|
3700 | return | |
3696 |
|
3701 | |||
3697 | def __refreshSpectraHeisWindow(self, puObj): |
|
3702 | def __refreshSpectraHeisWindow(self, puObj): | |
3698 |
|
3703 | |||
3699 | opObj = puObj.getOperationObj(name="IncohInt4SpectraHeis") |
|
3704 | opObj = puObj.getOperationObj(name="IncohInt4SpectraHeis") | |
3700 | if opObj == None: |
|
3705 | if opObj == None: | |
3701 | self.specHeisOpIncoherent.clear() |
|
3706 | self.specHeisOpIncoherent.clear() | |
3702 | self.specHeisOpCebIncoherent.setCheckState(0) |
|
3707 | self.specHeisOpCebIncoherent.setCheckState(0) | |
3703 | else: |
|
3708 | else: | |
3704 | for parmObj in opObj.getParameterObjList(): |
|
3709 | for parmObj in opObj.getParameterObjList(): | |
3705 | if parmObj.name == 'timeInterval': |
|
3710 | if parmObj.name == 'timeInterval': | |
3706 | value = opObj.getParameterValue(parameterName='timeInterval') |
|
3711 | value = opObj.getParameterValue(parameterName='timeInterval') | |
3707 | value = float(value) |
|
3712 | value = float(value) | |
3708 | self.specHeisOpIncoherent.setText(str(value)) |
|
3713 | self.specHeisOpIncoherent.setText(str(value)) | |
3709 | self.specHeisOpIncoherent.setEnabled(True) |
|
3714 | self.specHeisOpIncoherent.setEnabled(True) | |
3710 | self.specHeisOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3715 | self.specHeisOpCebIncoherent.setCheckState(QtCore.Qt.Checked) | |
3711 | self.specHeisOpCobIncInt.setCurrentIndex(0) |
|
3716 | self.specHeisOpCobIncInt.setCurrentIndex(0) | |
3712 |
|
3717 | |||
3713 | # SpectraHeis Graph |
|
3718 | # SpectraHeis Graph | |
3714 |
|
3719 | |||
3715 | self.specHeisGgraphXminXmax.clear() |
|
3720 | self.specHeisGgraphXminXmax.clear() | |
3716 | self.specHeisGgraphYminYmax.clear() |
|
3721 | self.specHeisGgraphYminYmax.clear() | |
3717 |
|
3722 | |||
3718 | self.specHeisGgraphChannelList.clear() |
|
3723 | self.specHeisGgraphChannelList.clear() | |
3719 | self.specHeisGgraphTminTmax.clear() |
|
3724 | self.specHeisGgraphTminTmax.clear() | |
3720 | self.specHeisGgraphTimeRange.clear() |
|
3725 | self.specHeisGgraphTimeRange.clear() | |
3721 | self.specHeisGgraphftpratio.clear() |
|
3726 | self.specHeisGgraphftpratio.clear() | |
3722 |
|
3727 | |||
3723 | opObj = puObj.getOperationObj(name='SpectraHeisScope') |
|
3728 | opObj = puObj.getOperationObj(name='SpectraHeisScope') | |
3724 | if opObj == None: |
|
3729 | if opObj == None: | |
3725 | self.specHeisGraphCebSpectraplot.setCheckState(0) |
|
3730 | self.specHeisGraphCebSpectraplot.setCheckState(0) | |
3726 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
3731 | self.specHeisGraphSaveSpectra.setCheckState(0) | |
3727 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
3732 | self.specHeisGraphftpSpectra.setCheckState(0) | |
3728 | else: |
|
3733 | else: | |
3729 | operationSpectraHeisScope = "Enable" |
|
3734 | operationSpectraHeisScope = "Enable" | |
3730 | self.specHeisGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3735 | self.specHeisGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) | |
3731 |
|
3736 | |||
3732 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3737 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
3733 | if parmObj == None: |
|
3738 | if parmObj == None: | |
3734 | self.specHeisGgraphChannelList.clear() |
|
3739 | self.specHeisGgraphChannelList.clear() | |
3735 | else: |
|
3740 | else: | |
3736 | value = opObj.getParameterValue(parameterName='channelList') |
|
3741 | value = opObj.getParameterValue(parameterName='channelList') | |
3737 | channelListSpectraHeisScope = str(value)[1:-1] |
|
3742 | channelListSpectraHeisScope = str(value)[1:-1] | |
3738 | self.specHeisGgraphChannelList.setText(channelListSpectraHeisScope) |
|
3743 | self.specHeisGgraphChannelList.setText(channelListSpectraHeisScope) | |
3739 | self.specHeisGgraphChannelList.setEnabled(True) |
|
3744 | self.specHeisGgraphChannelList.setEnabled(True) | |
3740 |
|
3745 | |||
3741 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3746 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3742 | if parmObj == None: |
|
3747 | if parmObj == None: | |
3743 | self.specHeisGgraphXminXmax.clear() |
|
3748 | self.specHeisGgraphXminXmax.clear() | |
3744 | else: |
|
3749 | else: | |
3745 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3750 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3746 | value1 = str(value1) |
|
3751 | value1 = str(value1) | |
3747 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3752 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3748 | value2 = str(value2) |
|
3753 | value2 = str(value2) | |
3749 | value = value1 + "," + value2 |
|
3754 | value = value1 + "," + value2 | |
3750 | self.specHeisGgraphXminXmax.setText(value) |
|
3755 | self.specHeisGgraphXminXmax.setText(value) | |
3751 | self.specHeisGgraphXminXmax.setEnabled(True) |
|
3756 | self.specHeisGgraphXminXmax.setEnabled(True) | |
3752 |
|
3757 | |||
3753 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3758 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3754 | if parmObj == None: |
|
3759 | if parmObj == None: | |
3755 | self.specHeisGgraphYminYmax.clear() |
|
3760 | self.specHeisGgraphYminYmax.clear() | |
3756 | else: |
|
3761 | else: | |
3757 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3762 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3758 | value1 = str(value1) |
|
3763 | value1 = str(value1) | |
3759 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3764 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3760 | value2 = str(value2) |
|
3765 | value2 = str(value2) | |
3761 | value = value1 + "," + value2 |
|
3766 | value = value1 + "," + value2 | |
3762 | self.specHeisGgraphYminYmax.setText(value) |
|
3767 | self.specHeisGgraphYminYmax.setText(value) | |
3763 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
3768 | self.specHeisGgraphYminYmax.setEnabled(True) | |
3764 |
|
3769 | |||
3765 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3770 | parmObj = opObj.getParameterObj(parameterName="save") | |
3766 | if parmObj == None: |
|
3771 | if parmObj == None: | |
3767 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
3772 | self.specHeisGraphSaveSpectra.setCheckState(0) | |
3768 | else: |
|
3773 | else: | |
3769 | self.specHeisGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) |
|
3774 | self.specHeisGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) | |
3770 |
|
3775 | |||
3771 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3776 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3772 | if parmObj == None: |
|
3777 | if parmObj == None: | |
3773 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
3778 | self.specHeisGraphftpSpectra.setCheckState(0) | |
3774 | else: |
|
3779 | else: | |
3775 | self.specHeisGraphftpSpectra.setCheckState(QtCore.Qt.Checked) |
|
3780 | self.specHeisGraphftpSpectra.setCheckState(QtCore.Qt.Checked) | |
3776 |
|
3781 | |||
3777 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3782 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3778 | if parmObj: |
|
3783 | if parmObj: | |
3779 | value = parmObj.getValue() |
|
3784 | value = parmObj.getValue() | |
3780 | self.specHeisGraphPath.setText(value) |
|
3785 | self.specHeisGraphPath.setText(value) | |
3781 |
|
3786 | |||
3782 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3787 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3783 | if parmObj: |
|
3788 | if parmObj: | |
3784 | value = parmObj.getValue() |
|
3789 | value = parmObj.getValue() | |
3785 | self.specHeisGgraphftpratio.setText(str(value)) |
|
3790 | self.specHeisGgraphftpratio.setText(str(value)) | |
3786 |
|
3791 | |||
3787 | opObj = puObj.getOperationObj(name='RTIfromSpectraHeis') |
|
3792 | opObj = puObj.getOperationObj(name='RTIfromSpectraHeis') | |
3788 |
|
3793 | |||
3789 | if opObj == None: |
|
3794 | if opObj == None: | |
3790 | self.specHeisGraphCebRTIplot.setCheckState(0) |
|
3795 | self.specHeisGraphCebRTIplot.setCheckState(0) | |
3791 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
3796 | self.specHeisGraphSaveRTIplot.setCheckState(0) | |
3792 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
3797 | self.specHeisGraphftpRTIplot.setCheckState(0) | |
3793 | else: |
|
3798 | else: | |
3794 | self.specHeisGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3799 | self.specHeisGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) | |
3795 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3800 | parmObj = opObj.getParameterObj(parameterName='channelList') | |
3796 | if parmObj == None: |
|
3801 | if parmObj == None: | |
3797 | self.specHeisGgraphChannelList.clear() |
|
3802 | self.specHeisGgraphChannelList.clear() | |
3798 | else: |
|
3803 | else: | |
3799 | value = opObj.getParameterValue(parameterName='channelList') |
|
3804 | value = opObj.getParameterValue(parameterName='channelList') | |
3800 | channelListRTIPlot = str(value)[1:-1] |
|
3805 | channelListRTIPlot = str(value)[1:-1] | |
3801 | self.specGgraphChannelList.setText(channelListRTIPlot) |
|
3806 | self.specGgraphChannelList.setText(channelListRTIPlot) | |
3802 | self.specGgraphChannelList.setEnabled(True) |
|
3807 | self.specGgraphChannelList.setEnabled(True) | |
3803 |
|
3808 | |||
3804 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3809 | parmObj = opObj.getParameterObj(parameterName='xmin') | |
3805 | if parmObj == None: |
|
3810 | if parmObj == None: | |
3806 | self.specHeisGgraphTminTmax.clear() |
|
3811 | self.specHeisGgraphTminTmax.clear() | |
3807 | else: |
|
3812 | else: | |
3808 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3813 | value1 = opObj.getParameterValue(parameterName='xmin') | |
3809 | value1 = str(value1) |
|
3814 | value1 = str(value1) | |
3810 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3815 | value2 = opObj.getParameterValue(parameterName='xmax') | |
3811 | value2 = str(value2) |
|
3816 | value2 = str(value2) | |
3812 | value = value1 + "," + value2 |
|
3817 | value = value1 + "," + value2 | |
3813 | self.specHeisGgraphTminTmax.setText(value) |
|
3818 | self.specHeisGgraphTminTmax.setText(value) | |
3814 | self.specHeisGgraphTminTmax.setEnabled(True) |
|
3819 | self.specHeisGgraphTminTmax.setEnabled(True) | |
3815 |
|
3820 | |||
3816 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3821 | parmObj = opObj.getParameterObj(parameterName='timerange') | |
3817 | if parmObj == None: |
|
3822 | if parmObj == None: | |
3818 | self.specGgraphTimeRange.clear() |
|
3823 | self.specGgraphTimeRange.clear() | |
3819 | else: |
|
3824 | else: | |
3820 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3825 | value1 = opObj.getParameterValue(parameterName='timerange') | |
3821 | value1 = str(value1) |
|
3826 | value1 = str(value1) | |
3822 | self.specHeisGgraphTimeRange.setText(value1) |
|
3827 | self.specHeisGgraphTimeRange.setText(value1) | |
3823 | self.specHeisGgraphTimeRange.setEnabled(True) |
|
3828 | self.specHeisGgraphTimeRange.setEnabled(True) | |
3824 |
|
3829 | |||
3825 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3830 | parmObj = opObj.getParameterObj(parameterName='ymin') | |
3826 | if parmObj == None: |
|
3831 | if parmObj == None: | |
3827 | self.specHeisGgraphYminYmax.clear() |
|
3832 | self.specHeisGgraphYminYmax.clear() | |
3828 | else: |
|
3833 | else: | |
3829 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3834 | value1 = opObj.getParameterValue(parameterName='ymin') | |
3830 | value1 = str(value1) |
|
3835 | value1 = str(value1) | |
3831 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3836 | value2 = opObj.getParameterValue(parameterName='ymax') | |
3832 | value2 = str(value2) |
|
3837 | value2 = str(value2) | |
3833 | value = value1 + "," + value2 |
|
3838 | value = value1 + "," + value2 | |
3834 | self.specHeisGgraphYminYmax.setText(value) |
|
3839 | self.specHeisGgraphYminYmax.setText(value) | |
3835 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
3840 | self.specHeisGgraphYminYmax.setEnabled(True) | |
3836 |
|
3841 | |||
3837 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3842 | parmObj = opObj.getParameterObj(parameterName="save") | |
3838 | if parmObj == None: |
|
3843 | if parmObj == None: | |
3839 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
3844 | self.specHeisGraphSaveRTIplot.setCheckState(0) | |
3840 | else: |
|
3845 | else: | |
3841 | self.specHeisGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3846 | self.specHeisGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) | |
3842 |
|
3847 | |||
3843 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3848 | parmObj = opObj.getParameterObj(parameterName="ftp") | |
3844 | if parmObj == None: |
|
3849 | if parmObj == None: | |
3845 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
3850 | self.specHeisGraphftpRTIplot.setCheckState(0) | |
3846 | else: |
|
3851 | else: | |
3847 | self.specHeisGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3852 | self.specHeisGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) | |
3848 |
|
3853 | |||
3849 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3854 | parmObj = opObj.getParameterObj(parameterName="figpath") | |
3850 | if parmObj: |
|
3855 | if parmObj: | |
3851 | value = parmObj.getValue() |
|
3856 | value = parmObj.getValue() | |
3852 | self.specHeisGraphPath.setText(value) |
|
3857 | self.specHeisGraphPath.setText(value) | |
3853 |
|
3858 | |||
3854 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3859 | parmObj = opObj.getParameterObj(parameterName="wr_period") | |
3855 | if parmObj: |
|
3860 | if parmObj: | |
3856 | value = parmObj.getValue() |
|
3861 | value = parmObj.getValue() | |
3857 | self.specHeisGgraphftpratio.setText(str(value)) |
|
3862 | self.specHeisGgraphftpratio.setText(str(value)) | |
3858 |
|
3863 | |||
3859 | # outputSpectraHeisWrite |
|
3864 | # outputSpectraHeisWrite | |
3860 | opObj = puObj.getOperationObj(name='FitsWriter') |
|
3865 | opObj = puObj.getOperationObj(name='FitsWriter') | |
3861 | if opObj == None: |
|
3866 | if opObj == None: | |
3862 | self.specHeisOutputPath.clear() |
|
3867 | self.specHeisOutputPath.clear() | |
3863 | self.specHeisOutputblocksperfile.clear() |
|
3868 | self.specHeisOutputblocksperfile.clear() | |
3864 | self.specHeisOutputMetada.clear() |
|
3869 | self.specHeisOutputMetada.clear() | |
3865 | else: |
|
3870 | else: | |
3866 | value = opObj.getParameterObj(parameterName='path') |
|
3871 | value = opObj.getParameterObj(parameterName='path') | |
3867 | if value == None: |
|
3872 | if value == None: | |
3868 | self.specHeisOutputPath.clear() |
|
3873 | self.specHeisOutputPath.clear() | |
3869 | else: |
|
3874 | else: | |
3870 | value = opObj.getParameterValue(parameterName='path') |
|
3875 | value = opObj.getParameterValue(parameterName='path') | |
3871 | path = str(value) |
|
3876 | path = str(value) | |
3872 | self.specHeisOutputPath.setText(path) |
|
3877 | self.specHeisOutputPath.setText(path) | |
3873 | value = opObj.getParameterObj(parameterName='dataBlocksPerFile') |
|
3878 | value = opObj.getParameterObj(parameterName='dataBlocksPerFile') | |
3874 | if value == None: |
|
3879 | if value == None: | |
3875 | self.specHeisOutputblocksperfile.clear() |
|
3880 | self.specHeisOutputblocksperfile.clear() | |
3876 | else: |
|
3881 | else: | |
3877 | value = opObj.getParameterValue(parameterName='dataBlocksPerFile') |
|
3882 | value = opObj.getParameterValue(parameterName='dataBlocksPerFile') | |
3878 | blocksperfile = str(value) |
|
3883 | blocksperfile = str(value) | |
3879 | self.specHeisOutputblocksperfile.setText(blocksperfile) |
|
3884 | self.specHeisOutputblocksperfile.setText(blocksperfile) | |
3880 | value = opObj.getParameterObj(parameterName='metadatafile') |
|
3885 | value = opObj.getParameterObj(parameterName='metadatafile') | |
3881 | if value == None: |
|
3886 | if value == None: | |
3882 | self.specHeisOutputMetada.clear() |
|
3887 | self.specHeisOutputMetada.clear() | |
3883 | else: |
|
3888 | else: | |
3884 | value = opObj.getParameterValue(parameterName='metadatafile') |
|
3889 | value = opObj.getParameterValue(parameterName='metadatafile') | |
3885 | metada = str(value) |
|
3890 | metadata_file = str(value) | |
3886 | self.specHeisOutputMetada.setText(metada) |
|
3891 | self.specHeisOutputMetada.setText(metadata_file) | |
3887 |
|
3892 | |||
3888 | return |
|
3893 | return | |
3889 |
|
3894 | |||
3890 | def __refreshCorrelationWindow(self, puObj): |
|
3895 | def __refreshCorrelationWindow(self, puObj): | |
3891 | pass |
|
3896 | pass | |
3892 |
|
3897 | |||
3893 | def refreshPUWindow(self, puObj): |
|
3898 | def refreshPUWindow(self, puObj): | |
3894 |
|
3899 | |||
3895 | if puObj.datatype == 'Voltage': |
|
3900 | if puObj.datatype == 'Voltage': | |
3896 | self.__refreshVoltageWindow(puObj) |
|
3901 | self.__refreshVoltageWindow(puObj) | |
3897 |
|
3902 | |||
3898 | if puObj.datatype == 'Spectra': |
|
3903 | if puObj.datatype == 'Spectra': | |
3899 | self.__refreshSpectraWindow(puObj) |
|
3904 | self.__refreshSpectraWindow(puObj) | |
3900 |
|
3905 | |||
3901 | if puObj.datatype == 'SpectraHeis': |
|
3906 | if puObj.datatype == 'SpectraHeis': | |
3902 | self.__refreshSpectraHeisWindow(puObj) |
|
3907 | self.__refreshSpectraHeisWindow(puObj) | |
3903 |
|
3908 | |||
3904 | def refreshProjectProperties(self, projectObjView): |
|
3909 | def refreshProjectProperties(self, projectObjView): | |
3905 |
|
3910 | |||
3906 | propertyBuffObj = PropertyBuffer() |
|
3911 | propertyBuffObj = PropertyBuffer() | |
3907 | name = projectObjView.name |
|
3912 | name = projectObjView.name | |
3908 |
|
3913 | |||
3909 | propertyBuffObj.append("Properties", "Name", projectObjView.name), |
|
3914 | propertyBuffObj.append("Properties", "Name", projectObjView.name), | |
3910 | propertyBuffObj.append("Properties", "Description", projectObjView.description) |
|
3915 | propertyBuffObj.append("Properties", "Description", projectObjView.description) | |
3911 | propertyBuffObj.append("Properties", "Workspace", self.pathWorkSpace) |
|
3916 | propertyBuffObj.append("Properties", "Workspace", self.pathWorkSpace) | |
3912 |
|
3917 | |||
3913 | readUnitObj = projectObjView.getReadUnitObj() |
|
3918 | readUnitObj = projectObjView.getReadUnitObj() | |
3914 | runOperationObj = readUnitObj.getOperationObj(name='run') |
|
3919 | runOperationObj = readUnitObj.getOperationObj(name='run') | |
3915 |
|
3920 | |||
3916 | for thisParmObj in runOperationObj.getParameterObjList(): |
|
3921 | for thisParmObj in runOperationObj.getParameterObjList(): | |
3917 | propertyBuffObj.append("Reading parms", thisParmObj.name, str(thisParmObj.getValue())) |
|
3922 | propertyBuffObj.append("Reading parms", thisParmObj.name, str(thisParmObj.getValue())) | |
3918 |
|
3923 | |||
3919 | propertiesModel = propertyBuffObj.getPropertyModel() |
|
3924 | propertiesModel = propertyBuffObj.getPropertyModel() | |
3920 |
|
3925 | |||
3921 | self.treeProjectProperties.setModel(propertiesModel) |
|
3926 | self.treeProjectProperties.setModel(propertiesModel) | |
3922 | self.treeProjectProperties.expandAll() |
|
3927 | self.treeProjectProperties.expandAll() | |
3923 | self.treeProjectProperties.resizeColumnToContents(0) |
|
3928 | self.treeProjectProperties.resizeColumnToContents(0) | |
3924 | self.treeProjectProperties.resizeColumnToContents(1) |
|
3929 | self.treeProjectProperties.resizeColumnToContents(1) | |
3925 |
|
3930 | |||
3926 | def refreshPUProperties(self, puObjView): |
|
3931 | def refreshPUProperties(self, puObjView): | |
3927 |
|
3932 | |||
3928 | ############ FTP CONFIG ################################ |
|
3933 | ############ FTP CONFIG ################################ | |
3929 | #Deleting FTP Conf. This processing unit have not got any |
|
3934 | #Deleting FTP Conf. This processing unit have not got any | |
3930 | #FTP configuration by default |
|
3935 | #FTP configuration by default | |
3931 | if puObjView.id in self.__puLocalFolder2FTP.keys(): |
|
3936 | if puObjView.id in self.__puLocalFolder2FTP.keys(): | |
3932 | self.__puLocalFolder2FTP.pop(puObjView.id) |
|
3937 | self.__puLocalFolder2FTP.pop(puObjView.id) | |
3933 | ######################################################## |
|
3938 | ######################################################## | |
3934 |
|
3939 | |||
3935 | propertyBuffObj = PropertyBuffer() |
|
3940 | propertyBuffObj = PropertyBuffer() | |
3936 |
|
3941 | |||
3937 | for thisOp in puObjView.getOperationObjList(): |
|
3942 | for thisOp in puObjView.getOperationObjList(): | |
3938 |
|
3943 | |||
3939 | operationName = thisOp.name |
|
3944 | operationName = thisOp.name | |
3940 |
|
3945 | |||
3941 | if operationName == 'run': |
|
3946 | if operationName == 'run': | |
3942 | operationName = 'Properties' |
|
3947 | operationName = 'Properties' | |
3943 |
|
3948 | |||
3944 | else: |
|
3949 | else: | |
3945 | if not thisOp.getParameterObjList(): |
|
3950 | if not thisOp.getParameterObjList(): | |
3946 | propertyBuffObj.append(operationName, '--', '--') |
|
3951 | propertyBuffObj.append(operationName, '--', '--') | |
3947 | continue |
|
3952 | continue | |
3948 |
|
3953 | |||
3949 | for thisParmObj in thisOp.getParameterObjList(): |
|
3954 | for thisParmObj in thisOp.getParameterObjList(): | |
3950 | propertyBuffObj.append(operationName, thisParmObj.name, str(thisParmObj.getValue())) |
|
3955 | propertyBuffObj.append(operationName, thisParmObj.name, str(thisParmObj.getValue())) | |
3951 |
|
3956 | |||
3952 | ############ FTP CONFIG ################################ |
|
3957 | ############ FTP CONFIG ################################ | |
3953 | if thisParmObj.name == "ftp_wei" and thisParmObj.getValue(): |
|
3958 | if thisParmObj.name == "ftp_wei" and thisParmObj.getValue(): | |
3954 | value = thisParmObj.getValue() |
|
3959 | value = thisParmObj.getValue() | |
3955 | self.temporalFTP.ftp_wei = value |
|
3960 | self.temporalFTP.ftp_wei = value | |
3956 |
|
3961 | |||
3957 | if thisParmObj.name == "exp_code" and thisParmObj.getValue(): |
|
3962 | if thisParmObj.name == "exp_code" and thisParmObj.getValue(): | |
3958 | value = thisParmObj.getValue() |
|
3963 | value = thisParmObj.getValue() | |
3959 | self.temporalFTP.exp_code = value |
|
3964 | self.temporalFTP.exp_code = value | |
3960 |
|
3965 | |||
3961 | if thisParmObj.name == "sub_exp_code" and thisParmObj.getValue(): |
|
3966 | if thisParmObj.name == "sub_exp_code" and thisParmObj.getValue(): | |
3962 | value = thisParmObj.getValue() |
|
3967 | value = thisParmObj.getValue() | |
3963 | self.temporalFTP.sub_exp_code = value |
|
3968 | self.temporalFTP.sub_exp_code = value | |
3964 |
|
3969 | |||
3965 | if thisParmObj.name == "plot_pos" and thisParmObj.getValue(): |
|
3970 | if thisParmObj.name == "plot_pos" and thisParmObj.getValue(): | |
3966 | value = thisParmObj.getValue() |
|
3971 | value = thisParmObj.getValue() | |
3967 | self.temporalFTP.plot_pos = value |
|
3972 | self.temporalFTP.plot_pos = value | |
3968 |
|
3973 | |||
3969 | if thisParmObj.name == 'ftp' and thisParmObj.getValue(): |
|
3974 | if thisParmObj.name == 'ftp' and thisParmObj.getValue(): | |
3970 | figpathObj = thisOp.getParameterObj('figpath') |
|
3975 | figpathObj = thisOp.getParameterObj('figpath') | |
3971 | if figpathObj: |
|
3976 | if figpathObj: | |
3972 | self.__puLocalFolder2FTP[puObjView.id] = figpathObj.getValue() |
|
3977 | self.__puLocalFolder2FTP[puObjView.id] = figpathObj.getValue() | |
3973 |
|
3978 | |||
3974 | ######################################################## |
|
3979 | ######################################################## | |
3975 |
|
3980 | |||
3976 | propertiesModel = propertyBuffObj.getPropertyModel() |
|
3981 | propertiesModel = propertyBuffObj.getPropertyModel() | |
3977 |
|
3982 | |||
3978 | self.treeProjectProperties.setModel(propertiesModel) |
|
3983 | self.treeProjectProperties.setModel(propertiesModel) | |
3979 | self.treeProjectProperties.expandAll() |
|
3984 | self.treeProjectProperties.expandAll() | |
3980 | self.treeProjectProperties.resizeColumnToContents(0) |
|
3985 | self.treeProjectProperties.resizeColumnToContents(0) | |
3981 | self.treeProjectProperties.resizeColumnToContents(1) |
|
3986 | self.treeProjectProperties.resizeColumnToContents(1) | |
3982 |
|
3987 | |||
3983 | def refreshGraphicsId(self): |
|
3988 | def refreshGraphicsId(self): | |
3984 |
|
3989 | |||
3985 | projectObj = self.getSelectedProjectObj() |
|
3990 | projectObj = self.getSelectedProjectObj() | |
3986 |
|
3991 | |||
3987 | if not projectObj: |
|
3992 | if not projectObj: | |
3988 | return |
|
3993 | return | |
3989 |
|
3994 | |||
3990 | for idPU, puObj in projectObj.procUnitConfObjDict.items(): |
|
3995 | for idPU, puObj in projectObj.procUnitConfObjDict.items(): | |
3991 |
|
3996 | |||
3992 | for opObj in puObj.getOperationObjList(): |
|
3997 | for opObj in puObj.getOperationObjList(): | |
3993 |
|
3998 | |||
3994 | if opObj.name not in ('Scope', 'SpectraPlot', 'CrossSpectraPlot', 'RTIPlot', 'CoherenceMap', 'PowerProfilePlot', 'Noise', 'SpectraHeisScope', 'RTIfromSpectraHeis'): |
|
3999 | if opObj.name not in ('Scope', 'SpectraPlot', 'CrossSpectraPlot', 'RTIPlot', 'CoherenceMap', 'PowerProfilePlot', 'Noise', 'SpectraHeisScope', 'RTIfromSpectraHeis'): | |
3995 | continue |
|
4000 | continue | |
3996 |
|
4001 | |||
3997 | opObj.changeParameter(name='id', value=opObj.id, format='int') |
|
4002 | opObj.changeParameter(name='id', value=opObj.id, format='int') | |
3998 |
|
4003 | |||
3999 | def on_click(self, index): |
|
4004 | def on_click(self, index): | |
4000 |
|
4005 | |||
4001 | self.selectedItemTree = self.projectExplorerModel.itemFromIndex(index) |
|
4006 | self.selectedItemTree = self.projectExplorerModel.itemFromIndex(index) | |
4002 |
|
4007 | |||
4003 | projectObjView = self.getSelectedProjectObj() |
|
4008 | projectObjView = self.getSelectedProjectObj() | |
4004 |
|
4009 | |||
4005 | if not projectObjView: |
|
4010 | if not projectObjView: | |
4006 | return |
|
4011 | return | |
4007 |
|
4012 | |||
4008 | self.create = False |
|
4013 | self.create = False | |
4009 | selectedObjView = self.getSelectedItemObj() |
|
4014 | selectedObjView = self.getSelectedItemObj() | |
4010 |
|
4015 | |||
4011 | #A project has been selected |
|
4016 | #A project has been selected | |
4012 | if projectObjView == selectedObjView: |
|
4017 | if projectObjView == selectedObjView: | |
4013 |
|
4018 | |||
4014 | self.refreshProjectWindow(projectObjView) |
|
4019 | self.refreshProjectWindow(projectObjView) | |
4015 | self.refreshProjectProperties(projectObjView) |
|
4020 | self.refreshProjectProperties(projectObjView) | |
4016 |
|
4021 | |||
4017 | self.tabProject.setEnabled(True) |
|
4022 | self.tabProject.setEnabled(True) | |
4018 | self.tabVoltage.setEnabled(False) |
|
4023 | self.tabVoltage.setEnabled(False) | |
4019 | self.tabSpectra.setEnabled(False) |
|
4024 | self.tabSpectra.setEnabled(False) | |
4020 | self.tabCorrelation.setEnabled(False) |
|
4025 | self.tabCorrelation.setEnabled(False) | |
4021 | self.tabSpectraHeis.setEnabled(False) |
|
4026 | self.tabSpectraHeis.setEnabled(False) | |
4022 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
4027 | self.tabWidgetProject.setCurrentWidget(self.tabProject) | |
4023 |
|
4028 | |||
4024 | return |
|
4029 | return | |
4025 |
|
4030 | |||
4026 | #A processing unit has been selected |
|
4031 | #A processing unit has been selected | |
4027 | voltEnable = False |
|
4032 | voltEnable = False | |
4028 | specEnable = False |
|
4033 | specEnable = False | |
4029 | corrEnable = False |
|
4034 | corrEnable = False | |
4030 | specHeisEnable = False |
|
4035 | specHeisEnable = False | |
4031 | tabSelected = self.tabProject |
|
4036 | tabSelected = self.tabProject | |
4032 |
|
4037 | |||
4033 | puObj = selectedObjView |
|
4038 | puObj = selectedObjView | |
4034 |
|
4039 | |||
4035 | self.refreshPUWindow(puObj) |
|
4040 | self.refreshPUWindow(puObj) | |
4036 | self.refreshPUProperties(puObj) |
|
4041 | self.refreshPUProperties(puObj) | |
4037 | self.showtabPUCreated(puObj.datatype) |
|
4042 | self.showtabPUCreated(puObj.datatype) | |
4038 |
|
4043 | |||
4039 | def on_right_click(self, pos): |
|
4044 | def on_right_click(self, pos): | |
4040 |
|
4045 | |||
4041 | self.menu = QtGui.QMenu() |
|
4046 | self.menu = QtGui.QMenu() | |
4042 | quitAction0 = self.menu.addAction("Create a New Project") |
|
4047 | quitAction0 = self.menu.addAction("Create a New Project") | |
4043 | quitAction1 = self.menu.addAction("Create a New Processing Unit") |
|
4048 | quitAction1 = self.menu.addAction("Create a New Processing Unit") | |
4044 | quitAction2 = self.menu.addAction("Delete Item") |
|
4049 | quitAction2 = self.menu.addAction("Delete Item") | |
4045 | quitAction3 = self.menu.addAction("Quit") |
|
4050 | quitAction3 = self.menu.addAction("Quit") | |
4046 |
|
4051 | |||
4047 | if len(self.__itemTreeDict) == 0: |
|
4052 | if len(self.__itemTreeDict) == 0: | |
4048 | quitAction2.setEnabled(False) |
|
4053 | quitAction2.setEnabled(False) | |
4049 | else: |
|
4054 | else: | |
4050 | quitAction2.setEnabled(True) |
|
4055 | quitAction2.setEnabled(True) | |
4051 |
|
4056 | |||
4052 | action = self.menu.exec_(self.mapToGlobal(pos)) |
|
4057 | action = self.menu.exec_(self.mapToGlobal(pos)) | |
4053 |
|
4058 | |||
4054 | if action == quitAction0: |
|
4059 | if action == quitAction0: | |
4055 | self. setInputsProject_View() |
|
4060 | self. setInputsProject_View() | |
4056 | self.create = True |
|
4061 | self.create = True | |
4057 |
|
4062 | |||
4058 | if action == quitAction1: |
|
4063 | if action == quitAction1: | |
4059 | if len(self.__projectObjDict) == 0: |
|
4064 | if len(self.__projectObjDict) == 0: | |
4060 | outputstr = "You need to create a Project before adding a Processing Unit" |
|
4065 | outputstr = "You need to create a Project before adding a Processing Unit" | |
4061 | self.console.clear() |
|
4066 | self.console.clear() | |
4062 | self.console.append(outputstr) |
|
4067 | self.console.append(outputstr) | |
4063 | return 0 |
|
4068 | return 0 | |
4064 | else: |
|
4069 | else: | |
4065 | self.addPUWindow() |
|
4070 | self.addPUWindow() | |
4066 | self.console.clear() |
|
4071 | self.console.clear() | |
4067 | self.console.append("Please, Choose the type of Processing Unit") |
|
4072 | self.console.append("Please, Choose the type of Processing Unit") | |
4068 | # self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") |
|
4073 | # self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") | |
4069 | # self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") |
|
4074 | # self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") | |
4070 | # self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") |
|
4075 | # self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") | |
4071 |
|
4076 | |||
4072 | if action == quitAction2: |
|
4077 | if action == quitAction2: | |
4073 | index = self.selectedItemTree |
|
4078 | index = self.selectedItemTree | |
4074 | try: |
|
4079 | try: | |
4075 | index.parent() |
|
4080 | index.parent() | |
4076 | except: |
|
4081 | except: | |
4077 | self.console.append('Please first select a Project or Processing Unit') |
|
4082 | self.console.append('Please first select a Project or Processing Unit') | |
4078 | return 0 |
|
4083 | return 0 | |
4079 | # print index.parent(),index |
|
4084 | # print index.parent(),index | |
4080 | if index.parent() == None: |
|
4085 | if index.parent() == None: | |
4081 | self.projectExplorerModel.removeRow(index.row()) |
|
4086 | self.projectExplorerModel.removeRow(index.row()) | |
4082 | else: |
|
4087 | else: | |
4083 | index.parent().removeRow(index.row()) |
|
4088 | index.parent().removeRow(index.row()) | |
4084 | self.removeItemTreeFromProject() |
|
4089 | self.removeItemTreeFromProject() | |
4085 | self.console.clear() |
|
4090 | self.console.clear() | |
4086 | # for i in self.projectExplorerTree.selectionModel().selection().indexes(): |
|
4091 | # for i in self.projectExplorerTree.selectionModel().selection().indexes(): | |
4087 | # print i.row() |
|
4092 | # print i.row() | |
4088 |
|
4093 | |||
4089 | if action == quitAction3: |
|
4094 | if action == quitAction3: | |
4090 | self.close() |
|
4095 | self.close() | |
4091 | return 0 |
|
4096 | return 0 | |
4092 |
|
4097 | |||
4093 | def createProjectView(self, id): |
|
4098 | def createProjectView(self, id): | |
4094 |
|
4099 | |||
4095 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
4100 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() | |
4096 | id = str(id) |
|
4101 | id = str(id) | |
4097 | projectParms = self.__getParmsFromProjectWindow() |
|
4102 | projectParms = self.__getParmsFromProjectWindow() | |
4098 |
|
4103 | |||
4099 | if not projectParms.isValid(): |
|
4104 | if not projectParms.isValid(): | |
4100 | return None |
|
4105 | return None | |
4101 |
|
4106 | |||
4102 | projectObjView = Project() |
|
4107 | projectObjView = Project() | |
4103 | projectObjView.setup(id=id, name=projectParms.name, description=projectParms.description) |
|
4108 | projectObjView.setup(id=id, name=projectParms.name, description=projectParms.description) | |
4104 |
|
4109 | |||
4105 | self.__projectObjDict[id] = projectObjView |
|
4110 | self.__projectObjDict[id] = projectObjView | |
4106 | self.addProject2ProjectExplorer(id=id, name=projectObjView.name) |
|
4111 | self.addProject2ProjectExplorer(id=id, name=projectObjView.name) | |
4107 |
|
4112 | |||
4108 | return projectObjView |
|
4113 | return projectObjView | |
4109 |
|
4114 | |||
4110 | def updateProjectView(self): |
|
4115 | def updateProjectView(self): | |
4111 |
|
4116 | |||
4112 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
4117 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() | |
4113 |
|
4118 | |||
4114 | projectParms = self.__getParmsFromProjectWindow() |
|
4119 | projectParms = self.__getParmsFromProjectWindow() | |
4115 |
|
4120 | |||
4116 | if not projectParms.isValid(): |
|
4121 | if not projectParms.isValid(): | |
4117 | return None |
|
4122 | return None | |
4118 |
|
4123 | |||
4119 | projectObjView = self.getSelectedProjectObj() |
|
4124 | projectObjView = self.getSelectedProjectObj() | |
4120 |
|
4125 | |||
4121 | if not projectObjView: |
|
4126 | if not projectObjView: | |
4122 | self.console.append("Please select a project before update it") |
|
4127 | self.console.append("Please select a project before update it") | |
4123 | return None |
|
4128 | return None | |
4124 |
|
4129 | |||
4125 | projectObjView.update(name=projectParms.name, description=projectParms.description) |
|
4130 | projectObjView.update(name=projectParms.name, description=projectParms.description) | |
4126 |
|
4131 | |||
4127 | return projectObjView |
|
4132 | return projectObjView | |
4128 |
|
4133 | |||
4129 | def createReadUnitView(self, projectObjView): |
|
4134 | def createReadUnitView(self, projectObjView): | |
4130 |
|
4135 | |||
4131 | # project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
4136 | # project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() | |
4132 |
|
4137 | |||
4133 | projectParms = self.__getParmsFromProjectWindow() |
|
4138 | projectParms = self.__getParmsFromProjectWindow() | |
4134 |
|
4139 | |||
4135 | if not projectParms.isValid(): |
|
4140 | if not projectParms.isValid(): | |
4136 | return None |
|
4141 | return None | |
4137 |
|
4142 | |||
4138 | if projectParms.datatype in ("Voltage", "Spectra", "Fits"): |
|
4143 | if projectParms.datatype in ("Voltage", "Spectra", "Fits"): | |
4139 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, |
|
4144 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, | |
4140 | path=projectParms.dpath, |
|
4145 | path=projectParms.dpath, | |
4141 | startDate=projectParms.startDate, |
|
4146 | startDate=projectParms.startDate, | |
4142 | endDate=projectParms.endDate, |
|
4147 | endDate=projectParms.endDate, | |
4143 | startTime=projectParms.startTime, |
|
4148 | startTime=projectParms.startTime, | |
4144 | endTime=projectParms.endTime, |
|
4149 | endTime=projectParms.endTime, | |
4145 | online=projectParms.online, |
|
4150 | online=projectParms.online, | |
4146 | walk=projectParms.walk |
|
4151 | walk=projectParms.walk | |
4147 | ) |
|
4152 | ) | |
4148 |
|
4153 | |||
4149 | if projectParms.set: |
|
4154 | if projectParms.set: | |
4150 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") |
|
4155 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") | |
4151 |
|
4156 | |||
4152 | if projectParms.delay: |
|
4157 | if projectParms.delay: | |
4153 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4158 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") | |
4154 |
|
4159 | |||
4155 | if projectParms.expLabel: |
|
4160 | if projectParms.expLabel: | |
4156 | readUnitConfObj.addParameter(name="expLabel", value=projectParms.expLabel) |
|
4161 | readUnitConfObj.addParameter(name="expLabel", value=projectParms.expLabel) | |
4157 |
|
4162 | |||
4158 | readUnitConfObj.addOperation(name="printInfo") |
|
4163 | readUnitConfObj.addOperation(name="printInfo") | |
4159 |
|
4164 | |||
4160 | if projectParms.datatype == "USRP": |
|
4165 | if projectParms.datatype == "USRP": | |
4161 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, |
|
4166 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, | |
4162 | path=projectParms.dpath, |
|
4167 | path=projectParms.dpath, | |
4163 | startDate=projectParms.startDate, |
|
4168 | startDate=projectParms.startDate, | |
4164 | endDate=projectParms.endDate, |
|
4169 | endDate=projectParms.endDate, | |
4165 | startTime=projectParms.startTime, |
|
4170 | startTime=projectParms.startTime, | |
4166 | endTime=projectParms.endTime, |
|
4171 | endTime=projectParms.endTime, | |
4167 | online=projectParms.online, |
|
4172 | online=projectParms.online, | |
4168 | ippKm=projectParms.ippKm |
|
4173 | ippKm=projectParms.ippKm | |
4169 | ) |
|
4174 | ) | |
4170 |
|
4175 | |||
4171 | if projectParms.delay: |
|
4176 | if projectParms.delay: | |
4172 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4177 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") | |
4173 |
|
4178 | |||
4174 | return readUnitConfObj |
|
4179 | return readUnitConfObj | |
4175 |
|
4180 | |||
4176 | def updateReadUnitView(self, projectObjView, idReadUnit): |
|
4181 | def updateReadUnitView(self, projectObjView, idReadUnit): | |
4177 |
|
4182 | |||
4178 | # project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk , set = self.getParmsFromProjectWindow() |
|
4183 | # project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk , set = self.getParmsFromProjectWindow() | |
4179 |
|
4184 | |||
4180 | readUnitConfObj = projectObjView.getProcUnitObj(idReadUnit) |
|
4185 | readUnitConfObj = projectObjView.getProcUnitObj(idReadUnit) | |
4181 |
|
4186 | |||
4182 | projectParms = self.__getParmsFromProjectWindow() |
|
4187 | projectParms = self.__getParmsFromProjectWindow() | |
4183 |
|
4188 | |||
4184 | if not projectParms.isValid(): |
|
4189 | if not projectParms.isValid(): | |
4185 | return None |
|
4190 | return None | |
4186 |
|
4191 | |||
4187 | if projectParms.datatype in ["Voltage", "Spectra", "Fits"]: |
|
4192 | if projectParms.datatype in ["Voltage", "Spectra", "Fits"]: | |
4188 | readUnitConfObj.update(datatype=projectParms.datatype, |
|
4193 | readUnitConfObj.update(datatype=projectParms.datatype, | |
4189 | path=projectParms.dpath, |
|
4194 | path=projectParms.dpath, | |
4190 | startDate=projectParms.startDate, |
|
4195 | startDate=projectParms.startDate, | |
4191 | endDate=projectParms.endDate, |
|
4196 | endDate=projectParms.endDate, | |
4192 | startTime=projectParms.startTime, |
|
4197 | startTime=projectParms.startTime, | |
4193 | endTime=projectParms.endTime, |
|
4198 | endTime=projectParms.endTime, | |
4194 | online=projectParms.online, |
|
4199 | online=projectParms.online, | |
4195 | walk=projectParms.walk |
|
4200 | walk=projectParms.walk | |
4196 | ) |
|
4201 | ) | |
4197 | if projectParms.set: |
|
4202 | if projectParms.set: | |
4198 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") |
|
4203 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") | |
4199 |
|
4204 | |||
4200 | if projectParms.delay: |
|
4205 | if projectParms.delay: | |
4201 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4206 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") | |
4202 |
|
4207 | |||
4203 | if projectParms.expLabel: |
|
4208 | if projectParms.expLabel: | |
4204 | readUnitConfObj.addParameter(name="expLabel", value=projectParms.expLabel) |
|
4209 | readUnitConfObj.addParameter(name="expLabel", value=projectParms.expLabel) | |
4205 |
|
4210 | |||
4206 | readUnitConfObj.addOperation(name="printInfo") |
|
4211 | readUnitConfObj.addOperation(name="printInfo") | |
4207 |
|
4212 | |||
4208 | if projectParms.datatype == "USRP": |
|
4213 | if projectParms.datatype == "USRP": | |
4209 | readUnitConfObj.update(datatype=projectParms.datatype, |
|
4214 | readUnitConfObj.update(datatype=projectParms.datatype, | |
4210 | path=projectParms.dpath, |
|
4215 | path=projectParms.dpath, | |
4211 | startDate=projectParms.startDate, |
|
4216 | startDate=projectParms.startDate, | |
4212 | endDate=projectParms.endDate, |
|
4217 | endDate=projectParms.endDate, | |
4213 | startTime=projectParms.startTime, |
|
4218 | startTime=projectParms.startTime, | |
4214 | endTime=projectParms.endTime, |
|
4219 | endTime=projectParms.endTime, | |
4215 | online=projectParms.online, |
|
4220 | online=projectParms.online, | |
4216 | ippKm=projectParms.ippKm |
|
4221 | ippKm=projectParms.ippKm | |
4217 | ) |
|
4222 | ) | |
4218 |
|
4223 | |||
4219 | if projectParms.delay: |
|
4224 | if projectParms.delay: | |
4220 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4225 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") | |
4221 |
|
4226 | |||
4222 | return readUnitConfObj |
|
4227 | return readUnitConfObj | |
4223 |
|
4228 | |||
4224 | def createProcUnitView(self, projectObjView, datatype, inputId): |
|
4229 | def createProcUnitView(self, projectObjView, datatype, inputId): | |
4225 |
|
4230 | |||
4226 | procUnitConfObj = projectObjView.addProcUnit(datatype=datatype, inputId=inputId) |
|
4231 | procUnitConfObj = projectObjView.addProcUnit(datatype=datatype, inputId=inputId) | |
4227 |
|
4232 | |||
4228 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
4233 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj | |
4229 |
|
4234 | |||
4230 | return procUnitConfObj |
|
4235 | return procUnitConfObj | |
4231 |
|
4236 | |||
4232 | def updateProcUnitView(self, id): |
|
4237 | def updateProcUnitView(self, id): | |
4233 |
|
4238 | |||
4234 | procUnitConfObj = projectObjView.getProcUnitObj(id) |
|
4239 | procUnitConfObj = projectObjView.getProcUnitObj(id) | |
4235 | procUnitConfObj.removeOperations() |
|
4240 | procUnitConfObj.removeOperations() | |
4236 |
|
4241 | |||
4237 | return procUnitConfObj |
|
4242 | return procUnitConfObj | |
4238 |
|
4243 | |||
4239 | def addPUWindow(self): |
|
4244 | def addPUWindow(self): | |
4240 |
|
4245 | |||
4241 | self.configUPWindowObj = UnitProcessWindow(self) |
|
4246 | self.configUPWindowObj = UnitProcessWindow(self) | |
4242 | fatherObj = self.getSelectedItemObj() |
|
4247 | fatherObj = self.getSelectedItemObj() | |
4243 | try: |
|
4248 | try: | |
4244 | fatherObj.getElementName() |
|
4249 | fatherObj.getElementName() | |
4245 | except: |
|
4250 | except: | |
4246 | self.console.append("First left click on Project or Processing Unit") |
|
4251 | self.console.append("First left click on Project or Processing Unit") | |
4247 | return 0 |
|
4252 | return 0 | |
4248 |
|
4253 | |||
4249 | if fatherObj.getElementName() == 'Project': |
|
4254 | if fatherObj.getElementName() == 'Project': | |
4250 | readUnitConfObj = fatherObj.getReadUnitObj() |
|
4255 | readUnitConfObj = fatherObj.getReadUnitObj() | |
4251 | self.configUPWindowObj.dataTypeProject = str(readUnitConfObj.datatype) |
|
4256 | self.configUPWindowObj.dataTypeProject = str(readUnitConfObj.datatype) | |
4252 |
|
4257 | |||
4253 | self.configUPWindowObj.getfromWindowList.append(fatherObj) |
|
4258 | self.configUPWindowObj.getfromWindowList.append(fatherObj) | |
4254 | self.configUPWindowObj.loadTotalList() |
|
4259 | self.configUPWindowObj.loadTotalList() | |
4255 | self.configUPWindowObj.show() |
|
4260 | self.configUPWindowObj.show() | |
4256 | self.configUPWindowObj.closed.connect(self.createPUWindow) |
|
4261 | self.configUPWindowObj.closed.connect(self.createPUWindow) | |
4257 |
|
4262 | |||
4258 | def createPUWindow(self): |
|
4263 | def createPUWindow(self): | |
4259 |
|
4264 | |||
4260 | if not self.configUPWindowObj.create: |
|
4265 | if not self.configUPWindowObj.create: | |
4261 | return |
|
4266 | return | |
4262 |
|
4267 | |||
4263 | fatherObj = self.configUPWindowObj.getFromWindow |
|
4268 | fatherObj = self.configUPWindowObj.getFromWindow | |
4264 | datatype = self.configUPWindowObj.typeofUP |
|
4269 | datatype = self.configUPWindowObj.typeofUP | |
4265 |
|
4270 | |||
4266 | if fatherObj.getElementName() == 'Project': |
|
4271 | if fatherObj.getElementName() == 'Project': | |
4267 | inputId = fatherObj.getReadUnitId() |
|
4272 | inputId = fatherObj.getReadUnitId() | |
4268 | projectObjView = fatherObj |
|
4273 | projectObjView = fatherObj | |
4269 | else: |
|
4274 | else: | |
4270 | inputId = fatherObj.getId() |
|
4275 | inputId = fatherObj.getId() | |
4271 | projectObjView = self.getSelectedProjectObj() |
|
4276 | projectObjView = self.getSelectedProjectObj() | |
4272 |
|
4277 | |||
4273 | if not projectObjView: |
|
4278 | if not projectObjView: | |
4274 | return |
|
4279 | return | |
4275 |
|
4280 | |||
4276 | puObj = self.createProcUnitView(projectObjView, datatype, inputId) |
|
4281 | puObj = self.createProcUnitView(projectObjView, datatype, inputId) | |
4277 |
|
4282 | |||
4278 | self.addPU2ProjectExplorer(puObj) |
|
4283 | self.addPU2ProjectExplorer(puObj) | |
4279 |
|
4284 | |||
4280 | self.showtabPUCreated(datatype) |
|
4285 | self.showtabPUCreated(datatype) | |
4281 |
|
4286 | |||
4282 | self.clearPUWindow(datatype) |
|
4287 | self.clearPUWindow(datatype) | |
4283 |
|
4288 | |||
4284 | self.showPUinitView() |
|
4289 | self.showPUinitView() | |
4285 |
|
4290 | |||
4286 | def addFTPConf2Operation(self, puObj, opObj): |
|
4291 | def addFTPConf2Operation(self, puObj, opObj): | |
4287 |
|
4292 | |||
4288 | if not self.temporalFTP.create: |
|
4293 | if not self.temporalFTP.create: | |
4289 | self.temporalFTP.setwithoutconfiguration() |
|
4294 | self.temporalFTP.setwithoutconfiguration() | |
4290 |
|
4295 | |||
4291 | # opObj.addParameter(name='server', value=self.temporalFTP.server, format='str') |
|
4296 | # opObj.addParameter(name='server', value=self.temporalFTP.server, format='str') | |
4292 | # opObj.addParameter(name='remotefolder', value=self.temporalFTP.remotefolder, format='str') |
|
4297 | # opObj.addParameter(name='remotefolder', value=self.temporalFTP.remotefolder, format='str') | |
4293 | # opObj.addParameter(name='username', value=self.temporalFTP.username, format='str') |
|
4298 | # opObj.addParameter(name='username', value=self.temporalFTP.username, format='str') | |
4294 | # opObj.addParameter(name='password', value=self.temporalFTP.password, format='str') |
|
4299 | # opObj.addParameter(name='password', value=self.temporalFTP.password, format='str') | |
4295 |
|
4300 | |||
4296 | if self.temporalFTP.ftp_wei: |
|
4301 | if self.temporalFTP.ftp_wei: | |
4297 | opObj.addParameter(name='ftp_wei', value=int(self.temporalFTP.ftp_wei), format='int') |
|
4302 | opObj.addParameter(name='ftp_wei', value=int(self.temporalFTP.ftp_wei), format='int') | |
4298 | if self.temporalFTP.exp_code: |
|
4303 | if self.temporalFTP.exp_code: | |
4299 | opObj.addParameter(name='exp_code', value=int(self.temporalFTP.exp_code), format='int') |
|
4304 | opObj.addParameter(name='exp_code', value=int(self.temporalFTP.exp_code), format='int') | |
4300 | if self.temporalFTP.sub_exp_code: |
|
4305 | if self.temporalFTP.sub_exp_code: | |
4301 | opObj.addParameter(name='sub_exp_code', value=int(self.temporalFTP.sub_exp_code), format='int') |
|
4306 | opObj.addParameter(name='sub_exp_code', value=int(self.temporalFTP.sub_exp_code), format='int') | |
4302 | if self.temporalFTP.plot_pos: |
|
4307 | if self.temporalFTP.plot_pos: | |
4303 | opObj.addParameter(name='plot_pos', value=int(self.temporalFTP.plot_pos), format='int') |
|
4308 | opObj.addParameter(name='plot_pos', value=int(self.temporalFTP.plot_pos), format='int') | |
4304 |
|
4309 | |||
4305 | # def __checkFTPProcUnit(self, projectObj, localfolder): |
|
4310 | # def __checkFTPProcUnit(self, projectObj, localfolder): | |
4306 | # |
|
4311 | # | |
4307 | # puId = None |
|
4312 | # puId = None | |
4308 | # puObj = None |
|
4313 | # puObj = None | |
4309 | # |
|
4314 | # | |
4310 | # for thisPuId, thisPuObj in projectObj.procUnitItems(): |
|
4315 | # for thisPuId, thisPuObj in projectObj.procUnitItems(): | |
4311 | # |
|
4316 | # | |
4312 | # if not thisPuObj.name == "SendToServer": |
|
4317 | # if not thisPuObj.name == "SendToServer": | |
4313 | # continue |
|
4318 | # continue | |
4314 | # |
|
4319 | # | |
4315 | # opObj = thisPuObj.getOperationObj(name='run') |
|
4320 | # opObj = thisPuObj.getOperationObj(name='run') | |
4316 | # |
|
4321 | # | |
4317 | # parmObj = opObj.getParameterObj('localfolder') |
|
4322 | # parmObj = opObj.getParameterObj('localfolder') | |
4318 | # |
|
4323 | # | |
4319 | # #localfolder parameter should always be set, if it is not set then ProcUnit should be removed |
|
4324 | # #localfolder parameter should always be set, if it is not set then ProcUnit should be removed | |
4320 | # if not parmObj: |
|
4325 | # if not parmObj: | |
4321 | # projectObj.removeProcUnit(thisPuId) |
|
4326 | # projectObj.removeProcUnit(thisPuId) | |
4322 | # continue |
|
4327 | # continue | |
4323 | # |
|
4328 | # | |
4324 | # thisLocalfolder = parmObj.getValue() |
|
4329 | # thisLocalfolder = parmObj.getValue() | |
4325 | # |
|
4330 | # | |
4326 | # if localfolder != thisLocalfolder: |
|
4331 | # if localfolder != thisLocalfolder: | |
4327 | # continue |
|
4332 | # continue | |
4328 | # |
|
4333 | # | |
4329 | # puId = thisPuId |
|
4334 | # puId = thisPuId | |
4330 | # puObj = thisPuObj |
|
4335 | # puObj = thisPuObj | |
4331 | # break |
|
4336 | # break | |
4332 | # |
|
4337 | # | |
4333 | # return puObj |
|
4338 | # return puObj | |
4334 |
|
4339 | |||
4335 | def createFTPProcUnitView(self): |
|
4340 | def createFTPProcUnitView(self): | |
4336 |
|
4341 | |||
4337 | if not self.temporalFTP.create: |
|
4342 | if not self.temporalFTP.create: | |
4338 | self.temporalFTP.setwithoutconfiguration() |
|
4343 | self.temporalFTP.setwithoutconfiguration() | |
4339 |
|
4344 | |||
4340 | projectObj = self.getSelectedProjectObj() |
|
4345 | projectObj = self.getSelectedProjectObj() | |
4341 |
|
4346 | |||
4342 | if not projectObj: |
|
4347 | if not projectObj: | |
4343 | return |
|
4348 | return | |
4344 |
|
4349 | |||
4345 | self.removeAllFTPProcUnitView(projectObj) |
|
4350 | self.removeAllFTPProcUnitView(projectObj) | |
4346 |
|
4351 | |||
4347 | if not self.__puLocalFolder2FTP: |
|
4352 | if not self.__puLocalFolder2FTP: | |
4348 | return |
|
4353 | return | |
4349 |
|
4354 | |||
4350 | folderList = ",".join(self.__puLocalFolder2FTP.values()) |
|
4355 | folderList = ",".join(self.__puLocalFolder2FTP.values()) | |
4351 |
|
4356 | |||
4352 | procUnitConfObj = projectObj.addProcUnit(name="SendToServer") |
|
4357 | procUnitConfObj = projectObj.addProcUnit(name="SendToServer") | |
4353 |
|
4358 | |||
4354 | procUnitConfObj.addParameter(name='server', value=self.temporalFTP.server, format='str') |
|
4359 | procUnitConfObj.addParameter(name='server', value=self.temporalFTP.server, format='str') | |
4355 | procUnitConfObj.addParameter(name='username', value=self.temporalFTP.username, format='str') |
|
4360 | procUnitConfObj.addParameter(name='username', value=self.temporalFTP.username, format='str') | |
4356 | procUnitConfObj.addParameter(name='password', value=self.temporalFTP.password, format='str') |
|
4361 | procUnitConfObj.addParameter(name='password', value=self.temporalFTP.password, format='str') | |
4357 | procUnitConfObj.addParameter(name='localfolder', value=folderList, format='list') |
|
4362 | procUnitConfObj.addParameter(name='localfolder', value=folderList, format='list') | |
4358 | procUnitConfObj.addParameter(name='remotefolder', value=self.temporalFTP.remotefolder, format='str') |
|
4363 | procUnitConfObj.addParameter(name='remotefolder', value=self.temporalFTP.remotefolder, format='str') | |
4359 | procUnitConfObj.addParameter(name='ext', value=self.temporalFTP.extension, format='str') |
|
4364 | procUnitConfObj.addParameter(name='ext', value=self.temporalFTP.extension, format='str') | |
4360 | procUnitConfObj.addParameter(name='period', value=self.temporalFTP.period, format='int') |
|
4365 | procUnitConfObj.addParameter(name='period', value=self.temporalFTP.period, format='int') | |
4361 | procUnitConfObj.addParameter(name='protocol', value=self.temporalFTP.protocol, format='str') |
|
4366 | procUnitConfObj.addParameter(name='protocol', value=self.temporalFTP.protocol, format='str') | |
4362 |
|
4367 | |||
4363 | procUnitConfObj.addParameter(name='ftp_wei', value=self.temporalFTP.ftp_wei, format='int') |
|
4368 | procUnitConfObj.addParameter(name='ftp_wei', value=self.temporalFTP.ftp_wei, format='int') | |
4364 | procUnitConfObj.addParameter(name='exp_code', value=self.temporalFTP.exp_code, format='int') |
|
4369 | procUnitConfObj.addParameter(name='exp_code', value=self.temporalFTP.exp_code, format='int') | |
4365 | procUnitConfObj.addParameter(name='sub_exp_code', value=self.temporalFTP.sub_exp_code, format='int') |
|
4370 | procUnitConfObj.addParameter(name='sub_exp_code', value=self.temporalFTP.sub_exp_code, format='int') | |
4366 | procUnitConfObj.addParameter(name='plot_pos', value=self.temporalFTP.plot_pos, format='int') |
|
4371 | procUnitConfObj.addParameter(name='plot_pos', value=self.temporalFTP.plot_pos, format='int') | |
4367 |
|
4372 | |||
4368 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
4373 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj | |
4369 |
|
4374 | |||
4370 | def removeAllFTPProcUnitView(self, projectObj): |
|
4375 | def removeAllFTPProcUnitView(self, projectObj): | |
4371 |
|
4376 | |||
4372 | for thisPuId, thisPuObj in projectObj.procUnitItems(): |
|
4377 | for thisPuId, thisPuObj in projectObj.procUnitItems(): | |
4373 |
|
4378 | |||
4374 | if not thisPuObj.name == "SendToServer": |
|
4379 | if not thisPuObj.name == "SendToServer": | |
4375 | continue |
|
4380 | continue | |
4376 |
|
4381 | |||
4377 | projectObj.removeProcUnit(thisPuId) |
|
4382 | projectObj.removeProcUnit(thisPuId) | |
4378 |
|
4383 | |||
4379 | if thisPuId not in self.__puObjDict.keys(): |
|
4384 | if thisPuId not in self.__puObjDict.keys(): | |
4380 | continue |
|
4385 | continue | |
4381 |
|
4386 | |||
4382 | self.__puObjDict.pop(thisPuId) |
|
4387 | self.__puObjDict.pop(thisPuId) | |
4383 |
|
4388 | |||
4384 | def showPUinitView(self): |
|
4389 | def showPUinitView(self): | |
4385 |
|
4390 | |||
4386 | self.propertiesModel = TreeModel() |
|
4391 | self.propertiesModel = TreeModel() | |
4387 | self.propertiesModel.initPUVoltageView() |
|
4392 | self.propertiesModel.initPUVoltageView() | |
4388 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
4393 | self.treeProjectProperties.setModel(self.propertiesModel) | |
4389 | self.treeProjectProperties.expandAll() |
|
4394 | self.treeProjectProperties.expandAll() | |
4390 | self.treeProjectProperties.allColumnsShowFocus() |
|
4395 | self.treeProjectProperties.allColumnsShowFocus() | |
4391 | self.treeProjectProperties.resizeColumnToContents(1) |
|
4396 | self.treeProjectProperties.resizeColumnToContents(1) | |
4392 |
|
4397 | |||
4393 | def saveFTPFromOpObj(self, operationObj): |
|
4398 | def saveFTPFromOpObj(self, operationObj): | |
4394 |
|
4399 | |||
4395 | if operationObj.name != "SendByFTP": |
|
4400 | if operationObj.name != "SendByFTP": | |
4396 | return |
|
4401 | return | |
4397 |
|
4402 | |||
4398 | server = operationObj.getParameterValue("server") |
|
4403 | server = operationObj.getParameterValue("server") | |
4399 | username = operationObj.getParameterValue("username") |
|
4404 | username = operationObj.getParameterValue("username") | |
4400 | password = operationObj.getParameterValue("password") |
|
4405 | password = operationObj.getParameterValue("password") | |
4401 | localfolder = operationObj.getParameterValue("localfolder") |
|
4406 | localfolder = operationObj.getParameterValue("localfolder") | |
4402 | remotefolder = operationObj.getParameterValue("remotefolder") |
|
4407 | remotefolder = operationObj.getParameterValue("remotefolder") | |
4403 | ext = operationObj.getParameterValue("ext") |
|
4408 | ext = operationObj.getParameterValue("ext") | |
4404 | period = operationObj.getParameterValue("period") |
|
4409 | period = operationObj.getParameterValue("period") | |
4405 |
|
4410 | |||
4406 | self.temporalFTP.save(server=server, |
|
4411 | self.temporalFTP.save(server=server, | |
4407 | remotefolder=remotefolder, |
|
4412 | remotefolder=remotefolder, | |
4408 | username=username, |
|
4413 | username=username, | |
4409 | password=password, |
|
4414 | password=password, | |
4410 | localfolder=localfolder, |
|
4415 | localfolder=localfolder, | |
4411 | extension=ext) |
|
4416 | extension=ext) | |
4412 |
|
4417 | |||
4413 | return |
|
4418 | return | |
4414 |
|
4419 | |||
4415 | def saveFTPFromProcUnitObj(self, puObj): |
|
4420 | def saveFTPFromProcUnitObj(self, puObj): | |
4416 |
|
4421 | |||
4417 | opObj = puObj.getOperationObj(name="run") |
|
4422 | opObj = puObj.getOperationObj(name="run") | |
4418 |
|
4423 | |||
4419 | parmObj = opObj.getParameterObj(parameterName="server") |
|
4424 | parmObj = opObj.getParameterObj(parameterName="server") | |
4420 | if parmObj == None: |
|
4425 | if parmObj == None: | |
4421 | server = 'jro-app.igp.gob.pe' |
|
4426 | server = 'jro-app.igp.gob.pe' | |
4422 | else: |
|
4427 | else: | |
4423 | server = parmObj.getValue() |
|
4428 | server = parmObj.getValue() | |
4424 |
|
4429 | |||
4425 | parmObj = opObj.getParameterObj(parameterName="remotefolder") |
|
4430 | parmObj = opObj.getParameterObj(parameterName="remotefolder") | |
4426 | if parmObj == None: |
|
4431 | if parmObj == None: | |
4427 | remotefolder = '/home/wmaster/graficos' |
|
4432 | remotefolder = '/home/wmaster/graficos' | |
4428 | else: |
|
4433 | else: | |
4429 | remotefolder = parmObj.getValue() |
|
4434 | remotefolder = parmObj.getValue() | |
4430 |
|
4435 | |||
4431 | parmObj = opObj.getParameterObj(parameterName="username") |
|
4436 | parmObj = opObj.getParameterObj(parameterName="username") | |
4432 | if parmObj == None: |
|
4437 | if parmObj == None: | |
4433 | username = 'wmaster' |
|
4438 | username = 'wmaster' | |
4434 | else: |
|
4439 | else: | |
4435 | username = parmObj.getValue() |
|
4440 | username = parmObj.getValue() | |
4436 |
|
4441 | |||
4437 | parmObj = opObj.getParameterObj(parameterName="password") |
|
4442 | parmObj = opObj.getParameterObj(parameterName="password") | |
4438 | if parmObj == None: |
|
4443 | if parmObj == None: | |
4439 | password = 'mst2010vhf' |
|
4444 | password = 'mst2010vhf' | |
4440 | else: |
|
4445 | else: | |
4441 | password = parmObj.getValue() |
|
4446 | password = parmObj.getValue() | |
4442 |
|
4447 | |||
4443 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") |
|
4448 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") | |
4444 | if parmObj == None: |
|
4449 | if parmObj == None: | |
4445 | ftp_wei = 0 |
|
4450 | ftp_wei = 0 | |
4446 | else: |
|
4451 | else: | |
4447 | ftp_wei = parmObj.getValue() |
|
4452 | ftp_wei = parmObj.getValue() | |
4448 |
|
4453 | |||
4449 | parmObj = opObj.getParameterObj(parameterName="exp_code") |
|
4454 | parmObj = opObj.getParameterObj(parameterName="exp_code") | |
4450 | if parmObj == None: |
|
4455 | if parmObj == None: | |
4451 | exp_code = 0 |
|
4456 | exp_code = 0 | |
4452 | else: |
|
4457 | else: | |
4453 | exp_code = parmObj.getValue() |
|
4458 | exp_code = parmObj.getValue() | |
4454 |
|
4459 | |||
4455 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") |
|
4460 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") | |
4456 | if parmObj == None: |
|
4461 | if parmObj == None: | |
4457 | sub_exp_code = 0 |
|
4462 | sub_exp_code = 0 | |
4458 | else: |
|
4463 | else: | |
4459 | sub_exp_code = parmObj.getValue() |
|
4464 | sub_exp_code = parmObj.getValue() | |
4460 |
|
4465 | |||
4461 | parmObj = opObj.getParameterObj(parameterName="plot_pos") |
|
4466 | parmObj = opObj.getParameterObj(parameterName="plot_pos") | |
4462 | if parmObj == None: |
|
4467 | if parmObj == None: | |
4463 | plot_pos = 0 |
|
4468 | plot_pos = 0 | |
4464 | else: |
|
4469 | else: | |
4465 | plot_pos = parmObj.getValue() |
|
4470 | plot_pos = parmObj.getValue() | |
4466 |
|
4471 | |||
4467 | parmObj = opObj.getParameterObj(parameterName="localfolder") |
|
4472 | parmObj = opObj.getParameterObj(parameterName="localfolder") | |
4468 | if parmObj == None: |
|
4473 | if parmObj == None: | |
4469 | localfolder = None |
|
4474 | localfolder = None | |
4470 | else: |
|
4475 | else: | |
4471 | localfolder = parmObj.getValue() |
|
4476 | localfolder = parmObj.getValue() | |
4472 |
|
4477 | |||
4473 | parmObj = opObj.getParameterObj(parameterName="ext") |
|
4478 | parmObj = opObj.getParameterObj(parameterName="ext") | |
4474 | if parmObj == None: |
|
4479 | if parmObj == None: | |
4475 | extension = '.png' |
|
4480 | extension = '.png' | |
4476 | else: |
|
4481 | else: | |
4477 | extension = parmObj.getValue() |
|
4482 | extension = parmObj.getValue() | |
4478 |
|
4483 | |||
4479 | self.temporalFTP.save(server=server, |
|
4484 | self.temporalFTP.save(server=server, | |
4480 | remotefolder=remotefolder, |
|
4485 | remotefolder=remotefolder, | |
4481 | username=username, |
|
4486 | username=username, | |
4482 | password=password, |
|
4487 | password=password, | |
4483 | ftp_wei=ftp_wei, |
|
4488 | ftp_wei=ftp_wei, | |
4484 | exp_code=exp_code, |
|
4489 | exp_code=exp_code, | |
4485 | sub_exp_code=sub_exp_code, |
|
4490 | sub_exp_code=sub_exp_code, | |
4486 | plot_pos=plot_pos, |
|
4491 | plot_pos=plot_pos, | |
4487 | localfolder=localfolder, |
|
4492 | localfolder=localfolder, | |
4488 | extension=extension) |
|
4493 | extension=extension) | |
4489 |
|
4494 | |||
4490 | def addProject2ProjectExplorer(self, id, name): |
|
4495 | def addProject2ProjectExplorer(self, id, name): | |
4491 |
|
4496 | |||
4492 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4497 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) | |
4493 |
|
4498 | |||
4494 | parentItem = self.projectExplorerModel.invisibleRootItem() |
|
4499 | parentItem = self.projectExplorerModel.invisibleRootItem() | |
4495 | parentItem.appendRow(itemTree) |
|
4500 | parentItem.appendRow(itemTree) | |
4496 |
|
4501 | |||
4497 | self.projectExplorerTree.setCurrentIndex(itemTree.index()) |
|
4502 | self.projectExplorerTree.setCurrentIndex(itemTree.index()) | |
4498 |
|
4503 | |||
4499 | self.selectedItemTree = itemTree |
|
4504 | self.selectedItemTree = itemTree | |
4500 |
|
4505 | |||
4501 | self.__itemTreeDict[id] = itemTree |
|
4506 | self.__itemTreeDict[id] = itemTree | |
4502 |
|
4507 | |||
4503 | def addPU2ProjectExplorer(self, puObj): |
|
4508 | def addPU2ProjectExplorer(self, puObj): | |
4504 |
|
4509 | |||
4505 | id, name = puObj.id, puObj.datatype |
|
4510 | id, name = puObj.id, puObj.datatype | |
4506 |
|
4511 | |||
4507 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4512 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) | |
4508 |
|
4513 | |||
4509 | parentItem = self.selectedItemTree |
|
4514 | parentItem = self.selectedItemTree | |
4510 | parentItem.appendRow(itemTree) |
|
4515 | parentItem.appendRow(itemTree) | |
4511 | self.projectExplorerTree.expandAll() |
|
4516 | self.projectExplorerTree.expandAll() | |
4512 |
|
4517 | |||
4513 | self.projectExplorerTree.setCurrentIndex(itemTree.index()) |
|
4518 | self.projectExplorerTree.setCurrentIndex(itemTree.index()) | |
4514 |
|
4519 | |||
4515 | self.selectedItemTree = itemTree |
|
4520 | self.selectedItemTree = itemTree | |
4516 |
|
4521 | |||
4517 | self.__itemTreeDict[id] = itemTree |
|
4522 | self.__itemTreeDict[id] = itemTree | |
4518 |
|
4523 | |||
4519 | def addPU2PELoadXML(self, puObj): |
|
4524 | def addPU2PELoadXML(self, puObj): | |
4520 |
|
4525 | |||
4521 | id, name, inputId = puObj.id, puObj.datatype, puObj.inputId |
|
4526 | id, name, inputId = puObj.id, puObj.datatype, puObj.inputId | |
4522 |
|
4527 | |||
4523 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4528 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) | |
4524 |
|
4529 | |||
4525 | if self.__itemTreeDict.has_key(inputId): |
|
4530 | if self.__itemTreeDict.has_key(inputId): | |
4526 | parentItem = self.__itemTreeDict[inputId] |
|
4531 | parentItem = self.__itemTreeDict[inputId] | |
4527 | else: |
|
4532 | else: | |
4528 | #If parent is a Reader object |
|
4533 | #If parent is a Reader object | |
4529 | parentItem = self.__itemTreeDict[id[:-1]] |
|
4534 | parentItem = self.__itemTreeDict[id[:-1]] | |
4530 |
|
4535 | |||
4531 | parentItem.appendRow(itemTree) |
|
4536 | parentItem.appendRow(itemTree) | |
4532 | self.projectExplorerTree.expandAll() |
|
4537 | self.projectExplorerTree.expandAll() | |
4533 | parentItem = itemTree |
|
4538 | parentItem = itemTree | |
4534 | self.projectExplorerTree.setCurrentIndex(parentItem.index()) |
|
4539 | self.projectExplorerTree.setCurrentIndex(parentItem.index()) | |
4535 |
|
4540 | |||
4536 | self.__itemTreeDict[id] = itemTree |
|
4541 | self.__itemTreeDict[id] = itemTree | |
4537 | self.selectedItemTree = itemTree |
|
4542 | self.selectedItemTree = itemTree | |
4538 |
|
4543 | |||
4539 | def getSelectedProjectObj(self): |
|
4544 | def getSelectedProjectObj(self): | |
4540 | """ |
|
4545 | """ | |
4541 | Return the current project object selected. If a processing unit is |
|
4546 | Return the current project object selected. If a processing unit is | |
4542 | actually selected this function returns associated project. |
|
4547 | actually selected this function returns associated project. | |
4543 |
|
4548 | |||
4544 | None if any project or processing unit is selected |
|
4549 | None if any project or processing unit is selected | |
4545 | """ |
|
4550 | """ | |
4546 | for key in self.__itemTreeDict.keys(): |
|
4551 | for key in self.__itemTreeDict.keys(): | |
4547 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
4552 | if self.__itemTreeDict[key] != self.selectedItemTree: | |
4548 | continue |
|
4553 | continue | |
4549 |
|
4554 | |||
4550 | if self.__projectObjDict.has_key(key): |
|
4555 | if self.__projectObjDict.has_key(key): | |
4551 | projectObj = self.__projectObjDict[key] |
|
4556 | projectObj = self.__projectObjDict[key] | |
4552 | return projectObj |
|
4557 | return projectObj | |
4553 |
|
4558 | |||
4554 | puObj = self.__puObjDict[key] |
|
4559 | puObj = self.__puObjDict[key] | |
4555 |
|
4560 | |||
4556 | if puObj.parentId == None: |
|
4561 | if puObj.parentId == None: | |
4557 | projectId = puObj.getId()[0] |
|
4562 | projectId = puObj.getId()[0] | |
4558 | else: |
|
4563 | else: | |
4559 | projectId = puObj.parentId |
|
4564 | projectId = puObj.parentId | |
4560 |
|
4565 | |||
4561 | projectObj = self.__projectObjDict[projectId] |
|
4566 | projectObj = self.__projectObjDict[projectId] | |
4562 | return projectObj |
|
4567 | return projectObj | |
4563 |
|
4568 | |||
4564 | return None |
|
4569 | return None | |
4565 |
|
4570 | |||
4566 | def getSelectedItemObj(self): |
|
4571 | def getSelectedItemObj(self): | |
4567 | """ |
|
4572 | """ | |
4568 | Return the current project or processing unit object selected |
|
4573 | Return the current project or processing unit object selected | |
4569 |
|
4574 | |||
4570 | None if any project or processing unit is selected |
|
4575 | None if any project or processing unit is selected | |
4571 | """ |
|
4576 | """ | |
4572 | for key in self.__itemTreeDict.keys(): |
|
4577 | for key in self.__itemTreeDict.keys(): | |
4573 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
4578 | if self.__itemTreeDict[key] != self.selectedItemTree: | |
4574 | continue |
|
4579 | continue | |
4575 |
|
4580 | |||
4576 | if self.__projectObjDict.has_key(key) == True: |
|
4581 | if self.__projectObjDict.has_key(key) == True: | |
4577 | fatherObj = self.__projectObjDict[key] |
|
4582 | fatherObj = self.__projectObjDict[key] | |
4578 | else: |
|
4583 | else: | |
4579 | fatherObj = self.__puObjDict[key] |
|
4584 | fatherObj = self.__puObjDict[key] | |
4580 |
|
4585 | |||
4581 | return fatherObj |
|
4586 | return fatherObj | |
4582 |
|
4587 | |||
4583 | return None |
|
4588 | return None | |
4584 |
|
4589 | |||
4585 | def _WarningWindow(self, text, information): |
|
4590 | def _WarningWindow(self, text, information): | |
4586 |
|
4591 | |||
4587 | msgBox = QtGui.QMessageBox() |
|
4592 | msgBox = QtGui.QMessageBox() | |
4588 | msgBox.setText(text) |
|
4593 | msgBox.setText(text) | |
4589 | msgBox.setInformativeText(information) |
|
4594 | msgBox.setInformativeText(information) | |
4590 | msgBox.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) |
|
4595 | msgBox.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) | |
4591 | msgBox.setDefaultButton(QtGui.QMessageBox.Ok) |
|
4596 | msgBox.setDefaultButton(QtGui.QMessageBox.Ok) | |
4592 | ret = msgBox.exec_() |
|
4597 | ret = msgBox.exec_() | |
4593 |
|
4598 | |||
4594 | answer = False |
|
4599 | answer = False | |
4595 |
|
4600 | |||
4596 | if ret == QtGui.QMessageBox.Ok: |
|
4601 | if ret == QtGui.QMessageBox.Ok: | |
4597 | answer = True |
|
4602 | answer = True | |
4598 |
|
4603 | |||
4599 | return answer |
|
4604 | return answer | |
4600 |
|
4605 | |||
4601 | def __getNewProjectId(self): |
|
4606 | def __getNewProjectId(self): | |
4602 |
|
4607 | |||
4603 | loadProject = False |
|
4608 | loadProject = False | |
4604 |
|
4609 | |||
4605 | for thisId in range(1,10): |
|
4610 | for thisId in range(1,10): | |
4606 | newId = str(thisId) |
|
4611 | newId = str(thisId) | |
4607 | if newId in self.__projectObjDict.keys(): |
|
4612 | if newId in self.__projectObjDict.keys(): | |
4608 | continue |
|
4613 | continue | |
4609 |
|
4614 | |||
4610 | loadProject = True |
|
4615 | loadProject = True | |
4611 | projectId = newId |
|
4616 | projectId = newId | |
4612 | break |
|
4617 | break | |
4613 |
|
4618 | |||
4614 | if not loadProject: |
|
4619 | if not loadProject: | |
4615 | self.console.clear() |
|
4620 | self.console.clear() | |
4616 | self.console.append("The maximum number of projects has been loaded, a new project can not be loaded") |
|
4621 | self.console.append("The maximum number of projects has been loaded, a new project can not be loaded") | |
4617 | return None |
|
4622 | return None | |
4618 |
|
4623 | |||
4619 | return projectId |
|
4624 | return projectId | |
4620 |
|
4625 | |||
4621 | def openProject(self): |
|
4626 | def openProject(self): | |
4622 |
|
4627 | |||
4623 | self.actionStart.setEnabled(False) |
|
4628 | self.actionStart.setEnabled(False) | |
4624 | self.actionStarToolbar.setEnabled(False) |
|
4629 | self.actionStarToolbar.setEnabled(False) | |
4625 |
|
4630 | |||
4626 | self.frame_2.setEnabled(True) |
|
4631 | self.frame_2.setEnabled(True) | |
4627 |
|
4632 | |||
4628 | # print self.dir |
|
4633 | # print self.dir | |
4629 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) |
|
4634 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) | |
4630 |
|
4635 | |||
4631 | projectObjLoad = Project() |
|
4636 | projectObjLoad = Project() | |
4632 |
|
4637 | |||
4633 | try: |
|
4638 | try: | |
4634 | projectObjLoad.readXml(filename) |
|
4639 | projectObjLoad.readXml(filename) | |
4635 | except: |
|
4640 | except: | |
4636 | self.console.clear() |
|
4641 | self.console.clear() | |
4637 | self.console.append("The selected xml file could not be loaded ...") |
|
4642 | self.console.append("The selected xml file could not be loaded ...") | |
4638 | return 0 |
|
4643 | return 0 | |
4639 |
|
4644 | |||
4640 | self.create = False |
|
4645 | self.create = False | |
4641 | self.refreshProjectWindow(projectObjLoad) |
|
4646 | self.refreshProjectWindow(projectObjLoad) | |
4642 | self.refreshProjectProperties(projectObjLoad) |
|
4647 | self.refreshProjectProperties(projectObjLoad) | |
4643 |
|
4648 | |||
4644 | projectId = projectObjLoad.id |
|
4649 | projectId = projectObjLoad.id | |
4645 |
|
4650 | |||
4646 | if projectId in self.__projectObjDict.keys(): |
|
4651 | if projectId in self.__projectObjDict.keys(): | |
4647 |
|
4652 | |||
4648 | # answer = self._WarningWindow("You already have a project loaded with the same Id", |
|
4653 | # answer = self._WarningWindow("You already have a project loaded with the same Id", | |
4649 | # "Do you want to load the file anyway?") |
|
4654 | # "Do you want to load the file anyway?") | |
4650 | # if not answer: |
|
4655 | # if not answer: | |
4651 | # return |
|
4656 | # return | |
4652 |
|
4657 | |||
4653 | projectId = self.__getNewProjectId() |
|
4658 | projectId = self.__getNewProjectId() | |
4654 |
|
4659 | |||
4655 | if not projectId: |
|
4660 | if not projectId: | |
4656 | return |
|
4661 | return | |
4657 |
|
4662 | |||
4658 | projectObjLoad.updateId(projectId) |
|
4663 | projectObjLoad.updateId(projectId) | |
4659 |
|
4664 | |||
4660 | self.__projectObjDict[projectId] = projectObjLoad |
|
4665 | self.__projectObjDict[projectId] = projectObjLoad | |
4661 |
|
4666 | |||
4662 | self.addProject2ProjectExplorer(id=projectId, name=projectObjLoad.name) |
|
4667 | self.addProject2ProjectExplorer(id=projectId, name=projectObjLoad.name) | |
4663 |
|
4668 | |||
4664 | self.tabWidgetProject.setEnabled(True) |
|
4669 | self.tabWidgetProject.setEnabled(True) | |
4665 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
4670 | self.tabWidgetProject.setCurrentWidget(self.tabProject) | |
4666 | # Disable tabProject after finish the creation |
|
4671 | # Disable tabProject after finish the creation | |
4667 | self.tabProject.setEnabled(True) |
|
4672 | self.tabProject.setEnabled(True) | |
4668 | puObjorderList = OrderedDict(sorted(projectObjLoad.procUnitConfObjDict.items(), key=lambda x: x[0])) |
|
4673 | puObjorderList = OrderedDict(sorted(projectObjLoad.procUnitConfObjDict.items(), key=lambda x: x[0])) | |
4669 |
|
4674 | |||
4670 | for puId, puObj in puObjorderList.items(): |
|
4675 | for puId, puObj in puObjorderList.items(): | |
4671 |
|
4676 | |||
4672 | self.__puObjDict[puId] = puObj |
|
4677 | self.__puObjDict[puId] = puObj | |
4673 |
|
4678 | |||
4674 | if puObj.name == "SendToServer": |
|
4679 | if puObj.name == "SendToServer": | |
4675 | self.saveFTPFromProcUnitObj(puObj) |
|
4680 | self.saveFTPFromProcUnitObj(puObj) | |
4676 |
|
4681 | |||
4677 | ############## COMPATIBLE WITH OLD VERSIONS ################ |
|
4682 | ############## COMPATIBLE WITH OLD VERSIONS ################ | |
4678 | operationObj = puObj.getOperationObj("SendByFTP") |
|
4683 | operationObj = puObj.getOperationObj("SendByFTP") | |
4679 |
|
4684 | |||
4680 | if operationObj: |
|
4685 | if operationObj: | |
4681 | self.saveFTPFromOpObj(operationObj) |
|
4686 | self.saveFTPFromOpObj(operationObj) | |
4682 | ############################################################ |
|
4687 | ############################################################ | |
4683 |
|
4688 | |||
4684 | if puObj.inputId == '0': |
|
4689 | if puObj.inputId == '0': | |
4685 | continue |
|
4690 | continue | |
4686 |
|
4691 | |||
4687 | self.addPU2PELoadXML(puObj) |
|
4692 | self.addPU2PELoadXML(puObj) | |
4688 |
|
4693 | |||
4689 | self.refreshPUWindow(puObj) |
|
4694 | self.refreshPUWindow(puObj) | |
4690 | self.refreshPUProperties(puObj) |
|
4695 | self.refreshPUProperties(puObj) | |
4691 | self.showtabPUCreated(datatype=puObj.datatype) |
|
4696 | self.showtabPUCreated(datatype=puObj.datatype) | |
4692 |
|
4697 | |||
4693 | self.console.clear() |
|
4698 | self.console.clear() | |
4694 | self.console.append("The selected xml file has been loaded successfully") |
|
4699 | self.console.append("The selected xml file has been loaded successfully") | |
4695 |
|
4700 | |||
4696 | self.actionStart.setEnabled(True) |
|
4701 | self.actionStart.setEnabled(True) | |
4697 | self.actionStarToolbar.setEnabled(True) |
|
4702 | self.actionStarToolbar.setEnabled(True) | |
4698 |
|
4703 | |||
4699 | def create_updating_timer(self): |
|
4704 | def create_updating_timer(self): | |
4700 | self.comm_data_timer = QtCore.QTimer(self) |
|
4705 | self.comm_data_timer = QtCore.QTimer(self) | |
4701 | self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) |
|
4706 | self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) | |
4702 | self.comm_data_timer.start(1000) |
|
4707 | self.comm_data_timer.start(1000) | |
4703 |
|
4708 | |||
4704 | def on_comm_updating_timer(self): |
|
4709 | def on_comm_updating_timer(self): | |
4705 | # Verifica si algun proceso ha sido inicializado y sigue ejecutandose |
|
4710 | # Verifica si algun proceso ha sido inicializado y sigue ejecutandose | |
4706 | # Si el proceso se ha parado actualizar el GUI (stopProject) |
|
4711 | # Si el proceso se ha parado actualizar el GUI (stopProject) | |
4707 | if not self.__enable: |
|
4712 | if not self.__enable: | |
4708 | return |
|
4713 | return | |
4709 |
|
4714 | |||
4710 | if self.controllerThread.isFinished(): |
|
4715 | if self.controllerThread.isFinished(): | |
4711 | self.stopProject() |
|
4716 | self.stopProject() | |
4712 |
|
4717 | |||
4713 | # def jobStartedFromThread(self, success): |
|
4718 | # def jobStartedFromThread(self, success): | |
4714 | # |
|
4719 | # | |
4715 | # self.console.clear() |
|
4720 | # self.console.clear() | |
4716 | # self.console.append("Job started") |
|
4721 | # self.console.append("Job started") | |
4717 | # |
|
4722 | # | |
4718 | # def jobFinishedFromThread(self, success): |
|
4723 | # def jobFinishedFromThread(self, success): | |
4719 | # |
|
4724 | # | |
4720 | # self.stopProject() |
|
4725 | # self.stopProject() | |
4721 |
|
4726 | |||
4722 | def playProject(self, ext=".xml", save=1): |
|
4727 | def playProject(self, ext=".xml", save=1): | |
4723 |
|
4728 | |||
4724 | projectObj = self.getSelectedProjectObj() |
|
4729 | projectObj = self.getSelectedProjectObj() | |
4725 |
|
4730 | |||
4726 | if not projectObj: |
|
4731 | if not projectObj: | |
4727 | self.console.append("Please select a project before pressing PLAY button") |
|
4732 | self.console.append("Please select a project before pressing PLAY button") | |
4728 | return |
|
4733 | return | |
4729 |
|
4734 | |||
4730 | if save: |
|
4735 | if save: | |
4731 | filename = self.saveProject() |
|
4736 | filename = self.saveProject() | |
4732 | if filename == None: |
|
4737 | if filename == None: | |
4733 | self.console.append("Process did not initialize.") |
|
4738 | self.console.append("Process did not initialize.") | |
4734 | return |
|
4739 | return | |
4735 | else: |
|
4740 | else: | |
4736 | filename = TEMPORAL_FILE |
|
4741 | filename = TEMPORAL_FILE | |
4737 | projectObj.writeXml( os.path.join(self.pathWorkSpace,filename) ) |
|
4742 | projectObj.writeXml( os.path.join(self.pathWorkSpace,filename) ) | |
4738 |
|
4743 | |||
4739 | self.actionStart.setEnabled(False) |
|
4744 | self.actionStart.setEnabled(False) | |
4740 | self.actionPause.setEnabled(True) |
|
4745 | self.actionPause.setEnabled(True) | |
4741 | self.actionStop.setEnabled(True) |
|
4746 | self.actionStop.setEnabled(True) | |
4742 |
|
4747 | |||
4743 | self.actionStarToolbar.setEnabled(False) |
|
4748 | self.actionStarToolbar.setEnabled(False) | |
4744 | self.actionPauseToolbar.setEnabled(True) |
|
4749 | self.actionPauseToolbar.setEnabled(True) | |
4745 | self.actionStopToolbar.setEnabled(True) |
|
4750 | self.actionStopToolbar.setEnabled(True) | |
4746 |
|
4751 | |||
4747 | self.console.append("Please Wait...") |
|
4752 | self.console.append("Please Wait...") | |
4748 |
|
4753 | |||
4749 | self.controllerThread = ControllerThread(filename) |
|
4754 | self.controllerThread = ControllerThread(filename) | |
4750 |
|
4755 | |||
4751 | # QObject.connect( self.controllerThread, SIGNAL( "jobFinished( PyQt_PyObject )" ), self.jobFinishedFromThread ) |
|
4756 | # QObject.connect( self.controllerThread, SIGNAL( "jobFinished( PyQt_PyObject )" ), self.jobFinishedFromThread ) | |
4752 | # QObject.connect( self.controllerThread, SIGNAL( "jobStarted( PyQt_PyObject )" ), self.jobStartedFromThread ) |
|
4757 | # QObject.connect( self.controllerThread, SIGNAL( "jobStarted( PyQt_PyObject )" ), self.jobStartedFromThread ) | |
4753 | self.console.clear() |
|
4758 | self.console.clear() | |
4754 | self.controllerThread.start() |
|
4759 | self.controllerThread.start() | |
4755 | sleep(0.5) |
|
4760 | sleep(0.5) | |
4756 | self.__enable = True |
|
4761 | self.__enable = True | |
4757 |
|
4762 | |||
4758 | def stopProject(self): |
|
4763 | def stopProject(self): | |
4759 |
|
4764 | |||
4760 | self.__enable = False |
|
4765 | self.__enable = False | |
4761 |
|
4766 | |||
4762 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) |
|
4767 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) | |
4763 | self.controllerThread.stop() |
|
4768 | self.controllerThread.stop() | |
4764 |
|
4769 | |||
4765 | while self.controllerThread.isRunning(): |
|
4770 | while self.controllerThread.isRunning(): | |
4766 | sleep(0.5) |
|
4771 | sleep(0.5) | |
4767 |
|
4772 | |||
4768 | self.actionStart.setEnabled(True) |
|
4773 | self.actionStart.setEnabled(True) | |
4769 | self.actionPause.setEnabled(False) |
|
4774 | self.actionPause.setEnabled(False) | |
4770 | self.actionStop.setEnabled(False) |
|
4775 | self.actionStop.setEnabled(False) | |
4771 |
|
4776 | |||
4772 | self.actionStarToolbar.setEnabled(True) |
|
4777 | self.actionStarToolbar.setEnabled(True) | |
4773 | self.actionPauseToolbar.setEnabled(False) |
|
4778 | self.actionPauseToolbar.setEnabled(False) | |
4774 | self.actionStopToolbar.setEnabled(False) |
|
4779 | self.actionStopToolbar.setEnabled(False) | |
4775 |
|
4780 | |||
4776 | self.restorePauseIcon() |
|
4781 | self.restorePauseIcon() | |
4777 |
|
4782 | |||
4778 | def pauseProject(self): |
|
4783 | def pauseProject(self): | |
4779 |
|
4784 | |||
4780 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PAUSE, data=True)) |
|
4785 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PAUSE, data=True)) | |
4781 | self.controllerThread.pause() |
|
4786 | self.controllerThread.pause() | |
4782 |
|
4787 | |||
4783 | self.actionStart.setEnabled(False) |
|
4788 | self.actionStart.setEnabled(False) | |
4784 | self.actionPause.setEnabled(True) |
|
4789 | self.actionPause.setEnabled(True) | |
4785 | self.actionStop.setEnabled(True) |
|
4790 | self.actionStop.setEnabled(True) | |
4786 |
|
4791 | |||
4787 | self.actionStarToolbar.setEnabled(False) |
|
4792 | self.actionStarToolbar.setEnabled(False) | |
4788 | self.actionPauseToolbar.setEnabled(True) |
|
4793 | self.actionPauseToolbar.setEnabled(True) | |
4789 | self.actionStopToolbar.setEnabled(True) |
|
4794 | self.actionStopToolbar.setEnabled(True) | |
4790 |
|
4795 | |||
4791 | def saveProject(self, filename=None): |
|
4796 | def saveProject(self, filename=None): | |
4792 |
|
4797 | |||
4793 | self.actionStart.setEnabled(False) |
|
4798 | self.actionStart.setEnabled(False) | |
4794 | self.actionStarToolbar.setEnabled(False) |
|
4799 | self.actionStarToolbar.setEnabled(False) | |
4795 |
|
4800 | |||
4796 | projectObj = self.getSelectedProjectObj() |
|
4801 | projectObj = self.getSelectedProjectObj() | |
4797 |
|
4802 | |||
4798 | if not projectObj: |
|
4803 | if not projectObj: | |
4799 |
|
4804 | |||
4800 | if self.create: |
|
4805 | if self.create: | |
4801 | self.console.append("Please press Ok before save it") |
|
4806 | self.console.append("Please press Ok before save it") | |
4802 | else: |
|
4807 | else: | |
4803 | self.console.append("Please select a project before save it") |
|
4808 | self.console.append("Please select a project before save it") | |
4804 | return |
|
4809 | return | |
4805 |
|
4810 | |||
4806 | self.refreshGraphicsId() |
|
4811 | self.refreshGraphicsId() | |
4807 |
|
4812 | |||
4808 | sts = True |
|
4813 | sts = True | |
4809 | selectedItemObj = self.getSelectedItemObj() |
|
4814 | selectedItemObj = self.getSelectedItemObj() | |
4810 |
|
4815 | |||
4811 | #A Processing Unit has been selected |
|
4816 | #A Processing Unit has been selected | |
4812 | if projectObj == selectedItemObj: |
|
4817 | if projectObj == selectedItemObj: | |
4813 | if not self.on_proOk_clicked(): |
|
4818 | if not self.on_proOk_clicked(): | |
4814 | return None |
|
4819 | return None | |
4815 |
|
4820 | |||
4816 | #A Processing Unit has been selected |
|
4821 | #A Processing Unit has been selected | |
4817 | if projectObj != selectedItemObj: |
|
4822 | if projectObj != selectedItemObj: | |
4818 | puObj = selectedItemObj |
|
4823 | puObj = selectedItemObj | |
4819 |
|
4824 | |||
4820 | if puObj.name == 'VoltageProc': |
|
4825 | if puObj.name == 'VoltageProc': | |
4821 | sts = self.on_volOpOk_clicked() |
|
4826 | sts = self.on_volOpOk_clicked() | |
4822 | if puObj.name == 'SpectraProc': |
|
4827 | if puObj.name == 'SpectraProc': | |
4823 | sts = self.on_specOpOk_clicked() |
|
4828 | sts = self.on_specOpOk_clicked() | |
4824 | if puObj.name == 'SpectraHeisProc': |
|
4829 | if puObj.name == 'SpectraHeisProc': | |
4825 | sts = self.on_specHeisOpOk_clicked() |
|
4830 | sts = self.on_specHeisOpOk_clicked() | |
4826 |
|
4831 | |||
4827 | if not sts: |
|
4832 | if not sts: | |
4828 | return None |
|
4833 | return None | |
4829 |
|
4834 | |||
4830 | self.createFTPProcUnitView() |
|
4835 | self.createFTPProcUnitView() | |
4831 |
|
4836 | |||
4832 | if not filename: |
|
4837 | if not filename: | |
4833 | filename = os.path.join( str(self.pathWorkSpace), "%s%s" %(str(projectObj.name), '.xml') ) |
|
4838 | filename = os.path.join( str(self.pathWorkSpace), "%s%s" %(str(projectObj.name), '.xml') ) | |
4834 |
|
4839 | |||
4835 | projectObj.writeXml(filename) |
|
4840 | projectObj.writeXml(filename) | |
4836 | self.console.clear() |
|
4841 | self.console.clear() | |
4837 | self.console.append("Project saved") |
|
4842 | self.console.append("Project saved") | |
4838 | self.console.append("Press Play button to start data processing ...") |
|
4843 | self.console.append("Press Play button to start data processing ...") | |
4839 |
|
4844 | |||
4840 | self.actionStart.setEnabled(True) |
|
4845 | self.actionStart.setEnabled(True) | |
4841 | self.actionStarToolbar.setEnabled(True) |
|
4846 | self.actionStarToolbar.setEnabled(True) | |
4842 |
|
4847 | |||
4843 | return filename |
|
4848 | return filename | |
4844 |
|
4849 | |||
4845 | def removeItemTreeFromProject(self): |
|
4850 | def removeItemTreeFromProject(self): | |
4846 | """ |
|
4851 | """ | |
4847 | Metodo para eliminar el proyecto en el dictionario de proyectos y en el dictionario de vista de arbol |
|
4852 | Metodo para eliminar el proyecto en el dictionario de proyectos y en el dictionario de vista de arbol | |
4848 | """ |
|
4853 | """ | |
4849 | for key in self.__itemTreeDict.keys(): |
|
4854 | for key in self.__itemTreeDict.keys(): | |
4850 |
|
4855 | |||
4851 | #Check again because an item can delete multiple items (childs) |
|
4856 | #Check again because an item can delete multiple items (childs) | |
4852 | if key not in self.__itemTreeDict.keys(): |
|
4857 | if key not in self.__itemTreeDict.keys(): | |
4853 | continue |
|
4858 | continue | |
4854 |
|
4859 | |||
4855 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
4860 | if self.__itemTreeDict[key] != self.selectedItemTree: | |
4856 | continue |
|
4861 | continue | |
4857 |
|
4862 | |||
4858 | if self.__projectObjDict.has_key(key) == True: |
|
4863 | if self.__projectObjDict.has_key(key) == True: | |
4859 |
|
4864 | |||
4860 | del self.__projectObjDict[key] |
|
4865 | del self.__projectObjDict[key] | |
4861 | del self.__itemTreeDict[key] |
|
4866 | del self.__itemTreeDict[key] | |
4862 |
|
4867 | |||
4863 | else: |
|
4868 | else: | |
4864 | puObj = self.__puObjDict[key] |
|
4869 | puObj = self.__puObjDict[key] | |
4865 | idProjectParent = puObj.parentId |
|
4870 | idProjectParent = puObj.parentId | |
4866 | projectObj = self.__projectObjDict[idProjectParent] |
|
4871 | projectObj = self.__projectObjDict[idProjectParent] | |
4867 |
|
4872 | |||
4868 | del self.__puObjDict[key] |
|
4873 | del self.__puObjDict[key] | |
4869 | del self.__itemTreeDict[key] |
|
4874 | del self.__itemTreeDict[key] | |
4870 | del projectObj.procUnitConfObjDict[key] |
|
4875 | del projectObj.procUnitConfObjDict[key] | |
4871 |
|
4876 | |||
4872 | for key in projectObj.procUnitConfObjDict.keys(): |
|
4877 | for key in projectObj.procUnitConfObjDict.keys(): | |
4873 | if projectObj.procUnitConfObjDict[key].inputId != puObj.getId(): |
|
4878 | if projectObj.procUnitConfObjDict[key].inputId != puObj.getId(): | |
4874 | continue |
|
4879 | continue | |
4875 | del self.__puObjDict[projectObj.procUnitConfObjDict[key].getId()] |
|
4880 | del self.__puObjDict[projectObj.procUnitConfObjDict[key].getId()] | |
4876 | del self.__itemTreeDict[projectObj.procUnitConfObjDict[key].getId()] |
|
4881 | del self.__itemTreeDict[projectObj.procUnitConfObjDict[key].getId()] | |
4877 | del projectObj.procUnitConfObjDict[key] |
|
4882 | del projectObj.procUnitConfObjDict[key] | |
4878 | # print projectObj.procUnitConfObjDict |
|
4883 | # print projectObj.procUnitConfObjDict | |
4879 | # print self.__itemTreeDict,self.__projectObjDict,self.__puObjDict |
|
4884 | # print self.__itemTreeDict,self.__projectObjDict,self.__puObjDict | |
4880 |
|
4885 | |||
4881 | def setInputsProject_View(self): |
|
4886 | def setInputsProject_View(self): | |
4882 |
|
4887 | |||
4883 | self.tabWidgetProject.setEnabled(True) |
|
4888 | self.tabWidgetProject.setEnabled(True) | |
4884 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
4889 | self.tabWidgetProject.setCurrentWidget(self.tabProject) | |
4885 | self.tabProject.setEnabled(True) |
|
4890 | self.tabProject.setEnabled(True) | |
4886 | self.frame_2.setEnabled(False) |
|
4891 | self.frame_2.setEnabled(False) | |
4887 | self.proName.clear() |
|
4892 | self.proName.clear() | |
4888 | self.proName.setFocus() |
|
4893 | self.proName.setFocus() | |
4889 | self.proName.setSelection(0, 0) |
|
4894 | self.proName.setSelection(0, 0) | |
4890 | self.proName.setCursorPosition(0) |
|
4895 | self.proName.setCursorPosition(0) | |
4891 | self.proDataType.setText('.r') |
|
4896 | self.proDataType.setText('.r') | |
4892 | self.proDataPath.clear() |
|
4897 | self.proDataPath.clear() | |
4893 | self.proComDataType.clear() |
|
4898 | self.proComDataType.clear() | |
4894 | self.proComDataType.addItem("Voltage") |
|
4899 | self.proComDataType.addItem("Voltage") | |
4895 | self.proComDataType.addItem("Spectra") |
|
4900 | self.proComDataType.addItem("Spectra") | |
4896 | self.proComDataType.addItem("Fits") |
|
4901 | self.proComDataType.addItem("Fits") | |
4897 | self.proComDataType.addItem("USRP") |
|
4902 | self.proComDataType.addItem("USRP") | |
4898 |
|
4903 | |||
4899 | self.proComStartDate.clear() |
|
4904 | self.proComStartDate.clear() | |
4900 | self.proComEndDate.clear() |
|
4905 | self.proComEndDate.clear() | |
4901 |
|
4906 | |||
4902 | startTime = "00:00:00" |
|
4907 | startTime = "00:00:00" | |
4903 | endTime = "23:59:59" |
|
4908 | endTime = "23:59:59" | |
4904 | starlist = startTime.split(":") |
|
4909 | starlist = startTime.split(":") | |
4905 | endlist = endTime.split(":") |
|
4910 | endlist = endTime.split(":") | |
4906 | self.proDelay.setText("60") |
|
4911 | self.proDelay.setText("60") | |
4907 | self.proSet.setText("") |
|
4912 | self.proSet.setText("") | |
4908 |
|
4913 | |||
4909 | self.labelSet.show() |
|
4914 | self.labelSet.show() | |
4910 | self.proSet.show() |
|
4915 | self.proSet.show() | |
4911 |
|
4916 | |||
4912 | self.labelIPPKm.hide() |
|
4917 | self.labelIPPKm.hide() | |
4913 | self.proIPPKm.hide() |
|
4918 | self.proIPPKm.hide() | |
4914 |
|
4919 | |||
4915 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) |
|
4920 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) | |
4916 | self.proStartTime.setTime(self.time) |
|
4921 | self.proStartTime.setTime(self.time) | |
4917 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
4922 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) | |
4918 | self.proEndTime.setTime(self.time) |
|
4923 | self.proEndTime.setTime(self.time) | |
4919 | self.proDescription.clear() |
|
4924 | self.proDescription.clear() | |
4920 | self.proOk.setEnabled(False) |
|
4925 | self.proOk.setEnabled(False) | |
4921 | # self.console.append("Please, Write a name Project") |
|
4926 | # self.console.append("Please, Write a name Project") | |
4922 | # self.console.append("Introduce Project Parameters")DC |
|
4927 | # self.console.append("Introduce Project Parameters")DC | |
4923 | # self.console.append("Select data type Voltage( .rawdata) or Spectra(.pdata)") |
|
4928 | # self.console.append("Select data type Voltage( .rawdata) or Spectra(.pdata)") | |
4924 |
|
4929 | |||
4925 | def clearPUWindow(self, datatype): |
|
4930 | def clearPUWindow(self, datatype): | |
4926 |
|
4931 | |||
4927 | projectObjView = self.getSelectedProjectObj() |
|
4932 | projectObjView = self.getSelectedProjectObj() | |
4928 |
|
4933 | |||
4929 | if not projectObjView: |
|
4934 | if not projectObjView: | |
4930 | return |
|
4935 | return | |
4931 |
|
4936 | |||
4932 | puObj = self.getSelectedItemObj() |
|
4937 | puObj = self.getSelectedItemObj() | |
4933 | inputId = puObj.getInputId() |
|
4938 | inputId = puObj.getInputId() | |
4934 | inputPUObj = projectObjView.getProcUnitObj(inputId) |
|
4939 | inputPUObj = projectObjView.getProcUnitObj(inputId) | |
4935 |
|
4940 | |||
4936 | if datatype == 'Voltage': |
|
4941 | if datatype == 'Voltage': | |
4937 | self.volOpComChannels.setEnabled(False) |
|
4942 | self.volOpComChannels.setEnabled(False) | |
4938 | self.volOpComHeights.setEnabled(False) |
|
4943 | self.volOpComHeights.setEnabled(False) | |
4939 | self.volOpFilter.setEnabled(False) |
|
4944 | self.volOpFilter.setEnabled(False) | |
4940 | self.volOpComProfile.setEnabled(False) |
|
4945 | self.volOpComProfile.setEnabled(False) | |
4941 | self.volOpComCode.setEnabled(False) |
|
4946 | self.volOpComCode.setEnabled(False) | |
4942 | self.volOpCohInt.setEnabled(False) |
|
4947 | self.volOpCohInt.setEnabled(False) | |
4943 | self.volOpChannel.setEnabled(False) |
|
4948 | self.volOpChannel.setEnabled(False) | |
4944 | self.volOpHeights.setEnabled(False) |
|
4949 | self.volOpHeights.setEnabled(False) | |
4945 | self.volOpProfile.setEnabled(False) |
|
4950 | self.volOpProfile.setEnabled(False) | |
4946 | self.volOpRadarfrequency.setEnabled(False) |
|
4951 | self.volOpRadarfrequency.setEnabled(False) | |
4947 | self.volOpCebChannels.setCheckState(0) |
|
4952 | self.volOpCebChannels.setCheckState(0) | |
4948 | self.volOpCebRadarfrequency.setCheckState(0) |
|
4953 | self.volOpCebRadarfrequency.setCheckState(0) | |
4949 | self.volOpCebHeights.setCheckState(0) |
|
4954 | self.volOpCebHeights.setCheckState(0) | |
4950 | self.volOpCebFilter.setCheckState(0) |
|
4955 | self.volOpCebFilter.setCheckState(0) | |
4951 | self.volOpCebProfile.setCheckState(0) |
|
4956 | self.volOpCebProfile.setCheckState(0) | |
4952 | self.volOpCebDecodification.setCheckState(0) |
|
4957 | self.volOpCebDecodification.setCheckState(0) | |
4953 | self.volOpCebCohInt.setCheckState(0) |
|
4958 | self.volOpCebCohInt.setCheckState(0) | |
4954 |
|
4959 | |||
4955 | self.volOpChannel.clear() |
|
4960 | self.volOpChannel.clear() | |
4956 | self.volOpHeights.clear() |
|
4961 | self.volOpHeights.clear() | |
4957 | self.volOpProfile.clear() |
|
4962 | self.volOpProfile.clear() | |
4958 | self.volOpFilter.clear() |
|
4963 | self.volOpFilter.clear() | |
4959 | self.volOpCohInt.clear() |
|
4964 | self.volOpCohInt.clear() | |
4960 | self.volOpRadarfrequency.clear() |
|
4965 | self.volOpRadarfrequency.clear() | |
4961 |
|
4966 | |||
4962 | if datatype == 'Spectra': |
|
4967 | if datatype == 'Spectra': | |
4963 |
|
4968 | |||
4964 | if inputPUObj.datatype == 'Spectra': |
|
4969 | if inputPUObj.datatype == 'Spectra': | |
4965 | self.specOpnFFTpoints.setEnabled(False) |
|
4970 | self.specOpnFFTpoints.setEnabled(False) | |
4966 | self.specOpProfiles.setEnabled(False) |
|
4971 | self.specOpProfiles.setEnabled(False) | |
4967 | self.specOpippFactor.setEnabled(False) |
|
4972 | self.specOpippFactor.setEnabled(False) | |
4968 | else: |
|
4973 | else: | |
4969 | self.specOpnFFTpoints.setEnabled(True) |
|
4974 | self.specOpnFFTpoints.setEnabled(True) | |
4970 | self.specOpProfiles.setEnabled(True) |
|
4975 | self.specOpProfiles.setEnabled(True) | |
4971 | self.specOpippFactor.setEnabled(True) |
|
4976 | self.specOpippFactor.setEnabled(True) | |
4972 |
|
4977 | |||
4973 | self.specOpCebCrossSpectra.setCheckState(0) |
|
4978 | self.specOpCebCrossSpectra.setCheckState(0) | |
4974 | self.specOpCebChannel.setCheckState(0) |
|
4979 | self.specOpCebChannel.setCheckState(0) | |
4975 | self.specOpCebHeights.setCheckState(0) |
|
4980 | self.specOpCebHeights.setCheckState(0) | |
4976 | self.specOpCebIncoherent.setCheckState(0) |
|
4981 | self.specOpCebIncoherent.setCheckState(0) | |
4977 | self.specOpCebRemoveDC.setCheckState(0) |
|
4982 | self.specOpCebRemoveDC.setCheckState(0) | |
4978 | self.specOpCebRemoveInt.setCheckState(0) |
|
4983 | self.specOpCebRemoveInt.setCheckState(0) | |
4979 | self.specOpCebgetNoise.setCheckState(0) |
|
4984 | self.specOpCebgetNoise.setCheckState(0) | |
4980 | self.specOpCebRadarfrequency.setCheckState(0) |
|
4985 | self.specOpCebRadarfrequency.setCheckState(0) | |
4981 |
|
4986 | |||
4982 | self.specOpRadarfrequency.setEnabled(False) |
|
4987 | self.specOpRadarfrequency.setEnabled(False) | |
4983 | self.specOppairsList.setEnabled(False) |
|
4988 | self.specOppairsList.setEnabled(False) | |
4984 | self.specOpChannel.setEnabled(False) |
|
4989 | self.specOpChannel.setEnabled(False) | |
4985 | self.specOpHeights.setEnabled(False) |
|
4990 | self.specOpHeights.setEnabled(False) | |
4986 | self.specOpIncoherent.setEnabled(False) |
|
4991 | self.specOpIncoherent.setEnabled(False) | |
4987 | self.specOpgetNoise.setEnabled(False) |
|
4992 | self.specOpgetNoise.setEnabled(False) | |
4988 |
|
4993 | |||
4989 | self.specOpRadarfrequency.clear() |
|
4994 | self.specOpRadarfrequency.clear() | |
4990 | self.specOpnFFTpoints.clear() |
|
4995 | self.specOpnFFTpoints.clear() | |
4991 | self.specOpProfiles.clear() |
|
4996 | self.specOpProfiles.clear() | |
4992 | self.specOpippFactor.clear |
|
4997 | self.specOpippFactor.clear | |
4993 | self.specOppairsList.clear() |
|
4998 | self.specOppairsList.clear() | |
4994 | self.specOpChannel.clear() |
|
4999 | self.specOpChannel.clear() | |
4995 | self.specOpHeights.clear() |
|
5000 | self.specOpHeights.clear() | |
4996 | self.specOpIncoherent.clear() |
|
5001 | self.specOpIncoherent.clear() | |
4997 | self.specOpgetNoise.clear() |
|
5002 | self.specOpgetNoise.clear() | |
4998 |
|
5003 | |||
4999 | self.specGraphCebSpectraplot.setCheckState(0) |
|
5004 | self.specGraphCebSpectraplot.setCheckState(0) | |
5000 | self.specGraphCebCrossSpectraplot.setCheckState(0) |
|
5005 | self.specGraphCebCrossSpectraplot.setCheckState(0) | |
5001 | self.specGraphCebRTIplot.setCheckState(0) |
|
5006 | self.specGraphCebRTIplot.setCheckState(0) | |
5002 | self.specGraphCebRTInoise.setCheckState(0) |
|
5007 | self.specGraphCebRTInoise.setCheckState(0) | |
5003 | self.specGraphCebCoherencmap.setCheckState(0) |
|
5008 | self.specGraphCebCoherencmap.setCheckState(0) | |
5004 | self.specGraphPowerprofile.setCheckState(0) |
|
5009 | self.specGraphPowerprofile.setCheckState(0) | |
5005 |
|
5010 | |||
5006 | self.specGraphSaveSpectra.setCheckState(0) |
|
5011 | self.specGraphSaveSpectra.setCheckState(0) | |
5007 | self.specGraphSaveCross.setCheckState(0) |
|
5012 | self.specGraphSaveCross.setCheckState(0) | |
5008 | self.specGraphSaveRTIplot.setCheckState(0) |
|
5013 | self.specGraphSaveRTIplot.setCheckState(0) | |
5009 | self.specGraphSaveRTInoise.setCheckState(0) |
|
5014 | self.specGraphSaveRTInoise.setCheckState(0) | |
5010 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
5015 | self.specGraphSaveCoherencemap.setCheckState(0) | |
5011 | self.specGraphSavePowerprofile.setCheckState(0) |
|
5016 | self.specGraphSavePowerprofile.setCheckState(0) | |
5012 |
|
5017 | |||
5013 | self.specGraphftpRTIplot.setCheckState(0) |
|
5018 | self.specGraphftpRTIplot.setCheckState(0) | |
5014 | self.specGraphftpRTInoise.setCheckState(0) |
|
5019 | self.specGraphftpRTInoise.setCheckState(0) | |
5015 | self.specGraphftpCoherencemap.setCheckState(0) |
|
5020 | self.specGraphftpCoherencemap.setCheckState(0) | |
5016 |
|
5021 | |||
5017 | self.specGraphPath.clear() |
|
5022 | self.specGraphPath.clear() | |
5018 | self.specGraphPrefix.clear() |
|
5023 | self.specGraphPrefix.clear() | |
5019 |
|
5024 | |||
5020 | self.specGgraphftpratio.clear() |
|
5025 | self.specGgraphftpratio.clear() | |
5021 |
|
5026 | |||
5022 | self.specGgraphChannelList.clear() |
|
5027 | self.specGgraphChannelList.clear() | |
5023 | self.specGgraphFreq.clear() |
|
5028 | self.specGgraphFreq.clear() | |
5024 | self.specGgraphHeight.clear() |
|
5029 | self.specGgraphHeight.clear() | |
5025 | self.specGgraphDbsrange.clear() |
|
5030 | self.specGgraphDbsrange.clear() | |
5026 | self.specGgraphmagnitud.clear() |
|
5031 | self.specGgraphmagnitud.clear() | |
5027 | self.specGgraphTminTmax.clear() |
|
5032 | self.specGgraphTminTmax.clear() | |
5028 | self.specGgraphTimeRange.clear() |
|
5033 | self.specGgraphTimeRange.clear() | |
5029 |
|
5034 | |||
5030 | if datatype == 'SpectraHeis': |
|
5035 | if datatype == 'SpectraHeis': | |
5031 | self.specHeisOpCebIncoherent.setCheckState(0) |
|
5036 | self.specHeisOpCebIncoherent.setCheckState(0) | |
5032 | self.specHeisOpIncoherent.setEnabled(False) |
|
5037 | self.specHeisOpIncoherent.setEnabled(False) | |
5033 | self.specHeisOpIncoherent.clear() |
|
5038 | self.specHeisOpIncoherent.clear() | |
5034 |
|
5039 | |||
5035 | self.specHeisGraphCebSpectraplot.setCheckState(0) |
|
5040 | self.specHeisGraphCebSpectraplot.setCheckState(0) | |
5036 | self.specHeisGraphCebRTIplot.setCheckState(0) |
|
5041 | self.specHeisGraphCebRTIplot.setCheckState(0) | |
5037 |
|
5042 | |||
5038 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
5043 | self.specHeisGraphSaveSpectra.setCheckState(0) | |
5039 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
5044 | self.specHeisGraphSaveRTIplot.setCheckState(0) | |
5040 |
|
5045 | |||
5041 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
5046 | self.specHeisGraphftpSpectra.setCheckState(0) | |
5042 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
5047 | self.specHeisGraphftpRTIplot.setCheckState(0) | |
5043 |
|
5048 | |||
5044 | self.specHeisGraphPath.clear() |
|
5049 | self.specHeisGraphPath.clear() | |
5045 | self.specHeisGraphPrefix.clear() |
|
5050 | self.specHeisGraphPrefix.clear() | |
5046 | self.specHeisGgraphChannelList.clear() |
|
5051 | self.specHeisGgraphChannelList.clear() | |
5047 | self.specHeisGgraphXminXmax.clear() |
|
5052 | self.specHeisGgraphXminXmax.clear() | |
5048 | self.specHeisGgraphYminYmax.clear() |
|
5053 | self.specHeisGgraphYminYmax.clear() | |
5049 | self.specHeisGgraphTminTmax.clear() |
|
5054 | self.specHeisGgraphTminTmax.clear() | |
5050 | self.specHeisGgraphTimeRange.clear() |
|
5055 | self.specHeisGgraphTimeRange.clear() | |
5051 | self.specHeisGgraphftpratio.clear() |
|
5056 | self.specHeisGgraphftpratio.clear() | |
5052 |
|
5057 | |||
5053 | def showtabPUCreated(self, datatype): |
|
5058 | def showtabPUCreated(self, datatype): | |
5054 |
|
5059 | |||
5055 | if datatype == "Voltage": |
|
5060 | if datatype == "Voltage": | |
5056 | self.tabVoltage.setEnabled(True) |
|
5061 | self.tabVoltage.setEnabled(True) | |
5057 | self.tabProject.setEnabled(False) |
|
5062 | self.tabProject.setEnabled(False) | |
5058 | self.tabSpectra.setEnabled(False) |
|
5063 | self.tabSpectra.setEnabled(False) | |
5059 | self.tabCorrelation.setEnabled(False) |
|
5064 | self.tabCorrelation.setEnabled(False) | |
5060 | self.tabSpectraHeis.setEnabled(False) |
|
5065 | self.tabSpectraHeis.setEnabled(False) | |
5061 | self.tabWidgetProject.setCurrentWidget(self.tabVoltage) |
|
5066 | self.tabWidgetProject.setCurrentWidget(self.tabVoltage) | |
5062 |
|
5067 | |||
5063 | if datatype == "Spectra": |
|
5068 | if datatype == "Spectra": | |
5064 | self.tabVoltage.setEnabled(False) |
|
5069 | self.tabVoltage.setEnabled(False) | |
5065 | self.tabProject.setEnabled(False) |
|
5070 | self.tabProject.setEnabled(False) | |
5066 | self.tabSpectra.setEnabled(True) |
|
5071 | self.tabSpectra.setEnabled(True) | |
5067 | self.tabCorrelation.setEnabled(False) |
|
5072 | self.tabCorrelation.setEnabled(False) | |
5068 | self.tabSpectraHeis.setEnabled(False) |
|
5073 | self.tabSpectraHeis.setEnabled(False) | |
5069 | self.tabWidgetProject.setCurrentWidget(self.tabSpectra) |
|
5074 | self.tabWidgetProject.setCurrentWidget(self.tabSpectra) | |
5070 |
|
5075 | |||
5071 | if datatype == "SpectraHeis": |
|
5076 | if datatype == "SpectraHeis": | |
5072 | self.tabVoltage.setEnabled(False) |
|
5077 | self.tabVoltage.setEnabled(False) | |
5073 | self.tabProject.setEnabled(False) |
|
5078 | self.tabProject.setEnabled(False) | |
5074 | self.tabSpectra.setEnabled(False) |
|
5079 | self.tabSpectra.setEnabled(False) | |
5075 | self.tabCorrelation.setEnabled(False) |
|
5080 | self.tabCorrelation.setEnabled(False) | |
5076 | self.tabSpectraHeis.setEnabled(True) |
|
5081 | self.tabSpectraHeis.setEnabled(True) | |
5077 | self.tabWidgetProject.setCurrentWidget(self.tabSpectraHeis) |
|
5082 | self.tabWidgetProject.setCurrentWidget(self.tabSpectraHeis) | |
5078 |
|
5083 | |||
5079 | def checkInputsProject(self): |
|
5084 | def checkInputsProject(self): | |
5080 | """ |
|
5085 | """ | |
5081 | Check Inputs Project: |
|
5086 | Check Inputs Project: | |
5082 | - project_name |
|
5087 | - project_name | |
5083 | - datatype |
|
5088 | - datatype | |
5084 | - ext |
|
5089 | - ext | |
5085 | - data_path |
|
5090 | - data_path | |
5086 | - readmode |
|
5091 | - readmode | |
5087 | - delay |
|
5092 | - delay | |
5088 | - set |
|
5093 | - set | |
5089 | - walk |
|
5094 | - walk | |
5090 | """ |
|
5095 | """ | |
5091 | parms_ok = True |
|
5096 | parms_ok = True | |
5092 | project_name = str(self.proName.text()) |
|
5097 | project_name = str(self.proName.text()) | |
5093 | if project_name == '' or project_name == None: |
|
5098 | if project_name == '' or project_name == None: | |
5094 | outputstr = "Enter the Project Name" |
|
5099 | outputstr = "Enter the Project Name" | |
5095 | self.console.append(outputstr) |
|
5100 | self.console.append(outputstr) | |
5096 | parms_ok = False |
|
5101 | parms_ok = False | |
5097 | project_name = None |
|
5102 | project_name = None | |
5098 |
|
5103 | |||
5099 | datatype = str(self.proComDataType.currentText()) |
|
5104 | datatype = str(self.proComDataType.currentText()) | |
5100 | if not(datatype in ['Voltage', 'Spectra', 'Fits', 'USRP']): |
|
5105 | if not(datatype in ['Voltage', 'Spectra', 'Fits', 'USRP']): | |
5101 | outputstr = 'datatype = %s, this must be either Voltage, Spectra, SpectraHeis or USRP' % datatype |
|
5106 | outputstr = 'datatype = %s, this must be either Voltage, Spectra, SpectraHeis or USRP' % datatype | |
5102 | self.console.append(outputstr) |
|
5107 | self.console.append(outputstr) | |
5103 | parms_ok = False |
|
5108 | parms_ok = False | |
5104 | datatype = None |
|
5109 | datatype = None | |
5105 |
|
5110 | |||
5106 | ext = str(self.proDataType.text()) |
|
5111 | ext = str(self.proDataType.text()) | |
5107 | if not(ext in ['.r', '.pdata', '.fits', '.hdf5']): |
|
5112 | if not(ext in ['.r', '.pdata', '.fits', '.hdf5']): | |
5108 | outputstr = "extension files must be .r , .pdata, .fits or .hdf5" |
|
5113 | outputstr = "extension files must be .r , .pdata, .fits or .hdf5" | |
5109 | self.console.append(outputstr) |
|
5114 | self.console.append(outputstr) | |
5110 | parms_ok = False |
|
5115 | parms_ok = False | |
5111 | ext = None |
|
5116 | ext = None | |
5112 |
|
5117 | |||
5113 | data_path = str(self.proDataPath.text()) |
|
5118 | data_path = str(self.proDataPath.text()) | |
5114 |
|
5119 | |||
5115 | if data_path == '': |
|
5120 | if data_path == '': | |
5116 | outputstr = 'Datapath is empty' |
|
5121 | outputstr = 'Datapath is empty' | |
5117 | self.console.append(outputstr) |
|
5122 | self.console.append(outputstr) | |
5118 | parms_ok = False |
|
5123 | parms_ok = False | |
5119 | data_path = None |
|
5124 | data_path = None | |
5120 |
|
5125 | |||
5121 | if data_path != None: |
|
5126 | if data_path != None: | |
5122 | if not os.path.isdir(data_path): |
|
5127 | if not os.path.isdir(data_path): | |
5123 | outputstr = 'Datapath:%s does not exists' % data_path |
|
5128 | outputstr = 'Datapath:%s does not exists' % data_path | |
5124 | self.console.append(outputstr) |
|
5129 | self.console.append(outputstr) | |
5125 | parms_ok = False |
|
5130 | parms_ok = False | |
5126 | data_path = None |
|
5131 | data_path = None | |
5127 |
|
5132 | |||
5128 | read_mode = str(self.proComReadMode.currentText()) |
|
5133 | read_mode = str(self.proComReadMode.currentText()) | |
5129 | if not(read_mode in ['Online', 'Offline']): |
|
5134 | if not(read_mode in ['Online', 'Offline']): | |
5130 | outputstr = 'Read Mode: %s, this must be either Online or Offline' % read_mode |
|
5135 | outputstr = 'Read Mode: %s, this must be either Online or Offline' % read_mode | |
5131 | self.console.append(outputstr) |
|
5136 | self.console.append(outputstr) | |
5132 | parms_ok = False |
|
5137 | parms_ok = False | |
5133 | read_mode = None |
|
5138 | read_mode = None | |
5134 |
|
5139 | |||
5135 | delay = None |
|
5140 | delay = None | |
5136 | if read_mode == "Online": |
|
5141 | if read_mode == "Online": | |
5137 | parms_ok = False |
|
5142 | parms_ok = False | |
5138 | try: |
|
5143 | try: | |
5139 | delay = int(str(self.proDelay.text())) |
|
5144 | delay = int(str(self.proDelay.text())) | |
5140 | parms_ok = True |
|
5145 | parms_ok = True | |
5141 | except: |
|
5146 | except: | |
5142 | outputstr = 'Delay: %s, this must be a integer number' % str(self.proDelay.text()) |
|
5147 | outputstr = 'Delay: %s, this must be a integer number' % str(self.proDelay.text()) | |
5143 | self.console.append(outputstr) |
|
5148 | self.console.append(outputstr) | |
5144 |
|
5149 | |||
5145 | try: |
|
5150 | try: | |
5146 | set = int(str(self.proSet.text())) |
|
5151 | set = int(str(self.proSet.text())) | |
5147 | except: |
|
5152 | except: | |
5148 | # outputstr = 'Set: %s, this must be a integer number' % str(self.proName.text()) |
|
5153 | # outputstr = 'Set: %s, this must be a integer number' % str(self.proName.text()) | |
5149 | # self.console.append(outputstr) |
|
5154 | # self.console.append(outputstr) | |
5150 | # parms_ok = False |
|
5155 | # parms_ok = False | |
5151 | set = None |
|
5156 | set = None | |
5152 |
|
5157 | |||
5153 | walk = int(self.proComWalk.currentIndex()) |
|
5158 | walk = int(self.proComWalk.currentIndex()) | |
5154 | expLabel = str(self.proExpLabel.text()) |
|
5159 | expLabel = str(self.proExpLabel.text()) | |
5155 |
|
5160 | |||
5156 | return parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set, expLabel |
|
5161 | return parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set, expLabel | |
5157 |
|
5162 | |||
5158 | def checkInputsPUSave(self, datatype): |
|
5163 | def checkInputsPUSave(self, datatype): | |
5159 | """ |
|
5164 | """ | |
5160 | Check Inputs Spectra Save: |
|
5165 | Check Inputs Spectra Save: | |
5161 | - path |
|
5166 | - path | |
5162 | - blocks Per File |
|
5167 | - blocks Per File | |
5163 | - sufix |
|
5168 | - sufix | |
5164 | - dataformat |
|
5169 | - dataformat | |
5165 | """ |
|
5170 | """ | |
5166 | parms_ok = True |
|
5171 | parms_ok = True | |
5167 |
|
5172 | |||
5168 | if datatype == "Voltage": |
|
5173 | if datatype == "Voltage": | |
5169 | output_path = str(self.volOutputPath.text()) |
|
5174 | output_path = str(self.volOutputPath.text()) | |
5170 | blocksperfile = str(self.volOutputblocksperfile.text()) |
|
5175 | blocksperfile = str(self.volOutputblocksperfile.text()) | |
5171 | profilesperblock = str(self.volOutputprofilesperblock.text()) |
|
5176 | profilesperblock = str(self.volOutputprofilesperblock.text()) | |
5172 |
|
5177 | |||
5173 | if datatype == "Spectra": |
|
5178 | if datatype == "Spectra": | |
5174 | output_path = str(self.specOutputPath.text()) |
|
5179 | output_path = str(self.specOutputPath.text()) | |
5175 | blocksperfile = str(self.specOutputblocksperfile.text()) |
|
5180 | blocksperfile = str(self.specOutputblocksperfile.text()) | |
5176 | profilesperblock = 0 |
|
5181 | profilesperblock = 0 | |
5177 |
|
5182 | |||
5178 | if datatype == "SpectraHeis": |
|
5183 | if datatype == "SpectraHeis": | |
5179 | output_path = str(self.specHeisOutputPath.text()) |
|
5184 | output_path = str(self.specHeisOutputPath.text()) | |
5180 | blocksperfile = str(self.specHeisOutputblocksperfile.text()) |
|
5185 | blocksperfile = str(self.specHeisOutputblocksperfile.text()) | |
5181 | metada = str(self.specHeisOutputMetada.text()) |
|
5186 | metadata_file = str(self.specHeisOutputMetada.text()) | |
5182 |
|
5187 | |||
5183 | if output_path == '': |
|
5188 | if output_path == '': | |
5184 | outputstr = 'Outputpath is empty' |
|
5189 | outputstr = 'Outputpath is empty' | |
5185 | self.console.append(outputstr) |
|
5190 | self.console.append(outputstr) | |
5186 | parms_ok = False |
|
5191 | parms_ok = False | |
5187 | data_path = None |
|
|||
5188 |
|
||||
5189 | if output_path != None: |
|
|||
5190 | if not os.path.exists(output_path): |
|
|||
5191 | outputstr = 'OutputPath:%s does not exists' % output_path |
|
|||
5192 | self.console.append(outputstr) |
|
|||
5193 | parms_ok = False |
|
|||
5194 | output_path = None |
|
|||
5195 |
|
5192 | |||
|
5193 | if not os.path.isdir(output_path): | |||
|
5194 | outputstr = 'OutputPath:%s does not exists' % output_path | |||
|
5195 | self.console.append(outputstr) | |||
|
5196 | parms_ok = False | |||
5196 |
|
5197 | |||
5197 | try: |
|
5198 | try: | |
5198 | profilesperblock = int(profilesperblock) |
|
5199 | profilesperblock = int(profilesperblock) | |
5199 | except: |
|
5200 | except: | |
5200 | if datatype == "Voltage": |
|
5201 | if datatype == "Voltage": | |
5201 | outputstr = 'Profilesperblock: %s, this must be a integer number' % str(self.volOutputprofilesperblock.text()) |
|
5202 | outputstr = 'Profilesperblock: %s, this must be a integer number' % str(self.volOutputprofilesperblock.text()) | |
5202 | self.console.append(outputstr) |
|
5203 | self.console.append(outputstr) | |
5203 | parms_ok = False |
|
5204 | parms_ok = False | |
5204 | profilesperblock = None |
|
5205 | profilesperblock = None | |
5205 |
|
5206 | |||
5206 | try: |
|
5207 | try: | |
5207 | blocksperfile = int(blocksperfile) |
|
5208 | blocksperfile = int(blocksperfile) | |
5208 | except: |
|
5209 | except: | |
5209 | if datatype == "Voltage": |
|
5210 | if datatype == "Voltage": | |
5210 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.volOutputblocksperfile.text()) |
|
5211 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.volOutputblocksperfile.text()) | |
5211 | elif datatype == "Spectra": |
|
5212 | elif datatype == "Spectra": | |
5212 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.specOutputblocksperfile.text()) |
|
5213 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.specOutputblocksperfile.text()) | |
5213 | elif datatype == "SpectraHeis": |
|
5214 | elif datatype == "SpectraHeis": | |
5214 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.specHeisOutputblocksperfile.text()) |
|
5215 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.specHeisOutputblocksperfile.text()) | |
5215 |
|
5216 | |||
5216 | self.console.append(outputstr) |
|
5217 | self.console.append(outputstr) | |
5217 | parms_ok = False |
|
5218 | parms_ok = False | |
5218 | blocksperfile = None |
|
5219 | blocksperfile = None | |
5219 |
|
5220 | |||
5220 | if datatype == "SpectraHeis": |
|
5221 | if datatype == "SpectraHeis": | |
5221 |
if metada |
|
5222 | if metadata_file != '': | |
5222 |
|
|
5223 | if not os.path.isfile(metadata_file): | |
5223 | self.console.append(outputstr) |
|
5224 | outputstr = 'Metadata file %s does not exist' % metadata_file | |
5224 | parms_ok = False |
|
|||
5225 | if metada != None: |
|
|||
5226 | if not os.path.isfile(metada): |
|
|||
5227 | outputstr = 'Metadata:%s does not exists' % metada |
|
|||
5228 | self.console.append(outputstr) |
|
5225 | self.console.append(outputstr) | |
5229 | parms_ok = False |
|
5226 | parms_ok = False | |
5230 | output_path = None |
|
|||
5231 |
|
5227 | |||
5232 | if datatype == "Voltage": |
|
5228 | if datatype == "Voltage": | |
5233 | return parms_ok, output_path, blocksperfile, profilesperblock |
|
5229 | return parms_ok, output_path, blocksperfile, profilesperblock | |
5234 |
|
5230 | |||
5235 |
|
5231 | |||
5236 | if datatype == "Spectra": |
|
5232 | if datatype == "Spectra": | |
5237 | return parms_ok, output_path, blocksperfile, profilesperblock |
|
5233 | return parms_ok, output_path, blocksperfile, profilesperblock | |
5238 |
|
5234 | |||
5239 |
|
5235 | |||
5240 | if datatype == "SpectraHeis": |
|
5236 | if datatype == "SpectraHeis": | |
5241 | return parms_ok, output_path, blocksperfile, metada |
|
5237 | return parms_ok, output_path, blocksperfile, metadata_file | |
5242 |
|
5238 | |||
5243 | def findDatafiles(self, data_path, ext, walk, expLabel=''): |
|
5239 | def findDatafiles(self, data_path, ext, walk, expLabel=''): | |
5244 |
|
5240 | |||
5245 | dateList = [] |
|
5241 | dateList = [] | |
5246 | fileList = [] |
|
5242 | fileList = [] | |
5247 |
|
5243 | |||
5248 | if ext == ".r": |
|
5244 | if ext == ".r": | |
5249 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5245 | from schainpy.model.io.jroIO_base import JRODataReader | |
5250 |
|
5246 | |||
5251 | readerObj = JRODataReader() |
|
5247 | readerObj = JRODataReader() | |
5252 | dateList = readerObj.findDatafiles(path=data_path, |
|
5248 | dateList = readerObj.findDatafiles(path=data_path, | |
5253 | expLabel=expLabel, |
|
5249 | expLabel=expLabel, | |
5254 | ext=ext, |
|
5250 | ext=ext, | |
5255 | walk=walk) |
|
5251 | walk=walk) | |
5256 |
|
5252 | |||
5257 | if ext == ".pdata": |
|
5253 | if ext == ".pdata": | |
5258 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5254 | from schainpy.model.io.jroIO_base import JRODataReader | |
5259 |
|
5255 | |||
5260 | readerObj = JRODataReader() |
|
5256 | readerObj = JRODataReader() | |
5261 | dateList = readerObj.findDatafiles(path=data_path, |
|
5257 | dateList = readerObj.findDatafiles(path=data_path, | |
5262 | expLabel=expLabel, |
|
5258 | expLabel=expLabel, | |
5263 | ext=ext, |
|
5259 | ext=ext, | |
5264 | walk=walk) |
|
5260 | walk=walk) | |
5265 |
|
5261 | |||
5266 | if ext == ".fits": |
|
5262 | if ext == ".fits": | |
5267 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5263 | from schainpy.model.io.jroIO_base import JRODataReader | |
5268 |
|
5264 | |||
5269 | readerObj = JRODataReader() |
|
5265 | readerObj = JRODataReader() | |
5270 | dateList = readerObj.findDatafiles(path=data_path, |
|
5266 | dateList = readerObj.findDatafiles(path=data_path, | |
5271 | expLabel=expLabel, |
|
5267 | expLabel=expLabel, | |
5272 | ext=ext, |
|
5268 | ext=ext, | |
5273 | walk=walk) |
|
5269 | walk=walk) | |
5274 |
|
5270 | |||
5275 | if ext == ".hdf5": |
|
5271 | if ext == ".hdf5": | |
5276 | from schainpy.model.io.jroIO_usrp import USRPReader |
|
5272 | from schainpy.model.io.jroIO_usrp import USRPReader | |
5277 |
|
5273 | |||
5278 | readerObj = USRPReader() |
|
5274 | readerObj = USRPReader() | |
5279 | dateList = readerObj.findDatafiles(path=data_path) |
|
5275 | dateList = readerObj.findDatafiles(path=data_path) | |
5280 |
|
5276 | |||
5281 | return dateList |
|
5277 | return dateList | |
5282 |
|
5278 | |||
5283 | def loadDays(self, data_path, ext, walk, expLabel=''): |
|
5279 | def loadDays(self, data_path, ext, walk, expLabel=''): | |
5284 | """ |
|
5280 | """ | |
5285 | Method to loads day |
|
5281 | Method to loads day | |
5286 | """ |
|
5282 | """ | |
5287 | self.proOk.setEnabled(False) |
|
5283 | self.proOk.setEnabled(False) | |
5288 | self.proComStartDate.clear() |
|
5284 | self.proComStartDate.clear() | |
5289 | self.proComEndDate.clear() |
|
5285 | self.proComEndDate.clear() | |
5290 |
|
5286 | |||
5291 | self.dateList = [] |
|
5287 | self.dateList = [] | |
5292 |
|
5288 | |||
5293 | if not os.path.isdir(data_path): |
|
5289 | if not os.path.isdir(data_path): | |
5294 | return |
|
5290 | return | |
5295 |
|
5291 | |||
5296 | self.dataPath = data_path |
|
5292 | self.dataPath = data_path | |
5297 |
|
5293 | |||
5298 | dateList = self.findDatafiles(data_path, ext=ext, walk=walk, expLabel=expLabel) |
|
5294 | dateList = self.findDatafiles(data_path, ext=ext, walk=walk, expLabel=expLabel) | |
5299 |
|
5295 | |||
5300 | if not dateList: |
|
5296 | if not dateList: | |
5301 | # self.console.clear() |
|
5297 | # self.console.clear() | |
5302 | if walk: |
|
5298 | if walk: | |
5303 | if expLabel: |
|
5299 | if expLabel: | |
5304 | outputstr = "No files (*%s) were found on %s/DOYPATH/%s" % (ext, data_path, expLabel) |
|
5300 | outputstr = "No files (*%s) were found on %s/DOYPATH/%s" % (ext, data_path, expLabel) | |
5305 | else: |
|
5301 | else: | |
5306 | outputstr = "No files (*%s) were found on %s" % (ext, data_path) |
|
5302 | outputstr = "No files (*%s) were found on %s" % (ext, data_path) | |
5307 | else: |
|
5303 | else: | |
5308 | outputstr = "No files (*%s) were found on %s" % (ext, data_path) |
|
5304 | outputstr = "No files (*%s) were found on %s" % (ext, data_path) | |
5309 |
|
5305 | |||
5310 | self.console.append(outputstr) |
|
5306 | self.console.append(outputstr) | |
5311 | return |
|
5307 | return | |
5312 |
|
5308 | |||
5313 | dateStrList = [] |
|
5309 | dateStrList = [] | |
5314 | for thisDate in dateList: |
|
5310 | for thisDate in dateList: | |
5315 | dateStr = thisDate.strftime("%Y/%m/%d") |
|
5311 | dateStr = thisDate.strftime("%Y/%m/%d") | |
5316 |
|
5312 | |||
5317 | self.proComStartDate.addItem(dateStr) |
|
5313 | self.proComStartDate.addItem(dateStr) | |
5318 | self.proComEndDate.addItem(dateStr) |
|
5314 | self.proComEndDate.addItem(dateStr) | |
5319 | dateStrList.append(dateStr) |
|
5315 | dateStrList.append(dateStr) | |
5320 |
|
5316 | |||
5321 | self.proComStartDate.setCurrentIndex(0) |
|
5317 | self.proComStartDate.setCurrentIndex(0) | |
5322 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - 1) |
|
5318 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - 1) | |
5323 |
|
5319 | |||
5324 | self.dateList = dateStrList |
|
5320 | self.dateList = dateStrList | |
5325 | self.proOk.setEnabled(True) |
|
5321 | self.proOk.setEnabled(True) | |
5326 |
|
5322 | |||
5327 | self.console.clear() |
|
5323 | self.console.clear() | |
5328 | self.console.append("Successful load") |
|
5324 | self.console.append("Successful load") | |
5329 |
|
5325 | |||
5330 | return self.dateList |
|
5326 | return self.dateList | |
5331 |
|
5327 | |||
5332 | def setWorkSpaceGUI(self, pathWorkSpace=None): |
|
5328 | def setWorkSpaceGUI(self, pathWorkSpace=None): | |
5333 |
|
5329 | |||
5334 | if pathWorkSpace == None: |
|
5330 | if pathWorkSpace == None: | |
5335 | home = os.path.expanduser("~") |
|
5331 | home = os.path.expanduser("~") | |
5336 | pathWorkSpace = os.path.join(home,'schain_workspace') |
|
5332 | pathWorkSpace = os.path.join(home,'schain_workspace') | |
5337 |
|
5333 | |||
5338 | self.pathWorkSpace = pathWorkSpace |
|
5334 | self.pathWorkSpace = pathWorkSpace | |
5339 |
|
5335 | |||
5340 | """ |
|
5336 | """ | |
5341 | Comandos Usados en Console |
|
5337 | Comandos Usados en Console | |
5342 | """ |
|
5338 | """ | |
5343 | def __del__(self): |
|
5339 | def __del__(self): | |
5344 | sys.stdout = sys.__stdout__ |
|
5340 | sys.stdout = sys.__stdout__ | |
5345 | sys.stderr = sys.__stderr__ |
|
5341 | sys.stderr = sys.__stderr__ | |
5346 |
|
5342 | |||
5347 | def normalOutputWritten(self, text): |
|
5343 | def normalOutputWritten(self, text): | |
5348 | color_black = QtGui.QColor(0,0,0) |
|
5344 | color_black = QtGui.QColor(0,0,0) | |
5349 | self.console.setTextColor(color_black) |
|
5345 | self.console.setTextColor(color_black) | |
5350 | self.console.append(text) |
|
5346 | self.console.append(text) | |
5351 |
|
5347 | |||
5352 | def errorOutputWritten(self, text): |
|
5348 | def errorOutputWritten(self, text): | |
5353 | color_red = QtGui.QColor(255,0,0) |
|
5349 | color_red = QtGui.QColor(255,0,0) | |
5354 | color_black = QtGui.QColor(0,0,0) |
|
5350 | color_black = QtGui.QColor(0,0,0) | |
5355 |
|
5351 | |||
5356 | self.console.setTextColor(color_red) |
|
5352 | self.console.setTextColor(color_red) | |
5357 | self.console.append(text) |
|
5353 | self.console.append(text) | |
5358 | self.console.setTextColor(color_black) |
|
5354 | self.console.setTextColor(color_black) | |
5359 |
|
5355 | |||
5360 | def setGUIStatus(self): |
|
5356 | def setGUIStatus(self): | |
5361 |
|
5357 | |||
5362 | self.setWindowTitle("ROJ-Signal Chain") |
|
5358 | self.setWindowTitle("ROJ-Signal Chain") | |
5363 | self.setWindowIcon(QtGui.QIcon( os.path.join(FIGURES_PATH,"adn.jpg") )) |
|
5359 | self.setWindowIcon(QtGui.QIcon( os.path.join(FIGURES_PATH,"adn.jpg") )) | |
5364 |
|
5360 | |||
5365 | self.tabWidgetProject.setEnabled(False) |
|
5361 | self.tabWidgetProject.setEnabled(False) | |
5366 | self.tabVoltage.setEnabled(False) |
|
5362 | self.tabVoltage.setEnabled(False) | |
5367 | self.tabSpectra.setEnabled(False) |
|
5363 | self.tabSpectra.setEnabled(False) | |
5368 | self.tabCorrelation.setEnabled(False) |
|
5364 | self.tabCorrelation.setEnabled(False) | |
5369 | self.frame_2.setEnabled(False) |
|
5365 | self.frame_2.setEnabled(False) | |
5370 |
|
5366 | |||
5371 | self.actionCreate.setShortcut('Ctrl+N') |
|
5367 | self.actionCreate.setShortcut('Ctrl+N') | |
5372 | self.actionOpen.setShortcut('Ctrl+O') |
|
5368 | self.actionOpen.setShortcut('Ctrl+O') | |
5373 | self.actionSave.setShortcut('Ctrl+S') |
|
5369 | self.actionSave.setShortcut('Ctrl+S') | |
5374 | self.actionClose.setShortcut('Ctrl+X') |
|
5370 | self.actionClose.setShortcut('Ctrl+X') | |
5375 |
|
5371 | |||
5376 | self.actionStart.setShortcut('Ctrl+1') |
|
5372 | self.actionStart.setShortcut('Ctrl+1') | |
5377 | self.actionPause.setShortcut('Ctrl+2') |
|
5373 | self.actionPause.setShortcut('Ctrl+2') | |
5378 | self.actionStop.setShortcut('Ctrl+3') |
|
5374 | self.actionStop.setShortcut('Ctrl+3') | |
5379 |
|
5375 | |||
5380 | self.actionFTP.setShortcut('Ctrl+F') |
|
5376 | self.actionFTP.setShortcut('Ctrl+F') | |
5381 |
|
5377 | |||
5382 | self.actionStart.setEnabled(False) |
|
5378 | self.actionStart.setEnabled(False) | |
5383 | self.actionPause.setEnabled(False) |
|
5379 | self.actionPause.setEnabled(False) | |
5384 | self.actionStop.setEnabled(False) |
|
5380 | self.actionStop.setEnabled(False) | |
5385 |
|
5381 | |||
5386 | self.actionStarToolbar.setEnabled(False) |
|
5382 | self.actionStarToolbar.setEnabled(False) | |
5387 | self.actionPauseToolbar.setEnabled(False) |
|
5383 | self.actionPauseToolbar.setEnabled(False) | |
5388 | self.actionStopToolbar.setEnabled(False) |
|
5384 | self.actionStopToolbar.setEnabled(False) | |
5389 |
|
5385 | |||
5390 | self.proName.clear() |
|
5386 | self.proName.clear() | |
5391 | self.proDataPath.setText('') |
|
5387 | self.proDataPath.setText('') | |
5392 | self.console.setReadOnly(True) |
|
5388 | self.console.setReadOnly(True) | |
5393 | self.console.append("Welcome to Signal Chain\nOpen a project or Create a new one") |
|
5389 | self.console.append("Welcome to Signal Chain\nOpen a project or Create a new one") | |
5394 | self.proStartTime.setDisplayFormat("hh:mm:ss") |
|
5390 | self.proStartTime.setDisplayFormat("hh:mm:ss") | |
5395 | self.proDataType.setEnabled(False) |
|
5391 | self.proDataType.setEnabled(False) | |
5396 | self.time = QtCore.QTime() |
|
5392 | self.time = QtCore.QTime() | |
5397 | self.hour = 0 |
|
5393 | self.hour = 0 | |
5398 | self.min = 0 |
|
5394 | self.min = 0 | |
5399 | self.sec = 0 |
|
5395 | self.sec = 0 | |
5400 | self.proEndTime.setDisplayFormat("hh:mm:ss") |
|
5396 | self.proEndTime.setDisplayFormat("hh:mm:ss") | |
5401 | startTime = "00:00:00" |
|
5397 | startTime = "00:00:00" | |
5402 | endTime = "23:59:59" |
|
5398 | endTime = "23:59:59" | |
5403 | starlist = startTime.split(":") |
|
5399 | starlist = startTime.split(":") | |
5404 | endlist = endTime.split(":") |
|
5400 | endlist = endTime.split(":") | |
5405 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) |
|
5401 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) | |
5406 | self.proStartTime.setTime(self.time) |
|
5402 | self.proStartTime.setTime(self.time) | |
5407 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
5403 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) | |
5408 | self.proEndTime.setTime(self.time) |
|
5404 | self.proEndTime.setTime(self.time) | |
5409 | self.proOk.setEnabled(False) |
|
5405 | self.proOk.setEnabled(False) | |
5410 | # set model Project Explorer |
|
5406 | # set model Project Explorer | |
5411 | self.projectExplorerModel = QtGui.QStandardItemModel() |
|
5407 | self.projectExplorerModel = QtGui.QStandardItemModel() | |
5412 | self.projectExplorerModel.setHorizontalHeaderLabels(("Project Explorer",)) |
|
5408 | self.projectExplorerModel.setHorizontalHeaderLabels(("Project Explorer",)) | |
5413 | layout = QtGui.QVBoxLayout() |
|
5409 | layout = QtGui.QVBoxLayout() | |
5414 | layout.addWidget(self.projectExplorerTree) |
|
5410 | layout.addWidget(self.projectExplorerTree) | |
5415 | self.projectExplorerTree.setModel(self.projectExplorerModel) |
|
5411 | self.projectExplorerTree.setModel(self.projectExplorerModel) | |
5416 | self.projectExplorerTree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) |
|
5412 | self.projectExplorerTree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) | |
5417 | self.projectExplorerTree.customContextMenuRequested.connect(self.on_right_click) |
|
5413 | self.projectExplorerTree.customContextMenuRequested.connect(self.on_right_click) | |
5418 | self.projectExplorerTree.clicked.connect(self.on_click) |
|
5414 | self.projectExplorerTree.clicked.connect(self.on_click) | |
5419 | self.projectExplorerTree.expandAll() |
|
5415 | self.projectExplorerTree.expandAll() | |
5420 | # set model Project Properties |
|
5416 | # set model Project Properties | |
5421 |
|
5417 | |||
5422 | self.propertiesModel = TreeModel() |
|
5418 | self.propertiesModel = TreeModel() | |
5423 | self.propertiesModel.initProjectView() |
|
5419 | self.propertiesModel.initProjectView() | |
5424 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
5420 | self.treeProjectProperties.setModel(self.propertiesModel) | |
5425 | self.treeProjectProperties.expandAll() |
|
5421 | self.treeProjectProperties.expandAll() | |
5426 | self.treeProjectProperties.allColumnsShowFocus() |
|
5422 | self.treeProjectProperties.allColumnsShowFocus() | |
5427 | self.treeProjectProperties.resizeColumnToContents(1) |
|
5423 | self.treeProjectProperties.resizeColumnToContents(1) | |
5428 |
|
5424 | |||
5429 | # set Project |
|
5425 | # set Project | |
5430 | self.proExpLabel.setEnabled(True) |
|
5426 | self.proExpLabel.setEnabled(True) | |
5431 | self.proDelay.setEnabled(False) |
|
5427 | self.proDelay.setEnabled(False) | |
5432 | self.proSet.setEnabled(True) |
|
5428 | self.proSet.setEnabled(True) | |
5433 | self.proDataType.setReadOnly(True) |
|
5429 | self.proDataType.setReadOnly(True) | |
5434 |
|
5430 | |||
5435 | # set Operation Voltage |
|
5431 | # set Operation Voltage | |
5436 | self.volOpComChannels.setEnabled(False) |
|
5432 | self.volOpComChannels.setEnabled(False) | |
5437 | self.volOpComHeights.setEnabled(False) |
|
5433 | self.volOpComHeights.setEnabled(False) | |
5438 | self.volOpFilter.setEnabled(False) |
|
5434 | self.volOpFilter.setEnabled(False) | |
5439 | self.volOpComProfile.setEnabled(False) |
|
5435 | self.volOpComProfile.setEnabled(False) | |
5440 | self.volOpComCode.setEnabled(False) |
|
5436 | self.volOpComCode.setEnabled(False) | |
5441 | self.volOpFlip.setEnabled(False) |
|
5437 | self.volOpFlip.setEnabled(False) | |
5442 | self.volOpCohInt.setEnabled(False) |
|
5438 | self.volOpCohInt.setEnabled(False) | |
5443 | self.volOpRadarfrequency.setEnabled(False) |
|
5439 | self.volOpRadarfrequency.setEnabled(False) | |
5444 |
|
5440 | |||
5445 | self.volOpChannel.setEnabled(False) |
|
5441 | self.volOpChannel.setEnabled(False) | |
5446 | self.volOpHeights.setEnabled(False) |
|
5442 | self.volOpHeights.setEnabled(False) | |
5447 | self.volOpProfile.setEnabled(False) |
|
5443 | self.volOpProfile.setEnabled(False) | |
5448 | self.volOpComMode.setEnabled(False) |
|
5444 | self.volOpComMode.setEnabled(False) | |
5449 |
|
5445 | |||
5450 | self.volGraphPath.setEnabled(False) |
|
5446 | self.volGraphPath.setEnabled(False) | |
5451 | self.volGraphPrefix.setEnabled(False) |
|
5447 | self.volGraphPrefix.setEnabled(False) | |
5452 | self.volGraphToolPath.setEnabled(False) |
|
5448 | self.volGraphToolPath.setEnabled(False) | |
5453 |
|
5449 | |||
5454 | # set Graph Voltage |
|
5450 | # set Graph Voltage | |
5455 | self.volGraphChannelList.setEnabled(False) |
|
5451 | self.volGraphChannelList.setEnabled(False) | |
5456 | self.volGraphfreqrange.setEnabled(False) |
|
5452 | self.volGraphfreqrange.setEnabled(False) | |
5457 | self.volGraphHeightrange.setEnabled(False) |
|
5453 | self.volGraphHeightrange.setEnabled(False) | |
5458 |
|
5454 | |||
5459 | # set Operation Spectra |
|
5455 | # set Operation Spectra | |
5460 | self.specOpnFFTpoints.setEnabled(False) |
|
5456 | self.specOpnFFTpoints.setEnabled(False) | |
5461 | self.specOpProfiles.setEnabled(False) |
|
5457 | self.specOpProfiles.setEnabled(False) | |
5462 | self.specOpippFactor.setEnabled(False) |
|
5458 | self.specOpippFactor.setEnabled(False) | |
5463 | self.specOppairsList.setEnabled(False) |
|
5459 | self.specOppairsList.setEnabled(False) | |
5464 | self.specOpComChannel.setEnabled(False) |
|
5460 | self.specOpComChannel.setEnabled(False) | |
5465 | self.specOpComHeights.setEnabled(False) |
|
5461 | self.specOpComHeights.setEnabled(False) | |
5466 | self.specOpIncoherent.setEnabled(False) |
|
5462 | self.specOpIncoherent.setEnabled(False) | |
5467 | self.specOpgetNoise.setEnabled(False) |
|
5463 | self.specOpgetNoise.setEnabled(False) | |
5468 | self.specOpRadarfrequency.setEnabled(False) |
|
5464 | self.specOpRadarfrequency.setEnabled(False) | |
5469 |
|
5465 | |||
5470 |
|
5466 | |||
5471 | self.specOpChannel.setEnabled(False) |
|
5467 | self.specOpChannel.setEnabled(False) | |
5472 | self.specOpHeights.setEnabled(False) |
|
5468 | self.specOpHeights.setEnabled(False) | |
5473 | # set Graph Spectra |
|
5469 | # set Graph Spectra | |
5474 | self.specGgraphChannelList.setEnabled(False) |
|
5470 | self.specGgraphChannelList.setEnabled(False) | |
5475 | self.specGgraphFreq.setEnabled(False) |
|
5471 | self.specGgraphFreq.setEnabled(False) | |
5476 | self.specGgraphHeight.setEnabled(False) |
|
5472 | self.specGgraphHeight.setEnabled(False) | |
5477 | self.specGgraphDbsrange.setEnabled(False) |
|
5473 | self.specGgraphDbsrange.setEnabled(False) | |
5478 | self.specGgraphmagnitud.setEnabled(False) |
|
5474 | self.specGgraphmagnitud.setEnabled(False) | |
5479 | self.specGgraphTminTmax.setEnabled(False) |
|
5475 | self.specGgraphTminTmax.setEnabled(False) | |
5480 | self.specGgraphTimeRange.setEnabled(False) |
|
5476 | self.specGgraphTimeRange.setEnabled(False) | |
5481 | self.specGraphPath.setEnabled(False) |
|
5477 | self.specGraphPath.setEnabled(False) | |
5482 | self.specGraphToolPath.setEnabled(False) |
|
5478 | self.specGraphToolPath.setEnabled(False) | |
5483 | self.specGraphPrefix.setEnabled(False) |
|
5479 | self.specGraphPrefix.setEnabled(False) | |
5484 |
|
5480 | |||
5485 | self.specGgraphftpratio.setEnabled(False) |
|
5481 | self.specGgraphftpratio.setEnabled(False) | |
5486 | # set Operation SpectraHeis |
|
5482 | # set Operation SpectraHeis | |
5487 | self.specHeisOpIncoherent.setEnabled(False) |
|
5483 | self.specHeisOpIncoherent.setEnabled(False) | |
5488 | self.specHeisOpCobIncInt.setEnabled(False) |
|
5484 | self.specHeisOpCobIncInt.setEnabled(False) | |
5489 | # set Graph SpectraHeis |
|
5485 | # set Graph SpectraHeis | |
5490 | self.specHeisGgraphChannelList.setEnabled(False) |
|
5486 | self.specHeisGgraphChannelList.setEnabled(False) | |
5491 | self.specHeisGgraphXminXmax.setEnabled(False) |
|
5487 | self.specHeisGgraphXminXmax.setEnabled(False) | |
5492 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
5488 | self.specHeisGgraphYminYmax.setEnabled(False) | |
5493 | self.specHeisGgraphTminTmax.setEnabled(False) |
|
5489 | self.specHeisGgraphTminTmax.setEnabled(False) | |
5494 | self.specHeisGgraphTimeRange.setEnabled(False) |
|
5490 | self.specHeisGgraphTimeRange.setEnabled(False) | |
5495 | self.specHeisGgraphftpratio.setEnabled(False) |
|
5491 | self.specHeisGgraphftpratio.setEnabled(False) | |
5496 | self.specHeisGraphPath.setEnabled(False) |
|
5492 | self.specHeisGraphPath.setEnabled(False) | |
5497 | self.specHeisGraphPrefix.setEnabled(False) |
|
5493 | self.specHeisGraphPrefix.setEnabled(False) | |
5498 | self.specHeisGraphToolPath.setEnabled(False) |
|
5494 | self.specHeisGraphToolPath.setEnabled(False) | |
5499 |
|
5495 | |||
5500 |
|
5496 | |||
5501 | # tool tip gui |
|
5497 | # tool tip gui | |
5502 | QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10)) |
|
5498 | QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10)) | |
5503 | self.projectExplorerTree.setToolTip('Right clik to add Project or Unit Process') |
|
5499 | self.projectExplorerTree.setToolTip('Right clik to add Project or Unit Process') | |
5504 | # tool tip gui project |
|
5500 | # tool tip gui project | |
5505 | self.proComWalk.setToolTip('<b>On Files</b>:<i>Search file in format .r or pdata</i> <b>On Folders</b>:<i>Search file in a directory DYYYYDOY</i>') |
|
5501 | self.proComWalk.setToolTip('<b>On Files</b>:<i>Search file in format .r or pdata</i> <b>On Folders</b>:<i>Search file in a directory DYYYYDOY</i>') | |
5506 | self.proComWalk.setCurrentIndex(0) |
|
5502 | self.proComWalk.setCurrentIndex(0) | |
5507 | # tool tip gui volOp |
|
5503 | # tool tip gui volOp | |
5508 | self.volOpChannel.setToolTip('Example: 1,2,3,4,5') |
|
5504 | self.volOpChannel.setToolTip('Example: 1,2,3,4,5') | |
5509 | self.volOpHeights.setToolTip('Example: 90,180') |
|
5505 | self.volOpHeights.setToolTip('Example: 90,180') | |
5510 | self.volOpFilter.setToolTip('Example: 2') |
|
5506 | self.volOpFilter.setToolTip('Example: 2') | |
5511 | self.volOpProfile.setToolTip('Example:0,127') |
|
5507 | self.volOpProfile.setToolTip('Example:0,127') | |
5512 | self.volOpCohInt.setToolTip('Example: 128') |
|
5508 | self.volOpCohInt.setToolTip('Example: 128') | |
5513 | self.volOpFlip.setToolTip('ChannelList where flip will be applied. Example: 0,2,3') |
|
5509 | self.volOpFlip.setToolTip('ChannelList where flip will be applied. Example: 0,2,3') | |
5514 | self.volOpOk.setToolTip('If you have finished, please Ok ') |
|
5510 | self.volOpOk.setToolTip('If you have finished, please Ok ') | |
5515 | # tool tip gui volGraph |
|
5511 | # tool tip gui volGraph | |
5516 | self.volGraphfreqrange.setToolTip('Height range. Example: 50,100') |
|
5512 | self.volGraphfreqrange.setToolTip('Height range. Example: 50,100') | |
5517 | self.volGraphHeightrange.setToolTip('Amplitude. Example: 0,10000') |
|
5513 | self.volGraphHeightrange.setToolTip('Amplitude. Example: 0,10000') | |
5518 | # tool tip gui specOp |
|
5514 | # tool tip gui specOp | |
5519 | self.specOpnFFTpoints.setToolTip('Example: 128') |
|
5515 | self.specOpnFFTpoints.setToolTip('Example: 128') | |
5520 | self.specOpProfiles.setToolTip('Example: 128') |
|
5516 | self.specOpProfiles.setToolTip('Example: 128') | |
5521 | self.specOpippFactor.setToolTip('Example:1.0') |
|
5517 | self.specOpippFactor.setToolTip('Example:1.0') | |
5522 | self.specOpIncoherent.setToolTip('Example: 10') |
|
5518 | self.specOpIncoherent.setToolTip('Example: 10') | |
5523 | self.specOpgetNoise.setToolTip('Example:20,180,30,120 (minHei,maxHei,minVel,maxVel)') |
|
5519 | self.specOpgetNoise.setToolTip('Example:20,180,30,120 (minHei,maxHei,minVel,maxVel)') | |
5524 |
|
5520 | |||
5525 | self.specOpChannel.setToolTip('Example: 0,1,2,3') |
|
5521 | self.specOpChannel.setToolTip('Example: 0,1,2,3') | |
5526 | self.specOpHeights.setToolTip('Example: 90,180') |
|
5522 | self.specOpHeights.setToolTip('Example: 90,180') | |
5527 | self.specOppairsList.setToolTip('Example: (0,1),(2,3)') |
|
5523 | self.specOppairsList.setToolTip('Example: (0,1),(2,3)') | |
5528 | # tool tip gui specGraph |
|
5524 | # tool tip gui specGraph | |
5529 |
|
5525 | |||
5530 | self.specGgraphChannelList.setToolTip('Example: 0,3,4') |
|
5526 | self.specGgraphChannelList.setToolTip('Example: 0,3,4') | |
5531 | self.specGgraphFreq.setToolTip('Example: -20,20') |
|
5527 | self.specGgraphFreq.setToolTip('Example: -20,20') | |
5532 | self.specGgraphHeight.setToolTip('Example: 100,400') |
|
5528 | self.specGgraphHeight.setToolTip('Example: 100,400') | |
5533 | self.specGgraphDbsrange.setToolTip('Example: 30,170') |
|
5529 | self.specGgraphDbsrange.setToolTip('Example: 30,170') | |
5534 |
|
5530 | |||
5535 | self.specGraphPrefix.setToolTip('Example: EXPERIMENT_NAME') |
|
5531 | self.specGraphPrefix.setToolTip('Example: EXPERIMENT_NAME') | |
5536 |
|
5532 | |||
5537 |
|
5533 | |||
5538 | self.specHeisOpIncoherent.setToolTip('Example: 10') |
|
5534 | self.specHeisOpIncoherent.setToolTip('Example: 10') | |
5539 |
|
5535 | |||
5540 | self.specHeisGgraphChannelList.setToolTip('Example: 0,2,3') |
|
5536 | self.specHeisGgraphChannelList.setToolTip('Example: 0,2,3') | |
5541 | self.specHeisGgraphXminXmax.setToolTip('Example (Hz): -1000, 1000') |
|
5537 | self.specHeisGgraphXminXmax.setToolTip('Example (Hz): -1000, 1000') | |
5542 | self.specHeisGgraphYminYmax.setToolTip('Example (dB): 5, 35') |
|
5538 | self.specHeisGgraphYminYmax.setToolTip('Example (dB): 5, 35') | |
5543 | self.specHeisGgraphTminTmax.setToolTip('Example (hours): 0, 24') |
|
5539 | self.specHeisGgraphTminTmax.setToolTip('Example (hours): 0, 24') | |
5544 | self.specHeisGgraphTimeRange.setToolTip('Example (hours): 8') |
|
5540 | self.specHeisGgraphTimeRange.setToolTip('Example (hours): 8') | |
5545 |
|
5541 | |||
5546 | self.labelSet.show() |
|
5542 | self.labelSet.show() | |
5547 | self.proSet.show() |
|
5543 | self.proSet.show() | |
5548 |
|
5544 | |||
5549 | self.labelIPPKm.hide() |
|
5545 | self.labelIPPKm.hide() | |
5550 | self.proIPPKm.hide() |
|
5546 | self.proIPPKm.hide() | |
5551 |
|
5547 | |||
5552 | sys.stdout = ShowMeConsole(textWritten=self.normalOutputWritten) |
|
5548 | sys.stdout = ShowMeConsole(textWritten=self.normalOutputWritten) | |
5553 | # sys.stderr = ShowMeConsole(textWritten=self.errorOutputWritten) |
|
5549 | # sys.stderr = ShowMeConsole(textWritten=self.errorOutputWritten) | |
5554 |
|
5550 | |||
5555 |
|
5551 | |||
5556 | class UnitProcessWindow(QMainWindow, Ui_UnitProcess): |
|
5552 | class UnitProcessWindow(QMainWindow, Ui_UnitProcess): | |
5557 | """ |
|
5553 | """ | |
5558 | Class documentation goes here. |
|
5554 | Class documentation goes here. | |
5559 | """ |
|
5555 | """ | |
5560 | closed = pyqtSignal() |
|
5556 | closed = pyqtSignal() | |
5561 | create = False |
|
5557 | create = False | |
5562 |
|
5558 | |||
5563 | def __init__(self, parent=None): |
|
5559 | def __init__(self, parent=None): | |
5564 | """ |
|
5560 | """ | |
5565 | Constructor |
|
5561 | Constructor | |
5566 | """ |
|
5562 | """ | |
5567 | QMainWindow.__init__(self, parent) |
|
5563 | QMainWindow.__init__(self, parent) | |
5568 | self.setupUi(self) |
|
5564 | self.setupUi(self) | |
5569 | self.getFromWindow = None |
|
5565 | self.getFromWindow = None | |
5570 | self.getfromWindowList = [] |
|
5566 | self.getfromWindowList = [] | |
5571 | self.dataTypeProject = None |
|
5567 | self.dataTypeProject = None | |
5572 |
|
5568 | |||
5573 | self.listUP = None |
|
5569 | self.listUP = None | |
5574 |
|
5570 | |||
5575 | @pyqtSignature("") |
|
5571 | @pyqtSignature("") | |
5576 | def on_unitPokbut_clicked(self): |
|
5572 | def on_unitPokbut_clicked(self): | |
5577 | """ |
|
5573 | """ | |
5578 | Slot documentation goes here. |
|
5574 | Slot documentation goes here. | |
5579 | """ |
|
5575 | """ | |
5580 | self.create = True |
|
5576 | self.create = True | |
5581 | self.getFromWindow = self.getfromWindowList[int(self.comboInputBox.currentIndex())] |
|
5577 | self.getFromWindow = self.getfromWindowList[int(self.comboInputBox.currentIndex())] | |
5582 | # self.nameofUP= str(self.nameUptxt.text()) |
|
5578 | # self.nameofUP= str(self.nameUptxt.text()) | |
5583 | self.typeofUP = str(self.comboTypeBox.currentText()) |
|
5579 | self.typeofUP = str(self.comboTypeBox.currentText()) | |
5584 | self.close() |
|
5580 | self.close() | |
5585 |
|
5581 | |||
5586 |
|
5582 | |||
5587 | @pyqtSignature("") |
|
5583 | @pyqtSignature("") | |
5588 | def on_unitPcancelbut_clicked(self): |
|
5584 | def on_unitPcancelbut_clicked(self): | |
5589 | """ |
|
5585 | """ | |
5590 | Slot documentation goes here. |
|
5586 | Slot documentation goes here. | |
5591 | """ |
|
5587 | """ | |
5592 | self.create = False |
|
5588 | self.create = False | |
5593 | self.close() |
|
5589 | self.close() | |
5594 |
|
5590 | |||
5595 | def loadTotalList(self): |
|
5591 | def loadTotalList(self): | |
5596 | self.comboInputBox.clear() |
|
5592 | self.comboInputBox.clear() | |
5597 | for i in self.getfromWindowList: |
|
5593 | for i in self.getfromWindowList: | |
5598 |
|
5594 | |||
5599 | name = i.getElementName() |
|
5595 | name = i.getElementName() | |
5600 | if name == 'Project': |
|
5596 | if name == 'Project': | |
5601 | id = i.id |
|
5597 | id = i.id | |
5602 | name = i.name |
|
5598 | name = i.name | |
5603 | if self.dataTypeProject == 'Voltage': |
|
5599 | if self.dataTypeProject == 'Voltage': | |
5604 | self.comboTypeBox.clear() |
|
5600 | self.comboTypeBox.clear() | |
5605 | self.comboTypeBox.addItem("Voltage") |
|
5601 | self.comboTypeBox.addItem("Voltage") | |
5606 |
|
5602 | |||
5607 | if self.dataTypeProject == 'Spectra': |
|
5603 | if self.dataTypeProject == 'Spectra': | |
5608 | self.comboTypeBox.clear() |
|
5604 | self.comboTypeBox.clear() | |
5609 | self.comboTypeBox.addItem("Spectra") |
|
5605 | self.comboTypeBox.addItem("Spectra") | |
5610 | self.comboTypeBox.addItem("Correlation") |
|
5606 | self.comboTypeBox.addItem("Correlation") | |
5611 | if self.dataTypeProject == 'Fits': |
|
5607 | if self.dataTypeProject == 'Fits': | |
5612 | self.comboTypeBox.clear() |
|
5608 | self.comboTypeBox.clear() | |
5613 | self.comboTypeBox.addItem("SpectraHeis") |
|
5609 | self.comboTypeBox.addItem("SpectraHeis") | |
5614 |
|
5610 | |||
5615 |
|
5611 | |||
5616 | if name == 'ProcUnit': |
|
5612 | if name == 'ProcUnit': | |
5617 | id = int(i.id) - 1 |
|
5613 | id = int(i.id) - 1 | |
5618 | name = i.datatype |
|
5614 | name = i.datatype | |
5619 | if name == 'Voltage': |
|
5615 | if name == 'Voltage': | |
5620 | self.comboTypeBox.clear() |
|
5616 | self.comboTypeBox.clear() | |
5621 | self.comboTypeBox.addItem("Spectra") |
|
5617 | self.comboTypeBox.addItem("Spectra") | |
5622 | self.comboTypeBox.addItem("SpectraHeis") |
|
5618 | self.comboTypeBox.addItem("SpectraHeis") | |
5623 | self.comboTypeBox.addItem("Correlation") |
|
5619 | self.comboTypeBox.addItem("Correlation") | |
5624 | if name == 'Spectra': |
|
5620 | if name == 'Spectra': | |
5625 | self.comboTypeBox.clear() |
|
5621 | self.comboTypeBox.clear() | |
5626 | self.comboTypeBox.addItem("Spectra") |
|
5622 | self.comboTypeBox.addItem("Spectra") | |
5627 | self.comboTypeBox.addItem("SpectraHeis") |
|
5623 | self.comboTypeBox.addItem("SpectraHeis") | |
5628 | self.comboTypeBox.addItem("Correlation") |
|
5624 | self.comboTypeBox.addItem("Correlation") | |
5629 | if name == 'SpectraHeis': |
|
5625 | if name == 'SpectraHeis': | |
5630 | self.comboTypeBox.clear() |
|
5626 | self.comboTypeBox.clear() | |
5631 | self.comboTypeBox.addItem("SpectraHeis") |
|
5627 | self.comboTypeBox.addItem("SpectraHeis") | |
5632 |
|
5628 | |||
5633 | self.comboInputBox.addItem(str(name)) |
|
5629 | self.comboInputBox.addItem(str(name)) | |
5634 | # self.comboInputBox.addItem(str(name)+str(id)) |
|
5630 | # self.comboInputBox.addItem(str(name)+str(id)) | |
5635 |
|
5631 | |||
5636 | def closeEvent(self, event): |
|
5632 | def closeEvent(self, event): | |
5637 | self.closed.emit() |
|
5633 | self.closed.emit() | |
5638 | event.accept() |
|
5634 | event.accept() | |
5639 |
|
5635 | |||
5640 | class Ftp(QMainWindow, Ui_Ftp): |
|
5636 | class Ftp(QMainWindow, Ui_Ftp): | |
5641 | """ |
|
5637 | """ | |
5642 | Class documentation goes here. |
|
5638 | Class documentation goes here. | |
5643 | """ |
|
5639 | """ | |
5644 | create = False |
|
5640 | create = False | |
5645 | closed = pyqtSignal() |
|
5641 | closed = pyqtSignal() | |
5646 | server = None |
|
5642 | server = None | |
5647 | remotefolder = None |
|
5643 | remotefolder = None | |
5648 | username = None |
|
5644 | username = None | |
5649 | password = None |
|
5645 | password = None | |
5650 | ftp_wei = None |
|
5646 | ftp_wei = None | |
5651 | exp_code = None |
|
5647 | exp_code = None | |
5652 | sub_exp_code = None |
|
5648 | sub_exp_code = None | |
5653 | plot_pos = None |
|
5649 | plot_pos = None | |
5654 |
|
5650 | |||
5655 | def __init__(self, parent=None): |
|
5651 | def __init__(self, parent=None): | |
5656 | """ |
|
5652 | """ | |
5657 | Constructor |
|
5653 | Constructor | |
5658 | """ |
|
5654 | """ | |
5659 | QMainWindow.__init__(self, parent) |
|
5655 | QMainWindow.__init__(self, parent) | |
5660 | self.setupUi(self) |
|
5656 | self.setupUi(self) | |
5661 | self.setGUIStatus() |
|
5657 | self.setGUIStatus() | |
5662 |
|
5658 | |||
5663 | def setGUIStatus(self): |
|
5659 | def setGUIStatus(self): | |
5664 | self.setWindowTitle("ROJ-Signal Chain") |
|
5660 | self.setWindowTitle("ROJ-Signal Chain") | |
5665 | self.serverFTP.setToolTip('Example: jro-app.igp.gob.pe') |
|
5661 | self.serverFTP.setToolTip('Example: jro-app.igp.gob.pe') | |
5666 | self.folderFTP.setToolTip('Example: /home/wmaster/graficos') |
|
5662 | self.folderFTP.setToolTip('Example: /home/wmaster/graficos') | |
5667 | self.usernameFTP.setToolTip('Example: myusername') |
|
5663 | self.usernameFTP.setToolTip('Example: myusername') | |
5668 | self.passwordFTP.setToolTip('Example: mypass ') |
|
5664 | self.passwordFTP.setToolTip('Example: mypass ') | |
5669 | self.weightFTP.setToolTip('Example: 0') |
|
5665 | self.weightFTP.setToolTip('Example: 0') | |
5670 | self.expcodeFTP.setToolTip('Example: 0') |
|
5666 | self.expcodeFTP.setToolTip('Example: 0') | |
5671 | self.subexpFTP.setToolTip('Example: 0') |
|
5667 | self.subexpFTP.setToolTip('Example: 0') | |
5672 | self.plotposFTP.setToolTip('Example: 0') |
|
5668 | self.plotposFTP.setToolTip('Example: 0') | |
5673 |
|
5669 | |||
5674 | def setParmsfromTemporal(self, server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos): |
|
5670 | def setParmsfromTemporal(self, server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos): | |
5675 | self.serverFTP.setText(str(server)) |
|
5671 | self.serverFTP.setText(str(server)) | |
5676 | self.folderFTP.setText(str(remotefolder)) |
|
5672 | self.folderFTP.setText(str(remotefolder)) | |
5677 | self.usernameFTP.setText(str(username)) |
|
5673 | self.usernameFTP.setText(str(username)) | |
5678 | self.passwordFTP.setText(str(password)) |
|
5674 | self.passwordFTP.setText(str(password)) | |
5679 | self.weightFTP.setText(str(ftp_wei)) |
|
5675 | self.weightFTP.setText(str(ftp_wei)) | |
5680 | self.expcodeFTP.setText(str(exp_code)) |
|
5676 | self.expcodeFTP.setText(str(exp_code)) | |
5681 | self.subexpFTP.setText(str(sub_exp_code)) |
|
5677 | self.subexpFTP.setText(str(sub_exp_code)) | |
5682 | self.plotposFTP.setText(str(plot_pos)) |
|
5678 | self.plotposFTP.setText(str(plot_pos)) | |
5683 |
|
5679 | |||
5684 | def getParmsFromFtpWindow(self): |
|
5680 | def getParmsFromFtpWindow(self): | |
5685 | """ |
|
5681 | """ | |
5686 | Return Inputs Project: |
|
5682 | Return Inputs Project: | |
5687 | - server |
|
5683 | - server | |
5688 | - remotefolder |
|
5684 | - remotefolder | |
5689 | - username |
|
5685 | - username | |
5690 | - password |
|
5686 | - password | |
5691 | - ftp_wei |
|
5687 | - ftp_wei | |
5692 | - exp_code |
|
5688 | - exp_code | |
5693 | - sub_exp_code |
|
5689 | - sub_exp_code | |
5694 | - plot_pos |
|
5690 | - plot_pos | |
5695 | """ |
|
5691 | """ | |
5696 | name_server_ftp = str(self.serverFTP.text()) |
|
5692 | name_server_ftp = str(self.serverFTP.text()) | |
5697 | if not name_server_ftp: |
|
5693 | if not name_server_ftp: | |
5698 | self.console.clear() |
|
5694 | self.console.clear() | |
5699 | self.console.append("Please Write a FTP Server") |
|
5695 | self.console.append("Please Write a FTP Server") | |
5700 | return 0 |
|
5696 | return 0 | |
5701 |
|
5697 | |||
5702 | folder_server_ftp = str(self.folderFTP.text()) |
|
5698 | folder_server_ftp = str(self.folderFTP.text()) | |
5703 | if not folder_server_ftp: |
|
5699 | if not folder_server_ftp: | |
5704 | self.console.clear() |
|
5700 | self.console.clear() | |
5705 | self.console.append("Please Write a Folder") |
|
5701 | self.console.append("Please Write a Folder") | |
5706 | return 0 |
|
5702 | return 0 | |
5707 |
|
5703 | |||
5708 | username_ftp = str(self.usernameFTP.text()) |
|
5704 | username_ftp = str(self.usernameFTP.text()) | |
5709 | if not username_ftp: |
|
5705 | if not username_ftp: | |
5710 | self.console.clear() |
|
5706 | self.console.clear() | |
5711 | self.console.append("Please Write a User Name") |
|
5707 | self.console.append("Please Write a User Name") | |
5712 | return 0 |
|
5708 | return 0 | |
5713 |
|
5709 | |||
5714 | password_ftp = str(self.passwordFTP.text()) |
|
5710 | password_ftp = str(self.passwordFTP.text()) | |
5715 | if not password_ftp: |
|
5711 | if not password_ftp: | |
5716 | self.console.clear() |
|
5712 | self.console.clear() | |
5717 | self.console.append("Please Write a passwordFTP") |
|
5713 | self.console.append("Please Write a passwordFTP") | |
5718 | return 0 |
|
5714 | return 0 | |
5719 |
|
5715 | |||
5720 | ftp_wei = str(self.weightFTP.text()) |
|
5716 | ftp_wei = str(self.weightFTP.text()) | |
5721 | if not ftp_wei == "": |
|
5717 | if not ftp_wei == "": | |
5722 | try: |
|
5718 | try: | |
5723 | ftp_wei = int(self.weightFTP.text()) |
|
5719 | ftp_wei = int(self.weightFTP.text()) | |
5724 | except: |
|
5720 | except: | |
5725 | self.console.clear() |
|
5721 | self.console.clear() | |
5726 | self.console.append("Please Write a ftp_wei number") |
|
5722 | self.console.append("Please Write a ftp_wei number") | |
5727 | return 0 |
|
5723 | return 0 | |
5728 |
|
5724 | |||
5729 | exp_code = str(self.expcodeFTP.text()) |
|
5725 | exp_code = str(self.expcodeFTP.text()) | |
5730 | if not exp_code == "": |
|
5726 | if not exp_code == "": | |
5731 | try: |
|
5727 | try: | |
5732 | exp_code = int(self.expcodeFTP.text()) |
|
5728 | exp_code = int(self.expcodeFTP.text()) | |
5733 | except: |
|
5729 | except: | |
5734 | self.console.clear() |
|
5730 | self.console.clear() | |
5735 | self.console.append("Please Write a exp_code number") |
|
5731 | self.console.append("Please Write a exp_code number") | |
5736 | return 0 |
|
5732 | return 0 | |
5737 |
|
5733 | |||
5738 |
|
5734 | |||
5739 | sub_exp_code = str(self.subexpFTP.text()) |
|
5735 | sub_exp_code = str(self.subexpFTP.text()) | |
5740 | if not sub_exp_code == "": |
|
5736 | if not sub_exp_code == "": | |
5741 | try: |
|
5737 | try: | |
5742 | sub_exp_code = int(self.subexpFTP.text()) |
|
5738 | sub_exp_code = int(self.subexpFTP.text()) | |
5743 | except: |
|
5739 | except: | |
5744 | self.console.clear() |
|
5740 | self.console.clear() | |
5745 | self.console.append("Please Write a sub_exp_code number") |
|
5741 | self.console.append("Please Write a sub_exp_code number") | |
5746 | return 0 |
|
5742 | return 0 | |
5747 |
|
5743 | |||
5748 | plot_pos = str(self.plotposFTP.text()) |
|
5744 | plot_pos = str(self.plotposFTP.text()) | |
5749 | if not plot_pos == "": |
|
5745 | if not plot_pos == "": | |
5750 | try: |
|
5746 | try: | |
5751 | plot_pos = int(self.plotposFTP.text()) |
|
5747 | plot_pos = int(self.plotposFTP.text()) | |
5752 | except: |
|
5748 | except: | |
5753 | self.console.clear() |
|
5749 | self.console.clear() | |
5754 | self.console.append("Please Write a plot_pos number") |
|
5750 | self.console.append("Please Write a plot_pos number") | |
5755 | return 0 |
|
5751 | return 0 | |
5756 |
|
5752 | |||
5757 | return name_server_ftp, folder_server_ftp, username_ftp, password_ftp, ftp_wei, exp_code, sub_exp_code, plot_pos |
|
5753 | return name_server_ftp, folder_server_ftp, username_ftp, password_ftp, ftp_wei, exp_code, sub_exp_code, plot_pos | |
5758 |
|
5754 | |||
5759 | @pyqtSignature("") |
|
5755 | @pyqtSignature("") | |
5760 | def on_ftpOkButton_clicked(self): |
|
5756 | def on_ftpOkButton_clicked(self): | |
5761 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.getParmsFromFtpWindow() |
|
5757 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.getParmsFromFtpWindow() | |
5762 | self.create = True |
|
5758 | self.create = True | |
5763 | self.close() |
|
5759 | self.close() | |
5764 |
|
5760 | |||
5765 | @pyqtSignature("") |
|
5761 | @pyqtSignature("") | |
5766 | def on_ftpCancelButton_clicked(self): |
|
5762 | def on_ftpCancelButton_clicked(self): | |
5767 | self.create = False |
|
5763 | self.create = False | |
5768 | self.close() |
|
5764 | self.close() | |
5769 |
|
5765 | |||
5770 | def closeEvent(self, event): |
|
5766 | def closeEvent(self, event): | |
5771 | self.closed.emit() |
|
5767 | self.closed.emit() | |
5772 | event.accept() |
|
5768 | event.accept() | |
5773 |
|
5769 | |||
5774 | class ftpBuffer(): |
|
5770 | class ftpBuffer(): | |
5775 |
|
5771 | |||
5776 | server = None |
|
5772 | server = None | |
5777 | remotefolder = None |
|
5773 | remotefolder = None | |
5778 | username = None |
|
5774 | username = None | |
5779 | password = None |
|
5775 | password = None | |
5780 | ftp_wei = None |
|
5776 | ftp_wei = None | |
5781 | exp_code = None |
|
5777 | exp_code = None | |
5782 | sub_exp_code = None |
|
5778 | sub_exp_code = None | |
5783 | plot_pos = None |
|
5779 | plot_pos = None | |
5784 | create = False |
|
5780 | create = False | |
5785 | withoutconfig = False |
|
5781 | withoutconfig = False | |
5786 | createforView = False |
|
5782 | createforView = False | |
5787 | localfolder = None |
|
5783 | localfolder = None | |
5788 | extension = None |
|
5784 | extension = None | |
5789 | period = None |
|
5785 | period = None | |
5790 | protocol = None |
|
5786 | protocol = None | |
5791 |
|
5787 | |||
5792 | def __init__(self): |
|
5788 | def __init__(self): | |
5793 |
|
5789 | |||
5794 | self.create = False |
|
5790 | self.create = False | |
5795 | self.server = None |
|
5791 | self.server = None | |
5796 | self.remotefolder = None |
|
5792 | self.remotefolder = None | |
5797 | self.username = None |
|
5793 | self.username = None | |
5798 | self.password = None |
|
5794 | self.password = None | |
5799 | self.ftp_wei = None |
|
5795 | self.ftp_wei = None | |
5800 | self.exp_code = None |
|
5796 | self.exp_code = None | |
5801 | self.sub_exp_code = None |
|
5797 | self.sub_exp_code = None | |
5802 | self.plot_pos = None |
|
5798 | self.plot_pos = None | |
5803 | # self.create = False |
|
5799 | # self.create = False | |
5804 | self.localfolder = None |
|
5800 | self.localfolder = None | |
5805 | self.extension = None |
|
5801 | self.extension = None | |
5806 | self.period = None |
|
5802 | self.period = None | |
5807 | self.protocol = None |
|
5803 | self.protocol = None | |
5808 |
|
5804 | |||
5809 | def setwithoutconfiguration(self): |
|
5805 | def setwithoutconfiguration(self): | |
5810 |
|
5806 | |||
5811 | self.create = False |
|
5807 | self.create = False | |
5812 | self.server = "jro-app.igp.gob.pe" |
|
5808 | self.server = "jro-app.igp.gob.pe" | |
5813 | self.remotefolder = "/home/wmaster/graficos" |
|
5809 | self.remotefolder = "/home/wmaster/graficos" | |
5814 | self.username = "wmaster" |
|
5810 | self.username = "wmaster" | |
5815 | self.password = "mst2010vhf" |
|
5811 | self.password = "mst2010vhf" | |
5816 | self.withoutconfig = True |
|
5812 | self.withoutconfig = True | |
5817 | self.localfolder = './' |
|
5813 | self.localfolder = './' | |
5818 | self.extension = '.png' |
|
5814 | self.extension = '.png' | |
5819 | self.period = 60 |
|
5815 | self.period = 60 | |
5820 | self.protocol = 'ftp' |
|
5816 | self.protocol = 'ftp' | |
5821 | self.createforView = True |
|
5817 | self.createforView = True | |
5822 |
|
5818 | |||
5823 | if not self.ftp_wei: |
|
5819 | if not self.ftp_wei: | |
5824 | self.ftp_wei = 0 |
|
5820 | self.ftp_wei = 0 | |
5825 |
|
5821 | |||
5826 | if not self.exp_code: |
|
5822 | if not self.exp_code: | |
5827 | self.exp_code = 0 |
|
5823 | self.exp_code = 0 | |
5828 |
|
5824 | |||
5829 | if not self.sub_exp_code: |
|
5825 | if not self.sub_exp_code: | |
5830 | self.sub_exp_code = 0 |
|
5826 | self.sub_exp_code = 0 | |
5831 |
|
5827 | |||
5832 | if not self.plot_pos: |
|
5828 | if not self.plot_pos: | |
5833 | self.plot_pos = 0 |
|
5829 | self.plot_pos = 0 | |
5834 |
|
5830 | |||
5835 | def save(self, server, remotefolder, username, password, ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, localfolder='./', extension='.png', period=60, protocol='ftp'): |
|
5831 | def save(self, server, remotefolder, username, password, ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, localfolder='./', extension='.png', period=60, protocol='ftp'): | |
5836 |
|
5832 | |||
5837 | self.server = server |
|
5833 | self.server = server | |
5838 | self.remotefolder = remotefolder |
|
5834 | self.remotefolder = remotefolder | |
5839 | self.username = username |
|
5835 | self.username = username | |
5840 | self.password = password |
|
5836 | self.password = password | |
5841 | self.ftp_wei = ftp_wei |
|
5837 | self.ftp_wei = ftp_wei | |
5842 | self.exp_code = exp_code |
|
5838 | self.exp_code = exp_code | |
5843 | self.sub_exp_code = sub_exp_code |
|
5839 | self.sub_exp_code = sub_exp_code | |
5844 | self.plot_pos = plot_pos |
|
5840 | self.plot_pos = plot_pos | |
5845 | self.create = True |
|
5841 | self.create = True | |
5846 | self.withoutconfig = False |
|
5842 | self.withoutconfig = False | |
5847 | self.createforView = True |
|
5843 | self.createforView = True | |
5848 | self.localfolder = localfolder |
|
5844 | self.localfolder = localfolder | |
5849 | self.extension = extension |
|
5845 | self.extension = extension | |
5850 | self.period = period |
|
5846 | self.period = period | |
5851 | self.protocol = protocol |
|
5847 | self.protocol = protocol | |
5852 |
|
5848 | |||
5853 | def recover(self): |
|
5849 | def recover(self): | |
5854 |
|
5850 | |||
5855 | return self.server, self.remotefolder, self.username, self.password, self.ftp_wei, self.exp_code, self.sub_exp_code, self.plot_pos, self.extension, self.period, self.protocol |
|
5851 | return self.server, self.remotefolder, self.username, self.password, self.ftp_wei, self.exp_code, self.sub_exp_code, self.plot_pos, self.extension, self.period, self.protocol | |
5856 |
|
5852 | |||
5857 | class ShowMeConsole(QtCore.QObject): |
|
5853 | class ShowMeConsole(QtCore.QObject): | |
5858 |
|
5854 | |||
5859 | textWritten = QtCore.pyqtSignal(str) |
|
5855 | textWritten = QtCore.pyqtSignal(str) | |
5860 |
|
5856 | |||
5861 | def write(self, text): |
|
5857 | def write(self, text): | |
5862 |
|
5858 | |||
5863 | if text[-1] == "\n": |
|
5859 | if text[-1] == "\n": | |
5864 | text = text[:-1] |
|
5860 | text = text[:-1] | |
5865 |
|
5861 | |||
5866 | self.textWritten.emit(str(text)) |
|
5862 | self.textWritten.emit(str(text)) |
@@ -1,240 +1,240 | |||||
1 | from PyQt4 import QtCore, QtGui |
|
1 | from PyQt4 import QtCore, QtGui | |
2 |
|
2 | |||
3 | try: |
|
3 | try: | |
4 | _fromUtf8 = QtCore.QString.fromUtf8 |
|
4 | _fromUtf8 = QtCore.QString.fromUtf8 | |
5 | except AttributeError: |
|
5 | except AttributeError: | |
6 | def _fromUtf8(s): |
|
6 | def _fromUtf8(s): | |
7 | return s |
|
7 | return s | |
8 |
|
8 | |||
9 | try: |
|
9 | try: | |
10 | _encoding = QtGui.QApplication.UnicodeUTF8 |
|
10 | _encoding = QtGui.QApplication.UnicodeUTF8 | |
11 | def _translate(context, text, disambig): |
|
11 | def _translate(context, text, disambig): | |
12 | return QtGui.QApplication.translate(context, text, disambig, _encoding) |
|
12 | return QtGui.QApplication.translate(context, text, disambig, _encoding) | |
13 | except AttributeError: |
|
13 | except AttributeError: | |
14 | def _translate(context, text, disambig): |
|
14 | def _translate(context, text, disambig): | |
15 | return QtGui.QApplication.translate(context, text, disambig) |
|
15 | return QtGui.QApplication.translate(context, text, disambig) | |
16 |
|
16 | |||
17 | class Ui_SpectraHeisTab(object): |
|
17 | class Ui_SpectraHeisTab(object): | |
18 |
|
18 | |||
19 | def setupUi(self): |
|
19 | def setupUi(self): | |
20 |
|
20 | |||
21 | self.tabSpectraHeis = QtGui.QWidget() |
|
21 | self.tabSpectraHeis = QtGui.QWidget() | |
22 | self.tabSpectraHeis.setObjectName(_fromUtf8("tabSpectraHeis")) |
|
22 | self.tabSpectraHeis.setObjectName(_fromUtf8("tabSpectraHeis")) | |
23 | self.gridLayout_23 = QtGui.QGridLayout(self.tabSpectraHeis) |
|
23 | self.gridLayout_23 = QtGui.QGridLayout(self.tabSpectraHeis) | |
24 | self.gridLayout_23.setObjectName(_fromUtf8("gridLayout_23")) |
|
24 | self.gridLayout_23.setObjectName(_fromUtf8("gridLayout_23")) | |
25 | self.frame_6 = QtGui.QFrame(self.tabSpectraHeis) |
|
25 | self.frame_6 = QtGui.QFrame(self.tabSpectraHeis) | |
26 | self.frame_6.setFrameShape(QtGui.QFrame.StyledPanel) |
|
26 | self.frame_6.setFrameShape(QtGui.QFrame.StyledPanel) | |
27 | self.frame_6.setFrameShadow(QtGui.QFrame.Raised) |
|
27 | self.frame_6.setFrameShadow(QtGui.QFrame.Raised) | |
28 | self.frame_6.setObjectName(_fromUtf8("frame_6")) |
|
28 | self.frame_6.setObjectName(_fromUtf8("frame_6")) | |
29 | self.gridLayout_22 = QtGui.QGridLayout(self.frame_6) |
|
29 | self.gridLayout_22 = QtGui.QGridLayout(self.frame_6) | |
30 | self.gridLayout_22.setObjectName(_fromUtf8("gridLayout_22")) |
|
30 | self.gridLayout_22.setObjectName(_fromUtf8("gridLayout_22")) | |
31 | self.specHeisGraphClear = QtGui.QPushButton(self.frame_6) |
|
31 | self.specHeisGraphClear = QtGui.QPushButton(self.frame_6) | |
32 | self.specHeisGraphClear.setObjectName(_fromUtf8("specHeisGraphClear")) |
|
32 | self.specHeisGraphClear.setObjectName(_fromUtf8("specHeisGraphClear")) | |
33 | self.gridLayout_22.addWidget(self.specHeisGraphClear, 0, 1, 1, 1) |
|
33 | self.gridLayout_22.addWidget(self.specHeisGraphClear, 0, 1, 1, 1) | |
34 | self.specHeisOpOk = QtGui.QPushButton(self.frame_6) |
|
34 | self.specHeisOpOk = QtGui.QPushButton(self.frame_6) | |
35 | self.specHeisOpOk.setObjectName(_fromUtf8("specHeisOpOk")) |
|
35 | self.specHeisOpOk.setObjectName(_fromUtf8("specHeisOpOk")) | |
36 | self.gridLayout_22.addWidget(self.specHeisOpOk, 0, 0, 1, 1) |
|
36 | self.gridLayout_22.addWidget(self.specHeisOpOk, 0, 0, 1, 1) | |
37 | self.gridLayout_23.addWidget(self.frame_6, 1, 0, 1, 1) |
|
37 | self.gridLayout_23.addWidget(self.frame_6, 1, 0, 1, 1) | |
38 | self.tabWidgetSpectraHeis = QtGui.QTabWidget(self.tabSpectraHeis) |
|
38 | self.tabWidgetSpectraHeis = QtGui.QTabWidget(self.tabSpectraHeis) | |
39 | self.tabWidgetSpectraHeis.setObjectName(_fromUtf8("tabWidgetSpectraHeis")) |
|
39 | self.tabWidgetSpectraHeis.setObjectName(_fromUtf8("tabWidgetSpectraHeis")) | |
40 | self.tabopSpectraHeis = QtGui.QWidget() |
|
40 | self.tabopSpectraHeis = QtGui.QWidget() | |
41 | self.tabopSpectraHeis.setObjectName(_fromUtf8("tabopSpectraHeis")) |
|
41 | self.tabopSpectraHeis.setObjectName(_fromUtf8("tabopSpectraHeis")) | |
42 | self.gridLayout_21 = QtGui.QGridLayout(self.tabopSpectraHeis) |
|
42 | self.gridLayout_21 = QtGui.QGridLayout(self.tabopSpectraHeis) | |
43 | self.gridLayout_21.setObjectName(_fromUtf8("gridLayout_21")) |
|
43 | self.gridLayout_21.setObjectName(_fromUtf8("gridLayout_21")) | |
44 | spacerItem21 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
44 | spacerItem21 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
45 | self.gridLayout_21.addItem(spacerItem21, 0, 1, 1, 1) |
|
45 | self.gridLayout_21.addItem(spacerItem21, 0, 1, 1, 1) | |
46 | self.specHeisOpCobIncInt = QtGui.QComboBox(self.tabopSpectraHeis) |
|
46 | self.specHeisOpCobIncInt = QtGui.QComboBox(self.tabopSpectraHeis) | |
47 | self.specHeisOpCobIncInt.setObjectName(_fromUtf8("specHeisOpCobIncInt")) |
|
47 | self.specHeisOpCobIncInt.setObjectName(_fromUtf8("specHeisOpCobIncInt")) | |
48 | self.specHeisOpCobIncInt.addItem(_fromUtf8("")) |
|
48 | self.specHeisOpCobIncInt.addItem(_fromUtf8("")) | |
49 | self.gridLayout_21.addWidget(self.specHeisOpCobIncInt, 1, 0, 1, 1) |
|
49 | self.gridLayout_21.addWidget(self.specHeisOpCobIncInt, 1, 0, 1, 1) | |
50 | self.specHeisOpCebIncoherent = QtGui.QCheckBox(self.tabopSpectraHeis) |
|
50 | self.specHeisOpCebIncoherent = QtGui.QCheckBox(self.tabopSpectraHeis) | |
51 | self.specHeisOpCebIncoherent.setObjectName(_fromUtf8("specHeisOpCebIncoherent")) |
|
51 | self.specHeisOpCebIncoherent.setObjectName(_fromUtf8("specHeisOpCebIncoherent")) | |
52 | self.gridLayout_21.addWidget(self.specHeisOpCebIncoherent, 0, 0, 1, 1) |
|
52 | self.gridLayout_21.addWidget(self.specHeisOpCebIncoherent, 0, 0, 1, 1) | |
53 | self.specHeisOpIncoherent = QtGui.QLineEdit(self.tabopSpectraHeis) |
|
53 | self.specHeisOpIncoherent = QtGui.QLineEdit(self.tabopSpectraHeis) | |
54 | self.specHeisOpIncoherent.setObjectName(_fromUtf8("specHeisOpIncoherent")) |
|
54 | self.specHeisOpIncoherent.setObjectName(_fromUtf8("specHeisOpIncoherent")) | |
55 | self.gridLayout_21.addWidget(self.specHeisOpIncoherent, 1, 1, 1, 1) |
|
55 | self.gridLayout_21.addWidget(self.specHeisOpIncoherent, 1, 1, 1, 1) | |
56 | spacerItem22 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) |
|
56 | spacerItem22 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) | |
57 | self.gridLayout_21.addItem(spacerItem22, 2, 0, 1, 1) |
|
57 | self.gridLayout_21.addItem(spacerItem22, 2, 0, 1, 1) | |
58 | self.tabWidgetSpectraHeis.addTab(self.tabopSpectraHeis, _fromUtf8("")) |
|
58 | self.tabWidgetSpectraHeis.addTab(self.tabopSpectraHeis, _fromUtf8("")) | |
59 | self.tabgraphSpectraHeis = QtGui.QWidget() |
|
59 | self.tabgraphSpectraHeis = QtGui.QWidget() | |
60 | self.tabgraphSpectraHeis.setObjectName(_fromUtf8("tabgraphSpectraHeis")) |
|
60 | self.tabgraphSpectraHeis.setObjectName(_fromUtf8("tabgraphSpectraHeis")) | |
61 | self.gridLayout_20 = QtGui.QGridLayout(self.tabgraphSpectraHeis) |
|
61 | self.gridLayout_20 = QtGui.QGridLayout(self.tabgraphSpectraHeis) | |
62 | self.gridLayout_20.setObjectName(_fromUtf8("gridLayout_20")) |
|
62 | self.gridLayout_20.setObjectName(_fromUtf8("gridLayout_20")) | |
63 | self.label_54 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
63 | self.label_54 = QtGui.QLabel(self.tabgraphSpectraHeis) | |
64 | self.label_54.setObjectName(_fromUtf8("label_54")) |
|
64 | self.label_54.setObjectName(_fromUtf8("label_54")) | |
65 | self.gridLayout_20.addWidget(self.label_54, 1, 0, 1, 1) |
|
65 | self.gridLayout_20.addWidget(self.label_54, 1, 0, 1, 1) | |
66 | self.specHeisGraphToolPath = QtGui.QToolButton(self.tabgraphSpectraHeis) |
|
66 | self.specHeisGraphToolPath = QtGui.QToolButton(self.tabgraphSpectraHeis) | |
67 | self.specHeisGraphToolPath.setObjectName(_fromUtf8("specHeisGraphToolPath")) |
|
67 | self.specHeisGraphToolPath.setObjectName(_fromUtf8("specHeisGraphToolPath")) | |
68 | self.gridLayout_20.addWidget(self.specHeisGraphToolPath, 0, 6, 1, 1) |
|
68 | self.gridLayout_20.addWidget(self.specHeisGraphToolPath, 0, 6, 1, 1) | |
69 | self.specHeisGraphCebRTIplot = QtGui.QCheckBox(self.tabgraphSpectraHeis) |
|
69 | self.specHeisGraphCebRTIplot = QtGui.QCheckBox(self.tabgraphSpectraHeis) | |
70 | self.specHeisGraphCebRTIplot.setText(_fromUtf8("")) |
|
70 | self.specHeisGraphCebRTIplot.setText(_fromUtf8("")) | |
71 | self.specHeisGraphCebRTIplot.setObjectName(_fromUtf8("specHeisGraphCebRTIplot")) |
|
71 | self.specHeisGraphCebRTIplot.setObjectName(_fromUtf8("specHeisGraphCebRTIplot")) | |
72 | self.gridLayout_20.addWidget(self.specHeisGraphCebRTIplot, 4, 2, 1, 1) |
|
72 | self.gridLayout_20.addWidget(self.specHeisGraphCebRTIplot, 4, 2, 1, 1) | |
73 | self.label_62 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
73 | self.label_62 = QtGui.QLabel(self.tabgraphSpectraHeis) | |
74 | self.label_62.setObjectName(_fromUtf8("label_62")) |
|
74 | self.label_62.setObjectName(_fromUtf8("label_62")) | |
75 | self.gridLayout_20.addWidget(self.label_62, 7, 0, 1, 1) |
|
75 | self.gridLayout_20.addWidget(self.label_62, 7, 0, 1, 1) | |
76 | self.label_63 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
76 | self.label_63 = QtGui.QLabel(self.tabgraphSpectraHeis) | |
77 | self.label_63.setObjectName(_fromUtf8("label_63")) |
|
77 | self.label_63.setObjectName(_fromUtf8("label_63")) | |
78 | self.gridLayout_20.addWidget(self.label_63, 8, 0, 1, 1) |
|
78 | self.gridLayout_20.addWidget(self.label_63, 8, 0, 1, 1) | |
79 | self.label_64 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
79 | self.label_64 = QtGui.QLabel(self.tabgraphSpectraHeis) | |
80 | self.label_64.setObjectName(_fromUtf8("label_64")) |
|
80 | self.label_64.setObjectName(_fromUtf8("label_64")) | |
81 | self.gridLayout_20.addWidget(self.label_64, 9, 0, 1, 1) |
|
81 | self.gridLayout_20.addWidget(self.label_64, 9, 0, 1, 1) | |
82 | self.label_65 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
82 | self.label_65 = QtGui.QLabel(self.tabgraphSpectraHeis) | |
83 | self.label_65.setObjectName(_fromUtf8("label_65")) |
|
83 | self.label_65.setObjectName(_fromUtf8("label_65")) | |
84 | self.gridLayout_20.addWidget(self.label_65, 10, 0, 1, 1) |
|
84 | self.gridLayout_20.addWidget(self.label_65, 10, 0, 1, 1) | |
85 | spacerItem23 = QtGui.QSpacerItem(134, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
85 | spacerItem23 = QtGui.QSpacerItem(134, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
86 | self.gridLayout_20.addItem(spacerItem23, 11, 0, 1, 2) |
|
86 | self.gridLayout_20.addItem(spacerItem23, 11, 0, 1, 2) | |
87 | self.specHeisGgraphftpratio = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
87 | self.specHeisGgraphftpratio = QtGui.QLineEdit(self.tabgraphSpectraHeis) | |
88 | self.specHeisGgraphftpratio.setObjectName(_fromUtf8("specHeisGgraphftpratio")) |
|
88 | self.specHeisGgraphftpratio.setObjectName(_fromUtf8("specHeisGgraphftpratio")) | |
89 | self.gridLayout_20.addWidget(self.specHeisGgraphftpratio, 10, 1, 1, 6) |
|
89 | self.gridLayout_20.addWidget(self.specHeisGgraphftpratio, 10, 1, 1, 6) | |
90 | self.specHeisGraphftpRTIplot = QtGui.QCheckBox(self.tabgraphSpectraHeis) |
|
90 | self.specHeisGraphftpRTIplot = QtGui.QCheckBox(self.tabgraphSpectraHeis) | |
91 | self.specHeisGraphftpRTIplot.setText(_fromUtf8("")) |
|
91 | self.specHeisGraphftpRTIplot.setText(_fromUtf8("")) | |
92 | self.specHeisGraphftpRTIplot.setObjectName(_fromUtf8("specHeisGraphftpRTIplot")) |
|
92 | self.specHeisGraphftpRTIplot.setObjectName(_fromUtf8("specHeisGraphftpRTIplot")) | |
93 | self.gridLayout_20.addWidget(self.specHeisGraphftpRTIplot, 4, 6, 1, 1) |
|
93 | self.gridLayout_20.addWidget(self.specHeisGraphftpRTIplot, 4, 6, 1, 1) | |
94 | self.specHeisGgraphTminTmax = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
94 | self.specHeisGgraphTminTmax = QtGui.QLineEdit(self.tabgraphSpectraHeis) | |
95 | self.specHeisGgraphTminTmax.setObjectName(_fromUtf8("specHeisGgraphTminTmax")) |
|
95 | self.specHeisGgraphTminTmax.setObjectName(_fromUtf8("specHeisGgraphTminTmax")) | |
96 | self.gridLayout_20.addWidget(self.specHeisGgraphTminTmax, 8, 1, 1, 6) |
|
96 | self.gridLayout_20.addWidget(self.specHeisGgraphTminTmax, 8, 1, 1, 6) | |
97 | self.label_60 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
97 | self.label_60 = QtGui.QLabel(self.tabgraphSpectraHeis) | |
98 | self.label_60.setObjectName(_fromUtf8("label_60")) |
|
98 | self.label_60.setObjectName(_fromUtf8("label_60")) | |
99 | self.gridLayout_20.addWidget(self.label_60, 5, 0, 1, 1) |
|
99 | self.gridLayout_20.addWidget(self.label_60, 5, 0, 1, 1) | |
100 | self.label_61 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
100 | self.label_61 = QtGui.QLabel(self.tabgraphSpectraHeis) | |
101 | self.label_61.setObjectName(_fromUtf8("label_61")) |
|
101 | self.label_61.setObjectName(_fromUtf8("label_61")) | |
102 | self.gridLayout_20.addWidget(self.label_61, 6, 0, 1, 1) |
|
102 | self.gridLayout_20.addWidget(self.label_61, 6, 0, 1, 1) | |
103 | self.specHeisGraphPrefix = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
103 | self.specHeisGraphPrefix = QtGui.QLineEdit(self.tabgraphSpectraHeis) | |
104 | self.specHeisGraphPrefix.setObjectName(_fromUtf8("specHeisGraphPrefix")) |
|
104 | self.specHeisGraphPrefix.setObjectName(_fromUtf8("specHeisGraphPrefix")) | |
105 | self.gridLayout_20.addWidget(self.specHeisGraphPrefix, 1, 1, 1, 6) |
|
105 | self.gridLayout_20.addWidget(self.specHeisGraphPrefix, 1, 1, 1, 6) | |
106 | self.label_56 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
106 | self.label_56 = QtGui.QLabel(self.tabgraphSpectraHeis) | |
107 | self.label_56.setObjectName(_fromUtf8("label_56")) |
|
107 | self.label_56.setObjectName(_fromUtf8("label_56")) | |
108 | self.gridLayout_20.addWidget(self.label_56, 2, 4, 1, 1) |
|
108 | self.gridLayout_20.addWidget(self.label_56, 2, 4, 1, 1) | |
109 | self.label_57 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
109 | self.label_57 = QtGui.QLabel(self.tabgraphSpectraHeis) | |
110 | self.label_57.setObjectName(_fromUtf8("label_57")) |
|
110 | self.label_57.setObjectName(_fromUtf8("label_57")) | |
111 | self.gridLayout_20.addWidget(self.label_57, 2, 6, 1, 1) |
|
111 | self.gridLayout_20.addWidget(self.label_57, 2, 6, 1, 1) | |
112 | self.label_58 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
112 | self.label_58 = QtGui.QLabel(self.tabgraphSpectraHeis) | |
113 | self.label_58.setObjectName(_fromUtf8("label_58")) |
|
113 | self.label_58.setObjectName(_fromUtf8("label_58")) | |
114 | self.gridLayout_20.addWidget(self.label_58, 3, 0, 1, 1) |
|
114 | self.gridLayout_20.addWidget(self.label_58, 3, 0, 1, 1) | |
115 | self.specHeisGraphCebSpectraplot = QtGui.QCheckBox(self.tabgraphSpectraHeis) |
|
115 | self.specHeisGraphCebSpectraplot = QtGui.QCheckBox(self.tabgraphSpectraHeis) | |
116 | self.specHeisGraphCebSpectraplot.setText(_fromUtf8("")) |
|
116 | self.specHeisGraphCebSpectraplot.setText(_fromUtf8("")) | |
117 | self.specHeisGraphCebSpectraplot.setObjectName(_fromUtf8("specHeisGraphCebSpectraplot")) |
|
117 | self.specHeisGraphCebSpectraplot.setObjectName(_fromUtf8("specHeisGraphCebSpectraplot")) | |
118 | self.gridLayout_20.addWidget(self.specHeisGraphCebSpectraplot, 3, 2, 1, 1) |
|
118 | self.gridLayout_20.addWidget(self.specHeisGraphCebSpectraplot, 3, 2, 1, 1) | |
119 | self.specHeisGgraphYminYmax = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
119 | self.specHeisGgraphYminYmax = QtGui.QLineEdit(self.tabgraphSpectraHeis) | |
120 | self.specHeisGgraphYminYmax.setObjectName(_fromUtf8("specHeisGgraphYminYmax")) |
|
120 | self.specHeisGgraphYminYmax.setObjectName(_fromUtf8("specHeisGgraphYminYmax")) | |
121 | self.gridLayout_20.addWidget(self.specHeisGgraphYminYmax, 7, 1, 1, 6) |
|
121 | self.gridLayout_20.addWidget(self.specHeisGgraphYminYmax, 7, 1, 1, 6) | |
122 | self.label_53 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
122 | self.label_53 = QtGui.QLabel(self.tabgraphSpectraHeis) | |
123 | self.label_53.setObjectName(_fromUtf8("label_53")) |
|
123 | self.label_53.setObjectName(_fromUtf8("label_53")) | |
124 | self.gridLayout_20.addWidget(self.label_53, 0, 0, 1, 1) |
|
124 | self.gridLayout_20.addWidget(self.label_53, 0, 0, 1, 1) | |
125 | self.label_55 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
125 | self.label_55 = QtGui.QLabel(self.tabgraphSpectraHeis) | |
126 | self.label_55.setObjectName(_fromUtf8("label_55")) |
|
126 | self.label_55.setObjectName(_fromUtf8("label_55")) | |
127 | self.gridLayout_20.addWidget(self.label_55, 2, 2, 1, 1) |
|
127 | self.gridLayout_20.addWidget(self.label_55, 2, 2, 1, 1) | |
128 | self.specHeisGraphSaveRTIplot = QtGui.QCheckBox(self.tabgraphSpectraHeis) |
|
128 | self.specHeisGraphSaveRTIplot = QtGui.QCheckBox(self.tabgraphSpectraHeis) | |
129 | self.specHeisGraphSaveRTIplot.setText(_fromUtf8("")) |
|
129 | self.specHeisGraphSaveRTIplot.setText(_fromUtf8("")) | |
130 | self.specHeisGraphSaveRTIplot.setObjectName(_fromUtf8("specHeisGraphSaveRTIplot")) |
|
130 | self.specHeisGraphSaveRTIplot.setObjectName(_fromUtf8("specHeisGraphSaveRTIplot")) | |
131 | self.gridLayout_20.addWidget(self.specHeisGraphSaveRTIplot, 4, 4, 1, 1) |
|
131 | self.gridLayout_20.addWidget(self.specHeisGraphSaveRTIplot, 4, 4, 1, 1) | |
132 | spacerItem24 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
132 | spacerItem24 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
133 | self.gridLayout_20.addItem(spacerItem24, 2, 3, 1, 1) |
|
133 | self.gridLayout_20.addItem(spacerItem24, 2, 3, 1, 1) | |
134 | self.specHeisGgraphXminXmax = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
134 | self.specHeisGgraphXminXmax = QtGui.QLineEdit(self.tabgraphSpectraHeis) | |
135 | self.specHeisGgraphXminXmax.setObjectName(_fromUtf8("specHeisGgraphXminXmax")) |
|
135 | self.specHeisGgraphXminXmax.setObjectName(_fromUtf8("specHeisGgraphXminXmax")) | |
136 | self.gridLayout_20.addWidget(self.specHeisGgraphXminXmax, 6, 1, 1, 6) |
|
136 | self.gridLayout_20.addWidget(self.specHeisGgraphXminXmax, 6, 1, 1, 6) | |
137 | self.specHeisGgraphChannelList = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
137 | self.specHeisGgraphChannelList = QtGui.QLineEdit(self.tabgraphSpectraHeis) | |
138 | self.specHeisGgraphChannelList.setObjectName(_fromUtf8("specHeisGgraphChannelList")) |
|
138 | self.specHeisGgraphChannelList.setObjectName(_fromUtf8("specHeisGgraphChannelList")) | |
139 | self.gridLayout_20.addWidget(self.specHeisGgraphChannelList, 5, 1, 1, 6) |
|
139 | self.gridLayout_20.addWidget(self.specHeisGgraphChannelList, 5, 1, 1, 6) | |
140 | self.specHeisGgraphTimeRange = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
140 | self.specHeisGgraphTimeRange = QtGui.QLineEdit(self.tabgraphSpectraHeis) | |
141 | self.specHeisGgraphTimeRange.setObjectName(_fromUtf8("specHeisGgraphTimeRange")) |
|
141 | self.specHeisGgraphTimeRange.setObjectName(_fromUtf8("specHeisGgraphTimeRange")) | |
142 | self.gridLayout_20.addWidget(self.specHeisGgraphTimeRange, 9, 1, 1, 6) |
|
142 | self.gridLayout_20.addWidget(self.specHeisGgraphTimeRange, 9, 1, 1, 6) | |
143 | spacerItem25 = QtGui.QSpacerItem(106, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
143 | spacerItem25 = QtGui.QSpacerItem(106, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
144 | self.gridLayout_20.addItem(spacerItem25, 11, 3, 1, 3) |
|
144 | self.gridLayout_20.addItem(spacerItem25, 11, 3, 1, 3) | |
145 | self.specHeisGraphSaveSpectra = QtGui.QCheckBox(self.tabgraphSpectraHeis) |
|
145 | self.specHeisGraphSaveSpectra = QtGui.QCheckBox(self.tabgraphSpectraHeis) | |
146 | self.specHeisGraphSaveSpectra.setText(_fromUtf8("")) |
|
146 | self.specHeisGraphSaveSpectra.setText(_fromUtf8("")) | |
147 | self.specHeisGraphSaveSpectra.setObjectName(_fromUtf8("specHeisGraphSaveSpectra")) |
|
147 | self.specHeisGraphSaveSpectra.setObjectName(_fromUtf8("specHeisGraphSaveSpectra")) | |
148 | self.gridLayout_20.addWidget(self.specHeisGraphSaveSpectra, 3, 4, 1, 1) |
|
148 | self.gridLayout_20.addWidget(self.specHeisGraphSaveSpectra, 3, 4, 1, 1) | |
149 | self.specHeisGraphftpSpectra = QtGui.QCheckBox(self.tabgraphSpectraHeis) |
|
149 | self.specHeisGraphftpSpectra = QtGui.QCheckBox(self.tabgraphSpectraHeis) | |
150 | self.specHeisGraphftpSpectra.setText(_fromUtf8("")) |
|
150 | self.specHeisGraphftpSpectra.setText(_fromUtf8("")) | |
151 | self.specHeisGraphftpSpectra.setObjectName(_fromUtf8("specHeisGraphftpSpectra")) |
|
151 | self.specHeisGraphftpSpectra.setObjectName(_fromUtf8("specHeisGraphftpSpectra")) | |
152 | self.gridLayout_20.addWidget(self.specHeisGraphftpSpectra, 3, 6, 1, 1) |
|
152 | self.gridLayout_20.addWidget(self.specHeisGraphftpSpectra, 3, 6, 1, 1) | |
153 | self.label_59 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
153 | self.label_59 = QtGui.QLabel(self.tabgraphSpectraHeis) | |
154 | self.label_59.setObjectName(_fromUtf8("label_59")) |
|
154 | self.label_59.setObjectName(_fromUtf8("label_59")) | |
155 | self.gridLayout_20.addWidget(self.label_59, 4, 0, 1, 1) |
|
155 | self.gridLayout_20.addWidget(self.label_59, 4, 0, 1, 1) | |
156 | spacerItem26 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
156 | spacerItem26 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) | |
157 | self.gridLayout_20.addItem(spacerItem26, 2, 5, 1, 1) |
|
157 | self.gridLayout_20.addItem(spacerItem26, 2, 5, 1, 1) | |
158 | self.specHeisGraphPath = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
158 | self.specHeisGraphPath = QtGui.QLineEdit(self.tabgraphSpectraHeis) | |
159 | self.specHeisGraphPath.setObjectName(_fromUtf8("specHeisGraphPath")) |
|
159 | self.specHeisGraphPath.setObjectName(_fromUtf8("specHeisGraphPath")) | |
160 | self.gridLayout_20.addWidget(self.specHeisGraphPath, 0, 1, 1, 5) |
|
160 | self.gridLayout_20.addWidget(self.specHeisGraphPath, 0, 1, 1, 5) | |
161 | self.tabWidgetSpectraHeis.addTab(self.tabgraphSpectraHeis, _fromUtf8("")) |
|
161 | self.tabWidgetSpectraHeis.addTab(self.tabgraphSpectraHeis, _fromUtf8("")) | |
162 | self.taboutputSpectraHeis = QtGui.QWidget() |
|
162 | self.taboutputSpectraHeis = QtGui.QWidget() | |
163 | self.taboutputSpectraHeis.setObjectName(_fromUtf8("taboutputSpectraHeis")) |
|
163 | self.taboutputSpectraHeis.setObjectName(_fromUtf8("taboutputSpectraHeis")) | |
164 | self.gridLayout_19 = QtGui.QGridLayout(self.taboutputSpectraHeis) |
|
164 | self.gridLayout_19 = QtGui.QGridLayout(self.taboutputSpectraHeis) | |
165 | self.gridLayout_19.setObjectName(_fromUtf8("gridLayout_19")) |
|
165 | self.gridLayout_19.setObjectName(_fromUtf8("gridLayout_19")) | |
166 | self.label_67 = QtGui.QLabel(self.taboutputSpectraHeis) |
|
166 | self.label_67 = QtGui.QLabel(self.taboutputSpectraHeis) | |
167 | self.label_67.setObjectName(_fromUtf8("label_67")) |
|
167 | self.label_67.setObjectName(_fromUtf8("label_67")) | |
168 | self.gridLayout_19.addWidget(self.label_67, 1, 0, 1, 1) |
|
168 | self.gridLayout_19.addWidget(self.label_67, 1, 0, 1, 1) | |
169 | self.label_68 = QtGui.QLabel(self.taboutputSpectraHeis) |
|
169 | self.label_68 = QtGui.QLabel(self.taboutputSpectraHeis) | |
170 | self.label_68.setObjectName(_fromUtf8("label_68")) |
|
170 | self.label_68.setObjectName(_fromUtf8("label_68")) | |
171 | self.gridLayout_19.addWidget(self.label_68, 2, 0, 1, 2) |
|
171 | self.gridLayout_19.addWidget(self.label_68, 2, 0, 1, 2) | |
172 | self.label_66 = QtGui.QLabel(self.taboutputSpectraHeis) |
|
172 | self.label_66 = QtGui.QLabel(self.taboutputSpectraHeis) | |
173 | self.label_66.setObjectName(_fromUtf8("label_66")) |
|
173 | self.label_66.setObjectName(_fromUtf8("label_66")) | |
174 | self.gridLayout_19.addWidget(self.label_66, 0, 0, 1, 1) |
|
174 | self.gridLayout_19.addWidget(self.label_66, 0, 0, 1, 1) | |
175 | spacerItem27 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) |
|
175 | spacerItem27 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) | |
176 | self.gridLayout_19.addItem(spacerItem27, 4, 0, 1, 1) |
|
176 | self.gridLayout_19.addItem(spacerItem27, 4, 0, 1, 1) | |
177 | self.specHeisOutputToolPath = QtGui.QToolButton(self.taboutputSpectraHeis) |
|
177 | self.specHeisOutputToolPath = QtGui.QToolButton(self.taboutputSpectraHeis) | |
178 | self.specHeisOutputToolPath.setObjectName(_fromUtf8("specHeisOutputToolPath")) |
|
178 | self.specHeisOutputToolPath.setObjectName(_fromUtf8("specHeisOutputToolPath")) | |
179 | self.gridLayout_19.addWidget(self.specHeisOutputToolPath, 1, 4, 1, 1) |
|
179 | self.gridLayout_19.addWidget(self.specHeisOutputToolPath, 1, 4, 1, 1) | |
180 | self.specHeisOutputPath = QtGui.QLineEdit(self.taboutputSpectraHeis) |
|
180 | self.specHeisOutputPath = QtGui.QLineEdit(self.taboutputSpectraHeis) | |
181 | self.specHeisOutputPath.setObjectName(_fromUtf8("specHeisOutputPath")) |
|
181 | self.specHeisOutputPath.setObjectName(_fromUtf8("specHeisOutputPath")) | |
182 | self.gridLayout_19.addWidget(self.specHeisOutputPath, 1, 3, 1, 1) |
|
182 | self.gridLayout_19.addWidget(self.specHeisOutputPath, 1, 3, 1, 1) | |
183 | self.specHeisOutputComdata = QtGui.QComboBox(self.taboutputSpectraHeis) |
|
183 | self.specHeisOutputComdata = QtGui.QComboBox(self.taboutputSpectraHeis) | |
184 | self.specHeisOutputComdata.setObjectName(_fromUtf8("specHeisOutputComdata")) |
|
184 | self.specHeisOutputComdata.setObjectName(_fromUtf8("specHeisOutputComdata")) | |
185 | self.specHeisOutputComdata.addItem(_fromUtf8("")) |
|
185 | self.specHeisOutputComdata.addItem(_fromUtf8("")) | |
186 | self.gridLayout_19.addWidget(self.specHeisOutputComdata, 0, 3, 1, 2) |
|
186 | self.gridLayout_19.addWidget(self.specHeisOutputComdata, 0, 3, 1, 2) | |
187 | self.label_69 = QtGui.QLabel(self.taboutputSpectraHeis) |
|
187 | self.label_69 = QtGui.QLabel(self.taboutputSpectraHeis) | |
188 | self.label_69.setObjectName(_fromUtf8("label_69")) |
|
188 | self.label_69.setObjectName(_fromUtf8("label_69")) | |
189 | self.gridLayout_19.addWidget(self.label_69, 3, 0, 1, 2) |
|
189 | self.gridLayout_19.addWidget(self.label_69, 3, 0, 1, 2) | |
190 | self.specHeisOutputblocksperfile = QtGui.QLineEdit(self.taboutputSpectraHeis) |
|
190 | self.specHeisOutputblocksperfile = QtGui.QLineEdit(self.taboutputSpectraHeis) | |
191 | self.specHeisOutputblocksperfile.setObjectName(_fromUtf8("specHeisOutputblocksperfile")) |
|
191 | self.specHeisOutputblocksperfile.setObjectName(_fromUtf8("specHeisOutputblocksperfile")) | |
192 | self.gridLayout_19.addWidget(self.specHeisOutputblocksperfile, 2, 3, 1, 1) |
|
192 | self.gridLayout_19.addWidget(self.specHeisOutputblocksperfile, 2, 3, 1, 1) | |
193 | self.specHeisOutputMetada = QtGui.QLineEdit(self.taboutputSpectraHeis) |
|
193 | self.specHeisOutputMetada = QtGui.QLineEdit(self.taboutputSpectraHeis) | |
194 | self.specHeisOutputMetada.setObjectName(_fromUtf8("specHeisOutputMetada")) |
|
194 | self.specHeisOutputMetada.setObjectName(_fromUtf8("specHeisOutputMetada")) | |
195 | self.gridLayout_19.addWidget(self.specHeisOutputMetada, 3, 3, 1, 1) |
|
195 | self.gridLayout_19.addWidget(self.specHeisOutputMetada, 3, 3, 1, 1) | |
196 | self.specHeisOutputMetadaToolPath = QtGui.QToolButton(self.taboutputSpectraHeis) |
|
196 | self.specHeisOutputMetadaToolPath = QtGui.QToolButton(self.taboutputSpectraHeis) | |
197 | self.specHeisOutputMetadaToolPath.setObjectName(_fromUtf8("specHeisOutputMetadaToolPath")) |
|
197 | self.specHeisOutputMetadaToolPath.setObjectName(_fromUtf8("specHeisOutputMetadaToolPath")) | |
198 | self.gridLayout_19.addWidget(self.specHeisOutputMetadaToolPath, 3, 4, 1, 1) |
|
198 | self.gridLayout_19.addWidget(self.specHeisOutputMetadaToolPath, 3, 4, 1, 1) | |
199 | self.tabWidgetSpectraHeis.addTab(self.taboutputSpectraHeis, _fromUtf8("")) |
|
199 | self.tabWidgetSpectraHeis.addTab(self.taboutputSpectraHeis, _fromUtf8("")) | |
200 | self.gridLayout_23.addWidget(self.tabWidgetSpectraHeis, 0, 0, 1, 1) |
|
200 | self.gridLayout_23.addWidget(self.tabWidgetSpectraHeis, 0, 0, 1, 1) | |
201 |
|
201 | |||
202 | self.tabWidgetProject.addTab(self.tabSpectraHeis, _fromUtf8("")) |
|
202 | self.tabWidgetProject.addTab(self.tabSpectraHeis, _fromUtf8("")) | |
203 |
|
203 | |||
204 | self.tabWidgetSpectraHeis.setCurrentIndex(0) |
|
204 | self.tabWidgetSpectraHeis.setCurrentIndex(0) | |
205 |
|
205 | |||
206 | def retranslateUi(self): |
|
206 | def retranslateUi(self): | |
207 |
|
207 | |||
208 | self.specHeisGraphClear.setText(_translate("MainWindow", "Clear", None)) |
|
208 | self.specHeisGraphClear.setText(_translate("MainWindow", "Clear", None)) | |
209 | self.specHeisOpOk.setText(_translate("MainWindow", "Ok", None)) |
|
209 | self.specHeisOpOk.setText(_translate("MainWindow", "Ok", None)) | |
210 | self.specHeisOpCobIncInt.setItemText(0, _translate("MainWindow", "Time Interval", None)) |
|
210 | self.specHeisOpCobIncInt.setItemText(0, _translate("MainWindow", "Time Interval", None)) | |
211 | self.specHeisOpCebIncoherent.setText(_translate("MainWindow", "Incoherent Intergration", None)) |
|
211 | self.specHeisOpCebIncoherent.setText(_translate("MainWindow", "Incoherent Intergration", None)) | |
212 |
|
212 | |||
213 | self.tabWidgetSpectraHeis.setTabText(self.tabWidgetSpectraHeis.indexOf(self.tabopSpectraHeis), _translate("MainWindow", "Operation", None)) |
|
213 | self.tabWidgetSpectraHeis.setTabText(self.tabWidgetSpectraHeis.indexOf(self.tabopSpectraHeis), _translate("MainWindow", "Operation", None)) | |
214 | self.label_54.setText(_translate("MainWindow", "Prefix", None)) |
|
214 | self.label_54.setText(_translate("MainWindow", "Prefix", None)) | |
215 | self.specHeisGraphToolPath.setText(_translate("MainWindow", "...", None)) |
|
215 | self.specHeisGraphToolPath.setText(_translate("MainWindow", "...", None)) | |
216 | self.label_62.setText(_translate("MainWindow", "Intensity range (dB)", None)) |
|
216 | self.label_62.setText(_translate("MainWindow", "Intensity range (dB)", None)) | |
217 | self.label_63.setText(_translate("MainWindow", "Time range (hours):", None)) |
|
217 | self.label_63.setText(_translate("MainWindow", "Time range (hours):", None)) | |
218 | self.label_64.setText(_translate("MainWindow", "Time interval:", None)) |
|
218 | self.label_64.setText(_translate("MainWindow", "Time interval:", None)) | |
219 | self.label_65.setText(_translate("MainWindow", "Wr Period", None)) |
|
219 | self.label_65.setText(_translate("MainWindow", "Wr Period", None)) | |
220 | self.label_60.setText(_translate("MainWindow", "Channel List:", None)) |
|
220 | self.label_60.setText(_translate("MainWindow", "Channel List:", None)) | |
221 | self.label_61.setText(_translate("MainWindow", "Frequency range", None)) |
|
221 | self.label_61.setText(_translate("MainWindow", "Frequency range", None)) | |
222 | self.label_56.setText(_translate("MainWindow", "Save", None)) |
|
222 | self.label_56.setText(_translate("MainWindow", "Save", None)) | |
223 | self.label_57.setText(_translate("MainWindow", "ftp", None)) |
|
223 | self.label_57.setText(_translate("MainWindow", "ftp", None)) | |
224 | self.label_58.setText(_translate("MainWindow", "Spectra Plot", None)) |
|
224 | self.label_58.setText(_translate("MainWindow", "Spectra Plot", None)) | |
225 | self.label_53.setText(_translate("MainWindow", "Path", None)) |
|
225 | self.label_53.setText(_translate("MainWindow", "Path", None)) | |
226 | self.label_55.setText(_translate("MainWindow", "Show", None)) |
|
226 | self.label_55.setText(_translate("MainWindow", "Show", None)) | |
227 | self.label_59.setText(_translate("MainWindow", "RTI Plot", None)) |
|
227 | self.label_59.setText(_translate("MainWindow", "RTI Plot", None)) | |
228 |
|
228 | |||
229 | self.tabWidgetSpectraHeis.setTabText(self.tabWidgetSpectraHeis.indexOf(self.tabgraphSpectraHeis), _translate("MainWindow", "Graphics", None)) |
|
229 | self.tabWidgetSpectraHeis.setTabText(self.tabWidgetSpectraHeis.indexOf(self.tabgraphSpectraHeis), _translate("MainWindow", "Graphics", None)) | |
230 | self.label_67.setText(_translate("MainWindow", "Path:", None)) |
|
230 | self.label_67.setText(_translate("MainWindow", "Path:", None)) | |
231 |
self.label_68.setText(_translate("MainWindow", "Blocks |
|
231 | self.label_68.setText(_translate("MainWindow", "Blocks per file:", None)) | |
232 | self.label_66.setText(_translate("MainWindow", "Type:", None)) |
|
232 | self.label_66.setText(_translate("MainWindow", "Type:", None)) | |
233 |
|
233 | |||
234 | self.tabWidgetSpectraHeis.setTabText(self.tabWidgetSpectraHeis.indexOf(self.taboutputSpectraHeis), _translate("MainWindow", "Output", None)) |
|
234 | self.tabWidgetSpectraHeis.setTabText(self.tabWidgetSpectraHeis.indexOf(self.taboutputSpectraHeis), _translate("MainWindow", "Output", None)) | |
235 | self.specHeisOutputToolPath.setText(_translate("MainWindow", "...", None)) |
|
235 | self.specHeisOutputToolPath.setText(_translate("MainWindow", "...", None)) | |
236 | self.specHeisOutputComdata.setItemText(0, _translate("MainWindow", ".fits", None)) |
|
236 | self.specHeisOutputComdata.setItemText(0, _translate("MainWindow", ".fits", None)) | |
237 | self.label_69.setText(_translate("MainWindow", "Metada", None)) |
|
237 | self.label_69.setText(_translate("MainWindow", "Metadata file:", None)) | |
238 | self.specHeisOutputMetadaToolPath.setText(_translate("MainWindow", "...", None)) |
|
238 | self.specHeisOutputMetadaToolPath.setText(_translate("MainWindow", "...", None)) | |
239 |
|
239 | |||
240 | self.tabWidgetProject.setTabText(self.tabWidgetProject.indexOf(self.tabSpectraHeis), _translate("MainWindow", "SpectraHeis", None)) |
|
240 | self.tabWidgetProject.setTabText(self.tabWidgetProject.indexOf(self.tabSpectraHeis), _translate("MainWindow", "SpectraHeis", None)) |
@@ -1,1132 +1,1128 | |||||
1 | ''' |
|
1 | ''' | |
2 |
|
2 | |||
3 | $Author: murco $ |
|
3 | $Author: murco $ | |
4 | $Id: JROData.py 173 2012-11-20 15:06:21Z murco $ |
|
4 | $Id: JROData.py 173 2012-11-20 15:06:21Z murco $ | |
5 | ''' |
|
5 | ''' | |
6 |
|
6 | |||
7 | import copy |
|
7 | import copy | |
8 | import numpy |
|
8 | import numpy | |
9 | import datetime |
|
9 | import datetime | |
10 |
|
10 | |||
11 | from jroheaderIO import SystemHeader, RadarControllerHeader |
|
11 | from jroheaderIO import SystemHeader, RadarControllerHeader | |
12 |
|
12 | |||
13 | def getNumpyDtype(dataTypeCode): |
|
13 | def getNumpyDtype(dataTypeCode): | |
14 |
|
14 | |||
15 | if dataTypeCode == 0: |
|
15 | if dataTypeCode == 0: | |
16 | numpyDtype = numpy.dtype([('real','<i1'),('imag','<i1')]) |
|
16 | numpyDtype = numpy.dtype([('real','<i1'),('imag','<i1')]) | |
17 | elif dataTypeCode == 1: |
|
17 | elif dataTypeCode == 1: | |
18 | numpyDtype = numpy.dtype([('real','<i2'),('imag','<i2')]) |
|
18 | numpyDtype = numpy.dtype([('real','<i2'),('imag','<i2')]) | |
19 | elif dataTypeCode == 2: |
|
19 | elif dataTypeCode == 2: | |
20 | numpyDtype = numpy.dtype([('real','<i4'),('imag','<i4')]) |
|
20 | numpyDtype = numpy.dtype([('real','<i4'),('imag','<i4')]) | |
21 | elif dataTypeCode == 3: |
|
21 | elif dataTypeCode == 3: | |
22 | numpyDtype = numpy.dtype([('real','<i8'),('imag','<i8')]) |
|
22 | numpyDtype = numpy.dtype([('real','<i8'),('imag','<i8')]) | |
23 | elif dataTypeCode == 4: |
|
23 | elif dataTypeCode == 4: | |
24 | numpyDtype = numpy.dtype([('real','<f4'),('imag','<f4')]) |
|
24 | numpyDtype = numpy.dtype([('real','<f4'),('imag','<f4')]) | |
25 | elif dataTypeCode == 5: |
|
25 | elif dataTypeCode == 5: | |
26 | numpyDtype = numpy.dtype([('real','<f8'),('imag','<f8')]) |
|
26 | numpyDtype = numpy.dtype([('real','<f8'),('imag','<f8')]) | |
27 | else: |
|
27 | else: | |
28 | raise ValueError, 'dataTypeCode was not defined' |
|
28 | raise ValueError, 'dataTypeCode was not defined' | |
29 |
|
29 | |||
30 | return numpyDtype |
|
30 | return numpyDtype | |
31 |
|
31 | |||
32 | def getDataTypeCode(numpyDtype): |
|
32 | def getDataTypeCode(numpyDtype): | |
33 |
|
33 | |||
34 | if numpyDtype == numpy.dtype([('real','<i1'),('imag','<i1')]): |
|
34 | if numpyDtype == numpy.dtype([('real','<i1'),('imag','<i1')]): | |
35 | datatype = 0 |
|
35 | datatype = 0 | |
36 | elif numpyDtype == numpy.dtype([('real','<i2'),('imag','<i2')]): |
|
36 | elif numpyDtype == numpy.dtype([('real','<i2'),('imag','<i2')]): | |
37 | datatype = 1 |
|
37 | datatype = 1 | |
38 | elif numpyDtype == numpy.dtype([('real','<i4'),('imag','<i4')]): |
|
38 | elif numpyDtype == numpy.dtype([('real','<i4'),('imag','<i4')]): | |
39 | datatype = 2 |
|
39 | datatype = 2 | |
40 | elif numpyDtype == numpy.dtype([('real','<i8'),('imag','<i8')]): |
|
40 | elif numpyDtype == numpy.dtype([('real','<i8'),('imag','<i8')]): | |
41 | datatype = 3 |
|
41 | datatype = 3 | |
42 | elif numpyDtype == numpy.dtype([('real','<f4'),('imag','<f4')]): |
|
42 | elif numpyDtype == numpy.dtype([('real','<f4'),('imag','<f4')]): | |
43 | datatype = 4 |
|
43 | datatype = 4 | |
44 | elif numpyDtype == numpy.dtype([('real','<f8'),('imag','<f8')]): |
|
44 | elif numpyDtype == numpy.dtype([('real','<f8'),('imag','<f8')]): | |
45 | datatype = 5 |
|
45 | datatype = 5 | |
46 | else: |
|
46 | else: | |
47 | datatype = None |
|
47 | datatype = None | |
48 |
|
48 | |||
49 | return datatype |
|
49 | return datatype | |
50 |
|
50 | |||
51 | def hildebrand_sekhon(data, navg): |
|
51 | def hildebrand_sekhon(data, navg): | |
52 | """ |
|
52 | """ | |
53 | This method is for the objective determination of the noise level in Doppler spectra. This |
|
53 | This method is for the objective determination of the noise level in Doppler spectra. This | |
54 | implementation technique is based on the fact that the standard deviation of the spectral |
|
54 | implementation technique is based on the fact that the standard deviation of the spectral | |
55 | densities is equal to the mean spectral density for white Gaussian noise |
|
55 | densities is equal to the mean spectral density for white Gaussian noise | |
56 |
|
56 | |||
57 | Inputs: |
|
57 | Inputs: | |
58 | Data : heights |
|
58 | Data : heights | |
59 | navg : numbers of averages |
|
59 | navg : numbers of averages | |
60 |
|
60 | |||
61 | Return: |
|
61 | Return: | |
62 | -1 : any error |
|
62 | -1 : any error | |
63 | anoise : noise's level |
|
63 | anoise : noise's level | |
64 | """ |
|
64 | """ | |
65 |
|
65 | |||
66 | sortdata = numpy.sort(data,axis=None) |
|
66 | sortdata = numpy.sort(data,axis=None) | |
67 | lenOfData = len(sortdata) |
|
67 | lenOfData = len(sortdata) | |
68 | nums_min = lenOfData/10 |
|
68 | nums_min = lenOfData/10 | |
69 |
|
69 | |||
70 | if (lenOfData/10) > 2: |
|
70 | if (lenOfData/10) > 2: | |
71 | nums_min = lenOfData/10 |
|
71 | nums_min = lenOfData/10 | |
72 | else: |
|
72 | else: | |
73 | nums_min = 2 |
|
73 | nums_min = 2 | |
74 |
|
74 | |||
75 | sump = 0. |
|
75 | sump = 0. | |
76 |
|
76 | |||
77 | sumq = 0. |
|
77 | sumq = 0. | |
78 |
|
78 | |||
79 | j = 0 |
|
79 | j = 0 | |
80 |
|
80 | |||
81 | cont = 1 |
|
81 | cont = 1 | |
82 |
|
82 | |||
83 | while((cont==1)and(j<lenOfData)): |
|
83 | while((cont==1)and(j<lenOfData)): | |
84 |
|
84 | |||
85 | sump += sortdata[j] |
|
85 | sump += sortdata[j] | |
86 |
|
86 | |||
87 | sumq += sortdata[j]**2 |
|
87 | sumq += sortdata[j]**2 | |
88 |
|
88 | |||
89 | if j > nums_min: |
|
89 | if j > nums_min: | |
90 | rtest = float(j)/(j-1) + 1.0/navg |
|
90 | rtest = float(j)/(j-1) + 1.0/navg | |
91 | if ((sumq*j) > (rtest*sump**2)): |
|
91 | if ((sumq*j) > (rtest*sump**2)): | |
92 | j = j - 1 |
|
92 | j = j - 1 | |
93 | sump = sump - sortdata[j] |
|
93 | sump = sump - sortdata[j] | |
94 | sumq = sumq - sortdata[j]**2 |
|
94 | sumq = sumq - sortdata[j]**2 | |
95 | cont = 0 |
|
95 | cont = 0 | |
96 |
|
96 | |||
97 | j += 1 |
|
97 | j += 1 | |
98 |
|
98 | |||
99 | lnoise = sump /j |
|
99 | lnoise = sump /j | |
100 | stdv = numpy.sqrt((sumq - lnoise**2)/(j - 1)) |
|
100 | stdv = numpy.sqrt((sumq - lnoise**2)/(j - 1)) | |
101 | return lnoise |
|
101 | return lnoise | |
102 |
|
102 | |||
103 | class Beam: |
|
103 | class Beam: | |
104 | def __init__(self): |
|
104 | def __init__(self): | |
105 | self.codeList = [] |
|
105 | self.codeList = [] | |
106 | self.azimuthList = [] |
|
106 | self.azimuthList = [] | |
107 | self.zenithList = [] |
|
107 | self.zenithList = [] | |
108 |
|
108 | |||
109 | class GenericData(object): |
|
109 | class GenericData(object): | |
110 |
|
110 | |||
111 | flagNoData = True |
|
111 | flagNoData = True | |
112 |
|
112 | |||
113 | def __init__(self): |
|
113 | def __init__(self): | |
114 |
|
114 | |||
115 | raise ValueError, "This class has not been implemented" |
|
115 | raise ValueError, "This class has not been implemented" | |
116 |
|
116 | |||
117 | def copy(self, inputObj=None): |
|
117 | def copy(self, inputObj=None): | |
118 |
|
118 | |||
119 | if inputObj == None: |
|
119 | if inputObj == None: | |
120 | return copy.deepcopy(self) |
|
120 | return copy.deepcopy(self) | |
121 |
|
121 | |||
122 | for key in inputObj.__dict__.keys(): |
|
122 | for key in inputObj.__dict__.keys(): | |
123 | self.__dict__[key] = inputObj.__dict__[key] |
|
123 | self.__dict__[key] = inputObj.__dict__[key] | |
124 |
|
124 | |||
125 | def deepcopy(self): |
|
125 | def deepcopy(self): | |
126 |
|
126 | |||
127 | return copy.deepcopy(self) |
|
127 | return copy.deepcopy(self) | |
128 |
|
128 | |||
129 | def isEmpty(self): |
|
129 | def isEmpty(self): | |
130 |
|
130 | |||
131 | return self.flagNoData |
|
131 | return self.flagNoData | |
132 |
|
132 | |||
133 | class JROData(GenericData): |
|
133 | class JROData(GenericData): | |
134 |
|
134 | |||
135 | # m_BasicHeader = BasicHeader() |
|
135 | # m_BasicHeader = BasicHeader() | |
136 | # m_ProcessingHeader = ProcessingHeader() |
|
136 | # m_ProcessingHeader = ProcessingHeader() | |
137 |
|
137 | |||
138 | systemHeaderObj = SystemHeader() |
|
138 | systemHeaderObj = SystemHeader() | |
139 |
|
139 | |||
140 | radarControllerHeaderObj = RadarControllerHeader() |
|
140 | radarControllerHeaderObj = RadarControllerHeader() | |
141 |
|
141 | |||
142 | # data = None |
|
142 | # data = None | |
143 |
|
143 | |||
144 | type = None |
|
144 | type = None | |
145 |
|
145 | |||
146 | datatype = None #dtype but in string |
|
146 | datatype = None #dtype but in string | |
147 |
|
147 | |||
148 | # dtype = None |
|
148 | # dtype = None | |
149 |
|
149 | |||
150 | # nChannels = None |
|
150 | # nChannels = None | |
151 |
|
151 | |||
152 | # nHeights = None |
|
152 | # nHeights = None | |
153 |
|
153 | |||
154 | nProfiles = None |
|
154 | nProfiles = None | |
155 |
|
155 | |||
156 | heightList = None |
|
156 | heightList = None | |
157 |
|
157 | |||
158 | channelList = None |
|
158 | channelList = None | |
159 |
|
159 | |||
160 | flagDiscontinuousBlock = False |
|
160 | flagDiscontinuousBlock = False | |
161 |
|
161 | |||
162 | useLocalTime = False |
|
162 | useLocalTime = False | |
163 |
|
163 | |||
164 | utctime = None |
|
164 | utctime = None | |
165 |
|
165 | |||
166 | timeZone = None |
|
166 | timeZone = None | |
167 |
|
167 | |||
168 | dstFlag = None |
|
168 | dstFlag = None | |
169 |
|
169 | |||
170 | errorCount = None |
|
170 | errorCount = None | |
171 |
|
171 | |||
172 | blocksize = None |
|
172 | blocksize = None | |
173 |
|
173 | |||
174 | # nCode = None |
|
174 | # nCode = None | |
175 | # |
|
175 | # | |
176 | # nBaud = None |
|
176 | # nBaud = None | |
177 | # |
|
177 | # | |
178 | # code = None |
|
178 | # code = None | |
179 |
|
179 | |||
180 | flagDecodeData = False #asumo q la data no esta decodificada |
|
180 | flagDecodeData = False #asumo q la data no esta decodificada | |
181 |
|
181 | |||
182 | flagDeflipData = False #asumo q la data no esta sin flip |
|
182 | flagDeflipData = False #asumo q la data no esta sin flip | |
183 |
|
183 | |||
184 | flagShiftFFT = False |
|
184 | flagShiftFFT = False | |
185 |
|
185 | |||
186 | # ippSeconds = None |
|
186 | # ippSeconds = None | |
187 |
|
187 | |||
188 | # timeInterval = None |
|
188 | # timeInterval = None | |
189 |
|
189 | |||
190 | nCohInt = None |
|
190 | nCohInt = None | |
191 |
|
191 | |||
192 | # noise = None |
|
192 | # noise = None | |
193 |
|
193 | |||
194 | windowOfFilter = 1 |
|
194 | windowOfFilter = 1 | |
195 |
|
195 | |||
196 | #Speed of ligth |
|
196 | #Speed of ligth | |
197 | C = 3e8 |
|
197 | C = 3e8 | |
198 |
|
198 | |||
199 | frequency = 49.92e6 |
|
199 | frequency = 49.92e6 | |
200 |
|
200 | |||
201 | realtime = False |
|
201 | realtime = False | |
202 |
|
202 | |||
203 | beacon_heiIndexList = None |
|
203 | beacon_heiIndexList = None | |
204 |
|
204 | |||
205 | last_block = None |
|
205 | last_block = None | |
206 |
|
206 | |||
207 | blocknow = None |
|
207 | blocknow = None | |
208 |
|
208 | |||
209 | azimuth = None |
|
209 | azimuth = None | |
210 |
|
210 | |||
211 | zenith = None |
|
211 | zenith = None | |
212 |
|
212 | |||
213 | beam = Beam() |
|
213 | beam = Beam() | |
214 |
|
214 | |||
215 | profileIndex = None |
|
215 | profileIndex = None | |
216 |
|
216 | |||
217 | def __init__(self): |
|
217 | def __init__(self): | |
218 |
|
218 | |||
219 | raise ValueError, "This class has not been implemented" |
|
219 | raise ValueError, "This class has not been implemented" | |
220 |
|
220 | |||
221 | def getNoise(self): |
|
221 | def getNoise(self): | |
222 |
|
222 | |||
223 | raise ValueError, "Not implemented" |
|
223 | raise ValueError, "Not implemented" | |
224 |
|
224 | |||
225 | def getNChannels(self): |
|
225 | def getNChannels(self): | |
226 |
|
226 | |||
227 | return len(self.channelList) |
|
227 | return len(self.channelList) | |
228 |
|
228 | |||
229 | def getChannelIndexList(self): |
|
229 | def getChannelIndexList(self): | |
230 |
|
230 | |||
231 | return range(self.nChannels) |
|
231 | return range(self.nChannels) | |
232 |
|
232 | |||
233 | def getNHeights(self): |
|
233 | def getNHeights(self): | |
234 |
|
234 | |||
235 | return len(self.heightList) |
|
235 | return len(self.heightList) | |
236 |
|
236 | |||
237 | def getHeiRange(self, extrapoints=0): |
|
237 | def getHeiRange(self, extrapoints=0): | |
238 |
|
238 | |||
239 | heis = self.heightList |
|
239 | heis = self.heightList | |
240 | # deltah = self.heightList[1] - self.heightList[0] |
|
240 | # deltah = self.heightList[1] - self.heightList[0] | |
241 | # |
|
241 | # | |
242 | # heis.append(self.heightList[-1]) |
|
242 | # heis.append(self.heightList[-1]) | |
243 |
|
243 | |||
244 | return heis |
|
244 | return heis | |
245 |
|
245 | |||
246 | def getltctime(self): |
|
246 | def getltctime(self): | |
247 |
|
247 | |||
248 | if self.useLocalTime: |
|
248 | if self.useLocalTime: | |
249 | return self.utctime - self.timeZone*60 |
|
249 | return self.utctime - self.timeZone*60 | |
250 |
|
250 | |||
251 | return self.utctime |
|
251 | return self.utctime | |
252 |
|
252 | |||
253 | def getDatatime(self): |
|
253 | def getDatatime(self): | |
254 |
|
254 | |||
255 | datatimeValue = datetime.datetime.utcfromtimestamp(self.ltctime) |
|
255 | datatimeValue = datetime.datetime.utcfromtimestamp(self.ltctime) | |
256 | return datatimeValue |
|
256 | return datatimeValue | |
257 |
|
257 | |||
258 | def getTimeRange(self): |
|
258 | def getTimeRange(self): | |
259 |
|
259 | |||
260 | datatime = [] |
|
260 | datatime = [] | |
261 |
|
261 | |||
262 | datatime.append(self.ltctime) |
|
262 | datatime.append(self.ltctime) | |
263 | datatime.append(self.ltctime + self.timeInterval+60) |
|
263 | datatime.append(self.ltctime + self.timeInterval+60) | |
264 |
|
264 | |||
265 | datatime = numpy.array(datatime) |
|
265 | datatime = numpy.array(datatime) | |
266 |
|
266 | |||
267 | return datatime |
|
267 | return datatime | |
268 |
|
268 | |||
269 | def getFmax(self): |
|
269 | def getFmax(self): | |
270 |
|
270 | |||
271 | PRF = 1./(self.ippSeconds * self.nCohInt) |
|
271 | PRF = 1./(self.ippSeconds * self.nCohInt) | |
272 |
|
272 | |||
273 | fmax = PRF/2. |
|
273 | fmax = PRF/2. | |
274 |
|
274 | |||
275 | return fmax |
|
275 | return fmax | |
276 |
|
276 | |||
277 | def getVmax(self): |
|
277 | def getVmax(self): | |
278 |
|
278 | |||
279 | _lambda = self.C/self.frequency |
|
279 | _lambda = self.C/self.frequency | |
280 |
|
280 | |||
281 | vmax = self.getFmax() * _lambda |
|
281 | vmax = self.getFmax() * _lambda | |
282 |
|
282 | |||
283 | return vmax |
|
283 | return vmax | |
284 |
|
284 | |||
285 | def get_ippSeconds(self): |
|
285 | def get_ippSeconds(self): | |
286 | ''' |
|
286 | ''' | |
287 | ''' |
|
287 | ''' | |
288 | return self.radarControllerHeaderObj.ippSeconds |
|
288 | return self.radarControllerHeaderObj.ippSeconds | |
289 |
|
289 | |||
290 | def set_ippSeconds(self, ippSeconds): |
|
290 | def set_ippSeconds(self, ippSeconds): | |
291 | ''' |
|
291 | ''' | |
292 | ''' |
|
292 | ''' | |
293 |
|
293 | |||
294 | self.radarControllerHeaderObj.ippSeconds = ippSeconds |
|
294 | self.radarControllerHeaderObj.ippSeconds = ippSeconds | |
295 |
|
295 | |||
296 | return |
|
296 | return | |
297 |
|
297 | |||
298 | def get_dtype(self): |
|
298 | def get_dtype(self): | |
299 | ''' |
|
299 | ''' | |
300 | ''' |
|
300 | ''' | |
301 | return getNumpyDtype(self.datatype) |
|
301 | return getNumpyDtype(self.datatype) | |
302 |
|
302 | |||
303 | def set_dtype(self, numpyDtype): |
|
303 | def set_dtype(self, numpyDtype): | |
304 | ''' |
|
304 | ''' | |
305 | ''' |
|
305 | ''' | |
306 |
|
306 | |||
307 | self.datatype = getDataTypeCode(numpyDtype) |
|
307 | self.datatype = getDataTypeCode(numpyDtype) | |
308 |
|
308 | |||
309 | def get_code(self): |
|
309 | def get_code(self): | |
310 | ''' |
|
310 | ''' | |
311 | ''' |
|
311 | ''' | |
312 | return self.radarControllerHeaderObj.code |
|
312 | return self.radarControllerHeaderObj.code | |
313 |
|
313 | |||
314 | def set_code(self, code): |
|
314 | def set_code(self, code): | |
315 | ''' |
|
315 | ''' | |
316 | ''' |
|
316 | ''' | |
317 | self.radarControllerHeaderObj.code = code |
|
317 | self.radarControllerHeaderObj.code = code | |
318 |
|
318 | |||
319 | return |
|
319 | return | |
320 |
|
320 | |||
321 | def get_ncode(self): |
|
321 | def get_ncode(self): | |
322 | ''' |
|
322 | ''' | |
323 | ''' |
|
323 | ''' | |
324 | return self.radarControllerHeaderObj.nCode |
|
324 | return self.radarControllerHeaderObj.nCode | |
325 |
|
325 | |||
326 | def set_ncode(self, nCode): |
|
326 | def set_ncode(self, nCode): | |
327 | ''' |
|
327 | ''' | |
328 | ''' |
|
328 | ''' | |
329 | self.radarControllerHeaderObj.nCode = nCode |
|
329 | self.radarControllerHeaderObj.nCode = nCode | |
330 |
|
330 | |||
331 | return |
|
331 | return | |
332 |
|
332 | |||
333 | def get_nbaud(self): |
|
333 | def get_nbaud(self): | |
334 | ''' |
|
334 | ''' | |
335 | ''' |
|
335 | ''' | |
336 | return self.radarControllerHeaderObj.nBaud |
|
336 | return self.radarControllerHeaderObj.nBaud | |
337 |
|
337 | |||
338 | def set_nbaud(self, nBaud): |
|
338 | def set_nbaud(self, nBaud): | |
339 | ''' |
|
339 | ''' | |
340 | ''' |
|
340 | ''' | |
341 | self.radarControllerHeaderObj.nBaud = nBaud |
|
341 | self.radarControllerHeaderObj.nBaud = nBaud | |
342 |
|
342 | |||
343 | return |
|
343 | return | |
344 | # def getTimeInterval(self): |
|
344 | # def getTimeInterval(self): | |
345 | # |
|
345 | # | |
346 | # raise IOError, "This method should be implemented inside each Class" |
|
346 | # raise IOError, "This method should be implemented inside each Class" | |
347 |
|
347 | |||
348 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") |
|
348 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") | |
349 | channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") |
|
349 | channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") | |
350 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") |
|
350 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") | |
351 | #noise = property(getNoise, "I'm the 'nHeights' property.") |
|
351 | #noise = property(getNoise, "I'm the 'nHeights' property.") | |
352 | datatime = property(getDatatime, "I'm the 'datatime' property") |
|
352 | datatime = property(getDatatime, "I'm the 'datatime' property") | |
353 | ltctime = property(getltctime, "I'm the 'ltctime' property") |
|
353 | ltctime = property(getltctime, "I'm the 'ltctime' property") | |
354 | ippSeconds = property(get_ippSeconds, set_ippSeconds) |
|
354 | ippSeconds = property(get_ippSeconds, set_ippSeconds) | |
355 | dtype = property(get_dtype, set_dtype) |
|
355 | dtype = property(get_dtype, set_dtype) | |
356 | # timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
356 | # timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
357 | code = property(get_code, set_code) |
|
357 | code = property(get_code, set_code) | |
358 | nCode = property(get_ncode, set_ncode) |
|
358 | nCode = property(get_ncode, set_ncode) | |
359 | nBaud = property(get_nbaud, set_nbaud) |
|
359 | nBaud = property(get_nbaud, set_nbaud) | |
360 |
|
360 | |||
361 | class Voltage(JROData): |
|
361 | class Voltage(JROData): | |
362 |
|
362 | |||
363 | #data es un numpy array de 2 dmensiones (canales, alturas) |
|
363 | #data es un numpy array de 2 dmensiones (canales, alturas) | |
364 | data = None |
|
364 | data = None | |
365 |
|
365 | |||
366 | def __init__(self): |
|
366 | def __init__(self): | |
367 | ''' |
|
367 | ''' | |
368 | Constructor |
|
368 | Constructor | |
369 | ''' |
|
369 | ''' | |
370 |
|
370 | |||
371 | self.useLocalTime = True |
|
371 | self.useLocalTime = True | |
372 |
|
372 | |||
373 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
373 | self.radarControllerHeaderObj = RadarControllerHeader() | |
374 |
|
374 | |||
375 | self.systemHeaderObj = SystemHeader() |
|
375 | self.systemHeaderObj = SystemHeader() | |
376 |
|
376 | |||
377 | self.type = "Voltage" |
|
377 | self.type = "Voltage" | |
378 |
|
378 | |||
379 | self.data = None |
|
379 | self.data = None | |
380 |
|
380 | |||
381 | # self.dtype = None |
|
381 | # self.dtype = None | |
382 |
|
382 | |||
383 | # self.nChannels = 0 |
|
383 | # self.nChannels = 0 | |
384 |
|
384 | |||
385 | # self.nHeights = 0 |
|
385 | # self.nHeights = 0 | |
386 |
|
386 | |||
387 | self.nProfiles = None |
|
387 | self.nProfiles = None | |
388 |
|
388 | |||
389 | self.heightList = None |
|
389 | self.heightList = None | |
390 |
|
390 | |||
391 | self.channelList = None |
|
391 | self.channelList = None | |
392 |
|
392 | |||
393 | # self.channelIndexList = None |
|
393 | # self.channelIndexList = None | |
394 |
|
394 | |||
395 | self.flagNoData = True |
|
395 | self.flagNoData = True | |
396 |
|
396 | |||
397 | self.flagDiscontinuousBlock = False |
|
397 | self.flagDiscontinuousBlock = False | |
398 |
|
398 | |||
399 | self.utctime = None |
|
399 | self.utctime = None | |
400 |
|
400 | |||
401 | self.timeZone = None |
|
401 | self.timeZone = None | |
402 |
|
402 | |||
403 | self.dstFlag = None |
|
403 | self.dstFlag = None | |
404 |
|
404 | |||
405 | self.errorCount = None |
|
405 | self.errorCount = None | |
406 |
|
406 | |||
407 | self.nCohInt = None |
|
407 | self.nCohInt = None | |
408 |
|
408 | |||
409 | self.blocksize = None |
|
409 | self.blocksize = None | |
410 |
|
410 | |||
411 | self.flagDecodeData = False #asumo q la data no esta decodificada |
|
411 | self.flagDecodeData = False #asumo q la data no esta decodificada | |
412 |
|
412 | |||
413 | self.flagDeflipData = False #asumo q la data no esta sin flip |
|
413 | self.flagDeflipData = False #asumo q la data no esta sin flip | |
414 |
|
414 | |||
415 | self.flagShiftFFT = False |
|
415 | self.flagShiftFFT = False | |
416 |
|
416 | |||
417 | self.flagDataAsBlock = False #Asumo que la data es leida perfil a perfil |
|
417 | self.flagDataAsBlock = False #Asumo que la data es leida perfil a perfil | |
418 |
|
418 | |||
419 | self.profileIndex = 0 |
|
419 | self.profileIndex = 0 | |
420 |
|
420 | |||
421 | def getNoisebyHildebrand(self, channel = None): |
|
421 | def getNoisebyHildebrand(self, channel = None): | |
422 | """ |
|
422 | """ | |
423 | Determino el nivel de ruido usando el metodo Hildebrand-Sekhon |
|
423 | Determino el nivel de ruido usando el metodo Hildebrand-Sekhon | |
424 |
|
424 | |||
425 | Return: |
|
425 | Return: | |
426 | noiselevel |
|
426 | noiselevel | |
427 | """ |
|
427 | """ | |
428 |
|
428 | |||
429 | if channel != None: |
|
429 | if channel != None: | |
430 | data = self.data[channel] |
|
430 | data = self.data[channel] | |
431 | nChannels = 1 |
|
431 | nChannels = 1 | |
432 | else: |
|
432 | else: | |
433 | data = self.data |
|
433 | data = self.data | |
434 | nChannels = self.nChannels |
|
434 | nChannels = self.nChannels | |
435 |
|
435 | |||
436 | noise = numpy.zeros(nChannels) |
|
436 | noise = numpy.zeros(nChannels) | |
437 | power = data * numpy.conjugate(data) |
|
437 | power = data * numpy.conjugate(data) | |
438 |
|
438 | |||
439 | for thisChannel in range(nChannels): |
|
439 | for thisChannel in range(nChannels): | |
440 | if nChannels == 1: |
|
440 | if nChannels == 1: | |
441 | daux = power[:].real |
|
441 | daux = power[:].real | |
442 | else: |
|
442 | else: | |
443 | daux = power[thisChannel,:].real |
|
443 | daux = power[thisChannel,:].real | |
444 | noise[thisChannel] = hildebrand_sekhon(daux, self.nCohInt) |
|
444 | noise[thisChannel] = hildebrand_sekhon(daux, self.nCohInt) | |
445 |
|
445 | |||
446 | return noise |
|
446 | return noise | |
447 |
|
447 | |||
448 | def getNoise(self, type = 1, channel = None): |
|
448 | def getNoise(self, type = 1, channel = None): | |
449 |
|
449 | |||
450 | if type == 1: |
|
450 | if type == 1: | |
451 | noise = self.getNoisebyHildebrand(channel) |
|
451 | noise = self.getNoisebyHildebrand(channel) | |
452 |
|
452 | |||
453 | return 10*numpy.log10(noise) |
|
453 | return 10*numpy.log10(noise) | |
454 |
|
454 | |||
455 | def getPower(self, channel = None): |
|
455 | def getPower(self, channel = None): | |
456 |
|
456 | |||
457 | if channel != None: |
|
457 | if channel != None: | |
458 | data = self.data[channel] |
|
458 | data = self.data[channel] | |
459 | else: |
|
459 | else: | |
460 | data = self.data |
|
460 | data = self.data | |
461 |
|
461 | |||
462 | power = data * numpy.conjugate(data) |
|
462 | power = data * numpy.conjugate(data) | |
463 |
|
463 | |||
464 | return 10*numpy.log10(power.real) |
|
464 | return 10*numpy.log10(power.real) | |
465 |
|
465 | |||
466 | def getTimeInterval(self): |
|
466 | def getTimeInterval(self): | |
467 |
|
467 | |||
468 | timeInterval = self.ippSeconds * self.nCohInt |
|
468 | timeInterval = self.ippSeconds * self.nCohInt | |
469 |
|
469 | |||
470 | return timeInterval |
|
470 | return timeInterval | |
471 |
|
471 | |||
472 | noise = property(getNoise, "I'm the 'nHeights' property.") |
|
472 | noise = property(getNoise, "I'm the 'nHeights' property.") | |
473 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
473 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
474 |
|
474 | |||
475 | class Spectra(JROData): |
|
475 | class Spectra(JROData): | |
476 |
|
476 | |||
477 | #data es un numpy array de 2 dmensiones (canales, perfiles, alturas) |
|
477 | #data es un numpy array de 2 dmensiones (canales, perfiles, alturas) | |
478 | data_spc = None |
|
478 | data_spc = None | |
479 |
|
479 | |||
480 | #data es un numpy array de 2 dmensiones (canales, pares, alturas) |
|
480 | #data es un numpy array de 2 dmensiones (canales, pares, alturas) | |
481 | data_cspc = None |
|
481 | data_cspc = None | |
482 |
|
482 | |||
483 | #data es un numpy array de 2 dmensiones (canales, alturas) |
|
483 | #data es un numpy array de 2 dmensiones (canales, alturas) | |
484 | data_dc = None |
|
484 | data_dc = None | |
485 |
|
485 | |||
486 | nFFTPoints = None |
|
486 | nFFTPoints = None | |
487 |
|
487 | |||
488 | # nPairs = None |
|
488 | # nPairs = None | |
489 |
|
489 | |||
490 | pairsList = None |
|
490 | pairsList = None | |
491 |
|
491 | |||
492 | nIncohInt = None |
|
492 | nIncohInt = None | |
493 |
|
493 | |||
494 | wavelength = None #Necesario para cacular el rango de velocidad desde la frecuencia |
|
494 | wavelength = None #Necesario para cacular el rango de velocidad desde la frecuencia | |
495 |
|
495 | |||
496 | nCohInt = None #se requiere para determinar el valor de timeInterval |
|
496 | nCohInt = None #se requiere para determinar el valor de timeInterval | |
497 |
|
497 | |||
498 | ippFactor = None |
|
498 | ippFactor = None | |
499 |
|
499 | |||
500 | profileIndex = 0 |
|
500 | profileIndex = 0 | |
501 |
|
501 | |||
502 | def __init__(self): |
|
502 | def __init__(self): | |
503 | ''' |
|
503 | ''' | |
504 | Constructor |
|
504 | Constructor | |
505 | ''' |
|
505 | ''' | |
506 |
|
506 | |||
507 | self.useLocalTime = True |
|
507 | self.useLocalTime = True | |
508 |
|
508 | |||
509 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
509 | self.radarControllerHeaderObj = RadarControllerHeader() | |
510 |
|
510 | |||
511 | self.systemHeaderObj = SystemHeader() |
|
511 | self.systemHeaderObj = SystemHeader() | |
512 |
|
512 | |||
513 | self.type = "Spectra" |
|
513 | self.type = "Spectra" | |
514 |
|
514 | |||
515 | # self.data = None |
|
515 | # self.data = None | |
516 |
|
516 | |||
517 | # self.dtype = None |
|
517 | # self.dtype = None | |
518 |
|
518 | |||
519 | # self.nChannels = 0 |
|
519 | # self.nChannels = 0 | |
520 |
|
520 | |||
521 | # self.nHeights = 0 |
|
521 | # self.nHeights = 0 | |
522 |
|
522 | |||
523 | self.nProfiles = None |
|
523 | self.nProfiles = None | |
524 |
|
524 | |||
525 | self.heightList = None |
|
525 | self.heightList = None | |
526 |
|
526 | |||
527 | self.channelList = None |
|
527 | self.channelList = None | |
528 |
|
528 | |||
529 | # self.channelIndexList = None |
|
529 | # self.channelIndexList = None | |
530 |
|
530 | |||
531 | self.pairsList = None |
|
531 | self.pairsList = None | |
532 |
|
532 | |||
533 | self.flagNoData = True |
|
533 | self.flagNoData = True | |
534 |
|
534 | |||
535 | self.flagDiscontinuousBlock = False |
|
535 | self.flagDiscontinuousBlock = False | |
536 |
|
536 | |||
537 | self.utctime = None |
|
537 | self.utctime = None | |
538 |
|
538 | |||
539 | self.nCohInt = None |
|
539 | self.nCohInt = None | |
540 |
|
540 | |||
541 | self.nIncohInt = None |
|
541 | self.nIncohInt = None | |
542 |
|
542 | |||
543 | self.blocksize = None |
|
543 | self.blocksize = None | |
544 |
|
544 | |||
545 | self.nFFTPoints = None |
|
545 | self.nFFTPoints = None | |
546 |
|
546 | |||
547 | self.wavelength = None |
|
547 | self.wavelength = None | |
548 |
|
548 | |||
549 | self.flagDecodeData = False #asumo q la data no esta decodificada |
|
549 | self.flagDecodeData = False #asumo q la data no esta decodificada | |
550 |
|
550 | |||
551 | self.flagDeflipData = False #asumo q la data no esta sin flip |
|
551 | self.flagDeflipData = False #asumo q la data no esta sin flip | |
552 |
|
552 | |||
553 | self.flagShiftFFT = False |
|
553 | self.flagShiftFFT = False | |
554 |
|
554 | |||
555 | self.ippFactor = 1 |
|
555 | self.ippFactor = 1 | |
556 |
|
556 | |||
557 | #self.noise = None |
|
557 | #self.noise = None | |
558 |
|
558 | |||
559 | self.beacon_heiIndexList = [] |
|
559 | self.beacon_heiIndexList = [] | |
560 |
|
560 | |||
561 | self.noise_estimation = None |
|
561 | self.noise_estimation = None | |
562 |
|
562 | |||
563 |
|
563 | |||
564 | def getNoisebyHildebrand(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): |
|
564 | def getNoisebyHildebrand(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): | |
565 | """ |
|
565 | """ | |
566 | Determino el nivel de ruido usando el metodo Hildebrand-Sekhon |
|
566 | Determino el nivel de ruido usando el metodo Hildebrand-Sekhon | |
567 |
|
567 | |||
568 | Return: |
|
568 | Return: | |
569 | noiselevel |
|
569 | noiselevel | |
570 | """ |
|
570 | """ | |
571 |
|
571 | |||
572 | noise = numpy.zeros(self.nChannels) |
|
572 | noise = numpy.zeros(self.nChannels) | |
573 |
|
573 | |||
574 | for channel in range(self.nChannels): |
|
574 | for channel in range(self.nChannels): | |
575 | daux = self.data_spc[channel,xmin_index:xmax_index,ymin_index:ymax_index] |
|
575 | daux = self.data_spc[channel,xmin_index:xmax_index,ymin_index:ymax_index] | |
576 | noise[channel] = hildebrand_sekhon(daux, self.nIncohInt) |
|
576 | noise[channel] = hildebrand_sekhon(daux, self.nIncohInt) | |
577 |
|
577 | |||
578 | return noise |
|
578 | return noise | |
579 |
|
579 | |||
580 | def getNoise(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): |
|
580 | def getNoise(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): | |
581 |
|
581 | |||
582 | if self.noise_estimation != None: |
|
582 | if self.noise_estimation != None: | |
583 | return self.noise_estimation #this was estimated by getNoise Operation defined in jroproc_spectra.py |
|
583 | return self.noise_estimation #this was estimated by getNoise Operation defined in jroproc_spectra.py | |
584 | else: |
|
584 | else: | |
585 | noise = self.getNoisebyHildebrand(xmin_index, xmax_index, ymin_index, ymax_index) |
|
585 | noise = self.getNoisebyHildebrand(xmin_index, xmax_index, ymin_index, ymax_index) | |
586 | return noise |
|
586 | return noise | |
587 |
|
587 | |||
588 |
|
588 | |||
589 | def getFreqRange(self, extrapoints=0): |
|
589 | def getFreqRange(self, extrapoints=0): | |
590 |
|
590 | |||
591 | deltafreq = self.getFmax() / (self.nFFTPoints*self.ippFactor) |
|
591 | deltafreq = self.getFmax() / (self.nFFTPoints*self.ippFactor) | |
592 | freqrange = deltafreq*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltafreq/2 |
|
592 | freqrange = deltafreq*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltafreq/2 | |
593 |
|
593 | |||
594 | return freqrange |
|
594 | return freqrange | |
595 |
|
595 | |||
596 | def getVelRange(self, extrapoints=0): |
|
596 | def getVelRange(self, extrapoints=0): | |
597 |
|
597 | |||
598 | deltav = self.getVmax() / (self.nFFTPoints*self.ippFactor) |
|
598 | deltav = self.getVmax() / (self.nFFTPoints*self.ippFactor) | |
599 | velrange = deltav*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltav/2 |
|
599 | velrange = deltav*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltav/2 | |
600 |
|
600 | |||
601 | return velrange |
|
601 | return velrange | |
602 |
|
602 | |||
603 | def getNPairs(self): |
|
603 | def getNPairs(self): | |
604 |
|
604 | |||
605 | return len(self.pairsList) |
|
605 | return len(self.pairsList) | |
606 |
|
606 | |||
607 | def getPairsIndexList(self): |
|
607 | def getPairsIndexList(self): | |
608 |
|
608 | |||
609 | return range(self.nPairs) |
|
609 | return range(self.nPairs) | |
610 |
|
610 | |||
611 | def getNormFactor(self): |
|
611 | def getNormFactor(self): | |
612 |
|
612 | |||
613 | pwcode = 1 |
|
613 | pwcode = 1 | |
614 |
|
614 | |||
615 | if self.flagDecodeData: |
|
615 | if self.flagDecodeData: | |
616 | pwcode = numpy.sum(self.code[0]**2) |
|
616 | pwcode = numpy.sum(self.code[0]**2) | |
617 | #normFactor = min(self.nFFTPoints,self.nProfiles)*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter |
|
617 | #normFactor = min(self.nFFTPoints,self.nProfiles)*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter | |
618 | normFactor = self.nProfiles*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter |
|
618 | normFactor = self.nProfiles*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter | |
619 |
|
619 | |||
620 | return normFactor |
|
620 | return normFactor | |
621 |
|
621 | |||
622 | def getFlagCspc(self): |
|
622 | def getFlagCspc(self): | |
623 |
|
623 | |||
624 | if self.data_cspc is None: |
|
624 | if self.data_cspc is None: | |
625 | return True |
|
625 | return True | |
626 |
|
626 | |||
627 | return False |
|
627 | return False | |
628 |
|
628 | |||
629 | def getFlagDc(self): |
|
629 | def getFlagDc(self): | |
630 |
|
630 | |||
631 | if self.data_dc is None: |
|
631 | if self.data_dc is None: | |
632 | return True |
|
632 | return True | |
633 |
|
633 | |||
634 | return False |
|
634 | return False | |
635 |
|
635 | |||
636 | def getTimeInterval(self): |
|
636 | def getTimeInterval(self): | |
637 |
|
637 | |||
638 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt * self.nProfiles |
|
638 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt * self.nProfiles | |
639 |
|
639 | |||
640 | return timeInterval |
|
640 | return timeInterval | |
641 |
|
641 | |||
642 | def setValue(self, value): |
|
642 | def setValue(self, value): | |
643 |
|
643 | |||
644 | print "This property should not be initialized" |
|
644 | print "This property should not be initialized" | |
645 |
|
645 | |||
646 | return |
|
646 | return | |
647 |
|
647 | |||
648 | nPairs = property(getNPairs, setValue, "I'm the 'nPairs' property.") |
|
648 | nPairs = property(getNPairs, setValue, "I'm the 'nPairs' property.") | |
649 | pairsIndexList = property(getPairsIndexList, setValue, "I'm the 'pairsIndexList' property.") |
|
649 | pairsIndexList = property(getPairsIndexList, setValue, "I'm the 'pairsIndexList' property.") | |
650 | normFactor = property(getNormFactor, setValue, "I'm the 'getNormFactor' property.") |
|
650 | normFactor = property(getNormFactor, setValue, "I'm the 'getNormFactor' property.") | |
651 | flag_cspc = property(getFlagCspc, setValue) |
|
651 | flag_cspc = property(getFlagCspc, setValue) | |
652 | flag_dc = property(getFlagDc, setValue) |
|
652 | flag_dc = property(getFlagDc, setValue) | |
653 | noise = property(getNoise, setValue, "I'm the 'nHeights' property.") |
|
653 | noise = property(getNoise, setValue, "I'm the 'nHeights' property.") | |
654 | timeInterval = property(getTimeInterval, setValue, "I'm the 'timeInterval' property") |
|
654 | timeInterval = property(getTimeInterval, setValue, "I'm the 'timeInterval' property") | |
655 |
|
655 | |||
656 | class SpectraHeis(Spectra): |
|
656 | class SpectraHeis(Spectra): | |
657 |
|
657 | |||
658 | data_spc = None |
|
658 | data_spc = None | |
659 |
|
659 | |||
660 | data_cspc = None |
|
660 | data_cspc = None | |
661 |
|
661 | |||
662 | data_dc = None |
|
662 | data_dc = None | |
663 |
|
663 | |||
664 | nFFTPoints = None |
|
664 | nFFTPoints = None | |
665 |
|
665 | |||
666 | # nPairs = None |
|
666 | # nPairs = None | |
667 |
|
667 | |||
668 | pairsList = None |
|
668 | pairsList = None | |
669 |
|
669 | |||
670 | nCohInt = None |
|
670 | nCohInt = None | |
671 |
|
671 | |||
672 | nIncohInt = None |
|
672 | nIncohInt = None | |
673 |
|
673 | |||
674 | def __init__(self): |
|
674 | def __init__(self): | |
675 |
|
675 | |||
676 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
676 | self.radarControllerHeaderObj = RadarControllerHeader() | |
677 |
|
677 | |||
678 | self.systemHeaderObj = SystemHeader() |
|
678 | self.systemHeaderObj = SystemHeader() | |
679 |
|
679 | |||
680 | self.type = "SpectraHeis" |
|
680 | self.type = "SpectraHeis" | |
681 |
|
681 | |||
682 | # self.dtype = None |
|
682 | # self.dtype = None | |
683 |
|
683 | |||
684 | # self.nChannels = 0 |
|
684 | # self.nChannels = 0 | |
685 |
|
685 | |||
686 | # self.nHeights = 0 |
|
686 | # self.nHeights = 0 | |
687 |
|
687 | |||
688 | self.nProfiles = None |
|
688 | self.nProfiles = None | |
689 |
|
689 | |||
690 | self.heightList = None |
|
690 | self.heightList = None | |
691 |
|
691 | |||
692 | self.channelList = None |
|
692 | self.channelList = None | |
693 |
|
693 | |||
694 | # self.channelIndexList = None |
|
694 | # self.channelIndexList = None | |
695 |
|
695 | |||
696 | self.flagNoData = True |
|
696 | self.flagNoData = True | |
697 |
|
697 | |||
698 | self.flagDiscontinuousBlock = False |
|
698 | self.flagDiscontinuousBlock = False | |
699 |
|
699 | |||
700 | # self.nPairs = 0 |
|
700 | # self.nPairs = 0 | |
701 |
|
701 | |||
702 | self.utctime = None |
|
702 | self.utctime = None | |
703 |
|
703 | |||
704 | self.blocksize = None |
|
704 | self.blocksize = None | |
705 |
|
705 | |||
706 | self.profileIndex = 0 |
|
706 | self.profileIndex = 0 | |
707 |
|
707 | |||
708 | self.nCohInt = 1 |
|
708 | self.nCohInt = 1 | |
709 |
|
709 | |||
710 | self.nIncohInt = 1 |
|
710 | self.nIncohInt = 1 | |
711 |
|
711 | |||
712 | def getNormFactor(self): |
|
712 | def getNormFactor(self): | |
713 | pwcode = 1 |
|
713 | pwcode = 1 | |
714 | if self.flagDecodeData: |
|
714 | if self.flagDecodeData: | |
715 | pwcode = numpy.sum(self.code[0]**2) |
|
715 | pwcode = numpy.sum(self.code[0]**2) | |
716 |
|
716 | |||
717 | normFactor = self.nIncohInt*self.nCohInt*pwcode |
|
717 | normFactor = self.nIncohInt*self.nCohInt*pwcode | |
718 |
|
718 | |||
719 | return normFactor |
|
719 | return normFactor | |
720 |
|
720 | |||
721 | def getTimeInterval(self): |
|
721 | def getTimeInterval(self): | |
722 |
|
722 | |||
723 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt |
|
723 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt | |
724 |
|
724 | |||
725 | return timeInterval |
|
725 | return timeInterval | |
726 |
|
726 | |||
727 | normFactor = property(getNormFactor, "I'm the 'getNormFactor' property.") |
|
727 | normFactor = property(getNormFactor, "I'm the 'getNormFactor' property.") | |
728 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
728 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
729 |
|
729 | |||
730 | class Fits(JROData): |
|
730 | class Fits(JROData): | |
731 |
|
731 | |||
732 | heightList = None |
|
732 | heightList = None | |
733 |
|
733 | |||
734 | channelList = None |
|
734 | channelList = None | |
735 |
|
735 | |||
736 | flagNoData = True |
|
736 | flagNoData = True | |
737 |
|
737 | |||
738 | flagDiscontinuousBlock = False |
|
738 | flagDiscontinuousBlock = False | |
739 |
|
739 | |||
740 | useLocalTime = False |
|
740 | useLocalTime = False | |
741 |
|
741 | |||
742 | utctime = None |
|
742 | utctime = None | |
743 |
|
743 | |||
744 | timeZone = None |
|
744 | timeZone = None | |
745 |
|
745 | |||
746 | # ippSeconds = None |
|
746 | # ippSeconds = None | |
747 |
|
747 | |||
748 | # timeInterval = None |
|
748 | # timeInterval = None | |
749 |
|
749 | |||
750 | nCohInt = None |
|
750 | nCohInt = None | |
751 |
|
751 | |||
752 | nIncohInt = None |
|
752 | nIncohInt = None | |
753 |
|
753 | |||
754 | noise = None |
|
754 | noise = None | |
755 |
|
755 | |||
756 | windowOfFilter = 1 |
|
756 | windowOfFilter = 1 | |
757 |
|
757 | |||
758 | #Speed of ligth |
|
758 | #Speed of ligth | |
759 | C = 3e8 |
|
759 | C = 3e8 | |
760 |
|
760 | |||
761 | frequency = 49.92e6 |
|
761 | frequency = 49.92e6 | |
762 |
|
762 | |||
763 | realtime = False |
|
763 | realtime = False | |
764 |
|
764 | |||
765 |
|
765 | |||
766 | def __init__(self): |
|
766 | def __init__(self): | |
767 |
|
767 | |||
768 | self.type = "Fits" |
|
768 | self.type = "Fits" | |
769 |
|
769 | |||
770 | self.nProfiles = None |
|
770 | self.nProfiles = None | |
771 |
|
771 | |||
772 | self.heightList = None |
|
772 | self.heightList = None | |
773 |
|
773 | |||
774 | self.channelList = None |
|
774 | self.channelList = None | |
775 |
|
775 | |||
776 | # self.channelIndexList = None |
|
776 | # self.channelIndexList = None | |
777 |
|
777 | |||
778 | self.flagNoData = True |
|
778 | self.flagNoData = True | |
779 |
|
779 | |||
780 | self.utctime = None |
|
780 | self.utctime = None | |
781 |
|
781 | |||
782 | self.nCohInt = 1 |
|
782 | self.nCohInt = 1 | |
783 |
|
783 | |||
784 | self.nIncohInt = 1 |
|
784 | self.nIncohInt = 1 | |
785 |
|
785 | |||
786 | self.useLocalTime = True |
|
786 | self.useLocalTime = True | |
787 |
|
787 | |||
788 | self.profileIndex = 0 |
|
788 | self.profileIndex = 0 | |
789 |
|
789 | |||
790 | # self.utctime = None |
|
790 | # self.utctime = None | |
791 | # self.timeZone = None |
|
791 | # self.timeZone = None | |
792 | # self.ltctime = None |
|
792 | # self.ltctime = None | |
793 | # self.timeInterval = None |
|
793 | # self.timeInterval = None | |
794 | # self.header = None |
|
794 | # self.header = None | |
795 | # self.data_header = None |
|
795 | # self.data_header = None | |
796 | # self.data = None |
|
796 | # self.data = None | |
797 | # self.datatime = None |
|
797 | # self.datatime = None | |
798 | # self.flagNoData = False |
|
798 | # self.flagNoData = False | |
799 | # self.expName = '' |
|
799 | # self.expName = '' | |
800 | # self.nChannels = None |
|
800 | # self.nChannels = None | |
801 | # self.nSamples = None |
|
801 | # self.nSamples = None | |
802 | # self.dataBlocksPerFile = None |
|
802 | # self.dataBlocksPerFile = None | |
803 | # self.comments = '' |
|
803 | # self.comments = '' | |
804 | # |
|
804 | # | |
805 |
|
805 | |||
806 |
|
806 | |||
807 | def getltctime(self): |
|
807 | def getltctime(self): | |
808 |
|
808 | |||
809 | if self.useLocalTime: |
|
809 | if self.useLocalTime: | |
810 | return self.utctime - self.timeZone*60 |
|
810 | return self.utctime - self.timeZone*60 | |
811 |
|
811 | |||
812 | return self.utctime |
|
812 | return self.utctime | |
813 |
|
813 | |||
814 | def getDatatime(self): |
|
814 | def getDatatime(self): | |
815 |
|
815 | |||
816 | datatime = datetime.datetime.utcfromtimestamp(self.ltctime) |
|
816 | datatime = datetime.datetime.utcfromtimestamp(self.ltctime) | |
817 | return datatime |
|
817 | return datatime | |
818 |
|
818 | |||
819 | def getTimeRange(self): |
|
819 | def getTimeRange(self): | |
820 |
|
820 | |||
821 | datatime = [] |
|
821 | datatime = [] | |
822 |
|
822 | |||
823 | datatime.append(self.ltctime) |
|
823 | datatime.append(self.ltctime) | |
824 | datatime.append(self.ltctime + self.timeInterval) |
|
824 | datatime.append(self.ltctime + self.timeInterval) | |
825 |
|
825 | |||
826 | datatime = numpy.array(datatime) |
|
826 | datatime = numpy.array(datatime) | |
827 |
|
827 | |||
828 | return datatime |
|
828 | return datatime | |
829 |
|
829 | |||
830 | def getHeiRange(self): |
|
830 | def getHeiRange(self): | |
831 |
|
831 | |||
832 | heis = self.heightList |
|
832 | heis = self.heightList | |
833 |
|
833 | |||
834 | return heis |
|
834 | return heis | |
835 |
|
835 | |||
836 | def isEmpty(self): |
|
|||
837 |
|
||||
838 | return self.flagNoData |
|
|||
839 |
|
||||
840 | def getNHeights(self): |
|
836 | def getNHeights(self): | |
841 |
|
837 | |||
842 | return len(self.heightList) |
|
838 | return len(self.heightList) | |
843 |
|
839 | |||
844 | def getNChannels(self): |
|
840 | def getNChannels(self): | |
845 |
|
841 | |||
846 | return len(self.channelList) |
|
842 | return len(self.channelList) | |
847 |
|
843 | |||
848 | def getChannelIndexList(self): |
|
844 | def getChannelIndexList(self): | |
849 |
|
845 | |||
850 | return range(self.nChannels) |
|
846 | return range(self.nChannels) | |
851 |
|
847 | |||
852 | def getNoise(self, type = 1): |
|
848 | def getNoise(self, type = 1): | |
853 |
|
849 | |||
854 | #noise = numpy.zeros(self.nChannels) |
|
850 | #noise = numpy.zeros(self.nChannels) | |
855 |
|
851 | |||
856 | if type == 1: |
|
852 | if type == 1: | |
857 | noise = self.getNoisebyHildebrand() |
|
853 | noise = self.getNoisebyHildebrand() | |
858 |
|
854 | |||
859 | if type == 2: |
|
855 | if type == 2: | |
860 | noise = self.getNoisebySort() |
|
856 | noise = self.getNoisebySort() | |
861 |
|
857 | |||
862 | if type == 3: |
|
858 | if type == 3: | |
863 | noise = self.getNoisebyWindow() |
|
859 | noise = self.getNoisebyWindow() | |
864 |
|
860 | |||
865 | return noise |
|
861 | return noise | |
866 |
|
862 | |||
867 | def getTimeInterval(self): |
|
863 | def getTimeInterval(self): | |
868 |
|
864 | |||
869 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt |
|
865 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt | |
870 |
|
866 | |||
871 | return timeInterval |
|
867 | return timeInterval | |
872 |
|
868 | |||
873 | datatime = property(getDatatime, "I'm the 'datatime' property") |
|
869 | datatime = property(getDatatime, "I'm the 'datatime' property") | |
874 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") |
|
870 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") | |
875 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") |
|
871 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") | |
876 | channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") |
|
872 | channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") | |
877 | noise = property(getNoise, "I'm the 'nHeights' property.") |
|
873 | noise = property(getNoise, "I'm the 'nHeights' property.") | |
878 |
|
874 | |||
879 | ltctime = property(getltctime, "I'm the 'ltctime' property") |
|
875 | ltctime = property(getltctime, "I'm the 'ltctime' property") | |
880 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
876 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
881 |
|
877 | |||
882 | class Correlation(JROData): |
|
878 | class Correlation(JROData): | |
883 |
|
879 | |||
884 | noise = None |
|
880 | noise = None | |
885 |
|
881 | |||
886 | SNR = None |
|
882 | SNR = None | |
887 |
|
883 | |||
888 | pairsAutoCorr = None #Pairs of Autocorrelation |
|
884 | pairsAutoCorr = None #Pairs of Autocorrelation | |
889 |
|
885 | |||
890 | #-------------------------------------------------- |
|
886 | #-------------------------------------------------- | |
891 |
|
887 | |||
892 | data_corr = None |
|
888 | data_corr = None | |
893 |
|
889 | |||
894 | data_volt = None |
|
890 | data_volt = None | |
895 |
|
891 | |||
896 | lagT = None # each element value is a profileIndex |
|
892 | lagT = None # each element value is a profileIndex | |
897 |
|
893 | |||
898 | lagR = None # each element value is in km |
|
894 | lagR = None # each element value is in km | |
899 |
|
895 | |||
900 | pairsList = None |
|
896 | pairsList = None | |
901 |
|
897 | |||
902 | calculateVelocity = None |
|
898 | calculateVelocity = None | |
903 |
|
899 | |||
904 | nPoints = None |
|
900 | nPoints = None | |
905 |
|
901 | |||
906 | nAvg = None |
|
902 | nAvg = None | |
907 |
|
903 | |||
908 | bufferSize = None |
|
904 | bufferSize = None | |
909 |
|
905 | |||
910 | def __init__(self): |
|
906 | def __init__(self): | |
911 | ''' |
|
907 | ''' | |
912 | Constructor |
|
908 | Constructor | |
913 | ''' |
|
909 | ''' | |
914 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
910 | self.radarControllerHeaderObj = RadarControllerHeader() | |
915 |
|
911 | |||
916 | self.systemHeaderObj = SystemHeader() |
|
912 | self.systemHeaderObj = SystemHeader() | |
917 |
|
913 | |||
918 | self.type = "Correlation" |
|
914 | self.type = "Correlation" | |
919 |
|
915 | |||
920 | self.data = None |
|
916 | self.data = None | |
921 |
|
917 | |||
922 | self.dtype = None |
|
918 | self.dtype = None | |
923 |
|
919 | |||
924 | self.nProfiles = None |
|
920 | self.nProfiles = None | |
925 |
|
921 | |||
926 | self.heightList = None |
|
922 | self.heightList = None | |
927 |
|
923 | |||
928 | self.channelList = None |
|
924 | self.channelList = None | |
929 |
|
925 | |||
930 | self.flagNoData = True |
|
926 | self.flagNoData = True | |
931 |
|
927 | |||
932 | self.flagDiscontinuousBlock = False |
|
928 | self.flagDiscontinuousBlock = False | |
933 |
|
929 | |||
934 | self.utctime = None |
|
930 | self.utctime = None | |
935 |
|
931 | |||
936 | self.timeZone = None |
|
932 | self.timeZone = None | |
937 |
|
933 | |||
938 | self.dstFlag = None |
|
934 | self.dstFlag = None | |
939 |
|
935 | |||
940 | self.errorCount = None |
|
936 | self.errorCount = None | |
941 |
|
937 | |||
942 | self.blocksize = None |
|
938 | self.blocksize = None | |
943 |
|
939 | |||
944 | self.flagDecodeData = False #asumo q la data no esta decodificada |
|
940 | self.flagDecodeData = False #asumo q la data no esta decodificada | |
945 |
|
941 | |||
946 | self.flagDeflipData = False #asumo q la data no esta sin flip |
|
942 | self.flagDeflipData = False #asumo q la data no esta sin flip | |
947 |
|
943 | |||
948 | self.pairsList = None |
|
944 | self.pairsList = None | |
949 |
|
945 | |||
950 | self.nPoints = None |
|
946 | self.nPoints = None | |
951 |
|
947 | |||
952 | def getLagTRange(self, extrapoints=0): |
|
948 | def getLagTRange(self, extrapoints=0): | |
953 |
|
949 | |||
954 | lagTRange = self.lagT |
|
950 | lagTRange = self.lagT | |
955 | diff = lagTRange[1] - lagTRange[0] |
|
951 | diff = lagTRange[1] - lagTRange[0] | |
956 | extra = numpy.arange(1,extrapoints + 1)*diff + lagTRange[-1] |
|
952 | extra = numpy.arange(1,extrapoints + 1)*diff + lagTRange[-1] | |
957 | lagTRange = numpy.hstack((lagTRange, extra)) |
|
953 | lagTRange = numpy.hstack((lagTRange, extra)) | |
958 |
|
954 | |||
959 | return lagTRange |
|
955 | return lagTRange | |
960 |
|
956 | |||
961 | def getLagRRange(self, extrapoints=0): |
|
957 | def getLagRRange(self, extrapoints=0): | |
962 |
|
958 | |||
963 | return self.lagR |
|
959 | return self.lagR | |
964 |
|
960 | |||
965 | def getPairsList(self): |
|
961 | def getPairsList(self): | |
966 |
|
962 | |||
967 | return self.pairsList |
|
963 | return self.pairsList | |
968 |
|
964 | |||
969 | def getCalculateVelocity(self): |
|
965 | def getCalculateVelocity(self): | |
970 |
|
966 | |||
971 | return self.calculateVelocity |
|
967 | return self.calculateVelocity | |
972 |
|
968 | |||
973 | def getNPoints(self): |
|
969 | def getNPoints(self): | |
974 |
|
970 | |||
975 | return self.nPoints |
|
971 | return self.nPoints | |
976 |
|
972 | |||
977 | def getNAvg(self): |
|
973 | def getNAvg(self): | |
978 |
|
974 | |||
979 | return self.nAvg |
|
975 | return self.nAvg | |
980 |
|
976 | |||
981 | def getBufferSize(self): |
|
977 | def getBufferSize(self): | |
982 |
|
978 | |||
983 | return self.bufferSize |
|
979 | return self.bufferSize | |
984 |
|
980 | |||
985 | def getPairsAutoCorr(self): |
|
981 | def getPairsAutoCorr(self): | |
986 | pairsList = self.pairsList |
|
982 | pairsList = self.pairsList | |
987 | pairsAutoCorr = numpy.zeros(self.nChannels, dtype = 'int')*numpy.nan |
|
983 | pairsAutoCorr = numpy.zeros(self.nChannels, dtype = 'int')*numpy.nan | |
988 |
|
984 | |||
989 | for l in range(len(pairsList)): |
|
985 | for l in range(len(pairsList)): | |
990 | firstChannel = pairsList[l][0] |
|
986 | firstChannel = pairsList[l][0] | |
991 | secondChannel = pairsList[l][1] |
|
987 | secondChannel = pairsList[l][1] | |
992 |
|
988 | |||
993 | #Obteniendo pares de Autocorrelacion |
|
989 | #Obteniendo pares de Autocorrelacion | |
994 | if firstChannel == secondChannel: |
|
990 | if firstChannel == secondChannel: | |
995 | pairsAutoCorr[firstChannel] = int(l) |
|
991 | pairsAutoCorr[firstChannel] = int(l) | |
996 |
|
992 | |||
997 | pairsAutoCorr = pairsAutoCorr.astype(int) |
|
993 | pairsAutoCorr = pairsAutoCorr.astype(int) | |
998 |
|
994 | |||
999 | return pairsAutoCorr |
|
995 | return pairsAutoCorr | |
1000 |
|
996 | |||
1001 | def getNoise(self, mode = 2): |
|
997 | def getNoise(self, mode = 2): | |
1002 |
|
998 | |||
1003 | indR = numpy.where(self.lagR == 0)[0][0] |
|
999 | indR = numpy.where(self.lagR == 0)[0][0] | |
1004 | indT = numpy.where(self.lagT == 0)[0][0] |
|
1000 | indT = numpy.where(self.lagT == 0)[0][0] | |
1005 |
|
1001 | |||
1006 | jspectra0 = self.data_corr[:,:,indR,:] |
|
1002 | jspectra0 = self.data_corr[:,:,indR,:] | |
1007 | jspectra = copy.copy(jspectra0) |
|
1003 | jspectra = copy.copy(jspectra0) | |
1008 |
|
1004 | |||
1009 | num_chan = jspectra.shape[0] |
|
1005 | num_chan = jspectra.shape[0] | |
1010 | num_hei = jspectra.shape[2] |
|
1006 | num_hei = jspectra.shape[2] | |
1011 |
|
1007 | |||
1012 | freq_dc = jspectra.shape[1]/2 |
|
1008 | freq_dc = jspectra.shape[1]/2 | |
1013 | ind_vel = numpy.array([-2,-1,1,2]) + freq_dc |
|
1009 | ind_vel = numpy.array([-2,-1,1,2]) + freq_dc | |
1014 |
|
1010 | |||
1015 | if ind_vel[0]<0: |
|
1011 | if ind_vel[0]<0: | |
1016 | ind_vel[range(0,1)] = ind_vel[range(0,1)] + self.num_prof |
|
1012 | ind_vel[range(0,1)] = ind_vel[range(0,1)] + self.num_prof | |
1017 |
|
1013 | |||
1018 | if mode == 1: |
|
1014 | if mode == 1: | |
1019 | jspectra[:,freq_dc,:] = (jspectra[:,ind_vel[1],:] + jspectra[:,ind_vel[2],:])/2 #CORRECCION |
|
1015 | jspectra[:,freq_dc,:] = (jspectra[:,ind_vel[1],:] + jspectra[:,ind_vel[2],:])/2 #CORRECCION | |
1020 |
|
1016 | |||
1021 | if mode == 2: |
|
1017 | if mode == 2: | |
1022 |
|
1018 | |||
1023 | vel = numpy.array([-2,-1,1,2]) |
|
1019 | vel = numpy.array([-2,-1,1,2]) | |
1024 | xx = numpy.zeros([4,4]) |
|
1020 | xx = numpy.zeros([4,4]) | |
1025 |
|
1021 | |||
1026 | for fil in range(4): |
|
1022 | for fil in range(4): | |
1027 | xx[fil,:] = vel[fil]**numpy.asarray(range(4)) |
|
1023 | xx[fil,:] = vel[fil]**numpy.asarray(range(4)) | |
1028 |
|
1024 | |||
1029 | xx_inv = numpy.linalg.inv(xx) |
|
1025 | xx_inv = numpy.linalg.inv(xx) | |
1030 | xx_aux = xx_inv[0,:] |
|
1026 | xx_aux = xx_inv[0,:] | |
1031 |
|
1027 | |||
1032 | for ich in range(num_chan): |
|
1028 | for ich in range(num_chan): | |
1033 | yy = jspectra[ich,ind_vel,:] |
|
1029 | yy = jspectra[ich,ind_vel,:] | |
1034 | jspectra[ich,freq_dc,:] = numpy.dot(xx_aux,yy) |
|
1030 | jspectra[ich,freq_dc,:] = numpy.dot(xx_aux,yy) | |
1035 |
|
1031 | |||
1036 | junkid = jspectra[ich,freq_dc,:]<=0 |
|
1032 | junkid = jspectra[ich,freq_dc,:]<=0 | |
1037 | cjunkid = sum(junkid) |
|
1033 | cjunkid = sum(junkid) | |
1038 |
|
1034 | |||
1039 | if cjunkid.any(): |
|
1035 | if cjunkid.any(): | |
1040 | jspectra[ich,freq_dc,junkid.nonzero()] = (jspectra[ich,ind_vel[1],junkid] + jspectra[ich,ind_vel[2],junkid])/2 |
|
1036 | jspectra[ich,freq_dc,junkid.nonzero()] = (jspectra[ich,ind_vel[1],junkid] + jspectra[ich,ind_vel[2],junkid])/2 | |
1041 |
|
1037 | |||
1042 | noise = jspectra0[:,freq_dc,:] - jspectra[:,freq_dc,:] |
|
1038 | noise = jspectra0[:,freq_dc,:] - jspectra[:,freq_dc,:] | |
1043 |
|
1039 | |||
1044 | return noise |
|
1040 | return noise | |
1045 |
|
1041 | |||
1046 | def getTimeInterval(self): |
|
1042 | def getTimeInterval(self): | |
1047 |
|
1043 | |||
1048 | timeInterval = self.ippSeconds * self.nCohInt * self.nPoints |
|
1044 | timeInterval = self.ippSeconds * self.nCohInt * self.nPoints | |
1049 |
|
1045 | |||
1050 | return timeInterval |
|
1046 | return timeInterval | |
1051 |
|
1047 | |||
1052 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
1048 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
1053 | # pairsList = property(getPairsList, "I'm the 'pairsList' property.") |
|
1049 | # pairsList = property(getPairsList, "I'm the 'pairsList' property.") | |
1054 | # nPoints = property(getNPoints, "I'm the 'nPoints' property.") |
|
1050 | # nPoints = property(getNPoints, "I'm the 'nPoints' property.") | |
1055 | calculateVelocity = property(getCalculateVelocity, "I'm the 'calculateVelocity' property.") |
|
1051 | calculateVelocity = property(getCalculateVelocity, "I'm the 'calculateVelocity' property.") | |
1056 | nAvg = property(getNAvg, "I'm the 'nAvg' property.") |
|
1052 | nAvg = property(getNAvg, "I'm the 'nAvg' property.") | |
1057 | bufferSize = property(getBufferSize, "I'm the 'bufferSize' property.") |
|
1053 | bufferSize = property(getBufferSize, "I'm the 'bufferSize' property.") | |
1058 |
|
1054 | |||
1059 |
|
1055 | |||
1060 | class Parameters(JROData): |
|
1056 | class Parameters(JROData): | |
1061 |
|
1057 | |||
1062 | #Information from previous data |
|
1058 | #Information from previous data | |
1063 |
|
1059 | |||
1064 | inputUnit = None #Type of data to be processed |
|
1060 | inputUnit = None #Type of data to be processed | |
1065 |
|
1061 | |||
1066 | operation = None #Type of operation to parametrize |
|
1062 | operation = None #Type of operation to parametrize | |
1067 |
|
1063 | |||
1068 | normFactor = None #Normalization Factor |
|
1064 | normFactor = None #Normalization Factor | |
1069 |
|
1065 | |||
1070 | groupList = None #List of Pairs, Groups, etc |
|
1066 | groupList = None #List of Pairs, Groups, etc | |
1071 |
|
1067 | |||
1072 | #Parameters |
|
1068 | #Parameters | |
1073 |
|
1069 | |||
1074 | data_param = None #Parameters obtained |
|
1070 | data_param = None #Parameters obtained | |
1075 |
|
1071 | |||
1076 | data_pre = None #Data Pre Parametrization |
|
1072 | data_pre = None #Data Pre Parametrization | |
1077 |
|
1073 | |||
1078 | data_SNR = None #Signal to Noise Ratio |
|
1074 | data_SNR = None #Signal to Noise Ratio | |
1079 |
|
1075 | |||
1080 | # heightRange = None #Heights |
|
1076 | # heightRange = None #Heights | |
1081 |
|
1077 | |||
1082 | abscissaList = None #Abscissa, can be velocities, lags or time |
|
1078 | abscissaList = None #Abscissa, can be velocities, lags or time | |
1083 |
|
1079 | |||
1084 | noise = None #Noise Potency |
|
1080 | noise = None #Noise Potency | |
1085 |
|
1081 | |||
1086 | utctimeInit = None #Initial UTC time |
|
1082 | utctimeInit = None #Initial UTC time | |
1087 |
|
1083 | |||
1088 | paramInterval = None #Time interval to calculate Parameters in seconds |
|
1084 | paramInterval = None #Time interval to calculate Parameters in seconds | |
1089 |
|
1085 | |||
1090 | #Fitting |
|
1086 | #Fitting | |
1091 |
|
1087 | |||
1092 | data_error = None #Error of the estimation |
|
1088 | data_error = None #Error of the estimation | |
1093 |
|
1089 | |||
1094 | constants = None |
|
1090 | constants = None | |
1095 |
|
1091 | |||
1096 | library = None |
|
1092 | library = None | |
1097 |
|
1093 | |||
1098 | #Output signal |
|
1094 | #Output signal | |
1099 |
|
1095 | |||
1100 | outputInterval = None #Time interval to calculate output signal in seconds |
|
1096 | outputInterval = None #Time interval to calculate output signal in seconds | |
1101 |
|
1097 | |||
1102 | data_output = None #Out signal |
|
1098 | data_output = None #Out signal | |
1103 |
|
1099 | |||
1104 |
|
1100 | |||
1105 |
|
1101 | |||
1106 | def __init__(self): |
|
1102 | def __init__(self): | |
1107 | ''' |
|
1103 | ''' | |
1108 | Constructor |
|
1104 | Constructor | |
1109 | ''' |
|
1105 | ''' | |
1110 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
1106 | self.radarControllerHeaderObj = RadarControllerHeader() | |
1111 |
|
1107 | |||
1112 | self.systemHeaderObj = SystemHeader() |
|
1108 | self.systemHeaderObj = SystemHeader() | |
1113 |
|
1109 | |||
1114 | self.type = "Parameters" |
|
1110 | self.type = "Parameters" | |
1115 |
|
1111 | |||
1116 | def getTimeRange1(self): |
|
1112 | def getTimeRange1(self): | |
1117 |
|
1113 | |||
1118 | datatime = [] |
|
1114 | datatime = [] | |
1119 |
|
1115 | |||
1120 | if self.useLocalTime: |
|
1116 | if self.useLocalTime: | |
1121 | time1 = self.utctimeInit - self.timeZone*60 |
|
1117 | time1 = self.utctimeInit - self.timeZone*60 | |
1122 | else: |
|
1118 | else: | |
1123 | time1 = utctimeInit |
|
1119 | time1 = utctimeInit | |
1124 |
|
1120 | |||
1125 | # datatime.append(self.utctimeInit) |
|
1121 | # datatime.append(self.utctimeInit) | |
1126 | # datatime.append(self.utctimeInit + self.outputInterval) |
|
1122 | # datatime.append(self.utctimeInit + self.outputInterval) | |
1127 | datatime.append(time1) |
|
1123 | datatime.append(time1) | |
1128 | datatime.append(time1 + self.outputInterval) |
|
1124 | datatime.append(time1 + self.outputInterval) | |
1129 |
|
1125 | |||
1130 | datatime = numpy.array(datatime) |
|
1126 | datatime = numpy.array(datatime) | |
1131 |
|
1127 | |||
1132 | return datatime |
|
1128 | return datatime |
@@ -1,19 +1,14 | |||||
1 | ''' |
|
1 | ''' | |
2 |
|
2 | |||
3 | $Author: murco $ |
|
3 | $Author: murco $ | |
4 | $Id: JRODataIO.py 169 2012-11-19 21:57:03Z murco $ |
|
4 | $Id: JRODataIO.py 169 2012-11-19 21:57:03Z murco $ | |
5 | ''' |
|
5 | ''' | |
6 |
|
6 | |||
7 | from jroIO_voltage import * |
|
7 | from jroIO_voltage import * | |
8 | from jroIO_spectra import * |
|
8 | from jroIO_spectra import * | |
9 | from jroIO_heispectra import * |
|
9 | from jroIO_heispectra import * | |
10 | from jroIO_usrp import * |
|
10 | from jroIO_usrp import * | |
11 |
|
||||
12 | # try: |
|
|||
13 | # from jroIO_usrp_api import * |
|
|||
14 | # except: |
|
|||
15 | # print "jroIO_usrp_api could not be imported" |
|
|||
16 |
|
11 | |||
17 | from jroIO_amisr import * |
|
12 | from jroIO_amisr import * | |
18 | from jroIO_HDF5 import * |
|
13 | from jroIO_HDF5 import * | |
19 | from jroIO_hf import * No newline at end of file |
|
14 | from jroIO_hf import * |
@@ -1,849 +1,845 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Jul 3, 2014 |
|
2 | Created on Jul 3, 2014 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author: roj-idl71 | |
5 | ''' |
|
5 | ''' | |
6 |
|
6 | |||
7 | import os, sys |
|
7 | import os, sys | |
8 | import time, datetime |
|
8 | import time, datetime | |
9 | import numpy |
|
9 | import numpy | |
10 | import fnmatch |
|
10 | import fnmatch | |
11 | import glob |
|
11 | import glob | |
12 |
|
12 | from time import sleep | ||
13 | try: |
|
|||
14 | from gevent import sleep |
|
|||
15 | except: |
|
|||
16 | from time import sleep |
|
|||
17 |
|
13 | |||
18 | try: |
|
14 | try: | |
19 | import pyfits |
|
15 | import pyfits | |
20 | except: |
|
16 | except ImportError, e: | |
21 | """ |
|
17 | print "Fits data cannot be used. Install pyfits module" | |
22 | """ |
|
|||
23 |
|
18 | |||
24 | from xml.etree.ElementTree import ElementTree |
|
19 | from xml.etree.ElementTree import ElementTree | |
25 |
|
20 | |||
26 | from jroIO_base import isRadarFolder, isNumber |
|
21 | from jroIO_base import isRadarFolder, isNumber | |
|
22 | from schainpy.model.data.jrodata import Fits | |||
27 | from schainpy.model.proc.jroproc_base import Operation, ProcessingUnit |
|
23 | from schainpy.model.proc.jroproc_base import Operation, ProcessingUnit | |
28 |
|
24 | |||
29 | class Fits: |
|
25 | class PyFits(object): | |
30 | name=None |
|
26 | name=None | |
31 | format=None |
|
27 | format=None | |
32 | array =None |
|
28 | array =None | |
33 | data =None |
|
29 | data =None | |
34 | thdulist=None |
|
30 | thdulist=None | |
35 | prihdr=None |
|
31 | prihdr=None | |
36 | hdu=None |
|
32 | hdu=None | |
37 |
|
33 | |||
38 | def __init__(self): |
|
34 | def __init__(self): | |
39 |
|
35 | |||
40 | pass |
|
36 | pass | |
41 |
|
37 | |||
42 | def setColF(self,name,format,array): |
|
38 | def setColF(self,name,format,array): | |
43 | self.name=name |
|
39 | self.name=name | |
44 | self.format=format |
|
40 | self.format=format | |
45 | self.array=array |
|
41 | self.array=array | |
46 | a1=numpy.array([self.array],dtype=numpy.float32) |
|
42 | a1=numpy.array([self.array],dtype=numpy.float32) | |
47 | self.col1 = pyfits.Column(name=self.name, format=self.format, array=a1) |
|
43 | self.col1 = pyfits.Column(name=self.name, format=self.format, array=a1) | |
48 | return self.col1 |
|
44 | return self.col1 | |
49 |
|
45 | |||
50 | # def setColP(self,name,format,data): |
|
46 | # def setColP(self,name,format,data): | |
51 | # self.name=name |
|
47 | # self.name=name | |
52 | # self.format=format |
|
48 | # self.format=format | |
53 | # self.data=data |
|
49 | # self.data=data | |
54 | # a2=numpy.array([self.data],dtype=numpy.float32) |
|
50 | # a2=numpy.array([self.data],dtype=numpy.float32) | |
55 | # self.col2 = pyfits.Column(name=self.name, format=self.format, array=a2) |
|
51 | # self.col2 = pyfits.Column(name=self.name, format=self.format, array=a2) | |
56 | # return self.col2 |
|
52 | # return self.col2 | |
57 |
|
53 | |||
58 |
|
54 | |||
59 | def writeData(self,name,format,data): |
|
55 | def writeData(self,name,format,data): | |
60 | self.name=name |
|
56 | self.name=name | |
61 | self.format=format |
|
57 | self.format=format | |
62 | self.data=data |
|
58 | self.data=data | |
63 | a2=numpy.array([self.data],dtype=numpy.float32) |
|
59 | a2=numpy.array([self.data],dtype=numpy.float32) | |
64 | self.col2 = pyfits.Column(name=self.name, format=self.format, array=a2) |
|
60 | self.col2 = pyfits.Column(name=self.name, format=self.format, array=a2) | |
65 | return self.col2 |
|
61 | return self.col2 | |
66 |
|
62 | |||
67 | def cFImage(self,idblock,year,month,day,hour,minute,second): |
|
63 | def cFImage(self,idblock,year,month,day,hour,minute,second): | |
68 | self.hdu= pyfits.PrimaryHDU(idblock) |
|
64 | self.hdu= pyfits.PrimaryHDU(idblock) | |
69 | self.hdu.header.set("Year",year) |
|
65 | self.hdu.header.set("Year",year) | |
70 | self.hdu.header.set("Month",month) |
|
66 | self.hdu.header.set("Month",month) | |
71 | self.hdu.header.set("Day",day) |
|
67 | self.hdu.header.set("Day",day) | |
72 | self.hdu.header.set("Hour",hour) |
|
68 | self.hdu.header.set("Hour",hour) | |
73 | self.hdu.header.set("Minute",minute) |
|
69 | self.hdu.header.set("Minute",minute) | |
74 | self.hdu.header.set("Second",second) |
|
70 | self.hdu.header.set("Second",second) | |
75 | return self.hdu |
|
71 | return self.hdu | |
76 |
|
72 | |||
77 |
|
73 | |||
78 | def Ctable(self,colList): |
|
74 | def Ctable(self,colList): | |
79 | self.cols=pyfits.ColDefs(colList) |
|
75 | self.cols=pyfits.ColDefs(colList) | |
80 | self.tbhdu = pyfits.new_table(self.cols) |
|
76 | self.tbhdu = pyfits.new_table(self.cols) | |
81 | return self.tbhdu |
|
77 | return self.tbhdu | |
82 |
|
78 | |||
83 |
|
79 | |||
84 | def CFile(self,hdu,tbhdu): |
|
80 | def CFile(self,hdu,tbhdu): | |
85 | self.thdulist=pyfits.HDUList([hdu,tbhdu]) |
|
81 | self.thdulist=pyfits.HDUList([hdu,tbhdu]) | |
86 |
|
82 | |||
87 | def wFile(self,filename): |
|
83 | def wFile(self,filename): | |
88 | if os.path.isfile(filename): |
|
84 | if os.path.isfile(filename): | |
89 | os.remove(filename) |
|
85 | os.remove(filename) | |
90 | self.thdulist.writeto(filename) |
|
86 | self.thdulist.writeto(filename) | |
91 |
|
87 | |||
92 |
|
88 | |||
93 | class ParameterConf: |
|
89 | class ParameterConf: | |
94 | ELEMENTNAME = 'Parameter' |
|
90 | ELEMENTNAME = 'Parameter' | |
95 | def __init__(self): |
|
91 | def __init__(self): | |
96 | self.name = '' |
|
92 | self.name = '' | |
97 | self.value = '' |
|
93 | self.value = '' | |
98 |
|
94 | |||
99 | def readXml(self, parmElement): |
|
95 | def readXml(self, parmElement): | |
100 | self.name = parmElement.get('name') |
|
96 | self.name = parmElement.get('name') | |
101 | self.value = parmElement.get('value') |
|
97 | self.value = parmElement.get('value') | |
102 |
|
98 | |||
103 | def getElementName(self): |
|
99 | def getElementName(self): | |
104 | return self.ELEMENTNAME |
|
100 | return self.ELEMENTNAME | |
105 |
|
101 | |||
106 | class Metadata: |
|
102 | class Metadata(object): | |
107 |
|
103 | |||
108 | def __init__(self, filename): |
|
104 | def __init__(self, filename): | |
109 | self.parmConfObjList = [] |
|
105 | self.parmConfObjList = [] | |
110 | self.readXml(filename) |
|
106 | self.readXml(filename) | |
111 |
|
107 | |||
112 | def readXml(self, filename): |
|
108 | def readXml(self, filename): | |
113 | self.projectElement = None |
|
109 | self.projectElement = None | |
114 | self.procUnitConfObjDict = {} |
|
110 | self.procUnitConfObjDict = {} | |
115 | self.projectElement = ElementTree().parse(filename) |
|
111 | self.projectElement = ElementTree().parse(filename) | |
116 | self.project = self.projectElement.tag |
|
112 | self.project = self.projectElement.tag | |
117 |
|
113 | |||
118 | parmElementList = self.projectElement.getiterator(ParameterConf().getElementName()) |
|
114 | parmElementList = self.projectElement.getiterator(ParameterConf().getElementName()) | |
119 |
|
115 | |||
120 | for parmElement in parmElementList: |
|
116 | for parmElement in parmElementList: | |
121 | parmConfObj = ParameterConf() |
|
117 | parmConfObj = ParameterConf() | |
122 | parmConfObj.readXml(parmElement) |
|
118 | parmConfObj.readXml(parmElement) | |
123 | self.parmConfObjList.append(parmConfObj) |
|
119 | self.parmConfObjList.append(parmConfObj) | |
124 |
|
120 | |||
125 | class FitsWriter(Operation): |
|
121 | class FitsWriter(Operation): | |
126 |
|
122 | |||
127 | def __init__(self): |
|
123 | def __init__(self): | |
128 | self.isConfig = False |
|
124 | self.isConfig = False | |
129 | self.dataBlocksPerFile = None |
|
125 | self.dataBlocksPerFile = None | |
130 | self.blockIndex = 0 |
|
126 | self.blockIndex = 0 | |
131 | self.flagIsNewFile = 1 |
|
127 | self.flagIsNewFile = 1 | |
132 | self.fitsObj = None |
|
128 | self.fitsObj = None | |
133 | self.optchar = 'P' |
|
129 | self.optchar = 'P' | |
134 | self.ext = '.fits' |
|
130 | self.ext = '.fits' | |
135 | self.setFile = 0 |
|
131 | self.setFile = 0 | |
136 |
|
132 | |||
137 | def setFitsHeader(self, dataOut, metadatafile): |
|
133 | def setFitsHeader(self, dataOut, metadatafile=None): | |
138 |
|
134 | |||
139 | header_data = pyfits.PrimaryHDU() |
|
135 | header_data = pyfits.PrimaryHDU() | |
140 |
|
136 | |||
141 | metadata4fits = Metadata(metadatafile) |
|
137 | header_data.header['EXPNAME'] = "RADAR DATA" | |
142 | for parameter in metadata4fits.parmConfObjList: |
|
138 | header_data.header['DATATYPE'] = "SPECTRA" | |
143 | parm_name = parameter.name |
|
139 | header_data.header['COMMENT'] = "" | |
144 | parm_value = parameter.value |
|
140 | ||
|
141 | if metadatafile: | |||
145 |
|
142 | |||
146 | # if parm_value == 'fromdatadatetime': |
|
143 | metadata4fits = Metadata(metadatafile) | |
147 | # value = time.strftime("%b %d %Y %H:%M:%S", dataOut.datatime.timetuple()) |
|
|||
148 | # elif parm_value == 'fromdataheights': |
|
|||
149 | # value = dataOut.nHeights |
|
|||
150 | # elif parm_value == 'fromdatachannel': |
|
|||
151 | # value = dataOut.nChannels |
|
|||
152 | # elif parm_value == 'fromdatasamples': |
|
|||
153 | # value = dataOut.nFFTPoints |
|
|||
154 | # else: |
|
|||
155 | # value = parm_value |
|
|||
156 |
|
||||
157 | header_data.header[parm_name] = parm_value |
|
|||
158 |
|
144 | |||
|
145 | for parameter in metadata4fits.parmConfObjList: | |||
|
146 | parm_name = parameter.name | |||
|
147 | parm_value = parameter.value | |||
|
148 | ||||
|
149 | header_data.header[parm_name] = parm_value | |||
159 |
|
150 | |||
160 | header_data.header['DATETIME'] = time.strftime("%b %d %Y %H:%M:%S", dataOut.datatime.timetuple()) |
|
151 | header_data.header['DATETIME'] = time.strftime("%b %d %Y %H:%M:%S", dataOut.datatime.timetuple()) | |
161 | header_data.header['CHANNELLIST'] = str(dataOut.channelList) |
|
152 | header_data.header['CHANNELLIST'] = str(dataOut.channelList) | |
162 | header_data.header['NCHANNELS'] = dataOut.nChannels |
|
153 | header_data.header['NCHANNELS'] = dataOut.nChannels | |
163 | #header_data.header['HEIGHTS'] = dataOut.heightList |
|
154 | #header_data.header['HEIGHTS'] = dataOut.heightList | |
164 | header_data.header['NHEIGHTS'] = dataOut.nHeights |
|
155 | header_data.header['NHEIGHTS'] = dataOut.nHeights | |
165 |
|
156 | |||
166 | header_data.header['IPPSECONDS'] = dataOut.ippSeconds |
|
157 | header_data.header['IPPSECONDS'] = dataOut.ippSeconds | |
167 | header_data.header['NCOHINT'] = dataOut.nCohInt |
|
158 | header_data.header['NCOHINT'] = dataOut.nCohInt | |
168 | header_data.header['NINCOHINT'] = dataOut.nIncohInt |
|
159 | header_data.header['NINCOHINT'] = dataOut.nIncohInt | |
169 | header_data.header['TIMEZONE'] = dataOut.timeZone |
|
160 | header_data.header['TIMEZONE'] = dataOut.timeZone | |
170 | header_data.header['NBLOCK'] = self.blockIndex |
|
161 | header_data.header['NBLOCK'] = self.blockIndex | |
171 |
|
162 | |||
172 | header_data.writeto(self.filename) |
|
163 | header_data.writeto(self.filename) | |
173 |
|
164 | |||
174 | self.addExtension(dataOut.heightList,'HEIGHTLIST') |
|
165 | self.addExtension(dataOut.heightList,'HEIGHTLIST') | |
175 |
|
166 | |||
176 |
|
167 | |||
177 | def setup(self, dataOut, path, dataBlocksPerFile, metadatafile): |
|
168 | def setup(self, dataOut, path, dataBlocksPerFile=100, metadatafile=None): | |
178 |
|
169 | |||
179 | self.path = path |
|
170 | self.path = path | |
180 | self.dataOut = dataOut |
|
171 | self.dataOut = dataOut | |
181 | self.metadatafile = metadatafile |
|
172 | self.metadatafile = metadatafile | |
182 | self.dataBlocksPerFile = dataBlocksPerFile |
|
173 | self.dataBlocksPerFile = dataBlocksPerFile | |
183 |
|
174 | |||
184 | def open(self): |
|
175 | def open(self): | |
185 | self.fitsObj = pyfits.open(self.filename, mode='update') |
|
176 | self.fitsObj = pyfits.open(self.filename, mode='update') | |
186 |
|
177 | |||
187 |
|
178 | |||
188 | def addExtension(self, data, tagname): |
|
179 | def addExtension(self, data, tagname): | |
189 | self.open() |
|
180 | self.open() | |
190 | extension = pyfits.ImageHDU(data=data, name=tagname) |
|
181 | extension = pyfits.ImageHDU(data=data, name=tagname) | |
191 | #extension.header['TAG'] = tagname |
|
182 | #extension.header['TAG'] = tagname | |
192 | self.fitsObj.append(extension) |
|
183 | self.fitsObj.append(extension) | |
193 | self.write() |
|
184 | self.write() | |
194 |
|
185 | |||
195 | def addData(self, data): |
|
186 | def addData(self, data): | |
196 | self.open() |
|
187 | self.open() | |
197 | extension = pyfits.ImageHDU(data=data, name=self.fitsObj[0].header['DATATYPE']) |
|
188 | extension = pyfits.ImageHDU(data=data, name=self.fitsObj[0].header['DATATYPE']) | |
198 | extension.header['UTCTIME'] = self.dataOut.utctime |
|
189 | extension.header['UTCTIME'] = self.dataOut.utctime | |
199 | self.fitsObj.append(extension) |
|
190 | self.fitsObj.append(extension) | |
200 | self.blockIndex += 1 |
|
191 | self.blockIndex += 1 | |
201 | self.fitsObj[0].header['NBLOCK'] = self.blockIndex |
|
192 | self.fitsObj[0].header['NBLOCK'] = self.blockIndex | |
202 |
|
193 | |||
203 | self.write() |
|
194 | self.write() | |
204 |
|
195 | |||
205 | def write(self): |
|
196 | def write(self): | |
206 |
|
197 | |||
207 | self.fitsObj.flush(verbose=True) |
|
198 | self.fitsObj.flush(verbose=True) | |
208 | self.fitsObj.close() |
|
199 | self.fitsObj.close() | |
209 |
|
200 | |||
210 |
|
201 | |||
211 | def setNextFile(self): |
|
202 | def setNextFile(self): | |
212 |
|
203 | |||
213 | ext = self.ext |
|
204 | ext = self.ext | |
214 | path = self.path |
|
205 | path = self.path | |
215 |
|
206 | |||
216 | timeTuple = time.localtime( self.dataOut.utctime) |
|
207 | timeTuple = time.localtime( self.dataOut.utctime) | |
217 | subfolder = 'd%4.4d%3.3d' % (timeTuple.tm_year,timeTuple.tm_yday) |
|
208 | subfolder = 'd%4.4d%3.3d' % (timeTuple.tm_year,timeTuple.tm_yday) | |
218 |
|
209 | |||
219 | fullpath = os.path.join( path, subfolder ) |
|
210 | fullpath = os.path.join( path, subfolder ) | |
220 | if not( os.path.exists(fullpath) ): |
|
211 | if not( os.path.exists(fullpath) ): | |
221 | os.mkdir(fullpath) |
|
212 | os.mkdir(fullpath) | |
222 | self.setFile = -1 #inicializo mi contador de seteo |
|
213 | self.setFile = -1 #inicializo mi contador de seteo | |
223 | else: |
|
214 | else: | |
224 | filesList = os.listdir( fullpath ) |
|
215 | filesList = os.listdir( fullpath ) | |
225 | if len( filesList ) > 0: |
|
216 | if len( filesList ) > 0: | |
226 | filesList = sorted( filesList, key=str.lower ) |
|
217 | filesList = sorted( filesList, key=str.lower ) | |
227 | filen = filesList[-1] |
|
218 | filen = filesList[-1] | |
228 |
|
219 | |||
229 | if isNumber( filen[8:11] ): |
|
220 | if isNumber( filen[8:11] ): | |
230 | self.setFile = int( filen[8:11] ) #inicializo mi contador de seteo al seteo del ultimo file |
|
221 | self.setFile = int( filen[8:11] ) #inicializo mi contador de seteo al seteo del ultimo file | |
231 | else: |
|
222 | else: | |
232 | self.setFile = -1 |
|
223 | self.setFile = -1 | |
233 | else: |
|
224 | else: | |
234 | self.setFile = -1 #inicializo mi contador de seteo |
|
225 | self.setFile = -1 #inicializo mi contador de seteo | |
235 |
|
226 | |||
236 | setFile = self.setFile |
|
227 | setFile = self.setFile | |
237 | setFile += 1 |
|
228 | setFile += 1 | |
238 |
|
229 | |||
239 | thisFile = '%s%4.4d%3.3d%3.3d%s' % (self.optchar, |
|
230 | thisFile = '%s%4.4d%3.3d%3.3d%s' % (self.optchar, | |
240 | timeTuple.tm_year, |
|
231 | timeTuple.tm_year, | |
241 | timeTuple.tm_yday, |
|
232 | timeTuple.tm_yday, | |
242 | setFile, |
|
233 | setFile, | |
243 | ext ) |
|
234 | ext ) | |
244 |
|
235 | |||
245 | filename = os.path.join( path, subfolder, thisFile ) |
|
236 | filename = os.path.join( path, subfolder, thisFile ) | |
246 |
|
237 | |||
247 | self.blockIndex = 0 |
|
238 | self.blockIndex = 0 | |
248 | self.filename = filename |
|
239 | self.filename = filename | |
249 | self.setFile = setFile |
|
240 | self.setFile = setFile | |
250 | self.flagIsNewFile = 1 |
|
241 | self.flagIsNewFile = 1 | |
251 |
|
242 | |||
252 | print 'Writing the file: %s'%self.filename |
|
243 | print 'Writing the file: %s'%self.filename | |
253 |
|
244 | |||
254 | self.setFitsHeader(self.dataOut, self.metadatafile) |
|
245 | self.setFitsHeader(self.dataOut, self.metadatafile) | |
255 |
|
246 | |||
256 | return 1 |
|
247 | return 1 | |
257 |
|
248 | |||
258 | def writeBlock(self): |
|
249 | def writeBlock(self): | |
259 | self.addData(self.dataOut.data_spc) |
|
250 | self.addData(self.dataOut.data_spc) | |
260 | self.flagIsNewFile = 0 |
|
251 | self.flagIsNewFile = 0 | |
261 |
|
252 | |||
262 |
|
253 | |||
263 | def __setNewBlock(self): |
|
254 | def __setNewBlock(self): | |
264 |
|
255 | |||
265 | if self.flagIsNewFile: |
|
256 | if self.flagIsNewFile: | |
266 | return 1 |
|
257 | return 1 | |
267 |
|
258 | |||
268 | if self.blockIndex < self.dataBlocksPerFile: |
|
259 | if self.blockIndex < self.dataBlocksPerFile: | |
269 | return 1 |
|
260 | return 1 | |
270 |
|
261 | |||
271 | if not( self.setNextFile() ): |
|
262 | if not( self.setNextFile() ): | |
272 | return 0 |
|
263 | return 0 | |
273 |
|
264 | |||
274 | return 1 |
|
265 | return 1 | |
275 |
|
266 | |||
276 | def writeNextBlock(self): |
|
267 | def writeNextBlock(self): | |
277 | if not( self.__setNewBlock() ): |
|
268 | if not( self.__setNewBlock() ): | |
278 | return 0 |
|
269 | return 0 | |
279 | self.writeBlock() |
|
270 | self.writeBlock() | |
280 | return 1 |
|
271 | return 1 | |
281 |
|
272 | |||
282 | def putData(self): |
|
273 | def putData(self): | |
283 | if self.flagIsNewFile: |
|
274 | if self.flagIsNewFile: | |
284 | self.setNextFile() |
|
275 | self.setNextFile() | |
285 | self.writeNextBlock() |
|
276 | self.writeNextBlock() | |
286 |
|
277 | |||
287 | def run(self, dataOut, **kwargs): |
|
278 | def run(self, dataOut, **kwargs): | |
288 | if not(self.isConfig): |
|
279 | if not(self.isConfig): | |
289 | self.setup(dataOut, **kwargs) |
|
280 | self.setup(dataOut, **kwargs) | |
290 | self.isConfig = True |
|
281 | self.isConfig = True | |
291 | self.putData() |
|
282 | self.putData() | |
292 |
|
283 | |||
293 |
|
284 | |||
294 | class FitsReader(ProcessingUnit): |
|
285 | class FitsReader(ProcessingUnit): | |
295 |
|
286 | |||
296 | # __TIMEZONE = time.timezone |
|
287 | # __TIMEZONE = time.timezone | |
297 |
|
288 | |||
298 | expName = None |
|
289 | expName = None | |
299 | datetimestr = None |
|
290 | datetimestr = None | |
300 | utc = None |
|
291 | utc = None | |
301 | nChannels = None |
|
292 | nChannels = None | |
302 | nSamples = None |
|
293 | nSamples = None | |
303 | dataBlocksPerFile = None |
|
294 | dataBlocksPerFile = None | |
304 | comments = None |
|
295 | comments = None | |
305 | lastUTTime = None |
|
296 | lastUTTime = None | |
306 | header_dict = None |
|
297 | header_dict = None | |
307 | data = None |
|
298 | data = None | |
308 | data_header_dict = None |
|
299 | data_header_dict = None | |
309 |
|
300 | |||
310 | def __init__(self): |
|
301 | def __init__(self): | |
311 | self.isConfig = False |
|
302 | self.isConfig = False | |
312 | self.ext = '.fits' |
|
303 | self.ext = '.fits' | |
313 | self.setFile = 0 |
|
304 | self.setFile = 0 | |
314 | self.flagNoMoreFiles = 0 |
|
305 | self.flagNoMoreFiles = 0 | |
315 | self.flagIsNewFile = 1 |
|
306 | self.flagIsNewFile = 1 | |
316 | self.flagDiscontinuousBlock = None |
|
307 | self.flagDiscontinuousBlock = None | |
317 | self.fileIndex = None |
|
308 | self.fileIndex = None | |
318 | self.filename = None |
|
309 | self.filename = None | |
319 | self.fileSize = None |
|
310 | self.fileSize = None | |
320 | self.fitsObj = None |
|
311 | self.fitsObj = None | |
321 | self.timeZone = None |
|
312 | self.timeZone = None | |
322 | self.nReadBlocks = 0 |
|
313 | self.nReadBlocks = 0 | |
323 | self.nTotalBlocks = 0 |
|
314 | self.nTotalBlocks = 0 | |
324 | self.dataOut = self.createObjByDefault() |
|
315 | self.dataOut = self.createObjByDefault() | |
325 | self.maxTimeStep = 10# deberia ser definido por el usuario usando el metodo setup() |
|
316 | self.maxTimeStep = 10# deberia ser definido por el usuario usando el metodo setup() | |
326 | self.blockIndex = 1 |
|
317 | self.blockIndex = 1 | |
327 |
|
318 | |||
328 | def createObjByDefault(self): |
|
319 | def createObjByDefault(self): | |
329 |
|
320 | |||
330 | dataObj = Fits() |
|
321 | dataObj = Fits() | |
331 |
|
322 | |||
332 | return dataObj |
|
323 | return dataObj | |
333 |
|
324 | |||
334 | def isFileinThisTime(self, filename, startTime, endTime, useLocalTime=False): |
|
325 | def isFileinThisTime(self, filename, startTime, endTime, useLocalTime=False): | |
335 | try: |
|
326 | try: | |
336 | fitsObj = pyfits.open(filename,'readonly') |
|
327 | fitsObj = pyfits.open(filename,'readonly') | |
337 | except: |
|
328 | except: | |
338 | raise IOError, "The file %s can't be opened" %(filename) |
|
329 | raise IOError, "The file %s can't be opened" %(filename) | |
339 |
|
330 | |||
340 | header = fitsObj[0].header |
|
331 | header = fitsObj[0].header | |
341 | struct_time = time.strptime(header['DATETIME'], "%b %d %Y %H:%M:%S") |
|
332 | struct_time = time.strptime(header['DATETIME'], "%b %d %Y %H:%M:%S") | |
342 | utc = time.mktime(struct_time) - time.timezone #TIMEZONE debe ser un parametro del header FITS |
|
333 | utc = time.mktime(struct_time) - time.timezone #TIMEZONE debe ser un parametro del header FITS | |
343 |
|
334 | |||
344 | ltc = utc |
|
335 | ltc = utc | |
345 | if useLocalTime: |
|
336 | if useLocalTime: | |
346 | ltc -= time.timezone |
|
337 | ltc -= time.timezone | |
347 | thisDatetime = datetime.datetime.utcfromtimestamp(ltc) |
|
338 | thisDatetime = datetime.datetime.utcfromtimestamp(ltc) | |
348 | thisTime = thisDatetime.time() |
|
339 | thisTime = thisDatetime.time() | |
349 |
|
340 | |||
350 | if not ((startTime <= thisTime) and (endTime > thisTime)): |
|
341 | if not ((startTime <= thisTime) and (endTime > thisTime)): | |
351 | return None |
|
342 | return None | |
352 |
|
343 | |||
353 | return thisDatetime |
|
344 | return thisDatetime | |
354 |
|
345 | |||
355 | def __setNextFileOnline(self): |
|
346 | def __setNextFileOnline(self): | |
356 | raise ValueError, "No implemented" |
|
347 | raise ValueError, "No implemented" | |
357 |
|
348 | |||
358 | def __setNextFileOffline(self): |
|
349 | def __setNextFileOffline(self): | |
359 | idFile = self.fileIndex |
|
350 | idFile = self.fileIndex | |
360 |
|
351 | |||
361 | while (True): |
|
352 | while (True): | |
362 | idFile += 1 |
|
353 | idFile += 1 | |
363 | if not(idFile < len(self.filenameList)): |
|
354 | if not(idFile < len(self.filenameList)): | |
364 | self.flagNoMoreFiles = 1 |
|
355 | self.flagNoMoreFiles = 1 | |
365 | print "No more Files" |
|
356 | print "No more Files" | |
366 | return 0 |
|
357 | return 0 | |
367 |
|
358 | |||
368 | filename = self.filenameList[idFile] |
|
359 | filename = self.filenameList[idFile] | |
369 |
|
360 | |||
370 | # if not(self.__verifyFile(filename)): |
|
361 | # if not(self.__verifyFile(filename)): | |
371 | # continue |
|
362 | # continue | |
372 |
|
363 | |||
373 | fileSize = os.path.getsize(filename) |
|
364 | fileSize = os.path.getsize(filename) | |
374 | fitsObj = pyfits.open(filename,'readonly') |
|
365 | fitsObj = pyfits.open(filename,'readonly') | |
375 | break |
|
366 | break | |
376 |
|
367 | |||
377 | self.flagIsNewFile = 1 |
|
368 | self.flagIsNewFile = 1 | |
378 | self.fileIndex = idFile |
|
369 | self.fileIndex = idFile | |
379 | self.filename = filename |
|
370 | self.filename = filename | |
380 | self.fileSize = fileSize |
|
371 | self.fileSize = fileSize | |
381 | self.fitsObj = fitsObj |
|
372 | self.fitsObj = fitsObj | |
382 | self.blockIndex = 0 |
|
373 | self.blockIndex = 0 | |
383 | print "Setting the file: %s"%self.filename |
|
374 | print "Setting the file: %s"%self.filename | |
384 |
|
375 | |||
385 | return 1 |
|
376 | return 1 | |
386 |
|
377 | |||
387 | def __setValuesFromHeader(self): |
|
378 | def __setValuesFromHeader(self): | |
388 |
|
379 | |||
389 | self.dataOut.header = self.header_dict |
|
380 | self.dataOut.header = self.header_dict | |
390 | self.dataOut.expName = self.expName |
|
381 | self.dataOut.expName = self.expName | |
391 | self.dataOut.nChannels = self.nChannels |
|
382 | ||
392 | self.dataOut.timeZone = self.timeZone |
|
383 | self.dataOut.timeZone = self.timeZone | |
393 | self.dataOut.dataBlocksPerFile = self.dataBlocksPerFile |
|
384 | self.dataOut.dataBlocksPerFile = self.dataBlocksPerFile | |
394 | self.dataOut.comments = self.comments |
|
385 | self.dataOut.comments = self.comments | |
395 | # self.dataOut.timeInterval = self.timeInterval |
|
386 | # self.dataOut.timeInterval = self.timeInterval | |
396 | self.dataOut.channelList = self.channelList |
|
387 | self.dataOut.channelList = self.channelList | |
397 | self.dataOut.heightList = self.heightList |
|
388 | self.dataOut.heightList = self.heightList | |
398 |
|
389 | |||
399 | self.dataOut.nCohInt = self.nCohInt |
|
390 | self.dataOut.nCohInt = self.nCohInt | |
400 | self.dataOut.nIncohInt = self.nIncohInt |
|
391 | self.dataOut.nIncohInt = self.nIncohInt | |
401 |
|
392 | |||
|
393 | self.dataOut.ippSeconds = self.ippSeconds | |||
|
394 | ||||
402 | def readHeader(self): |
|
395 | def readHeader(self): | |
403 | headerObj = self.fitsObj[0] |
|
396 | headerObj = self.fitsObj[0] | |
404 |
|
397 | |||
405 | self.header_dict = headerObj.header |
|
398 | self.header_dict = headerObj.header | |
406 | if 'EXPNAME' in headerObj.header.keys(): |
|
399 | if 'EXPNAME' in headerObj.header.keys(): | |
407 | self.expName = headerObj.header['EXPNAME'] |
|
400 | self.expName = headerObj.header['EXPNAME'] | |
408 |
|
401 | |||
409 | if 'DATATYPE' in headerObj.header.keys(): |
|
402 | if 'DATATYPE' in headerObj.header.keys(): | |
410 | self.dataType = headerObj.header['DATATYPE'] |
|
403 | self.dataType = headerObj.header['DATATYPE'] | |
411 |
|
404 | |||
412 | self.datetimestr = headerObj.header['DATETIME'] |
|
405 | self.datetimestr = headerObj.header['DATETIME'] | |
413 | channelList = headerObj.header['CHANNELLIST'] |
|
406 | channelList = headerObj.header['CHANNELLIST'] | |
414 | channelList = channelList.split('[') |
|
407 | channelList = channelList.split('[') | |
415 | channelList = channelList[1].split(']') |
|
408 | channelList = channelList[1].split(']') | |
416 | channelList = channelList[0].split(',') |
|
409 | channelList = channelList[0].split(',') | |
417 | channelList = [int(ch) for ch in channelList] |
|
410 | channelList = [int(ch) for ch in channelList] | |
418 | self.channelList = channelList |
|
411 | self.channelList = channelList | |
419 | self.nChannels = headerObj.header['NCHANNELS'] |
|
412 | self.nChannels = headerObj.header['NCHANNELS'] | |
420 | self.nHeights = headerObj.header['NHEIGHTS'] |
|
413 | self.nHeights = headerObj.header['NHEIGHTS'] | |
421 | self.ippSeconds = headerObj.header['IPPSECONDS'] |
|
414 | self.ippSeconds = headerObj.header['IPPSECONDS'] | |
422 | self.nCohInt = headerObj.header['NCOHINT'] |
|
415 | self.nCohInt = headerObj.header['NCOHINT'] | |
423 | self.nIncohInt = headerObj.header['NINCOHINT'] |
|
416 | self.nIncohInt = headerObj.header['NINCOHINT'] | |
424 | self.dataBlocksPerFile = headerObj.header['NBLOCK'] |
|
417 | self.dataBlocksPerFile = headerObj.header['NBLOCK'] | |
425 | self.timeZone = headerObj.header['TIMEZONE'] |
|
418 | self.timeZone = headerObj.header['TIMEZONE'] | |
426 |
|
419 | |||
427 | # self.timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt |
|
420 | # self.timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt | |
428 |
|
421 | |||
429 | if 'COMMENT' in headerObj.header.keys(): |
|
422 | if 'COMMENT' in headerObj.header.keys(): | |
430 | self.comments = headerObj.header['COMMENT'] |
|
423 | self.comments = headerObj.header['COMMENT'] | |
431 |
|
424 | |||
432 | self.readHeightList() |
|
425 | self.readHeightList() | |
433 |
|
426 | |||
434 | def readHeightList(self): |
|
427 | def readHeightList(self): | |
435 | self.blockIndex = self.blockIndex + 1 |
|
428 | self.blockIndex = self.blockIndex + 1 | |
436 | obj = self.fitsObj[self.blockIndex] |
|
429 | obj = self.fitsObj[self.blockIndex] | |
437 | self.heightList = obj.data |
|
430 | self.heightList = obj.data | |
438 | self.blockIndex = self.blockIndex + 1 |
|
431 | self.blockIndex = self.blockIndex + 1 | |
439 |
|
432 | |||
440 | def readExtension(self): |
|
433 | def readExtension(self): | |
441 | obj = self.fitsObj[self.blockIndex] |
|
434 | obj = self.fitsObj[self.blockIndex] | |
442 | self.heightList = obj.data |
|
435 | self.heightList = obj.data | |
443 | self.blockIndex = self.blockIndex + 1 |
|
436 | self.blockIndex = self.blockIndex + 1 | |
444 |
|
437 | |||
445 | def setNextFile(self): |
|
438 | def setNextFile(self): | |
446 |
|
439 | |||
447 | if self.online: |
|
440 | if self.online: | |
448 | newFile = self.__setNextFileOnline() |
|
441 | newFile = self.__setNextFileOnline() | |
449 | else: |
|
442 | else: | |
450 | newFile = self.__setNextFileOffline() |
|
443 | newFile = self.__setNextFileOffline() | |
451 |
|
444 | |||
452 | if not(newFile): |
|
445 | if not(newFile): | |
453 | return 0 |
|
446 | return 0 | |
454 |
|
447 | |||
455 | self.readHeader() |
|
448 | self.readHeader() | |
456 | self.__setValuesFromHeader() |
|
449 | self.__setValuesFromHeader() | |
457 | self.nReadBlocks = 0 |
|
450 | self.nReadBlocks = 0 | |
458 | # self.blockIndex = 1 |
|
451 | # self.blockIndex = 1 | |
459 | return 1 |
|
452 | return 1 | |
460 |
|
453 | |||
461 | def __searchFilesOffLine(self, |
|
454 | def __searchFilesOffLine(self, | |
462 | path, |
|
455 | path, | |
463 | startDate, |
|
456 | startDate, | |
464 | endDate, |
|
457 | endDate, | |
465 | startTime=datetime.time(0,0,0), |
|
458 | startTime=datetime.time(0,0,0), | |
466 | endTime=datetime.time(23,59,59), |
|
459 | endTime=datetime.time(23,59,59), | |
467 | set=None, |
|
460 | set=None, | |
468 | expLabel='', |
|
461 | expLabel='', | |
469 | ext='.fits', |
|
462 | ext='.fits', | |
470 | walk=True): |
|
463 | walk=True): | |
471 |
|
464 | |||
472 | pathList = [] |
|
465 | pathList = [] | |
473 |
|
466 | |||
474 | if not walk: |
|
467 | if not walk: | |
475 | pathList.append(path) |
|
468 | pathList.append(path) | |
476 |
|
469 | |||
477 | else: |
|
470 | else: | |
478 | dirList = [] |
|
471 | dirList = [] | |
479 | for thisPath in os.listdir(path): |
|
472 | for thisPath in os.listdir(path): | |
480 | if not os.path.isdir(os.path.join(path,thisPath)): |
|
473 | if not os.path.isdir(os.path.join(path,thisPath)): | |
481 | continue |
|
474 | continue | |
482 | if not isRadarFolder(thisPath): |
|
475 | if not isRadarFolder(thisPath): | |
483 | continue |
|
476 | continue | |
484 |
|
477 | |||
485 | dirList.append(thisPath) |
|
478 | dirList.append(thisPath) | |
486 |
|
479 | |||
487 | if not(dirList): |
|
480 | if not(dirList): | |
488 | return None, None |
|
481 | return None, None | |
489 |
|
482 | |||
490 | thisDate = startDate |
|
483 | thisDate = startDate | |
491 |
|
484 | |||
492 | while(thisDate <= endDate): |
|
485 | while(thisDate <= endDate): | |
493 | year = thisDate.timetuple().tm_year |
|
486 | year = thisDate.timetuple().tm_year | |
494 | doy = thisDate.timetuple().tm_yday |
|
487 | doy = thisDate.timetuple().tm_yday | |
495 |
|
488 | |||
496 | matchlist = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy) + '*') |
|
489 | matchlist = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy) + '*') | |
497 | if len(matchlist) == 0: |
|
490 | if len(matchlist) == 0: | |
498 | thisDate += datetime.timedelta(1) |
|
491 | thisDate += datetime.timedelta(1) | |
499 | continue |
|
492 | continue | |
500 | for match in matchlist: |
|
493 | for match in matchlist: | |
501 | pathList.append(os.path.join(path,match,expLabel)) |
|
494 | pathList.append(os.path.join(path,match,expLabel)) | |
502 |
|
495 | |||
503 | thisDate += datetime.timedelta(1) |
|
496 | thisDate += datetime.timedelta(1) | |
504 |
|
497 | |||
505 | if pathList == []: |
|
498 | if pathList == []: | |
506 | print "Any folder was found for the date range: %s-%s" %(startDate, endDate) |
|
499 | print "Any folder was found for the date range: %s-%s" %(startDate, endDate) | |
507 | return None, None |
|
500 | return None, None | |
508 |
|
501 | |||
509 | print "%d folder(s) was(were) found for the date range: %s - %s" %(len(pathList), startDate, endDate) |
|
502 | print "%d folder(s) was(were) found for the date range: %s - %s" %(len(pathList), startDate, endDate) | |
510 |
|
503 | |||
511 | filenameList = [] |
|
504 | filenameList = [] | |
512 | datetimeList = [] |
|
505 | datetimeList = [] | |
513 |
|
506 | |||
514 | for i in range(len(pathList)): |
|
507 | for i in range(len(pathList)): | |
515 |
|
508 | |||
516 | thisPath = pathList[i] |
|
509 | thisPath = pathList[i] | |
517 |
|
510 | |||
518 | fileList = glob.glob1(thisPath, "*%s" %ext) |
|
511 | fileList = glob.glob1(thisPath, "*%s" %ext) | |
519 | fileList.sort() |
|
512 | fileList.sort() | |
520 |
|
513 | |||
521 | for thisFile in fileList: |
|
514 | for thisFile in fileList: | |
522 |
|
515 | |||
523 | filename = os.path.join(thisPath,thisFile) |
|
516 | filename = os.path.join(thisPath,thisFile) | |
524 | thisDatetime = self.isFileinThisTime(filename, startTime, endTime) |
|
517 | thisDatetime = self.isFileinThisTime(filename, startTime, endTime) | |
525 |
|
518 | |||
526 | if not(thisDatetime): |
|
519 | if not(thisDatetime): | |
527 | continue |
|
520 | continue | |
528 |
|
521 | |||
529 | filenameList.append(filename) |
|
522 | filenameList.append(filename) | |
530 | datetimeList.append(thisDatetime) |
|
523 | datetimeList.append(thisDatetime) | |
531 |
|
524 | |||
532 | if not(filenameList): |
|
525 | if not(filenameList): | |
533 | print "Any file was found for the time range %s - %s" %(startTime, endTime) |
|
526 | print "Any file was found for the time range %s - %s" %(startTime, endTime) | |
534 | return None, None |
|
527 | return None, None | |
535 |
|
528 | |||
536 | print "%d file(s) was(were) found for the time range: %s - %s" %(len(filenameList), startTime, endTime) |
|
529 | print "%d file(s) was(were) found for the time range: %s - %s" %(len(filenameList), startTime, endTime) | |
537 |
|
530 | |||
538 |
|
531 | |||
539 | for i in range(len(filenameList)): |
|
532 | for i in range(len(filenameList)): | |
540 | print "%s -> [%s]" %(filenameList[i], datetimeList[i].ctime()) |
|
533 | print "%s -> [%s]" %(filenameList[i], datetimeList[i].ctime()) | |
541 |
|
534 | |||
542 | self.filenameList = filenameList |
|
535 | self.filenameList = filenameList | |
543 | self.datetimeList = datetimeList |
|
536 | self.datetimeList = datetimeList | |
544 |
|
537 | |||
545 | return pathList, filenameList |
|
538 | return pathList, filenameList | |
546 |
|
539 | |||
547 | def setup(self, path=None, |
|
540 | def setup(self, path=None, | |
548 | startDate=None, |
|
541 | startDate=None, | |
549 | endDate=None, |
|
542 | endDate=None, | |
550 | startTime=datetime.time(0,0,0), |
|
543 | startTime=datetime.time(0,0,0), | |
551 | endTime=datetime.time(23,59,59), |
|
544 | endTime=datetime.time(23,59,59), | |
552 | set=0, |
|
545 | set=0, | |
553 | expLabel = "", |
|
546 | expLabel = "", | |
554 | ext = None, |
|
547 | ext = None, | |
555 | online = False, |
|
548 | online = False, | |
556 | delay = 60, |
|
549 | delay = 60, | |
557 | walk = True): |
|
550 | walk = True): | |
558 |
|
551 | |||
559 | if path == None: |
|
552 | if path == None: | |
560 | raise ValueError, "The path is not valid" |
|
553 | raise ValueError, "The path is not valid" | |
561 |
|
554 | |||
562 | if ext == None: |
|
555 | if ext == None: | |
563 | ext = self.ext |
|
556 | ext = self.ext | |
564 |
|
557 | |||
565 | if not(online): |
|
558 | if not(online): | |
566 | print "Searching files in offline mode ..." |
|
559 | print "Searching files in offline mode ..." | |
567 | pathList, filenameList = self.__searchFilesOffLine(path, startDate=startDate, endDate=endDate, |
|
560 | pathList, filenameList = self.__searchFilesOffLine(path, startDate=startDate, endDate=endDate, | |
568 | startTime=startTime, endTime=endTime, |
|
561 | startTime=startTime, endTime=endTime, | |
569 | set=set, expLabel=expLabel, ext=ext, |
|
562 | set=set, expLabel=expLabel, ext=ext, | |
570 | walk=walk) |
|
563 | walk=walk) | |
571 |
|
564 | |||
572 | if not(pathList): |
|
565 | if not(pathList): | |
573 | print "No *%s files into the folder %s \nfor the range: %s - %s"%(ext, path, |
|
566 | print "No *%s files into the folder %s \nfor the range: %s - %s"%(ext, path, | |
574 | datetime.datetime.combine(startDate,startTime).ctime(), |
|
567 | datetime.datetime.combine(startDate,startTime).ctime(), | |
575 | datetime.datetime.combine(endDate,endTime).ctime()) |
|
568 | datetime.datetime.combine(endDate,endTime).ctime()) | |
576 |
|
569 | |||
577 | sys.exit(-1) |
|
570 | sys.exit(-1) | |
578 |
|
571 | |||
579 | self.fileIndex = -1 |
|
572 | self.fileIndex = -1 | |
580 | self.pathList = pathList |
|
573 | self.pathList = pathList | |
581 | self.filenameList = filenameList |
|
574 | self.filenameList = filenameList | |
582 |
|
575 | |||
583 | self.online = online |
|
576 | self.online = online | |
584 | self.delay = delay |
|
577 | self.delay = delay | |
585 | ext = ext.lower() |
|
578 | ext = ext.lower() | |
586 | self.ext = ext |
|
579 | self.ext = ext | |
587 |
|
580 | |||
588 | if not(self.setNextFile()): |
|
581 | if not(self.setNextFile()): | |
589 | if (startDate!=None) and (endDate!=None): |
|
582 | if (startDate!=None) and (endDate!=None): | |
590 | print "No files in range: %s - %s" %(datetime.datetime.combine(startDate,startTime).ctime(), datetime.datetime.combine(endDate,endTime).ctime()) |
|
583 | print "No files in range: %s - %s" %(datetime.datetime.combine(startDate,startTime).ctime(), datetime.datetime.combine(endDate,endTime).ctime()) | |
591 | elif startDate != None: |
|
584 | elif startDate != None: | |
592 | print "No files in range: %s" %(datetime.datetime.combine(startDate,startTime).ctime()) |
|
585 | print "No files in range: %s" %(datetime.datetime.combine(startDate,startTime).ctime()) | |
593 | else: |
|
586 | else: | |
594 | print "No files" |
|
587 | print "No files" | |
595 |
|
588 | |||
596 | sys.exit(-1) |
|
589 | sys.exit(-1) | |
597 |
|
590 | |||
598 |
|
591 | |||
599 |
|
592 | |||
600 | def readBlock(self): |
|
593 | def readBlock(self): | |
601 | dataObj = self.fitsObj[self.blockIndex] |
|
594 | dataObj = self.fitsObj[self.blockIndex] | |
602 |
|
595 | |||
603 | self.data = dataObj.data |
|
596 | self.data = dataObj.data | |
604 | self.data_header_dict = dataObj.header |
|
597 | self.data_header_dict = dataObj.header | |
605 | self.utc = self.data_header_dict['UTCTIME'] |
|
598 | self.utc = self.data_header_dict['UTCTIME'] | |
606 |
|
599 | |||
607 | self.flagIsNewFile = 0 |
|
600 | self.flagIsNewFile = 0 | |
608 | self.blockIndex += 1 |
|
601 | self.blockIndex += 1 | |
609 | self.nTotalBlocks += 1 |
|
602 | self.nTotalBlocks += 1 | |
610 | self.nReadBlocks += 1 |
|
603 | self.nReadBlocks += 1 | |
611 |
|
604 | |||
612 | return 1 |
|
605 | return 1 | |
613 |
|
606 | |||
614 | def __jumpToLastBlock(self): |
|
607 | def __jumpToLastBlock(self): | |
615 | raise ValueError, "No implemented" |
|
608 | raise ValueError, "No implemented" | |
616 |
|
609 | |||
617 | def __waitNewBlock(self): |
|
610 | def __waitNewBlock(self): | |
618 | """ |
|
611 | """ | |
619 | Return 1 si se encontro un nuevo bloque de datos, 0 de otra forma. |
|
612 | Return 1 si se encontro un nuevo bloque de datos, 0 de otra forma. | |
620 |
|
613 | |||
621 | Si el modo de lectura es OffLine siempre retorn 0 |
|
614 | Si el modo de lectura es OffLine siempre retorn 0 | |
622 | """ |
|
615 | """ | |
623 | if not self.online: |
|
616 | if not self.online: | |
624 | return 0 |
|
617 | return 0 | |
625 |
|
618 | |||
626 | if (self.nReadBlocks >= self.dataBlocksPerFile): |
|
619 | if (self.nReadBlocks >= self.dataBlocksPerFile): | |
627 | return 0 |
|
620 | return 0 | |
628 |
|
621 | |||
629 | currentPointer = self.fp.tell() |
|
622 | currentPointer = self.fp.tell() | |
630 |
|
623 | |||
631 | neededSize = self.processingHeaderObj.blockSize + self.basicHeaderSize |
|
624 | neededSize = self.processingHeaderObj.blockSize + self.basicHeaderSize | |
632 |
|
625 | |||
633 | for nTries in range( self.nTries ): |
|
626 | for nTries in range( self.nTries ): | |
634 |
|
627 | |||
635 | self.fp.close() |
|
628 | self.fp.close() | |
636 | self.fp = open( self.filename, 'rb' ) |
|
629 | self.fp = open( self.filename, 'rb' ) | |
637 | self.fp.seek( currentPointer ) |
|
630 | self.fp.seek( currentPointer ) | |
638 |
|
631 | |||
639 | self.fileSize = os.path.getsize( self.filename ) |
|
632 | self.fileSize = os.path.getsize( self.filename ) | |
640 | currentSize = self.fileSize - currentPointer |
|
633 | currentSize = self.fileSize - currentPointer | |
641 |
|
634 | |||
642 | if ( currentSize >= neededSize ): |
|
635 | if ( currentSize >= neededSize ): | |
643 | self.__rdBasicHeader() |
|
636 | self.__rdBasicHeader() | |
644 | return 1 |
|
637 | return 1 | |
645 |
|
638 | |||
646 | print "\tWaiting %0.2f seconds for the next block, try %03d ..." % (self.delay, nTries+1) |
|
639 | print "\tWaiting %0.2f seconds for the next block, try %03d ..." % (self.delay, nTries+1) | |
647 | sleep( self.delay ) |
|
640 | sleep( self.delay ) | |
648 |
|
641 | |||
649 |
|
642 | |||
650 | return 0 |
|
643 | return 0 | |
651 |
|
644 | |||
652 | def __setNewBlock(self): |
|
645 | def __setNewBlock(self): | |
653 |
|
646 | |||
654 | if self.online: |
|
647 | if self.online: | |
655 | self.__jumpToLastBlock() |
|
648 | self.__jumpToLastBlock() | |
656 |
|
649 | |||
657 | if self.flagIsNewFile: |
|
650 | if self.flagIsNewFile: | |
658 | return 1 |
|
651 | return 1 | |
659 |
|
652 | |||
660 | self.lastUTTime = self.utc |
|
653 | self.lastUTTime = self.utc | |
661 |
|
654 | |||
662 | if self.online: |
|
655 | if self.online: | |
663 | if self.__waitNewBlock(): |
|
656 | if self.__waitNewBlock(): | |
664 | return 1 |
|
657 | return 1 | |
665 |
|
658 | |||
666 | if self.nReadBlocks < self.dataBlocksPerFile: |
|
659 | if self.nReadBlocks < self.dataBlocksPerFile: | |
667 | return 1 |
|
660 | return 1 | |
668 |
|
661 | |||
669 | if not(self.setNextFile()): |
|
662 | if not(self.setNextFile()): | |
670 | return 0 |
|
663 | return 0 | |
671 |
|
664 | |||
672 | deltaTime = self.utc - self.lastUTTime |
|
665 | deltaTime = self.utc - self.lastUTTime | |
673 |
|
666 | |||
674 | self.flagDiscontinuousBlock = 0 |
|
667 | self.flagDiscontinuousBlock = 0 | |
675 |
|
668 | |||
676 | if deltaTime > self.maxTimeStep: |
|
669 | if deltaTime > self.maxTimeStep: | |
677 | self.flagDiscontinuousBlock = 1 |
|
670 | self.flagDiscontinuousBlock = 1 | |
678 |
|
671 | |||
679 | return 1 |
|
672 | return 1 | |
680 |
|
673 | |||
681 |
|
674 | |||
682 | def readNextBlock(self): |
|
675 | def readNextBlock(self): | |
683 | if not(self.__setNewBlock()): |
|
676 | if not(self.__setNewBlock()): | |
684 | return 0 |
|
677 | return 0 | |
685 |
|
678 | |||
686 | if not(self.readBlock()): |
|
679 | if not(self.readBlock()): | |
687 | return 0 |
|
680 | return 0 | |
688 |
|
681 | |||
689 | return 1 |
|
682 | return 1 | |
690 |
|
683 | |||
|
684 | def printInfo(self): | |||
|
685 | ||||
|
686 | pass | |||
691 |
|
687 | |||
692 | def getData(self): |
|
688 | def getData(self): | |
693 |
|
689 | |||
694 | if self.flagNoMoreFiles: |
|
690 | if self.flagNoMoreFiles: | |
695 | self.dataOut.flagNoData = True |
|
691 | self.dataOut.flagNoData = True | |
696 | print 'Process finished' |
|
692 | print 'Process finished' | |
697 | return 0 |
|
693 | return 0 | |
698 |
|
694 | |||
699 | self.flagDiscontinuousBlock = 0 |
|
695 | self.flagDiscontinuousBlock = 0 | |
700 | self.flagIsNewBlock = 0 |
|
696 | self.flagIsNewBlock = 0 | |
701 |
|
697 | |||
702 | if not(self.readNextBlock()): |
|
698 | if not(self.readNextBlock()): | |
703 | return 0 |
|
699 | return 0 | |
704 |
|
700 | |||
705 |
if self.data |
|
701 | if self.data is None: | |
706 | self.dataOut.flagNoData = True |
|
702 | self.dataOut.flagNoData = True | |
707 | return 0 |
|
703 | return 0 | |
708 |
|
704 | |||
709 | self.dataOut.data = self.data |
|
705 | self.dataOut.data = self.data | |
710 | self.dataOut.data_header = self.data_header_dict |
|
706 | self.dataOut.data_header = self.data_header_dict | |
711 | self.dataOut.utctime = self.utc |
|
707 | self.dataOut.utctime = self.utc | |
712 |
|
708 | |||
713 | # self.dataOut.header = self.header_dict |
|
709 | # self.dataOut.header = self.header_dict | |
714 | # self.dataOut.expName = self.expName |
|
710 | # self.dataOut.expName = self.expName | |
715 | # self.dataOut.nChannels = self.nChannels |
|
711 | # self.dataOut.nChannels = self.nChannels | |
716 | # self.dataOut.timeZone = self.timeZone |
|
712 | # self.dataOut.timeZone = self.timeZone | |
717 | # self.dataOut.dataBlocksPerFile = self.dataBlocksPerFile |
|
713 | # self.dataOut.dataBlocksPerFile = self.dataBlocksPerFile | |
718 | # self.dataOut.comments = self.comments |
|
714 | # self.dataOut.comments = self.comments | |
719 | # # self.dataOut.timeInterval = self.timeInterval |
|
715 | # # self.dataOut.timeInterval = self.timeInterval | |
720 | # self.dataOut.channelList = self.channelList |
|
716 | # self.dataOut.channelList = self.channelList | |
721 | # self.dataOut.heightList = self.heightList |
|
717 | # self.dataOut.heightList = self.heightList | |
722 | self.dataOut.flagNoData = False |
|
718 | self.dataOut.flagNoData = False | |
723 |
|
719 | |||
724 | return self.dataOut.data |
|
720 | return self.dataOut.data | |
725 |
|
721 | |||
726 | def run(self, **kwargs): |
|
722 | def run(self, **kwargs): | |
727 |
|
723 | |||
728 | if not(self.isConfig): |
|
724 | if not(self.isConfig): | |
729 | self.setup(**kwargs) |
|
725 | self.setup(**kwargs) | |
730 | self.isConfig = True |
|
726 | self.isConfig = True | |
731 |
|
727 | |||
732 | self.getData() |
|
728 | self.getData() | |
733 |
|
729 | |||
734 | class SpectraHeisWriter(Operation): |
|
730 | class SpectraHeisWriter(Operation): | |
735 | # set = None |
|
731 | # set = None | |
736 | setFile = None |
|
732 | setFile = None | |
737 | idblock = None |
|
733 | idblock = None | |
738 | doypath = None |
|
734 | doypath = None | |
739 | subfolder = None |
|
735 | subfolder = None | |
740 |
|
736 | |||
741 | def __init__(self): |
|
737 | def __init__(self): | |
742 | self.wrObj = Fits() |
|
738 | self.wrObj = PyFits() | |
743 | # self.dataOut = dataOut |
|
739 | # self.dataOut = dataOut | |
744 | self.nTotalBlocks=0 |
|
740 | self.nTotalBlocks=0 | |
745 | # self.set = None |
|
741 | # self.set = None | |
746 | self.setFile = None |
|
742 | self.setFile = None | |
747 | self.idblock = 0 |
|
743 | self.idblock = 0 | |
748 | self.wrpath = None |
|
744 | self.wrpath = None | |
749 | self.doypath = None |
|
745 | self.doypath = None | |
750 | self.subfolder = None |
|
746 | self.subfolder = None | |
751 | self.isConfig = False |
|
747 | self.isConfig = False | |
752 |
|
748 | |||
753 | def isNumber(str): |
|
749 | def isNumber(str): | |
754 | """ |
|
750 | """ | |
755 | Chequea si el conjunto de caracteres que componen un string puede ser convertidos a un numero. |
|
751 | Chequea si el conjunto de caracteres que componen un string puede ser convertidos a un numero. | |
756 |
|
752 | |||
757 | Excepciones: |
|
753 | Excepciones: | |
758 | Si un determinado string no puede ser convertido a numero |
|
754 | Si un determinado string no puede ser convertido a numero | |
759 | Input: |
|
755 | Input: | |
760 | str, string al cual se le analiza para determinar si convertible a un numero o no |
|
756 | str, string al cual se le analiza para determinar si convertible a un numero o no | |
761 |
|
757 | |||
762 | Return: |
|
758 | Return: | |
763 | True : si el string es uno numerico |
|
759 | True : si el string es uno numerico | |
764 | False : no es un string numerico |
|
760 | False : no es un string numerico | |
765 | """ |
|
761 | """ | |
766 | try: |
|
762 | try: | |
767 | float( str ) |
|
763 | float( str ) | |
768 | return True |
|
764 | return True | |
769 | except: |
|
765 | except: | |
770 | return False |
|
766 | return False | |
771 |
|
767 | |||
772 | def setup(self, dataOut, wrpath): |
|
768 | def setup(self, dataOut, wrpath): | |
773 |
|
769 | |||
774 | if not(os.path.exists(wrpath)): |
|
770 | if not(os.path.exists(wrpath)): | |
775 | os.mkdir(wrpath) |
|
771 | os.mkdir(wrpath) | |
776 |
|
772 | |||
777 | self.wrpath = wrpath |
|
773 | self.wrpath = wrpath | |
778 | # self.setFile = 0 |
|
774 | # self.setFile = 0 | |
779 | self.dataOut = dataOut |
|
775 | self.dataOut = dataOut | |
780 |
|
776 | |||
781 | def putData(self): |
|
777 | def putData(self): | |
782 | name= time.localtime( self.dataOut.utctime) |
|
778 | name= time.localtime( self.dataOut.utctime) | |
783 | ext=".fits" |
|
779 | ext=".fits" | |
784 |
|
780 | |||
785 | if self.doypath == None: |
|
781 | if self.doypath == None: | |
786 | self.subfolder = 'F%4.4d%3.3d_%d' % (name.tm_year,name.tm_yday,time.mktime(datetime.datetime.now().timetuple())) |
|
782 | self.subfolder = 'F%4.4d%3.3d_%d' % (name.tm_year,name.tm_yday,time.mktime(datetime.datetime.now().timetuple())) | |
787 | self.doypath = os.path.join( self.wrpath, self.subfolder ) |
|
783 | self.doypath = os.path.join( self.wrpath, self.subfolder ) | |
788 | os.mkdir(self.doypath) |
|
784 | os.mkdir(self.doypath) | |
789 |
|
785 | |||
790 | if self.setFile == None: |
|
786 | if self.setFile == None: | |
791 | # self.set = self.dataOut.set |
|
787 | # self.set = self.dataOut.set | |
792 | self.setFile = 0 |
|
788 | self.setFile = 0 | |
793 | # if self.set != self.dataOut.set: |
|
789 | # if self.set != self.dataOut.set: | |
794 | ## self.set = self.dataOut.set |
|
790 | ## self.set = self.dataOut.set | |
795 | # self.setFile = 0 |
|
791 | # self.setFile = 0 | |
796 |
|
792 | |||
797 | #make the filename |
|
793 | #make the filename | |
798 | thisFile = 'D%4.4d%3.3d_%3.3d%s' % (name.tm_year,name.tm_yday,self.setFile,ext) |
|
794 | thisFile = 'D%4.4d%3.3d_%3.3d%s' % (name.tm_year,name.tm_yday,self.setFile,ext) | |
799 |
|
795 | |||
800 | filename = os.path.join(self.wrpath,self.subfolder, thisFile) |
|
796 | filename = os.path.join(self.wrpath,self.subfolder, thisFile) | |
801 |
|
797 | |||
802 | idblock = numpy.array([self.idblock],dtype="int64") |
|
798 | idblock = numpy.array([self.idblock],dtype="int64") | |
803 | header=self.wrObj.cFImage(idblock=idblock, |
|
799 | header=self.wrObj.cFImage(idblock=idblock, | |
804 | year=time.gmtime(self.dataOut.utctime).tm_year, |
|
800 | year=time.gmtime(self.dataOut.utctime).tm_year, | |
805 | month=time.gmtime(self.dataOut.utctime).tm_mon, |
|
801 | month=time.gmtime(self.dataOut.utctime).tm_mon, | |
806 | day=time.gmtime(self.dataOut.utctime).tm_mday, |
|
802 | day=time.gmtime(self.dataOut.utctime).tm_mday, | |
807 | hour=time.gmtime(self.dataOut.utctime).tm_hour, |
|
803 | hour=time.gmtime(self.dataOut.utctime).tm_hour, | |
808 | minute=time.gmtime(self.dataOut.utctime).tm_min, |
|
804 | minute=time.gmtime(self.dataOut.utctime).tm_min, | |
809 | second=time.gmtime(self.dataOut.utctime).tm_sec) |
|
805 | second=time.gmtime(self.dataOut.utctime).tm_sec) | |
810 |
|
806 | |||
811 | c=3E8 |
|
807 | c=3E8 | |
812 | deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0] |
|
808 | deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0] | |
813 | freq=numpy.arange(-1*self.dataOut.nHeights/2.,self.dataOut.nHeights/2.)*(c/(2*deltaHeight*1000)) |
|
809 | freq=numpy.arange(-1*self.dataOut.nHeights/2.,self.dataOut.nHeights/2.)*(c/(2*deltaHeight*1000)) | |
814 |
|
810 | |||
815 | colList = [] |
|
811 | colList = [] | |
816 |
|
812 | |||
817 | colFreq=self.wrObj.setColF(name="freq", format=str(self.dataOut.nFFTPoints)+'E', array=freq) |
|
813 | colFreq=self.wrObj.setColF(name="freq", format=str(self.dataOut.nFFTPoints)+'E', array=freq) | |
818 |
|
814 | |||
819 | colList.append(colFreq) |
|
815 | colList.append(colFreq) | |
820 |
|
816 | |||
821 | nchannel=self.dataOut.nChannels |
|
817 | nchannel=self.dataOut.nChannels | |
822 |
|
818 | |||
823 | for i in range(nchannel): |
|
819 | for i in range(nchannel): | |
824 | col = self.wrObj.writeData(name="PCh"+str(i+1), |
|
820 | col = self.wrObj.writeData(name="PCh"+str(i+1), | |
825 | format=str(self.dataOut.nFFTPoints)+'E', |
|
821 | format=str(self.dataOut.nFFTPoints)+'E', | |
826 | data=10*numpy.log10(self.dataOut.data_spc[i,:])) |
|
822 | data=10*numpy.log10(self.dataOut.data_spc[i,:])) | |
827 |
|
823 | |||
828 | colList.append(col) |
|
824 | colList.append(col) | |
829 |
|
825 | |||
830 | data=self.wrObj.Ctable(colList=colList) |
|
826 | data=self.wrObj.Ctable(colList=colList) | |
831 |
|
827 | |||
832 | self.wrObj.CFile(header,data) |
|
828 | self.wrObj.CFile(header,data) | |
833 |
|
829 | |||
834 | self.wrObj.wFile(filename) |
|
830 | self.wrObj.wFile(filename) | |
835 |
|
831 | |||
836 | #update the setFile |
|
832 | #update the setFile | |
837 | self.setFile += 1 |
|
833 | self.setFile += 1 | |
838 | self.idblock += 1 |
|
834 | self.idblock += 1 | |
839 |
|
835 | |||
840 | return 1 |
|
836 | return 1 | |
841 |
|
837 | |||
842 | def run(self, dataOut, **kwargs): |
|
838 | def run(self, dataOut, **kwargs): | |
843 |
|
839 | |||
844 | if not(self.isConfig): |
|
840 | if not(self.isConfig): | |
845 |
|
841 | |||
846 | self.setup(dataOut, **kwargs) |
|
842 | self.setup(dataOut, **kwargs) | |
847 | self.isConfig = True |
|
843 | self.isConfig = True | |
848 |
|
844 | |||
849 | self.putData() No newline at end of file |
|
845 | self.putData() |
@@ -1,343 +1,343 | |||||
1 | import numpy |
|
1 | import numpy | |
2 |
|
2 | |||
3 | from jroproc_base import ProcessingUnit, Operation |
|
3 | from jroproc_base import ProcessingUnit, Operation | |
4 | from schainpy.model.data.jrodata import SpectraHeis |
|
4 | from schainpy.model.data.jrodata import SpectraHeis | |
5 |
|
5 | |||
6 | class SpectraHeisProc(ProcessingUnit): |
|
6 | class SpectraHeisProc(ProcessingUnit): | |
7 |
|
7 | |||
8 | def __init__(self): |
|
8 | def __init__(self): | |
9 |
|
9 | |||
10 | ProcessingUnit.__init__(self) |
|
10 | ProcessingUnit.__init__(self) | |
11 |
|
11 | |||
12 | # self.buffer = None |
|
12 | # self.buffer = None | |
13 | # self.firstdatatime = None |
|
13 | # self.firstdatatime = None | |
14 | # self.profIndex = 0 |
|
14 | # self.profIndex = 0 | |
15 | self.dataOut = SpectraHeis() |
|
15 | self.dataOut = SpectraHeis() | |
16 |
|
16 | |||
17 | def __updateObjFromVoltage(self): |
|
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 | |
21 | self.dataOut.errorCount = self.dataIn.errorCount |
|
21 | self.dataOut.errorCount = self.dataIn.errorCount | |
22 | self.dataOut.useLocalTime = self.dataIn.useLocalTime |
|
22 | self.dataOut.useLocalTime = self.dataIn.useLocalTime | |
23 |
|
23 | |||
24 | self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()# |
|
24 | self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()# | |
25 | self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy()# |
|
25 | self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy()# | |
26 | self.dataOut.channelList = self.dataIn.channelList |
|
26 | self.dataOut.channelList = self.dataIn.channelList | |
27 | self.dataOut.heightList = self.dataIn.heightList |
|
27 | self.dataOut.heightList = self.dataIn.heightList | |
28 | # self.dataOut.dtype = self.dataIn.dtype |
|
28 | # self.dataOut.dtype = self.dataIn.dtype | |
29 | self.dataOut.dtype = numpy.dtype([('real','<f4'),('imag','<f4')]) |
|
29 | self.dataOut.dtype = numpy.dtype([('real','<f4'),('imag','<f4')]) | |
30 | # self.dataOut.nHeights = self.dataIn.nHeights |
|
30 | # self.dataOut.nHeights = self.dataIn.nHeights | |
31 | # self.dataOut.nChannels = self.dataIn.nChannels |
|
31 | # self.dataOut.nChannels = self.dataIn.nChannels | |
32 | self.dataOut.nBaud = self.dataIn.nBaud |
|
32 | self.dataOut.nBaud = self.dataIn.nBaud | |
33 | self.dataOut.nCode = self.dataIn.nCode |
|
33 | self.dataOut.nCode = self.dataIn.nCode | |
34 | self.dataOut.code = self.dataIn.code |
|
34 | self.dataOut.code = self.dataIn.code | |
35 | # self.dataOut.nProfiles = 1 |
|
35 | # self.dataOut.nProfiles = 1 | |
36 | # self.dataOut.nProfiles = self.dataOut.nFFTPoints |
|
36 | # self.dataOut.nProfiles = self.dataOut.nFFTPoints | |
37 | self.dataOut.nFFTPoints = self.dataIn.nHeights |
|
37 | self.dataOut.nFFTPoints = self.dataIn.nHeights | |
38 | # self.dataOut.channelIndexList = self.dataIn.channelIndexList |
|
38 | # self.dataOut.channelIndexList = self.dataIn.channelIndexList | |
39 | # self.dataOut.flagNoData = self.dataIn.flagNoData |
|
39 | # self.dataOut.flagNoData = self.dataIn.flagNoData | |
40 | self.dataOut.flagDiscontinuousBlock = self.dataIn.flagDiscontinuousBlock |
|
40 | self.dataOut.flagDiscontinuousBlock = self.dataIn.flagDiscontinuousBlock | |
41 | self.dataOut.utctime = self.dataIn.utctime |
|
41 | self.dataOut.utctime = self.dataIn.utctime | |
42 | # self.dataOut.utctime = self.firstdatatime |
|
42 | # self.dataOut.utctime = self.firstdatatime | |
43 | self.dataOut.flagDecodeData = self.dataIn.flagDecodeData #asumo q la data esta decodificada |
|
43 | self.dataOut.flagDecodeData = self.dataIn.flagDecodeData #asumo q la data esta decodificada | |
44 | self.dataOut.flagDeflipData = self.dataIn.flagDeflipData #asumo q la data esta sin flip |
|
44 | self.dataOut.flagDeflipData = self.dataIn.flagDeflipData #asumo q la data esta sin flip | |
45 | # self.dataOut.flagShiftFFT = self.dataIn.flagShiftFFT |
|
45 | # self.dataOut.flagShiftFFT = self.dataIn.flagShiftFFT | |
46 | self.dataOut.nCohInt = self.dataIn.nCohInt |
|
46 | self.dataOut.nCohInt = self.dataIn.nCohInt | |
47 | self.dataOut.nIncohInt = 1 |
|
47 | self.dataOut.nIncohInt = 1 | |
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 | |||
58 | self.dataOut.utctime = self.dataIn.utctime |
|
58 | self.dataOut.utctime = self.dataIn.utctime | |
59 | self.dataOut.channelIndexList = self.dataIn.channelIndexList |
|
59 | # self.dataOut.channelIndexList = self.dataIn.channelIndexList | |
60 |
|
60 | |||
61 | self.dataOut.channelList = self.dataIn.channelList |
|
61 | self.dataOut.channelList = self.dataIn.channelList | |
62 | self.dataOut.heightList = self.dataIn.heightList |
|
62 | self.dataOut.heightList = self.dataIn.heightList | |
63 | self.dataOut.data_spc = self.dataIn.data |
|
63 | self.dataOut.data_spc = self.dataIn.data | |
64 | self.dataOut.ippSeconds = self.dataIn.ippSeconds |
|
64 | self.dataOut.ippSeconds = self.dataIn.ippSeconds | |
65 | self.dataOut.nCohInt = self.dataIn.nCohInt |
|
65 | self.dataOut.nCohInt = self.dataIn.nCohInt | |
66 | self.dataOut.nIncohInt = self.dataIn.nIncohInt |
|
66 | self.dataOut.nIncohInt = self.dataIn.nIncohInt | |
67 | # self.dataOut.timeInterval = self.dataIn.timeInterval |
|
67 | # self.dataOut.timeInterval = self.dataIn.timeInterval | |
68 | self.dataOut.timeZone = self.dataIn.timeZone |
|
68 | self.dataOut.timeZone = self.dataIn.timeZone | |
69 | self.dataOut.useLocalTime = True |
|
69 | self.dataOut.useLocalTime = True | |
70 | # self.dataOut. |
|
70 | # self.dataOut. | |
71 | # self.dataOut. |
|
71 | # self.dataOut. | |
72 |
|
72 | |||
73 | def __getFft(self): |
|
73 | def __getFft(self): | |
74 |
|
74 | |||
75 | fft_volt = numpy.fft.fft(self.dataIn.data, axis=1) |
|
75 | fft_volt = numpy.fft.fft(self.dataIn.data, axis=1) | |
76 | fft_volt = numpy.fft.fftshift(fft_volt,axes=(1,)) |
|
76 | fft_volt = numpy.fft.fftshift(fft_volt,axes=(1,)) | |
77 | spc = numpy.abs(fft_volt * numpy.conjugate(fft_volt))/(self.dataOut.nFFTPoints) |
|
77 | spc = numpy.abs(fft_volt * numpy.conjugate(fft_volt))/(self.dataOut.nFFTPoints) | |
78 | self.dataOut.data_spc = spc |
|
78 | self.dataOut.data_spc = spc | |
79 |
|
79 | |||
80 | def run(self): |
|
80 | def run(self): | |
81 |
|
81 | |||
82 | self.dataOut.flagNoData = True |
|
82 | self.dataOut.flagNoData = True | |
83 |
|
83 | |||
84 | if self.dataIn.type == "Fits": |
|
84 | if self.dataIn.type == "Fits": | |
85 | self.__updateObjFromFits() |
|
85 | self.__updateObjFromFits() | |
86 | self.dataOut.flagNoData = False |
|
86 | self.dataOut.flagNoData = False | |
87 | return |
|
87 | return | |
88 |
|
88 | |||
89 | if self.dataIn.type == "SpectraHeis": |
|
89 | if self.dataIn.type == "SpectraHeis": | |
90 | self.dataOut.copy(self.dataIn) |
|
90 | self.dataOut.copy(self.dataIn) | |
91 | return |
|
91 | return | |
92 |
|
92 | |||
93 | if self.dataIn.type == "Voltage": |
|
93 | if self.dataIn.type == "Voltage": | |
94 | self.__updateObjFromVoltage() |
|
94 | self.__updateObjFromVoltage() | |
95 | self.__getFft() |
|
95 | self.__getFft() | |
96 | self.dataOut.flagNoData = False |
|
96 | self.dataOut.flagNoData = False | |
97 |
|
97 | |||
98 | return |
|
98 | return | |
99 |
|
99 | |||
100 | raise ValueError, "The type object %s is not valid"%(self.dataIn.type) |
|
100 | raise ValueError, "The type object %s is not valid"%(self.dataIn.type) | |
101 |
|
101 | |||
102 |
|
102 | |||
103 | def selectChannels(self, channelList): |
|
103 | def selectChannels(self, channelList): | |
104 |
|
104 | |||
105 | channelIndexList = [] |
|
105 | channelIndexList = [] | |
106 |
|
106 | |||
107 | for channel in channelList: |
|
107 | for channel in channelList: | |
108 | index = self.dataOut.channelList.index(channel) |
|
108 | index = self.dataOut.channelList.index(channel) | |
109 | channelIndexList.append(index) |
|
109 | channelIndexList.append(index) | |
110 |
|
110 | |||
111 | self.selectChannelsByIndex(channelIndexList) |
|
111 | self.selectChannelsByIndex(channelIndexList) | |
112 |
|
112 | |||
113 | def selectChannelsByIndex(self, channelIndexList): |
|
113 | def selectChannelsByIndex(self, channelIndexList): | |
114 | """ |
|
114 | """ | |
115 | Selecciona un bloque de datos en base a canales segun el channelIndexList |
|
115 | Selecciona un bloque de datos en base a canales segun el channelIndexList | |
116 |
|
116 | |||
117 | Input: |
|
117 | Input: | |
118 | channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7] |
|
118 | channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7] | |
119 |
|
119 | |||
120 | Affected: |
|
120 | Affected: | |
121 | self.dataOut.data |
|
121 | self.dataOut.data | |
122 | self.dataOut.channelIndexList |
|
122 | self.dataOut.channelIndexList | |
123 | self.dataOut.nChannels |
|
123 | self.dataOut.nChannels | |
124 | self.dataOut.m_ProcessingHeader.totalSpectra |
|
124 | self.dataOut.m_ProcessingHeader.totalSpectra | |
125 | self.dataOut.systemHeaderObj.numChannels |
|
125 | self.dataOut.systemHeaderObj.numChannels | |
126 | self.dataOut.m_ProcessingHeader.blockSize |
|
126 | self.dataOut.m_ProcessingHeader.blockSize | |
127 |
|
127 | |||
128 | Return: |
|
128 | Return: | |
129 | None |
|
129 | None | |
130 | """ |
|
130 | """ | |
131 |
|
131 | |||
132 | for channelIndex in channelIndexList: |
|
132 | for channelIndex in channelIndexList: | |
133 | if channelIndex not in self.dataOut.channelIndexList: |
|
133 | if channelIndex not in self.dataOut.channelIndexList: | |
134 | print channelIndexList |
|
134 | print channelIndexList | |
135 | raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex |
|
135 | raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex | |
136 |
|
136 | |||
137 | # nChannels = len(channelIndexList) |
|
137 | # nChannels = len(channelIndexList) | |
138 |
|
138 | |||
139 | data_spc = self.dataOut.data_spc[channelIndexList,:] |
|
139 | data_spc = self.dataOut.data_spc[channelIndexList,:] | |
140 |
|
140 | |||
141 | self.dataOut.data_spc = data_spc |
|
141 | self.dataOut.data_spc = data_spc | |
142 | self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] |
|
142 | self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] | |
143 |
|
143 | |||
144 | return 1 |
|
144 | return 1 | |
145 |
|
145 | |||
146 | class IncohInt4SpectraHeis(Operation): |
|
146 | class IncohInt4SpectraHeis(Operation): | |
147 |
|
147 | |||
148 | isConfig = False |
|
148 | isConfig = False | |
149 |
|
149 | |||
150 | __profIndex = 0 |
|
150 | __profIndex = 0 | |
151 | __withOverapping = False |
|
151 | __withOverapping = False | |
152 |
|
152 | |||
153 | __byTime = False |
|
153 | __byTime = False | |
154 | __initime = None |
|
154 | __initime = None | |
155 | __lastdatatime = None |
|
155 | __lastdatatime = None | |
156 | __integrationtime = None |
|
156 | __integrationtime = None | |
157 |
|
157 | |||
158 | __buffer = None |
|
158 | __buffer = None | |
159 |
|
159 | |||
160 | __dataReady = False |
|
160 | __dataReady = False | |
161 |
|
161 | |||
162 | n = None |
|
162 | n = None | |
163 |
|
163 | |||
164 |
|
164 | |||
165 | def __init__(self): |
|
165 | def __init__(self): | |
166 |
|
166 | |||
167 | Operation.__init__(self) |
|
167 | Operation.__init__(self) | |
168 | # self.isConfig = False |
|
168 | # self.isConfig = False | |
169 |
|
169 | |||
170 | def setup(self, n=None, timeInterval=None, overlapping=False): |
|
170 | def setup(self, n=None, timeInterval=None, overlapping=False): | |
171 | """ |
|
171 | """ | |
172 | Set the parameters of the integration class. |
|
172 | Set the parameters of the integration class. | |
173 |
|
173 | |||
174 | Inputs: |
|
174 | Inputs: | |
175 |
|
175 | |||
176 | n : Number of coherent integrations |
|
176 | n : Number of coherent integrations | |
177 | timeInterval : Time of integration. If the parameter "n" is selected this one does not work |
|
177 | timeInterval : Time of integration. If the parameter "n" is selected this one does not work | |
178 | overlapping : |
|
178 | overlapping : | |
179 |
|
179 | |||
180 | """ |
|
180 | """ | |
181 |
|
181 | |||
182 | self.__initime = None |
|
182 | self.__initime = None | |
183 | self.__lastdatatime = 0 |
|
183 | self.__lastdatatime = 0 | |
184 | self.__buffer = None |
|
184 | self.__buffer = None | |
185 | self.__dataReady = False |
|
185 | self.__dataReady = False | |
186 |
|
186 | |||
187 |
|
187 | |||
188 | if n == None and timeInterval == None: |
|
188 | if n == None and timeInterval == None: | |
189 | raise ValueError, "n or timeInterval should be specified ..." |
|
189 | raise ValueError, "n or timeInterval should be specified ..." | |
190 |
|
190 | |||
191 | if n != None: |
|
191 | if n != None: | |
192 | self.n = n |
|
192 | self.n = n | |
193 | self.__byTime = False |
|
193 | self.__byTime = False | |
194 | else: |
|
194 | else: | |
195 | self.__integrationtime = timeInterval #* 60. #if (type(timeInterval)!=integer) -> change this line |
|
195 | self.__integrationtime = timeInterval #* 60. #if (type(timeInterval)!=integer) -> change this line | |
196 | self.n = 9999 |
|
196 | self.n = 9999 | |
197 | self.__byTime = True |
|
197 | self.__byTime = True | |
198 |
|
198 | |||
199 | if overlapping: |
|
199 | if overlapping: | |
200 | self.__withOverapping = True |
|
200 | self.__withOverapping = True | |
201 | self.__buffer = None |
|
201 | self.__buffer = None | |
202 | else: |
|
202 | else: | |
203 | self.__withOverapping = False |
|
203 | self.__withOverapping = False | |
204 | self.__buffer = 0 |
|
204 | self.__buffer = 0 | |
205 |
|
205 | |||
206 | self.__profIndex = 0 |
|
206 | self.__profIndex = 0 | |
207 |
|
207 | |||
208 | def putData(self, data): |
|
208 | def putData(self, data): | |
209 |
|
209 | |||
210 | """ |
|
210 | """ | |
211 | Add a profile to the __buffer and increase in one the __profileIndex |
|
211 | Add a profile to the __buffer and increase in one the __profileIndex | |
212 |
|
212 | |||
213 | """ |
|
213 | """ | |
214 |
|
214 | |||
215 | if not self.__withOverapping: |
|
215 | if not self.__withOverapping: | |
216 | self.__buffer += data.copy() |
|
216 | self.__buffer += data.copy() | |
217 | self.__profIndex += 1 |
|
217 | self.__profIndex += 1 | |
218 | return |
|
218 | return | |
219 |
|
219 | |||
220 | #Overlapping data |
|
220 | #Overlapping data | |
221 | nChannels, nHeis = data.shape |
|
221 | nChannels, nHeis = data.shape | |
222 | data = numpy.reshape(data, (1, nChannels, nHeis)) |
|
222 | data = numpy.reshape(data, (1, nChannels, nHeis)) | |
223 |
|
223 | |||
224 | #If the buffer is empty then it takes the data value |
|
224 | #If the buffer is empty then it takes the data value | |
225 | if self.__buffer is None: |
|
225 | if self.__buffer is None: | |
226 | self.__buffer = data |
|
226 | self.__buffer = data | |
227 | self.__profIndex += 1 |
|
227 | self.__profIndex += 1 | |
228 | return |
|
228 | return | |
229 |
|
229 | |||
230 | #If the buffer length is lower than n then stakcing the data value |
|
230 | #If the buffer length is lower than n then stakcing the data value | |
231 | if self.__profIndex < self.n: |
|
231 | if self.__profIndex < self.n: | |
232 | self.__buffer = numpy.vstack((self.__buffer, data)) |
|
232 | self.__buffer = numpy.vstack((self.__buffer, data)) | |
233 | self.__profIndex += 1 |
|
233 | self.__profIndex += 1 | |
234 | return |
|
234 | return | |
235 |
|
235 | |||
236 | #If the buffer length is equal to n then replacing the last buffer value with the data value |
|
236 | #If the buffer length is equal to n then replacing the last buffer value with the data value | |
237 | self.__buffer = numpy.roll(self.__buffer, -1, axis=0) |
|
237 | self.__buffer = numpy.roll(self.__buffer, -1, axis=0) | |
238 | self.__buffer[self.n-1] = data |
|
238 | self.__buffer[self.n-1] = data | |
239 | self.__profIndex = self.n |
|
239 | self.__profIndex = self.n | |
240 | return |
|
240 | return | |
241 |
|
241 | |||
242 |
|
242 | |||
243 | def pushData(self): |
|
243 | def pushData(self): | |
244 | """ |
|
244 | """ | |
245 | Return the sum of the last profiles and the profiles used in the sum. |
|
245 | Return the sum of the last profiles and the profiles used in the sum. | |
246 |
|
246 | |||
247 | Affected: |
|
247 | Affected: | |
248 |
|
248 | |||
249 | self.__profileIndex |
|
249 | self.__profileIndex | |
250 |
|
250 | |||
251 | """ |
|
251 | """ | |
252 |
|
252 | |||
253 | if not self.__withOverapping: |
|
253 | if not self.__withOverapping: | |
254 | data = self.__buffer |
|
254 | data = self.__buffer | |
255 | n = self.__profIndex |
|
255 | n = self.__profIndex | |
256 |
|
256 | |||
257 | self.__buffer = 0 |
|
257 | self.__buffer = 0 | |
258 | self.__profIndex = 0 |
|
258 | self.__profIndex = 0 | |
259 |
|
259 | |||
260 | return data, n |
|
260 | return data, n | |
261 |
|
261 | |||
262 | #Integration with Overlapping |
|
262 | #Integration with Overlapping | |
263 | data = numpy.sum(self.__buffer, axis=0) |
|
263 | data = numpy.sum(self.__buffer, axis=0) | |
264 | n = self.__profIndex |
|
264 | n = self.__profIndex | |
265 |
|
265 | |||
266 | return data, n |
|
266 | return data, n | |
267 |
|
267 | |||
268 | def byProfiles(self, data): |
|
268 | def byProfiles(self, data): | |
269 |
|
269 | |||
270 | self.__dataReady = False |
|
270 | self.__dataReady = False | |
271 | avgdata = None |
|
271 | avgdata = None | |
272 | # n = None |
|
272 | # n = None | |
273 |
|
273 | |||
274 | self.putData(data) |
|
274 | self.putData(data) | |
275 |
|
275 | |||
276 | if self.__profIndex == self.n: |
|
276 | if self.__profIndex == self.n: | |
277 |
|
277 | |||
278 | avgdata, n = self.pushData() |
|
278 | avgdata, n = self.pushData() | |
279 | self.__dataReady = True |
|
279 | self.__dataReady = True | |
280 |
|
280 | |||
281 | return avgdata |
|
281 | return avgdata | |
282 |
|
282 | |||
283 | def byTime(self, data, datatime): |
|
283 | def byTime(self, data, datatime): | |
284 |
|
284 | |||
285 | self.__dataReady = False |
|
285 | self.__dataReady = False | |
286 | avgdata = None |
|
286 | avgdata = None | |
287 | n = None |
|
287 | n = None | |
288 |
|
288 | |||
289 | self.putData(data) |
|
289 | self.putData(data) | |
290 |
|
290 | |||
291 | if (datatime - self.__initime) >= self.__integrationtime: |
|
291 | if (datatime - self.__initime) >= self.__integrationtime: | |
292 | avgdata, n = self.pushData() |
|
292 | avgdata, n = self.pushData() | |
293 | self.n = n |
|
293 | self.n = n | |
294 | self.__dataReady = True |
|
294 | self.__dataReady = True | |
295 |
|
295 | |||
296 | return avgdata |
|
296 | return avgdata | |
297 |
|
297 | |||
298 | def integrate(self, data, datatime=None): |
|
298 | def integrate(self, data, datatime=None): | |
299 |
|
299 | |||
300 | if self.__initime == None: |
|
300 | if self.__initime == None: | |
301 | self.__initime = datatime |
|
301 | self.__initime = datatime | |
302 |
|
302 | |||
303 | if self.__byTime: |
|
303 | if self.__byTime: | |
304 | avgdata = self.byTime(data, datatime) |
|
304 | avgdata = self.byTime(data, datatime) | |
305 | else: |
|
305 | else: | |
306 | avgdata = self.byProfiles(data) |
|
306 | avgdata = self.byProfiles(data) | |
307 |
|
307 | |||
308 |
|
308 | |||
309 | self.__lastdatatime = datatime |
|
309 | self.__lastdatatime = datatime | |
310 |
|
310 | |||
311 | if avgdata is None: |
|
311 | if avgdata is None: | |
312 | return None, None |
|
312 | return None, None | |
313 |
|
313 | |||
314 | avgdatatime = self.__initime |
|
314 | avgdatatime = self.__initime | |
315 |
|
315 | |||
316 | deltatime = datatime -self.__lastdatatime |
|
316 | deltatime = datatime -self.__lastdatatime | |
317 |
|
317 | |||
318 | if not self.__withOverapping: |
|
318 | if not self.__withOverapping: | |
319 | self.__initime = datatime |
|
319 | self.__initime = datatime | |
320 | else: |
|
320 | else: | |
321 | self.__initime += deltatime |
|
321 | self.__initime += deltatime | |
322 |
|
322 | |||
323 | return avgdata, avgdatatime |
|
323 | return avgdata, avgdatatime | |
324 |
|
324 | |||
325 | def run(self, dataOut, **kwargs): |
|
325 | def run(self, dataOut, **kwargs): | |
326 |
|
326 | |||
327 | if not self.isConfig: |
|
327 | if not self.isConfig: | |
328 | self.setup(**kwargs) |
|
328 | self.setup(**kwargs) | |
329 | self.isConfig = True |
|
329 | self.isConfig = True | |
330 |
|
330 | |||
331 | avgdata, avgdatatime = self.integrate(dataOut.data_spc, dataOut.utctime) |
|
331 | avgdata, avgdatatime = self.integrate(dataOut.data_spc, dataOut.utctime) | |
332 |
|
332 | |||
333 | # dataOut.timeInterval *= n |
|
333 | # dataOut.timeInterval *= n | |
334 | dataOut.flagNoData = True |
|
334 | dataOut.flagNoData = True | |
335 |
|
335 | |||
336 | if self.__dataReady: |
|
336 | if self.__dataReady: | |
337 | dataOut.data_spc = avgdata |
|
337 | dataOut.data_spc = avgdata | |
338 | dataOut.nIncohInt *= self.n |
|
338 | dataOut.nIncohInt *= self.n | |
339 | # dataOut.nCohInt *= self.n |
|
339 | # dataOut.nCohInt *= self.n | |
340 | dataOut.utctime = avgdatatime |
|
340 | dataOut.utctime = avgdatatime | |
341 | # dataOut.timeInterval = dataOut.ippSeconds * dataOut.nIncohInt |
|
341 | # dataOut.timeInterval = dataOut.ippSeconds * dataOut.nIncohInt | |
342 | # dataOut.timeInterval = self.__timeInterval*self.n |
|
342 | # dataOut.timeInterval = self.__timeInterval*self.n | |
343 | dataOut.flagNoData = False No newline at end of file |
|
343 | dataOut.flagNoData = False |
General Comments 0
You need to be logged in to leave comments.
Login now