@@ -1,8 +1,15 | |||
|
1 | 1 | VERSIONS: |
|
2 | 2 | |
|
3 | 3 | 2.1.2: |
|
4 | 4 | -jroutils_ftp.py: Bug fixed, Any error sending file stopped the Server Thread |
|
5 | 5 | Server thread opens and closes remote server each time file list is sent |
|
6 | 6 | -jroplot_spectra.py: Noise path was not being created saving noise data. |
|
7 | 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 | 2 | Created on Feb 7, 2012 |
|
3 | 3 | |
|
4 | 4 | @author $Author$ |
|
5 | 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 | 2 | Created on September , 2012 |
|
3 | 3 | @author: |
|
4 | 4 | ''' |
|
5 | from xml.etree.ElementTree import Element, SubElement | |
|
6 | from xml.etree import ElementTree as ET | |
|
5 | from xml.etree.ElementTree import ElementTree, Element, SubElement, tostring | |
|
7 | 6 | from xml.dom import minidom |
|
8 | 7 | |
|
9 | 8 | from model import * |
|
10 | 9 | |
|
11 | 10 | try: |
|
12 | 11 | from gevent import sleep |
|
13 | 12 | except: |
|
14 | 13 | from time import sleep |
|
15 | 14 | |
|
16 | 15 | import ast |
|
17 | 16 | |
|
18 | 17 | def prettify(elem): |
|
19 | 18 | """Return a pretty-printed XML string for the Element. |
|
20 | 19 | """ |
|
21 |
rough_string = |
|
|
20 | rough_string = tostring(elem, 'utf-8') | |
|
22 | 21 | reparsed = minidom.parseString(rough_string) |
|
23 | 22 | return reparsed.toprettyxml(indent=" ") |
|
24 | 23 | |
|
25 | 24 | class ParameterConf(): |
|
26 | 25 | |
|
27 | 26 | id = None |
|
28 | 27 | name = None |
|
29 | 28 | value = None |
|
30 | 29 | format = None |
|
31 | 30 | |
|
32 | 31 | __formated_value = None |
|
33 | 32 | |
|
34 | 33 | ELEMENTNAME = 'Parameter' |
|
35 | 34 | |
|
36 | 35 | def __init__(self): |
|
37 | 36 | |
|
38 | 37 | self.format = 'str' |
|
39 | 38 | |
|
40 | 39 | def getElementName(self): |
|
41 | 40 | |
|
42 | 41 | return self.ELEMENTNAME |
|
43 | 42 | |
|
44 | 43 | def getValue(self): |
|
45 | 44 | |
|
46 | 45 | value = self.value |
|
47 | 46 | format = self.format |
|
48 | 47 | |
|
49 | 48 | if self.__formated_value != None: |
|
50 | 49 | |
|
51 | 50 | return self.__formated_value |
|
52 | 51 | |
|
53 | 52 | if format == 'str': |
|
54 | 53 | self.__formated_value = str(value) |
|
55 | 54 | return self.__formated_value |
|
56 | 55 | |
|
57 | 56 | if value == '': |
|
58 | 57 | raise ValueError, "%s: This parameter value is empty" %self.name |
|
59 | 58 | |
|
60 | 59 | if format == 'bool': |
|
61 | 60 | value = int(value) |
|
62 | 61 | |
|
63 | 62 | if format == 'list': |
|
64 | 63 | strList = value.split(',') |
|
65 | 64 | |
|
66 | 65 | self.__formated_value = strList |
|
67 | 66 | |
|
68 | 67 | return self.__formated_value |
|
69 | 68 | |
|
70 | 69 | if format == 'intlist': |
|
71 | 70 | """ |
|
72 | 71 | Example: |
|
73 | 72 | value = (0,1,2) |
|
74 | 73 | """ |
|
75 | 74 | value = value.replace('(', '') |
|
76 | 75 | value = value.replace(')', '') |
|
77 | 76 | |
|
78 | 77 | value = value.replace('[', '') |
|
79 | 78 | value = value.replace(']', '') |
|
80 | 79 | |
|
81 | 80 | strList = value.split(',') |
|
82 | 81 | intList = [int(float(x)) for x in strList] |
|
83 | 82 | |
|
84 | 83 | self.__formated_value = intList |
|
85 | 84 | |
|
86 | 85 | return self.__formated_value |
|
87 | 86 | |
|
88 | 87 | if format == 'floatlist': |
|
89 | 88 | """ |
|
90 | 89 | Example: |
|
91 | 90 | value = (0.5, 1.4, 2.7) |
|
92 | 91 | """ |
|
93 | 92 | |
|
94 | 93 | value = value.replace('(', '') |
|
95 | 94 | value = value.replace(')', '') |
|
96 | 95 | |
|
97 | 96 | value = value.replace('[', '') |
|
98 | 97 | value = value.replace(']', '') |
|
99 | 98 | |
|
100 | 99 | strList = value.split(',') |
|
101 | 100 | floatList = [float(x) for x in strList] |
|
102 | 101 | |
|
103 | 102 | self.__formated_value = floatList |
|
104 | 103 | |
|
105 | 104 | return self.__formated_value |
|
106 | 105 | |
|
107 | 106 | if format == 'date': |
|
108 | 107 | strList = value.split('/') |
|
109 | 108 | intList = [int(x) for x in strList] |
|
110 | 109 | date = datetime.date(intList[0], intList[1], intList[2]) |
|
111 | 110 | |
|
112 | 111 | self.__formated_value = date |
|
113 | 112 | |
|
114 | 113 | return self.__formated_value |
|
115 | 114 | |
|
116 | 115 | if format == 'time': |
|
117 | 116 | strList = value.split(':') |
|
118 | 117 | intList = [int(x) for x in strList] |
|
119 | 118 | time = datetime.time(intList[0], intList[1], intList[2]) |
|
120 | 119 | |
|
121 | 120 | self.__formated_value = time |
|
122 | 121 | |
|
123 | 122 | return self.__formated_value |
|
124 | 123 | |
|
125 | 124 | if format == 'pairslist': |
|
126 | 125 | """ |
|
127 | 126 | Example: |
|
128 | 127 | value = (0,1),(1,2) |
|
129 | 128 | """ |
|
130 | 129 | |
|
131 | 130 | value = value.replace('(', '') |
|
132 | 131 | value = value.replace(')', '') |
|
133 | 132 | |
|
134 | 133 | value = value.replace('[', '') |
|
135 | 134 | value = value.replace(']', '') |
|
136 | 135 | |
|
137 | 136 | strList = value.split(',') |
|
138 | 137 | intList = [int(item) for item in strList] |
|
139 | 138 | pairList = [] |
|
140 | 139 | for i in range(len(intList)/2): |
|
141 | 140 | pairList.append((intList[i*2], intList[i*2 + 1])) |
|
142 | 141 | |
|
143 | 142 | self.__formated_value = pairList |
|
144 | 143 | |
|
145 | 144 | return self.__formated_value |
|
146 | 145 | |
|
147 | 146 | if format == 'multilist': |
|
148 | 147 | """ |
|
149 | 148 | Example: |
|
150 | 149 | value = (0,1,2),(3,4,5) |
|
151 | 150 | """ |
|
152 | 151 | multiList = ast.literal_eval(value) |
|
153 | 152 | |
|
154 | 153 | if type(multiList[0]) == int: |
|
155 | 154 | multiList = ast.literal_eval("(" + value + ")") |
|
156 | 155 | |
|
157 | 156 | self.__formated_value = multiList |
|
158 | 157 | |
|
159 | 158 | return self.__formated_value |
|
160 | 159 | |
|
161 | 160 | format_func = eval(format) |
|
162 | 161 | |
|
163 | 162 | self.__formated_value = format_func(value) |
|
164 | 163 | |
|
165 | 164 | return self.__formated_value |
|
166 | 165 | |
|
167 | 166 | def updateId(self, new_id): |
|
168 | 167 | |
|
169 | 168 | self.id = str(new_id) |
|
170 | 169 | |
|
171 | 170 | def setup(self, id, name, value, format='str'): |
|
172 | 171 | |
|
173 | 172 | self.id = str(id) |
|
174 | 173 | self.name = name |
|
175 | 174 | self.value = str(value) |
|
176 | 175 | self.format = str.lower(format) |
|
177 | 176 | |
|
178 | 177 | try: |
|
179 | 178 | self.getValue() |
|
180 | 179 | except: |
|
181 | 180 | return 0 |
|
182 | 181 | |
|
183 | 182 | return 1 |
|
184 | 183 | |
|
185 | 184 | def update(self, name, value, format='str'): |
|
186 | 185 | |
|
187 | 186 | self.name = name |
|
188 | 187 | self.value = str(value) |
|
189 | 188 | self.format = format |
|
190 | 189 | |
|
191 | 190 | def makeXml(self, opElement): |
|
192 | 191 | |
|
193 | 192 | parmElement = SubElement(opElement, self.ELEMENTNAME) |
|
194 | 193 | parmElement.set('id', str(self.id)) |
|
195 | 194 | parmElement.set('name', self.name) |
|
196 | 195 | parmElement.set('value', self.value) |
|
197 | 196 | parmElement.set('format', self.format) |
|
198 | 197 | |
|
199 | 198 | def readXml(self, parmElement): |
|
200 | 199 | |
|
201 | 200 | self.id = parmElement.get('id') |
|
202 | 201 | self.name = parmElement.get('name') |
|
203 | 202 | self.value = parmElement.get('value') |
|
204 | 203 | self.format = str.lower(parmElement.get('format')) |
|
205 | 204 | |
|
206 | 205 | #Compatible with old signal chain version |
|
207 | 206 | if self.format == 'int' and self.name == 'idfigure': |
|
208 | 207 | self.name = 'id' |
|
209 | 208 | |
|
210 | 209 | def printattr(self): |
|
211 | 210 | |
|
212 | 211 | print "Parameter[%s]: name = %s, value = %s, format = %s" %(self.id, self.name, self.value, self.format) |
|
213 | 212 | |
|
214 | 213 | class OperationConf(): |
|
215 | 214 | |
|
216 | 215 | id = None |
|
217 | 216 | name = None |
|
218 | 217 | priority = None |
|
219 | 218 | type = None |
|
220 | 219 | |
|
221 | 220 | parmConfObjList = [] |
|
222 | 221 | |
|
223 | 222 | ELEMENTNAME = 'Operation' |
|
224 | 223 | |
|
225 | 224 | def __init__(self): |
|
226 | 225 | |
|
227 | 226 | self.id = '0' |
|
228 | 227 | self.name = None |
|
229 | 228 | self.priority = None |
|
230 | 229 | self.type = 'self' |
|
231 | 230 | |
|
232 | 231 | |
|
233 | 232 | def __getNewId(self): |
|
234 | 233 | |
|
235 | 234 | return int(self.id)*10 + len(self.parmConfObjList) + 1 |
|
236 | 235 | |
|
237 | 236 | def updateId(self, new_id): |
|
238 | 237 | |
|
239 | 238 | self.id = str(new_id) |
|
240 | 239 | |
|
241 | 240 | n = 1 |
|
242 | 241 | for parmObj in self.parmConfObjList: |
|
243 | 242 | |
|
244 | 243 | idParm = str(int(new_id)*10 + n) |
|
245 | 244 | parmObj.updateId(idParm) |
|
246 | 245 | |
|
247 | 246 | n += 1 |
|
248 | 247 | |
|
249 | 248 | def getElementName(self): |
|
250 | 249 | |
|
251 | 250 | return self.ELEMENTNAME |
|
252 | 251 | |
|
253 | 252 | def getParameterObjList(self): |
|
254 | 253 | |
|
255 | 254 | return self.parmConfObjList |
|
256 | 255 | |
|
257 | 256 | def getParameterObj(self, parameterName): |
|
258 | 257 | |
|
259 | 258 | for parmConfObj in self.parmConfObjList: |
|
260 | 259 | |
|
261 | 260 | if parmConfObj.name != parameterName: |
|
262 | 261 | continue |
|
263 | 262 | |
|
264 | 263 | return parmConfObj |
|
265 | 264 | |
|
266 | 265 | return None |
|
267 | 266 | |
|
268 | 267 | def getParameterObjfromValue(self, parameterValue): |
|
269 | 268 | |
|
270 | 269 | for parmConfObj in self.parmConfObjList: |
|
271 | 270 | |
|
272 | 271 | if parmConfObj.getValue() != parameterValue: |
|
273 | 272 | continue |
|
274 | 273 | |
|
275 | 274 | return parmConfObj.getValue() |
|
276 | 275 | |
|
277 | 276 | return None |
|
278 | 277 | |
|
279 | 278 | def getParameterValue(self, parameterName): |
|
280 | 279 | |
|
281 | 280 | parameterObj = self.getParameterObj(parameterName) |
|
282 | 281 | |
|
283 | 282 | # if not parameterObj: |
|
284 | 283 | # return None |
|
285 | 284 | |
|
286 | 285 | value = parameterObj.getValue() |
|
287 | 286 | |
|
288 | 287 | return value |
|
289 | 288 | |
|
290 | 289 | def setup(self, id, name, priority, type): |
|
291 | 290 | |
|
292 | 291 | self.id = str(id) |
|
293 | 292 | self.name = name |
|
294 | 293 | self.type = type |
|
295 | 294 | self.priority = priority |
|
296 | 295 | |
|
297 | 296 | self.parmConfObjList = [] |
|
298 | 297 | |
|
299 | 298 | def removeParameters(self): |
|
300 | 299 | |
|
301 | 300 | for obj in self.parmConfObjList: |
|
302 | 301 | del obj |
|
303 | 302 | |
|
304 | 303 | self.parmConfObjList = [] |
|
305 | 304 | |
|
306 | 305 | def addParameter(self, name, value, format='str'): |
|
307 | 306 | |
|
308 | 307 | id = self.__getNewId() |
|
309 | 308 | |
|
310 | 309 | parmConfObj = ParameterConf() |
|
311 | 310 | if not parmConfObj.setup(id, name, value, format): |
|
312 | 311 | return None |
|
313 | 312 | |
|
314 | 313 | self.parmConfObjList.append(parmConfObj) |
|
315 | 314 | |
|
316 | 315 | return parmConfObj |
|
317 | 316 | |
|
318 | 317 | def changeParameter(self, name, value, format='str'): |
|
319 | 318 | |
|
320 | 319 | parmConfObj = self.getParameterObj(name) |
|
321 | 320 | parmConfObj.update(name, value, format) |
|
322 | 321 | |
|
323 | 322 | return parmConfObj |
|
324 | 323 | |
|
325 | 324 | def makeXml(self, upElement): |
|
326 | 325 | |
|
327 | 326 | opElement = SubElement(upElement, self.ELEMENTNAME) |
|
328 | 327 | opElement.set('id', str(self.id)) |
|
329 | 328 | opElement.set('name', self.name) |
|
330 | 329 | opElement.set('type', self.type) |
|
331 | 330 | opElement.set('priority', str(self.priority)) |
|
332 | 331 | |
|
333 | 332 | for parmConfObj in self.parmConfObjList: |
|
334 | 333 | parmConfObj.makeXml(opElement) |
|
335 | 334 | |
|
336 | 335 | def readXml(self, opElement): |
|
337 | 336 | |
|
338 | 337 | self.id = opElement.get('id') |
|
339 | 338 | self.name = opElement.get('name') |
|
340 | 339 | self.type = opElement.get('type') |
|
341 | 340 | self.priority = opElement.get('priority') |
|
342 | 341 | |
|
343 | 342 | #Compatible with old signal chain version |
|
344 | 343 | #Use of 'run' method instead 'init' |
|
345 | 344 | if self.type == 'self' and self.name == 'init': |
|
346 | 345 | self.name = 'run' |
|
347 | 346 | |
|
348 | 347 | self.parmConfObjList = [] |
|
349 | 348 | |
|
350 | 349 | parmElementList = opElement.getiterator(ParameterConf().getElementName()) |
|
351 | 350 | |
|
352 | 351 | for parmElement in parmElementList: |
|
353 | 352 | parmConfObj = ParameterConf() |
|
354 | 353 | parmConfObj.readXml(parmElement) |
|
355 | 354 | |
|
356 | 355 | #Compatible with old signal chain version |
|
357 | 356 | #If an 'plot' OPERATION is found, changes name operation by the value of its type PARAMETER |
|
358 | 357 | if self.type != 'self' and self.name == 'Plot': |
|
359 | 358 | if parmConfObj.format == 'str' and parmConfObj.name == 'type': |
|
360 | 359 | self.name = parmConfObj.value |
|
361 | 360 | continue |
|
362 | 361 | |
|
363 | 362 | self.parmConfObjList.append(parmConfObj) |
|
364 | 363 | |
|
365 | 364 | def printattr(self): |
|
366 | 365 | |
|
367 | 366 | print "%s[%s]: name = %s, type = %s, priority = %s" %(self.ELEMENTNAME, |
|
368 | 367 | self.id, |
|
369 | 368 | self.name, |
|
370 | 369 | self.type, |
|
371 | 370 | self.priority) |
|
372 | 371 | |
|
373 | 372 | for parmConfObj in self.parmConfObjList: |
|
374 | 373 | parmConfObj.printattr() |
|
375 | 374 | |
|
376 | 375 | def createObject(self): |
|
377 | 376 | |
|
378 | 377 | if self.type == 'self': |
|
379 | 378 | raise ValueError, "This operation type cannot be created" |
|
380 | 379 | |
|
381 | 380 | if self.type == 'external' or self.type == 'other': |
|
382 | 381 | className = eval(self.name) |
|
383 | 382 | opObj = className() |
|
384 | 383 | |
|
385 | 384 | return opObj |
|
386 | 385 | |
|
387 | 386 | class ProcUnitConf(): |
|
388 | 387 | |
|
389 | 388 | id = None |
|
390 | 389 | name = None |
|
391 | 390 | datatype = None |
|
392 | 391 | inputId = None |
|
393 | 392 | parentId = None |
|
394 | 393 | |
|
395 | 394 | opConfObjList = [] |
|
396 | 395 | |
|
397 | 396 | procUnitObj = None |
|
398 | 397 | opObjList = [] |
|
399 | 398 | |
|
400 | 399 | ELEMENTNAME = 'ProcUnit' |
|
401 | 400 | |
|
402 | 401 | def __init__(self): |
|
403 | 402 | |
|
404 | 403 | self.id = None |
|
405 | 404 | self.datatype = None |
|
406 | 405 | self.name = None |
|
407 | 406 | self.inputId = None |
|
408 | 407 | |
|
409 | 408 | self.opConfObjList = [] |
|
410 | 409 | |
|
411 | 410 | self.procUnitObj = None |
|
412 | 411 | self.opObjDict = {} |
|
413 | 412 | |
|
414 | 413 | def __getPriority(self): |
|
415 | 414 | |
|
416 | 415 | return len(self.opConfObjList)+1 |
|
417 | 416 | |
|
418 | 417 | def __getNewId(self): |
|
419 | 418 | |
|
420 | 419 | return int(self.id)*10 + len(self.opConfObjList) + 1 |
|
421 | 420 | |
|
422 | 421 | def getElementName(self): |
|
423 | 422 | |
|
424 | 423 | return self.ELEMENTNAME |
|
425 | 424 | |
|
426 | 425 | def getId(self): |
|
427 | 426 | |
|
428 | 427 | return self.id |
|
429 | 428 | |
|
430 | 429 | def updateId(self, new_id, parentId=parentId): |
|
431 | 430 | |
|
432 | 431 | |
|
433 | 432 | new_id = int(parentId)*10 + (int(self.id) % 10) |
|
434 | 433 | new_inputId = int(parentId)*10 + (int(self.inputId) % 10) |
|
435 | 434 | |
|
436 | 435 | #If this proc unit has not inputs |
|
437 | 436 | if self.inputId == '0': |
|
438 | 437 | new_inputId = 0 |
|
439 | 438 | |
|
440 | 439 | n = 1 |
|
441 | 440 | for opConfObj in self.opConfObjList: |
|
442 | 441 | |
|
443 | 442 | idOp = str(int(new_id)*10 + n) |
|
444 | 443 | opConfObj.updateId(idOp) |
|
445 | 444 | |
|
446 | 445 | n += 1 |
|
447 | 446 | |
|
448 | 447 | self.parentId = str(parentId) |
|
449 | 448 | self.id = str(new_id) |
|
450 | 449 | self.inputId = str(new_inputId) |
|
451 | 450 | |
|
452 | 451 | |
|
453 | 452 | def getInputId(self): |
|
454 | 453 | |
|
455 | 454 | return self.inputId |
|
456 | 455 | |
|
457 | 456 | def getOperationObjList(self): |
|
458 | 457 | |
|
459 | 458 | return self.opConfObjList |
|
460 | 459 | |
|
461 | 460 | def getOperationObj(self, name=None): |
|
462 | 461 | |
|
463 | 462 | for opConfObj in self.opConfObjList: |
|
464 | 463 | |
|
465 | 464 | if opConfObj.name != name: |
|
466 | 465 | continue |
|
467 | 466 | |
|
468 | 467 | return opConfObj |
|
469 | 468 | |
|
470 | 469 | return None |
|
471 | 470 | |
|
472 | 471 | def getOpObjfromParamValue(self, value=None): |
|
473 | 472 | |
|
474 | 473 | for opConfObj in self.opConfObjList: |
|
475 | 474 | if opConfObj.getParameterObjfromValue(parameterValue=value) != value: |
|
476 | 475 | continue |
|
477 | 476 | return opConfObj |
|
478 | 477 | return None |
|
479 | 478 | |
|
480 | 479 | def getProcUnitObj(self): |
|
481 | 480 | |
|
482 | 481 | return self.procUnitObj |
|
483 | 482 | |
|
484 | 483 | def setup(self, id, name, datatype, inputId, parentId=None): |
|
485 | 484 | |
|
486 | 485 | #Compatible with old signal chain version |
|
487 | 486 | if datatype==None and name==None: |
|
488 | 487 | raise ValueError, "datatype or name should be defined" |
|
489 | 488 | |
|
490 | 489 | if name==None: |
|
491 | 490 | if 'Proc' in datatype: |
|
492 | 491 | name = datatype |
|
493 | 492 | else: |
|
494 | 493 | name = '%sProc' %(datatype) |
|
495 | 494 | |
|
496 | 495 | if datatype==None: |
|
497 | 496 | datatype = name.replace('Proc','') |
|
498 | 497 | |
|
499 | 498 | self.id = str(id) |
|
500 | 499 | self.name = name |
|
501 | 500 | self.datatype = datatype |
|
502 | 501 | self.inputId = inputId |
|
503 | 502 | self.parentId = parentId |
|
504 | 503 | |
|
505 | 504 | self.opConfObjList = [] |
|
506 | 505 | |
|
507 | 506 | self.addOperation(name='run', optype='self') |
|
508 | 507 | |
|
509 | 508 | def removeOperations(self): |
|
510 | 509 | |
|
511 | 510 | for obj in self.opConfObjList: |
|
512 | 511 | del obj |
|
513 | 512 | |
|
514 | 513 | self.opConfObjList = [] |
|
515 | 514 | self.addOperation(name='run') |
|
516 | 515 | |
|
517 | 516 | def addParameter(self, **kwargs): |
|
518 | 517 | ''' |
|
519 | 518 | Add parameters to "run" operation |
|
520 | 519 | ''' |
|
521 | 520 | opObj = self.opConfObjList[0] |
|
522 | 521 | |
|
523 | 522 | opObj.addParameter(**kwargs) |
|
524 | 523 | |
|
525 | 524 | return opObj |
|
526 | 525 | |
|
527 | 526 | def addOperation(self, name, optype='self'): |
|
528 | 527 | |
|
529 | 528 | id = self.__getNewId() |
|
530 | 529 | priority = self.__getPriority() |
|
531 | 530 | |
|
532 | 531 | opConfObj = OperationConf() |
|
533 | 532 | opConfObj.setup(id, name=name, priority=priority, type=optype) |
|
534 | 533 | |
|
535 | 534 | self.opConfObjList.append(opConfObj) |
|
536 | 535 | |
|
537 | 536 | return opConfObj |
|
538 | 537 | |
|
539 | 538 | def makeXml(self, procUnitElement): |
|
540 | 539 | |
|
541 | 540 | upElement = SubElement(procUnitElement, self.ELEMENTNAME) |
|
542 | 541 | upElement.set('id', str(self.id)) |
|
543 | 542 | upElement.set('name', self.name) |
|
544 | 543 | upElement.set('datatype', self.datatype) |
|
545 | 544 | upElement.set('inputId', str(self.inputId)) |
|
546 | 545 | |
|
547 | 546 | for opConfObj in self.opConfObjList: |
|
548 | 547 | opConfObj.makeXml(upElement) |
|
549 | 548 | |
|
550 | 549 | def readXml(self, upElement): |
|
551 | 550 | |
|
552 | 551 | self.id = upElement.get('id') |
|
553 | 552 | self.name = upElement.get('name') |
|
554 | 553 | self.datatype = upElement.get('datatype') |
|
555 | 554 | self.inputId = upElement.get('inputId') |
|
556 | 555 | |
|
557 | 556 | if self.ELEMENTNAME == "ReadUnit": |
|
558 | 557 | self.datatype = self.datatype.replace("Reader", "") |
|
559 | 558 | |
|
560 | 559 | if self.ELEMENTNAME == "ProcUnit": |
|
561 | 560 | self.datatype = self.datatype.replace("Proc", "") |
|
562 | 561 | |
|
563 | 562 | if self.inputId == 'None': |
|
564 | 563 | self.inputId = '0' |
|
565 | 564 | |
|
566 | 565 | self.opConfObjList = [] |
|
567 | 566 | |
|
568 | 567 | opElementList = upElement.getiterator(OperationConf().getElementName()) |
|
569 | 568 | |
|
570 | 569 | for opElement in opElementList: |
|
571 | 570 | opConfObj = OperationConf() |
|
572 | 571 | opConfObj.readXml(opElement) |
|
573 | 572 | self.opConfObjList.append(opConfObj) |
|
574 | 573 | |
|
575 | 574 | def printattr(self): |
|
576 | 575 | |
|
577 | 576 | print "%s[%s]: name = %s, datatype = %s, inputId = %s" %(self.ELEMENTNAME, |
|
578 | 577 | self.id, |
|
579 | 578 | self.name, |
|
580 | 579 | self.datatype, |
|
581 | 580 | self.inputId) |
|
582 | 581 | |
|
583 | 582 | for opConfObj in self.opConfObjList: |
|
584 | 583 | opConfObj.printattr() |
|
585 | 584 | |
|
586 | 585 | def createObjects(self): |
|
587 | 586 | |
|
588 | 587 | className = eval(self.name) |
|
589 | 588 | procUnitObj = className() |
|
590 | 589 | |
|
591 | 590 | for opConfObj in self.opConfObjList: |
|
592 | 591 | |
|
593 | 592 | if opConfObj.type == 'self': |
|
594 | 593 | continue |
|
595 | 594 | |
|
596 | 595 | opObj = opConfObj.createObject() |
|
597 | 596 | |
|
598 | 597 | self.opObjDict[opConfObj.id] = opObj |
|
599 | 598 | procUnitObj.addOperation(opObj, opConfObj.id) |
|
600 | 599 | |
|
601 | 600 | self.procUnitObj = procUnitObj |
|
602 | 601 | |
|
603 | 602 | return procUnitObj |
|
604 | 603 | |
|
605 | 604 | def run(self): |
|
606 | 605 | |
|
607 | 606 | finalSts = False |
|
608 | 607 | |
|
609 | 608 | for opConfObj in self.opConfObjList: |
|
610 | 609 | |
|
611 | 610 | kwargs = {} |
|
612 | 611 | for parmConfObj in opConfObj.getParameterObjList(): |
|
613 | 612 | if opConfObj.name == 'run' and parmConfObj.name == 'datatype': |
|
614 | 613 | continue |
|
615 | 614 | |
|
616 | 615 | kwargs[parmConfObj.name] = parmConfObj.getValue() |
|
617 | 616 | |
|
618 | 617 | #print "\tRunning the '%s' operation with %s" %(opConfObj.name, opConfObj.id) |
|
619 | 618 | sts = self.procUnitObj.call(opType = opConfObj.type, |
|
620 | 619 | opName = opConfObj.name, |
|
621 | 620 | opId = opConfObj.id, |
|
622 | 621 | **kwargs) |
|
623 | 622 | finalSts = finalSts or sts |
|
624 | 623 | |
|
625 | 624 | return finalSts |
|
626 | 625 | |
|
627 | 626 | def close(self): |
|
628 | 627 | |
|
629 | 628 | for opConfObj in self.opConfObjList: |
|
630 | 629 | if opConfObj.type == 'self': |
|
631 | 630 | continue |
|
632 | 631 | |
|
633 | 632 | opObj = self.procUnitObj.getOperationObj(opConfObj.id) |
|
634 | 633 | opObj.close() |
|
635 | 634 | |
|
636 | 635 | self.procUnitObj.close() |
|
637 | 636 | |
|
638 | 637 | return |
|
639 | 638 | |
|
640 | 639 | class ReadUnitConf(ProcUnitConf): |
|
641 | 640 | |
|
642 | 641 | path = None |
|
643 | 642 | startDate = None |
|
644 | 643 | endDate = None |
|
645 | 644 | startTime = None |
|
646 | 645 | endTime = None |
|
647 | 646 | |
|
648 | 647 | ELEMENTNAME = 'ReadUnit' |
|
649 | 648 | |
|
650 | 649 | def __init__(self): |
|
651 | 650 | |
|
652 | 651 | self.id = None |
|
653 | 652 | self.datatype = None |
|
654 | 653 | self.name = None |
|
655 | 654 | self.inputId = None |
|
656 | 655 | |
|
657 | 656 | self.parentId = None |
|
658 | 657 | |
|
659 | 658 | self.opConfObjList = [] |
|
660 | 659 | self.opObjList = [] |
|
661 | 660 | |
|
662 | 661 | def getElementName(self): |
|
663 | 662 | |
|
664 | 663 | return self.ELEMENTNAME |
|
665 | 664 | |
|
666 | 665 | def setup(self, id, name, datatype, path, startDate="", endDate="", startTime="", endTime="", parentId=None, **kwargs): |
|
667 | 666 | |
|
668 | 667 | #Compatible with old signal chain version |
|
669 | 668 | if datatype==None and name==None: |
|
670 | 669 | raise ValueError, "datatype or name should be defined" |
|
671 | 670 | |
|
672 | 671 | if name==None: |
|
673 | 672 | if 'Reader' in datatype: |
|
674 | 673 | name = datatype |
|
675 | 674 | else: |
|
676 | 675 | name = '%sReader' %(datatype) |
|
677 | 676 | |
|
678 | 677 | if datatype==None: |
|
679 | 678 | datatype = name.replace('Reader','') |
|
680 | 679 | |
|
681 | 680 | self.id = id |
|
682 | 681 | self.name = name |
|
683 | 682 | self.datatype = datatype |
|
684 | 683 | |
|
685 | 684 | self.path = path |
|
686 | 685 | self.startDate = startDate |
|
687 | 686 | self.endDate = endDate |
|
688 | 687 | self.startTime = startTime |
|
689 | 688 | self.endTime = endTime |
|
690 | 689 | |
|
691 | 690 | self.inputId = '0' |
|
692 | 691 | self.parentId = parentId |
|
693 | 692 | |
|
694 | 693 | self.addRunOperation(**kwargs) |
|
695 | 694 | |
|
696 | 695 | def update(self, datatype, path, startDate, endDate, startTime, endTime, parentId=None, name=None, **kwargs): |
|
697 | 696 | |
|
698 | 697 | #Compatible with old signal chain version |
|
699 | 698 | if datatype==None and name==None: |
|
700 | 699 | raise ValueError, "datatype or name should be defined" |
|
701 | 700 | |
|
702 | 701 | if name==None: |
|
703 | 702 | if 'Reader' in datatype: |
|
704 | 703 | name = datatype |
|
705 | 704 | else: |
|
706 | 705 | name = '%sReader' %(datatype) |
|
707 | 706 | |
|
708 | 707 | if datatype==None: |
|
709 | 708 | datatype = name.replace('Reader','') |
|
710 | 709 | |
|
711 | 710 | self.datatype = datatype |
|
712 | 711 | self.name = name |
|
713 | 712 | self.path = path |
|
714 | 713 | self.startDate = startDate |
|
715 | 714 | self.endDate = endDate |
|
716 | 715 | self.startTime = startTime |
|
717 | 716 | self.endTime = endTime |
|
718 | 717 | |
|
719 | 718 | self.inputId = '0' |
|
720 | 719 | self.parentId = parentId |
|
721 | 720 | |
|
722 | 721 | self.updateRunOperation(**kwargs) |
|
723 | 722 | |
|
724 | 723 | def addRunOperation(self, **kwargs): |
|
725 | 724 | |
|
726 | 725 | opObj = self.addOperation(name = 'run', optype = 'self') |
|
727 | 726 | |
|
728 | 727 | opObj.addParameter(name='datatype' , value=self.datatype, format='str') |
|
729 | 728 | opObj.addParameter(name='path' , value=self.path, format='str') |
|
730 | 729 | opObj.addParameter(name='startDate' , value=self.startDate, format='date') |
|
731 | 730 | opObj.addParameter(name='endDate' , value=self.endDate, format='date') |
|
732 | 731 | opObj.addParameter(name='startTime' , value=self.startTime, format='time') |
|
733 | 732 | opObj.addParameter(name='endTime' , value=self.endTime, format='time') |
|
734 | 733 | |
|
735 | 734 | for key, value in kwargs.items(): |
|
736 | 735 | opObj.addParameter(name=key, value=value, format=type(value).__name__) |
|
737 | 736 | |
|
738 | 737 | return opObj |
|
739 | 738 | |
|
740 | 739 | def updateRunOperation(self, **kwargs): |
|
741 | 740 | |
|
742 | 741 | opObj = self.getOperationObj(name = 'run') |
|
743 | 742 | opObj.removeParameters() |
|
744 | 743 | |
|
745 | 744 | opObj.addParameter(name='datatype' , value=self.datatype, format='str') |
|
746 | 745 | opObj.addParameter(name='path' , value=self.path, format='str') |
|
747 | 746 | opObj.addParameter(name='startDate' , value=self.startDate, format='date') |
|
748 | 747 | opObj.addParameter(name='endDate' , value=self.endDate, format='date') |
|
749 | 748 | opObj.addParameter(name='startTime' , value=self.startTime, format='time') |
|
750 | 749 | opObj.addParameter(name='endTime' , value=self.endTime, format='time') |
|
751 | 750 | |
|
752 | 751 | for key, value in kwargs.items(): |
|
753 | 752 | opObj.addParameter(name=key, value=value, format=type(value).__name__) |
|
754 | 753 | |
|
755 | 754 | return opObj |
|
756 | 755 | |
|
757 | 756 | class Project(): |
|
758 | 757 | |
|
759 | 758 | id = None |
|
760 | 759 | name = None |
|
761 | 760 | description = None |
|
762 | 761 | # readUnitConfObjList = None |
|
763 | 762 | procUnitConfObjDict = None |
|
764 | 763 | |
|
765 | 764 | ELEMENTNAME = 'Project' |
|
766 | 765 | |
|
767 | 766 | def __init__(self, control=None, dataq=None): |
|
768 | 767 | |
|
769 | 768 | self.id = None |
|
770 | 769 | self.name = None |
|
771 | 770 | self.description = None |
|
772 | 771 | |
|
773 | 772 | self.procUnitConfObjDict = {} |
|
774 | 773 | |
|
775 | 774 | #global data_q |
|
776 | 775 | #data_q = dataq |
|
777 | 776 | |
|
778 | 777 | if control==None: |
|
779 | 778 | control = {'stop':False,'pause':False} |
|
780 | 779 | |
|
781 | 780 | self.control = control |
|
782 | 781 | |
|
783 | 782 | def __getNewId(self): |
|
784 | 783 | |
|
785 | 784 | id = int(self.id)*10 + len(self.procUnitConfObjDict) + 1 |
|
786 | 785 | |
|
787 | 786 | return str(id) |
|
788 | 787 | |
|
789 | 788 | def getElementName(self): |
|
790 | 789 | |
|
791 | 790 | return self.ELEMENTNAME |
|
792 | 791 | |
|
793 | 792 | def getId(self): |
|
794 | 793 | |
|
795 | 794 | return self.id |
|
796 | 795 | |
|
797 | 796 | def updateId(self, new_id): |
|
798 | 797 | |
|
799 | 798 | self.id = str(new_id) |
|
800 | 799 | |
|
801 | 800 | keyList = self.procUnitConfObjDict.keys() |
|
802 | 801 | keyList.sort() |
|
803 | 802 | |
|
804 | 803 | n = 1 |
|
805 | 804 | newProcUnitConfObjDict = {} |
|
806 | 805 | |
|
807 | 806 | for procKey in keyList: |
|
808 | 807 | |
|
809 | 808 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
810 | 809 | idProcUnit = str(int(self.id)*10 + n) |
|
811 | 810 | procUnitConfObj.updateId(idProcUnit, parentId = self.id) |
|
812 | 811 | |
|
813 | 812 | newProcUnitConfObjDict[idProcUnit] = procUnitConfObj |
|
814 | 813 | n += 1 |
|
815 | 814 | |
|
816 | 815 | self.procUnitConfObjDict = newProcUnitConfObjDict |
|
817 | 816 | |
|
818 | 817 | def setup(self, id, name, description): |
|
819 | 818 | |
|
820 | 819 | self.id = str(id) |
|
821 | 820 | self.name = name |
|
822 | 821 | self.description = description |
|
823 | 822 | |
|
824 | 823 | def update(self, name, description): |
|
825 | 824 | |
|
826 | 825 | self.name = name |
|
827 | 826 | self.description = description |
|
828 | 827 | |
|
829 | 828 | def addReadUnit(self, datatype=None, name=None, **kwargs): |
|
830 | 829 | |
|
831 | 830 | idReadUnit = self.__getNewId() |
|
832 | 831 | |
|
833 | 832 | readUnitConfObj = ReadUnitConf() |
|
834 | 833 | readUnitConfObj.setup(idReadUnit, name, datatype, parentId=self.id, **kwargs) |
|
835 | 834 | |
|
836 | 835 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
837 | 836 | |
|
838 | 837 | return readUnitConfObj |
|
839 | 838 | |
|
840 | 839 | def addProcUnit(self, inputId='0', datatype=None, name=None): |
|
841 | 840 | |
|
842 | 841 | idProcUnit = self.__getNewId() |
|
843 | 842 | |
|
844 | 843 | procUnitConfObj = ProcUnitConf() |
|
845 | 844 | procUnitConfObj.setup(idProcUnit, name, datatype, inputId, parentId=self.id) |
|
846 | 845 | |
|
847 | 846 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
848 | 847 | |
|
849 | 848 | return procUnitConfObj |
|
850 | 849 | |
|
851 | 850 | def removeProcUnit(self, id): |
|
852 | 851 | |
|
853 | 852 | if id in self.procUnitConfObjDict.keys(): |
|
854 | 853 | self.procUnitConfObjDict.pop(id) |
|
855 | 854 | |
|
856 | 855 | def getReadUnitId(self): |
|
857 | 856 | |
|
858 | 857 | readUnitConfObj = self.getReadUnitObj() |
|
859 | 858 | |
|
860 | 859 | return readUnitConfObj.id |
|
861 | 860 | |
|
862 | 861 | def getReadUnitObj(self): |
|
863 | 862 | |
|
864 | 863 | for obj in self.procUnitConfObjDict.values(): |
|
865 | 864 | if obj.getElementName() == "ReadUnit": |
|
866 | 865 | return obj |
|
867 | 866 | |
|
868 | 867 | return None |
|
869 | 868 | |
|
870 | 869 | def getProcUnitObj(self, id=None, name=None): |
|
871 | 870 | |
|
872 | 871 | if id != None: |
|
873 | 872 | return self.procUnitConfObjDict[id] |
|
874 | 873 | |
|
875 | 874 | if name != None: |
|
876 | 875 | return self.getProcUnitObjByName(name) |
|
877 | 876 | |
|
878 | 877 | return None |
|
879 | 878 | |
|
880 | 879 | def getProcUnitObjByName(self, name): |
|
881 | 880 | |
|
882 | 881 | for obj in self.procUnitConfObjDict.values(): |
|
883 | 882 | if obj.name == name: |
|
884 | 883 | return obj |
|
885 | 884 | |
|
886 | 885 | return None |
|
887 | 886 | |
|
888 | 887 | def procUnitItems(self): |
|
889 | 888 | |
|
890 | 889 | return self.procUnitConfObjDict.items() |
|
891 | 890 | |
|
892 | 891 | def makeXml(self): |
|
893 | 892 | |
|
894 | 893 | projectElement = Element('Project') |
|
895 | 894 | projectElement.set('id', str(self.id)) |
|
896 | 895 | projectElement.set('name', self.name) |
|
897 | 896 | projectElement.set('description', self.description) |
|
898 | 897 | |
|
899 | 898 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
900 | 899 | procUnitConfObj.makeXml(projectElement) |
|
901 | 900 | |
|
902 | 901 | self.projectElement = projectElement |
|
903 | 902 | |
|
904 | 903 | def writeXml(self, filename): |
|
905 | 904 | |
|
906 | 905 | self.makeXml() |
|
907 | 906 | |
|
908 | 907 | #print prettify(self.projectElement) |
|
909 | 908 | |
|
910 | 909 | ElementTree(self.projectElement).write(filename, method='xml') |
|
911 | 910 | |
|
912 | 911 | def readXml(self, filename): |
|
913 | 912 | |
|
914 | 913 | self.projectElement = None |
|
915 | 914 | self.procUnitConfObjDict = {} |
|
916 | 915 | |
|
917 | 916 | self.projectElement = ElementTree().parse(filename) |
|
918 | 917 | |
|
919 | 918 | self.project = self.projectElement.tag |
|
920 | 919 | |
|
921 | 920 | self.id = self.projectElement.get('id') |
|
922 | 921 | self.name = self.projectElement.get('name') |
|
923 | 922 | self.description = self.projectElement.get('description') |
|
924 | 923 | |
|
925 | 924 | readUnitElementList = self.projectElement.getiterator(ReadUnitConf().getElementName()) |
|
926 | 925 | |
|
927 | 926 | for readUnitElement in readUnitElementList: |
|
928 | 927 | readUnitConfObj = ReadUnitConf() |
|
929 | 928 | readUnitConfObj.readXml(readUnitElement) |
|
930 | 929 | |
|
931 | 930 | if readUnitConfObj.parentId == None: |
|
932 | 931 | readUnitConfObj.parentId = self.id |
|
933 | 932 | |
|
934 | 933 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
935 | 934 | |
|
936 | 935 | procUnitElementList = self.projectElement.getiterator(ProcUnitConf().getElementName()) |
|
937 | 936 | |
|
938 | 937 | for procUnitElement in procUnitElementList: |
|
939 | 938 | procUnitConfObj = ProcUnitConf() |
|
940 | 939 | procUnitConfObj.readXml(procUnitElement) |
|
941 | 940 | |
|
942 | 941 | if procUnitConfObj.parentId == None: |
|
943 | 942 | procUnitConfObj.parentId = self.id |
|
944 | 943 | |
|
945 | 944 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
946 | 945 | |
|
947 | 946 | def printattr(self): |
|
948 | 947 | |
|
949 | 948 | print "Project[%s]: name = %s, description = %s" %(self.id, |
|
950 | 949 | self.name, |
|
951 | 950 | self.description) |
|
952 | 951 | |
|
953 | 952 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
954 | 953 | procUnitConfObj.printattr() |
|
955 | 954 | |
|
956 | 955 | def createObjects(self): |
|
957 | 956 | |
|
958 | 957 | for procUnitConfObj in self.procUnitConfObjDict.values(): |
|
959 | 958 | procUnitConfObj.createObjects() |
|
960 | 959 | |
|
961 | 960 | def __connect(self, objIN, thisObj): |
|
962 | 961 | |
|
963 | 962 | thisObj.setInput(objIN.getOutputObj()) |
|
964 | 963 | |
|
965 | 964 | def connectObjects(self): |
|
966 | 965 | |
|
967 | 966 | for thisPUConfObj in self.procUnitConfObjDict.values(): |
|
968 | 967 | |
|
969 | 968 | inputId = thisPUConfObj.getInputId() |
|
970 | 969 | |
|
971 | 970 | if int(inputId) == 0: |
|
972 | 971 | continue |
|
973 | 972 | |
|
974 | 973 | #Get input object |
|
975 | 974 | puConfINObj = self.procUnitConfObjDict[inputId] |
|
976 | 975 | puObjIN = puConfINObj.getProcUnitObj() |
|
977 | 976 | |
|
978 | 977 | #Get current object |
|
979 | 978 | thisPUObj = thisPUConfObj.getProcUnitObj() |
|
980 | 979 | |
|
981 | 980 | self.__connect(puObjIN, thisPUObj) |
|
982 | 981 | |
|
983 | 982 | def run(self): |
|
984 | 983 | |
|
985 | 984 | |
|
986 | 985 | print "*"*50 |
|
987 | 986 | print " Starting SIGNAL CHAIN PROCESSING " |
|
988 | 987 | print "*"*50 |
|
989 | 988 | |
|
990 | 989 | |
|
991 | 990 | keyList = self.procUnitConfObjDict.keys() |
|
992 | 991 | keyList.sort() |
|
993 | 992 | |
|
994 | 993 | while(True): |
|
995 | 994 | |
|
996 | 995 | finalSts = False |
|
997 | 996 | |
|
998 | 997 | for procKey in keyList: |
|
999 | 998 | # print "Running the '%s' process with %s" %(procUnitConfObj.name, procUnitConfObj.id) |
|
1000 | 999 | |
|
1001 | 1000 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
1002 | 1001 | sts = procUnitConfObj.run() |
|
1003 | 1002 | finalSts = finalSts or sts |
|
1004 | 1003 | |
|
1005 | 1004 | #If every process unit finished so end process |
|
1006 | 1005 | if not(finalSts): |
|
1007 | 1006 | print "Every process unit have finished" |
|
1008 | 1007 | break |
|
1009 | 1008 | |
|
1010 | 1009 | if self.control['pause']: |
|
1011 | 1010 | print "Process suspended" |
|
1012 | 1011 | |
|
1013 | 1012 | while True: |
|
1014 | 1013 | sleep(0.1) |
|
1015 | 1014 | |
|
1016 | 1015 | if not self.control['pause']: |
|
1017 | 1016 | break |
|
1018 | 1017 | |
|
1019 | 1018 | if self.control['stop']: |
|
1020 | 1019 | break |
|
1021 | 1020 | print "Process reinitialized" |
|
1022 | 1021 | |
|
1023 | 1022 | if self.control['stop']: |
|
1024 | 1023 | # print "Process stopped" |
|
1025 | 1024 | break |
|
1026 | 1025 | |
|
1027 | 1026 | #Closing every process |
|
1028 | 1027 | for procKey in keyList: |
|
1029 | 1028 | procUnitConfObj = self.procUnitConfObjDict[procKey] |
|
1030 | 1029 | procUnitConfObj.close() |
|
1031 | 1030 | |
|
1032 | 1031 | print "Process finished" |
|
1033 | 1032 | |
|
1034 | 1033 | def start(self, filename): |
|
1035 | 1034 | |
|
1036 | 1035 | self.writeXml(filename) |
|
1037 | 1036 | self.readXml(filename) |
|
1038 | 1037 | |
|
1039 | 1038 | self.createObjects() |
|
1040 | 1039 | self.connectObjects() |
|
1041 | 1040 | self.run() |
|
1042 | 1041 | |
|
1043 | 1042 | if __name__ == '__main__': |
|
1044 | 1043 | |
|
1045 | 1044 | desc = "Segundo Test" |
|
1046 | 1045 | filename = "schain.xml" |
|
1047 | 1046 | |
|
1048 | 1047 | controllerObj = Project() |
|
1049 | 1048 | |
|
1050 | 1049 | controllerObj.setup(id = '191', name='test01', description=desc) |
|
1051 | 1050 | |
|
1052 | 1051 | readUnitConfObj = controllerObj.addReadUnit(datatype='Voltage', |
|
1053 | 1052 | path='data/rawdata/', |
|
1054 | 1053 | startDate='2011/01/01', |
|
1055 | 1054 | endDate='2012/12/31', |
|
1056 | 1055 | startTime='00:00:00', |
|
1057 | 1056 | endTime='23:59:59', |
|
1058 | 1057 | online=1, |
|
1059 | 1058 | walk=1) |
|
1060 | 1059 | |
|
1061 | 1060 | procUnitConfObj0 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) |
|
1062 | 1061 | |
|
1063 | 1062 | opObj10 = procUnitConfObj0.addOperation(name='selectChannels') |
|
1064 | 1063 | opObj10.addParameter(name='channelList', value='3,4,5', format='intlist') |
|
1065 | 1064 | |
|
1066 | 1065 | opObj10 = procUnitConfObj0.addOperation(name='selectHeights') |
|
1067 | 1066 | opObj10.addParameter(name='minHei', value='90', format='float') |
|
1068 | 1067 | opObj10.addParameter(name='maxHei', value='180', format='float') |
|
1069 | 1068 | |
|
1070 | 1069 | opObj12 = procUnitConfObj0.addOperation(name='CohInt', optype='external') |
|
1071 | 1070 | opObj12.addParameter(name='n', value='10', format='int') |
|
1072 | 1071 | |
|
1073 | 1072 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj0.getId()) |
|
1074 | 1073 | procUnitConfObj1.addParameter(name='nFFTPoints', value='32', format='int') |
|
1075 | 1074 | # procUnitConfObj1.addParameter(name='pairList', value='(0,1),(0,2),(1,2)', format='') |
|
1076 | 1075 | |
|
1077 | 1076 | |
|
1078 | 1077 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external') |
|
1079 | 1078 | opObj11.addParameter(name='idfigure', value='1', format='int') |
|
1080 | 1079 | opObj11.addParameter(name='wintitle', value='SpectraPlot0', format='str') |
|
1081 | 1080 | opObj11.addParameter(name='zmin', value='40', format='int') |
|
1082 | 1081 | opObj11.addParameter(name='zmax', value='90', format='int') |
|
1083 | 1082 | opObj11.addParameter(name='showprofile', value='1', format='int') |
|
1084 | 1083 | |
|
1085 | 1084 | print "Escribiendo el archivo XML" |
|
1086 | 1085 | |
|
1087 | 1086 | controllerObj.writeXml(filename) |
|
1088 | 1087 | |
|
1089 | 1088 | print "Leyendo el archivo XML" |
|
1090 | 1089 | controllerObj.readXml(filename) |
|
1091 | 1090 | #controllerObj.printattr() |
|
1092 | 1091 | |
|
1093 | 1092 | controllerObj.createObjects() |
|
1094 | 1093 | controllerObj.connectObjects() |
|
1095 | 1094 | controllerObj.run() |
|
1096 | 1095 | |
|
1097 | 1096 | No newline at end of file |
@@ -1,5866 +1,5862 | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """ |
|
3 | 3 | Module implementing MainWindow. |
|
4 | 4 | #+++++++++++++GUI V1++++++++++++++# |
|
5 | 5 | @author: AlexanderValdezPortocarrero Γ±_Γ± |
|
6 | 6 | """ |
|
7 | 7 | import os, sys, time |
|
8 | 8 | import datetime |
|
9 | 9 | import numpy |
|
10 | 10 | import Queue |
|
11 | 11 | |
|
12 | 12 | from collections import OrderedDict |
|
13 | 13 | from os.path import expanduser |
|
14 | 14 | from time import sleep |
|
15 | 15 | # from gevent import sleep |
|
16 | 16 | |
|
17 | 17 | import ast |
|
18 | 18 | |
|
19 | 19 | from PyQt4.QtGui import QMainWindow |
|
20 | 20 | from PyQt4.QtCore import pyqtSignature |
|
21 | 21 | from PyQt4.QtCore import pyqtSignal |
|
22 | 22 | from PyQt4 import QtCore |
|
23 | 23 | from PyQt4 import QtGui |
|
24 | 24 | # from PyQt4.QtCore import QThread |
|
25 | 25 | # from PyQt4.QtCore import QObject, SIGNAL |
|
26 | 26 | |
|
27 | 27 | from schainpy.gui.viewer.ui_unitprocess import Ui_UnitProcess |
|
28 | 28 | from schainpy.gui.viewer.ui_ftp import Ui_Ftp |
|
29 | 29 | from schainpy.gui.viewer.ui_mainwindow import Ui_BasicWindow |
|
30 | 30 | from schainpy.controller_api import ControllerThread |
|
31 | 31 | from schainpy.controller import Project |
|
32 | 32 | |
|
33 | 33 | from propertiesViewModel import TreeModel, PropertyBuffer |
|
34 | 34 | from parametersModel import ProjectParms |
|
35 | 35 | |
|
36 | 36 | from schainpy.gui.figures import tools |
|
37 | 37 | |
|
38 | 38 | FIGURES_PATH = tools.get_path() |
|
39 | 39 | TEMPORAL_FILE = ".temp.xml" |
|
40 | 40 | |
|
41 | 41 | def isRadarFile(file): |
|
42 | 42 | try: |
|
43 | 43 | year = int(file[1:5]) |
|
44 | 44 | doy = int(file[5:8]) |
|
45 | 45 | set = int(file[8:11]) |
|
46 | 46 | except: |
|
47 | 47 | return 0 |
|
48 | 48 | |
|
49 | 49 | return 1 |
|
50 | 50 | |
|
51 | 51 | def isRadarPath(path): |
|
52 | 52 | try: |
|
53 | 53 | year = int(path[1:5]) |
|
54 | 54 | doy = int(path[5:8]) |
|
55 | 55 | except: |
|
56 | 56 | return 0 |
|
57 | 57 | |
|
58 | 58 | return 1 |
|
59 | 59 | |
|
60 | 60 | def isInt(value): |
|
61 | 61 | |
|
62 | 62 | try: |
|
63 | 63 | int(value) |
|
64 | 64 | except: |
|
65 | 65 | return 0 |
|
66 | 66 | |
|
67 | 67 | return 1 |
|
68 | 68 | |
|
69 | 69 | def isFloat(value): |
|
70 | 70 | |
|
71 | 71 | try: |
|
72 | 72 | float(value) |
|
73 | 73 | except: |
|
74 | 74 | return 0 |
|
75 | 75 | |
|
76 | 76 | return 1 |
|
77 | 77 | |
|
78 | 78 | def isList(value): |
|
79 | 79 | |
|
80 | 80 | x = ast.literal_eval(value) |
|
81 | 81 | |
|
82 | 82 | if type(x) in (tuple, list): |
|
83 | 83 | return 1 |
|
84 | 84 | |
|
85 | 85 | return 0 |
|
86 | 86 | |
|
87 | 87 | class BasicWindow(QMainWindow, Ui_BasicWindow): |
|
88 | 88 | """ |
|
89 | 89 | """ |
|
90 | 90 | def __init__(self, parent=None): |
|
91 | 91 | """ |
|
92 | 92 | |
|
93 | 93 | """ |
|
94 | 94 | QMainWindow.__init__(self, parent) |
|
95 | 95 | self.setupUi(self) |
|
96 | 96 | self.__puObjDict = {} |
|
97 | 97 | self.__itemTreeDict = {} |
|
98 | 98 | self.readUnitConfObjList = [] |
|
99 | 99 | self.operObjList = [] |
|
100 | 100 | self.projecObjView = None |
|
101 | 101 | self.idProject = 0 |
|
102 | 102 | # self.idImag = 0 |
|
103 | 103 | |
|
104 | 104 | self.idImagscope = 0 |
|
105 | 105 | self.idImagspectra = 0 |
|
106 | 106 | self.idImagcross = 0 |
|
107 | 107 | self.idImagrti = 0 |
|
108 | 108 | self.idImagcoherence = 0 |
|
109 | 109 | self.idImagpower = 0 |
|
110 | 110 | self.idImagrtinoise = 0 |
|
111 | 111 | self.idImagspectraHeis = 0 |
|
112 | 112 | self.idImagrtiHeis = 0 |
|
113 | 113 | |
|
114 | 114 | self.dataPath = None |
|
115 | 115 | self.online = 0 |
|
116 | 116 | self.walk = 0 |
|
117 | 117 | self.create = False |
|
118 | 118 | self.selectedItemTree = None |
|
119 | 119 | self.controllerThread = None |
|
120 | 120 | # self.commCtrlPThread = None |
|
121 | 121 | # self.create_figure() |
|
122 | 122 | self.temporalFTP = ftpBuffer() |
|
123 | 123 | self.projectProperCaracteristica = [] |
|
124 | 124 | self.projectProperPrincipal = [] |
|
125 | 125 | self.projectProperDescripcion = [] |
|
126 | 126 | self.volProperCaracteristica = [] |
|
127 | 127 | self.volProperPrincipal = [] |
|
128 | 128 | self.volProperDescripcion = [] |
|
129 | 129 | self.specProperCaracteristica = [] |
|
130 | 130 | self.specProperPrincipal = [] |
|
131 | 131 | self.specProperDescripcion = [] |
|
132 | 132 | |
|
133 | 133 | self.specHeisProperCaracteristica = [] |
|
134 | 134 | self.specHeisProperPrincipal = [] |
|
135 | 135 | self.specHeisProperDescripcion = [] |
|
136 | 136 | |
|
137 | 137 | # self.pathWorkSpace = './' |
|
138 | 138 | |
|
139 | 139 | self.__projectObjDict = {} |
|
140 | 140 | self.__operationObjDict = {} |
|
141 | 141 | |
|
142 | 142 | self.__puLocalFolder2FTP = {} |
|
143 | 143 | self.__enable = False |
|
144 | 144 | |
|
145 | 145 | # self.create_comm() |
|
146 | 146 | self.create_updating_timer() |
|
147 | 147 | self.setGUIStatus() |
|
148 | 148 | |
|
149 | 149 | @pyqtSignature("") |
|
150 | 150 | def on_actionOpen_triggered(self): |
|
151 | 151 | """ |
|
152 | 152 | Slot documentation goes here. |
|
153 | 153 | """ |
|
154 | 154 | self.openProject() |
|
155 | 155 | |
|
156 | 156 | @pyqtSignature("") |
|
157 | 157 | def on_actionCreate_triggered(self): |
|
158 | 158 | """ |
|
159 | 159 | Slot documentation goes here. |
|
160 | 160 | """ |
|
161 | 161 | self.setInputsProject_View() |
|
162 | 162 | self.create = True |
|
163 | 163 | |
|
164 | 164 | @pyqtSignature("") |
|
165 | 165 | def on_actionSave_triggered(self): |
|
166 | 166 | """ |
|
167 | 167 | Slot documentation goes here. |
|
168 | 168 | """ |
|
169 | 169 | self.saveProject() |
|
170 | 170 | |
|
171 | 171 | @pyqtSignature("") |
|
172 | 172 | def on_actionClose_triggered(self): |
|
173 | 173 | """ |
|
174 | 174 | Slot documentation goes here. |
|
175 | 175 | """ |
|
176 | 176 | self.close() |
|
177 | 177 | |
|
178 | 178 | @pyqtSignature("") |
|
179 | 179 | def on_actionStart_triggered(self): |
|
180 | 180 | """ |
|
181 | 181 | """ |
|
182 | 182 | self.playProject() |
|
183 | 183 | |
|
184 | 184 | @pyqtSignature("") |
|
185 | 185 | def on_actionPause_triggered(self): |
|
186 | 186 | """ |
|
187 | 187 | """ |
|
188 | 188 | self.pauseProject() |
|
189 | 189 | |
|
190 | 190 | @pyqtSignature("") |
|
191 | 191 | def on_actionStop_triggered(self): |
|
192 | 192 | """ |
|
193 | 193 | """ |
|
194 | 194 | self.stopProject() |
|
195 | 195 | |
|
196 | 196 | @pyqtSignature("") |
|
197 | 197 | def on_actionAbout_triggered(self): |
|
198 | 198 | """ |
|
199 | 199 | """ |
|
200 | 200 | self.aboutEvent() |
|
201 | 201 | |
|
202 | 202 | @pyqtSignature("") |
|
203 | 203 | def on_actionFTP_triggered(self): |
|
204 | 204 | """ |
|
205 | 205 | """ |
|
206 | 206 | self.configFTPWindowObj = Ftp(self) |
|
207 | 207 | |
|
208 | 208 | if not self.temporalFTP.create: |
|
209 | 209 | self.temporalFTP.setwithoutconfiguration() |
|
210 | 210 | |
|
211 | 211 | self.configFTPWindowObj.setParmsfromTemporal(self.temporalFTP.server, |
|
212 | 212 | self.temporalFTP.remotefolder, |
|
213 | 213 | self.temporalFTP.username, |
|
214 | 214 | self.temporalFTP.password, |
|
215 | 215 | self.temporalFTP.ftp_wei, |
|
216 | 216 | self.temporalFTP.exp_code, |
|
217 | 217 | self.temporalFTP.sub_exp_code, |
|
218 | 218 | self.temporalFTP.plot_pos) |
|
219 | 219 | |
|
220 | 220 | self.configFTPWindowObj.show() |
|
221 | 221 | self.configFTPWindowObj.closed.connect(self.createFTPConfig) |
|
222 | 222 | |
|
223 | 223 | def createFTPConfig(self): |
|
224 | 224 | |
|
225 | 225 | if not self.configFTPWindowObj.create: |
|
226 | 226 | self.console.clear() |
|
227 | 227 | self.console.append("There is no FTP configuration") |
|
228 | 228 | return |
|
229 | 229 | |
|
230 | 230 | self.console.append("Push Ok in Spectra view to Add FTP Configuration") |
|
231 | 231 | |
|
232 | 232 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.configFTPWindowObj.getParmsFromFtpWindow() |
|
233 | 233 | self.temporalFTP.save(server=server, |
|
234 | 234 | remotefolder=remotefolder, |
|
235 | 235 | username=username, |
|
236 | 236 | password=password, |
|
237 | 237 | ftp_wei=ftp_wei, |
|
238 | 238 | exp_code=exp_code, |
|
239 | 239 | sub_exp_code=sub_exp_code, |
|
240 | 240 | plot_pos=plot_pos) |
|
241 | 241 | |
|
242 | 242 | @pyqtSignature("") |
|
243 | 243 | def on_actionOpenToolbar_triggered(self): |
|
244 | 244 | """ |
|
245 | 245 | Slot documentation goes here. |
|
246 | 246 | """ |
|
247 | 247 | self.openProject() |
|
248 | 248 | |
|
249 | 249 | @pyqtSignature("") |
|
250 | 250 | def on_actionCreateToolbar_triggered(self): |
|
251 | 251 | """ |
|
252 | 252 | Slot documentation goes here. |
|
253 | 253 | """ |
|
254 | 254 | self.setInputsProject_View() |
|
255 | 255 | self.create = True |
|
256 | 256 | |
|
257 | 257 | @pyqtSignature("") |
|
258 | 258 | def on_actionAddPU_triggered(self): |
|
259 | 259 | if len(self.__projectObjDict) == 0: |
|
260 | 260 | outputstr = "First Create a Project then add Processing Unit" |
|
261 | 261 | self.console.clear() |
|
262 | 262 | self.console.append(outputstr) |
|
263 | 263 | return 0 |
|
264 | 264 | else: |
|
265 | 265 | self.addPUWindow() |
|
266 | 266 | self.console.clear() |
|
267 | 267 | self.console.append("Please, Choose the type of Processing Unit") |
|
268 | 268 | self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") |
|
269 | 269 | self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") |
|
270 | 270 | self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") |
|
271 | 271 | |
|
272 | 272 | |
|
273 | 273 | @pyqtSignature("") |
|
274 | 274 | def on_actionSaveToolbar_triggered(self): |
|
275 | 275 | """ |
|
276 | 276 | Slot documentation goes here. |
|
277 | 277 | """ |
|
278 | 278 | self.saveProject() |
|
279 | 279 | |
|
280 | 280 | @pyqtSignature("") |
|
281 | 281 | def on_actionStarToolbar_triggered(self): |
|
282 | 282 | """ |
|
283 | 283 | Slot documentation goes here. |
|
284 | 284 | """ |
|
285 | 285 | self.playProject() |
|
286 | 286 | |
|
287 | 287 | @pyqtSignature("") |
|
288 | 288 | def on_actionPauseToolbar_triggered(self): |
|
289 | 289 | |
|
290 | 290 | self.pauseProject() |
|
291 | 291 | |
|
292 | 292 | @pyqtSignature("") |
|
293 | 293 | def on_actionStopToolbar_triggered(self): |
|
294 | 294 | """ |
|
295 | 295 | Slot documentation goes here. |
|
296 | 296 | """ |
|
297 | 297 | self.stopProject() |
|
298 | 298 | |
|
299 | 299 | @pyqtSignature("int") |
|
300 | 300 | def on_proComReadMode_activated(self, index): |
|
301 | 301 | """ |
|
302 | 302 | SELECCION DEL MODO DE LECTURA ON=1, OFF=0 |
|
303 | 303 | """ |
|
304 | 304 | if index == 0: |
|
305 | 305 | self.online = 0 |
|
306 | 306 | self.proDelay.setText("0") |
|
307 | 307 | self.proSet.setText("") |
|
308 | 308 | self.proSet.setEnabled(False) |
|
309 | 309 | self.proDelay.setEnabled(False) |
|
310 | 310 | elif index == 1: |
|
311 | 311 | self.online = 1 |
|
312 | 312 | self.proSet.setText("") |
|
313 | 313 | self.proDelay.setText("5") |
|
314 | 314 | self.proSet.setEnabled(True) |
|
315 | 315 | self.proDelay.setEnabled(True) |
|
316 | 316 | |
|
317 | 317 | @pyqtSignature("int") |
|
318 | 318 | def on_proComDataType_activated(self, index): |
|
319 | 319 | """ |
|
320 | 320 | Voltage or Spectra |
|
321 | 321 | """ |
|
322 | 322 | self.labelSet.show() |
|
323 | 323 | self.proSet.show() |
|
324 | 324 | |
|
325 | 325 | self.labExpLabel.show() |
|
326 | 326 | self.proExpLabel.show() |
|
327 | 327 | |
|
328 | 328 | self.labelIPPKm.hide() |
|
329 | 329 | self.proIPPKm.hide() |
|
330 | 330 | |
|
331 | 331 | if index == 0: |
|
332 | 332 | extension = '.r' |
|
333 | 333 | elif index == 1: |
|
334 | 334 | extension = '.pdata' |
|
335 | 335 | elif index == 2: |
|
336 | 336 | extension = '.fits' |
|
337 | 337 | elif index == 3: |
|
338 | 338 | extension = '.hdf5' |
|
339 | 339 | |
|
340 | 340 | self.labelIPPKm.show() |
|
341 | 341 | self.proIPPKm.show() |
|
342 | 342 | |
|
343 | 343 | self.labelSet.hide() |
|
344 | 344 | self.proSet.hide() |
|
345 | 345 | |
|
346 | 346 | self.labExpLabel.hide() |
|
347 | 347 | self.proExpLabel.hide() |
|
348 | 348 | |
|
349 | 349 | self.proDataType.setText(extension) |
|
350 | 350 | |
|
351 | 351 | @pyqtSignature("int") |
|
352 | 352 | def on_proComWalk_activated(self, index): |
|
353 | 353 | """ |
|
354 | 354 | |
|
355 | 355 | """ |
|
356 | 356 | if index == 0: |
|
357 | 357 | self.walk = 0 |
|
358 | 358 | elif index == 1: |
|
359 | 359 | self.walk = 1 |
|
360 | 360 | |
|
361 | 361 | @pyqtSignature("") |
|
362 | 362 | def on_proToolPath_clicked(self): |
|
363 | 363 | """ |
|
364 | 364 | Choose your path |
|
365 | 365 | """ |
|
366 | 366 | |
|
367 | 367 | current_dpath = './' |
|
368 | 368 | if self.dataPath: |
|
369 | 369 | current_dpath = self.dataPath |
|
370 | 370 | |
|
371 | 371 | datapath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', current_dpath, QtGui.QFileDialog.ShowDirsOnly)) |
|
372 | 372 | |
|
373 | 373 | #If it was canceled |
|
374 | 374 | if not datapath: |
|
375 | 375 | return |
|
376 | 376 | |
|
377 | 377 | #If any change was done |
|
378 | 378 | if datapath == self.dataPath: |
|
379 | 379 | return |
|
380 | 380 | |
|
381 | 381 | self.proDataPath.setText(datapath) |
|
382 | 382 | |
|
383 | 383 | self.actionStart.setEnabled(False) |
|
384 | 384 | self.actionStarToolbar.setEnabled(False) |
|
385 | 385 | self.proOk.setEnabled(False) |
|
386 | 386 | |
|
387 | 387 | self.proComStartDate.clear() |
|
388 | 388 | self.proComEndDate.clear() |
|
389 | 389 | |
|
390 | 390 | if not os.path.exists(datapath): |
|
391 | 391 | |
|
392 | 392 | self.console.clear() |
|
393 | 393 | self.console.append("Write a valid path") |
|
394 | 394 | return |
|
395 | 395 | |
|
396 | 396 | self.dataPath = datapath |
|
397 | 397 | |
|
398 | 398 | self.console.clear() |
|
399 | 399 | self.console.append("Select the read mode and press 'load button'") |
|
400 | 400 | |
|
401 | 401 | |
|
402 | 402 | @pyqtSignature("") |
|
403 | 403 | def on_proLoadButton_clicked(self): |
|
404 | 404 | |
|
405 | 405 | self.console.clear() |
|
406 | 406 | |
|
407 | 407 | # if not self.getSelectedProjectObj(): |
|
408 | 408 | # self.console.append("Please select a project before load files") |
|
409 | 409 | # return |
|
410 | 410 | |
|
411 | 411 | parameter_list = self.checkInputsProject() |
|
412 | 412 | |
|
413 | 413 | if not parameter_list[0]: |
|
414 | 414 | return |
|
415 | 415 | |
|
416 | 416 | parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set, expLabel = parameter_list |
|
417 | 417 | |
|
418 | 418 | if read_mode == "Offline": |
|
419 | 419 | self.proComStartDate.clear() |
|
420 | 420 | self.proComEndDate.clear() |
|
421 | 421 | self.proComStartDate.setEnabled(True) |
|
422 | 422 | self.proComEndDate.setEnabled(True) |
|
423 | 423 | self.proStartTime.setEnabled(True) |
|
424 | 424 | self.proEndTime.setEnabled(True) |
|
425 | 425 | self.frame_2.setEnabled(True) |
|
426 | 426 | |
|
427 | 427 | if read_mode == "Online": |
|
428 | 428 | self.proComStartDate.addItem("1960/01/30") |
|
429 | 429 | self.proComEndDate.addItem("2018/12/31") |
|
430 | 430 | self.proComStartDate.setEnabled(False) |
|
431 | 431 | self.proComEndDate.setEnabled(False) |
|
432 | 432 | self.proStartTime.setEnabled(False) |
|
433 | 433 | self.proEndTime.setEnabled(False) |
|
434 | 434 | self.frame_2.setEnabled(True) |
|
435 | 435 | |
|
436 | 436 | self.loadDays(data_path, ext, walk, expLabel) |
|
437 | 437 | |
|
438 | 438 | @pyqtSignature("int") |
|
439 | 439 | def on_proComStartDate_activated(self, index): |
|
440 | 440 | """ |
|
441 | 441 | SELECCION DEL RANGO DE FECHAS -START DATE |
|
442 | 442 | """ |
|
443 | 443 | stopIndex = self.proComEndDate.count() - self.proComEndDate.currentIndex() - 1 |
|
444 | 444 | |
|
445 | 445 | self.proComEndDate.clear() |
|
446 | 446 | for i in self.dateList[index:]: |
|
447 | 447 | self.proComEndDate.addItem(i) |
|
448 | 448 | |
|
449 | 449 | if self.proComEndDate.count() - stopIndex - 1 >= 0: |
|
450 | 450 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - stopIndex - 1) |
|
451 | 451 | else: |
|
452 | 452 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - 1) |
|
453 | 453 | |
|
454 | 454 | @pyqtSignature("int") |
|
455 | 455 | def on_proComEndDate_activated(self, index): |
|
456 | 456 | """ |
|
457 | 457 | SELECCION DEL RANGO DE FECHAS-END DATE |
|
458 | 458 | """ |
|
459 | 459 | pass |
|
460 | 460 | |
|
461 | 461 | @pyqtSignature("") |
|
462 | 462 | def on_proOk_clicked(self): |
|
463 | 463 | """ |
|
464 | 464 | AΓ±ade al Obj XML de Projecto, name,datatype,date,time,readmode,wait,etc, crea el readUnitProcess del archivo xml. |
|
465 | 465 | Prepara la configuraciΓ³n del diΓ‘grama del Arbol del treeView numero 2 |
|
466 | 466 | """ |
|
467 | 467 | |
|
468 | 468 | self.actionStart.setEnabled(False) |
|
469 | 469 | self.actionStarToolbar.setEnabled(False) |
|
470 | 470 | |
|
471 | 471 | self.console.clear() |
|
472 | 472 | |
|
473 | 473 | if self.create: |
|
474 | 474 | |
|
475 | 475 | projectId = self.__getNewProjectId() |
|
476 | 476 | |
|
477 | 477 | if not projectId: |
|
478 | 478 | return 0 |
|
479 | 479 | |
|
480 | 480 | projectObjView = self.createProjectView(projectId) |
|
481 | 481 | |
|
482 | 482 | if not projectObjView: |
|
483 | 483 | return 0 |
|
484 | 484 | |
|
485 | 485 | self.create = False |
|
486 | 486 | |
|
487 | 487 | readUnitObj = self.createReadUnitView(projectObjView) |
|
488 | 488 | |
|
489 | 489 | if not readUnitObj: |
|
490 | 490 | return 0 |
|
491 | 491 | |
|
492 | 492 | else: |
|
493 | 493 | projectObjView = self.updateProjectView() |
|
494 | 494 | |
|
495 | 495 | if not projectObjView: |
|
496 | 496 | return 0 |
|
497 | 497 | |
|
498 | 498 | projectId = projectObjView.getId() |
|
499 | 499 | idReadUnit = projectObjView.getReadUnitId() |
|
500 | 500 | readUnitObj = self.updateReadUnitView(projectObjView, idReadUnit) |
|
501 | 501 | |
|
502 | 502 | if not readUnitObj: |
|
503 | 503 | return 0 |
|
504 | 504 | |
|
505 | 505 | self.__itemTreeDict[projectId].setText(projectObjView.name) |
|
506 | 506 | # Project Properties |
|
507 | 507 | self.refreshProjectProperties(projectObjView) |
|
508 | 508 | # Disable tabProject after finish the creation |
|
509 | 509 | |
|
510 | 510 | self.actionStart.setEnabled(True) |
|
511 | 511 | self.actionStarToolbar.setEnabled(True) |
|
512 | 512 | self.console.clear() |
|
513 | 513 | self.console.append("The project parameters were validated") |
|
514 | 514 | |
|
515 | 515 | return 1 |
|
516 | 516 | |
|
517 | 517 | @pyqtSignature("") |
|
518 | 518 | def on_proClear_clicked(self): |
|
519 | 519 | |
|
520 | 520 | self.console.clear() |
|
521 | 521 | |
|
522 | 522 | @pyqtSignature("int") |
|
523 | 523 | def on_volOpCebChannels_stateChanged(self, p0): |
|
524 | 524 | """ |
|
525 | 525 | Check Box habilita operaciones de SelecciοΏ½n de Canales |
|
526 | 526 | """ |
|
527 | 527 | if p0 == 2: |
|
528 | 528 | self.volOpComChannels.setEnabled(True) |
|
529 | 529 | self.volOpChannel.setEnabled(True) |
|
530 | 530 | |
|
531 | 531 | if p0 == 0: |
|
532 | 532 | self.volOpComChannels.setEnabled(False) |
|
533 | 533 | self.volOpChannel.setEnabled(False) |
|
534 | 534 | self.volOpChannel.clear() |
|
535 | 535 | |
|
536 | 536 | @pyqtSignature("int") |
|
537 | 537 | def on_volOpCebHeights_stateChanged(self, p0): |
|
538 | 538 | """ |
|
539 | 539 | Check Box habilita operaciones de SelecciοΏ½n de Alturas |
|
540 | 540 | """ |
|
541 | 541 | if p0 == 2: |
|
542 | 542 | self.volOpHeights.setEnabled(True) |
|
543 | 543 | self.volOpComHeights.setEnabled(True) |
|
544 | 544 | |
|
545 | 545 | if p0 == 0: |
|
546 | 546 | self.volOpHeights.setEnabled(False) |
|
547 | 547 | self.volOpHeights.clear() |
|
548 | 548 | self.volOpComHeights.setEnabled(False) |
|
549 | 549 | |
|
550 | 550 | @pyqtSignature("int") |
|
551 | 551 | def on_volOpCebFilter_stateChanged(self, p0): |
|
552 | 552 | """ |
|
553 | 553 | Name='Decoder', optype='other' |
|
554 | 554 | """ |
|
555 | 555 | if p0 == 2: |
|
556 | 556 | self.volOpFilter.setEnabled(True) |
|
557 | 557 | |
|
558 | 558 | if p0 == 0: |
|
559 | 559 | self.volOpFilter.setEnabled(False) |
|
560 | 560 | self.volOpFilter.clear() |
|
561 | 561 | |
|
562 | 562 | @pyqtSignature("int") |
|
563 | 563 | def on_volOpCebProfile_stateChanged(self, p0): |
|
564 | 564 | """ |
|
565 | 565 | Check Box habilita ingreso del rango de Perfiles |
|
566 | 566 | """ |
|
567 | 567 | if p0 == 2: |
|
568 | 568 | self.volOpComProfile.setEnabled(True) |
|
569 | 569 | self.volOpProfile.setEnabled(True) |
|
570 | 570 | |
|
571 | 571 | if p0 == 0: |
|
572 | 572 | self.volOpComProfile.setEnabled(False) |
|
573 | 573 | self.volOpProfile.setEnabled(False) |
|
574 | 574 | self.volOpProfile.clear() |
|
575 | 575 | |
|
576 | 576 | @pyqtSignature("int") |
|
577 | 577 | def on_volOpComProfile_activated(self, index): |
|
578 | 578 | """ |
|
579 | 579 | Check Box habilita ingreso del rango de Perfiles |
|
580 | 580 | """ |
|
581 | 581 | #Profile List |
|
582 | 582 | if index == 0: |
|
583 | 583 | self.volOpProfile.setToolTip('List of selected profiles. Example: 0, 1, 2, 3, 4, 5, 6, 7') |
|
584 | 584 | |
|
585 | 585 | #Profile Range |
|
586 | 586 | if index == 1: |
|
587 | 587 | self.volOpProfile.setToolTip('Minimum and maximum profile index. Example: 0, 7') |
|
588 | 588 | |
|
589 | 589 | #Profile Range List |
|
590 | 590 | if index == 2: |
|
591 | 591 | self.volOpProfile.setToolTip('List of profile ranges. Example: (0, 7), (12, 19), (100, 200)') |
|
592 | 592 | |
|
593 | 593 | @pyqtSignature("int") |
|
594 | 594 | def on_volOpCebDecodification_stateChanged(self, p0): |
|
595 | 595 | """ |
|
596 | 596 | Check Box habilita |
|
597 | 597 | """ |
|
598 | 598 | if p0 == 2: |
|
599 | 599 | self.volOpComCode.setEnabled(True) |
|
600 | 600 | self.volOpComMode.setEnabled(True) |
|
601 | 601 | if p0 == 0: |
|
602 | 602 | self.volOpComCode.setEnabled(False) |
|
603 | 603 | self.volOpComMode.setEnabled(False) |
|
604 | 604 | |
|
605 | 605 | @pyqtSignature("int") |
|
606 | 606 | def on_volOpComCode_activated(self, index): |
|
607 | 607 | """ |
|
608 | 608 | Check Box habilita ingreso |
|
609 | 609 | """ |
|
610 | 610 | if index == 13: |
|
611 | 611 | self.volOpCode.setEnabled(True) |
|
612 | 612 | else: |
|
613 | 613 | self.volOpCode.setEnabled(False) |
|
614 | 614 | |
|
615 | 615 | if index == 0: |
|
616 | 616 | code = '' |
|
617 | 617 | self.volOpCode.setText(str(code)) |
|
618 | 618 | return |
|
619 | 619 | |
|
620 | 620 | if index == 1: |
|
621 | 621 | code = '(1,1,-1)' |
|
622 | 622 | nCode = '1' |
|
623 | 623 | nBaud = '3' |
|
624 | 624 | if index == 2: |
|
625 | 625 | code = '(1,1,-1,1)' |
|
626 | 626 | nCode = '1' |
|
627 | 627 | nBaud = '4' |
|
628 | 628 | if index == 3: |
|
629 | 629 | code = '(1,1,1,-1,1)' |
|
630 | 630 | nCode = '1' |
|
631 | 631 | nBaud = '5' |
|
632 | 632 | if index == 4: |
|
633 | 633 | code = '(1,1,1,-1,-1,1,-1)' |
|
634 | 634 | nCode = '1' |
|
635 | 635 | nBaud = '7' |
|
636 | 636 | if index == 5: |
|
637 | 637 | code = '(1,1,1,-1,-1,-1,1,-1,-1,1,-1)' |
|
638 | 638 | nCode = '1' |
|
639 | 639 | nBaud = '11' |
|
640 | 640 | if index == 6: |
|
641 | 641 | code = '(1,1,1,1,1,-1,-1,1,1,-1,1,-1,1)' |
|
642 | 642 | nCode = '1' |
|
643 | 643 | nBaud = '13' |
|
644 | 644 | if index == 7: |
|
645 | 645 | code = '(1,1,-1,-1,-1,1)' |
|
646 | 646 | nCode = '2' |
|
647 | 647 | nBaud = '3' |
|
648 | 648 | if index == 8: |
|
649 | 649 | code = '(1,1,-1,1,-1,-1,1,-1)' |
|
650 | 650 | nCode = '2' |
|
651 | 651 | nBaud = '4' |
|
652 | 652 | if index == 9: |
|
653 | 653 | code = '(1,1,1,-1,1,-1,-1,-1,1,-1)' |
|
654 | 654 | nCode = '2' |
|
655 | 655 | nBaud = '5' |
|
656 | 656 | if index == 10: |
|
657 | 657 | code = '(1,1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1)' |
|
658 | 658 | nCode = '2' |
|
659 | 659 | nBaud = '7' |
|
660 | 660 | if index == 11: |
|
661 | 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 | 662 | nCode = '2' |
|
663 | 663 | nBaud = '11' |
|
664 | 664 | if index == 12: |
|
665 | 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 | 666 | nCode = '2' |
|
667 | 667 | nBaud = '13' |
|
668 | 668 | |
|
669 | 669 | code = ast.literal_eval(code) |
|
670 | 670 | nCode = int(nCode) |
|
671 | 671 | nBaud = int(nBaud) |
|
672 | 672 | |
|
673 | 673 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() |
|
674 | 674 | |
|
675 | 675 | self.volOpCode.setText(str(code)) |
|
676 | 676 | |
|
677 | 677 | @pyqtSignature("int") |
|
678 | 678 | def on_volOpCebFlip_stateChanged(self, p0): |
|
679 | 679 | """ |
|
680 | 680 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
681 | 681 | """ |
|
682 | 682 | if p0 == 2: |
|
683 | 683 | self.volOpFlip.setEnabled(True) |
|
684 | 684 | if p0 == 0: |
|
685 | 685 | self.volOpFlip.setEnabled(False) |
|
686 | 686 | self.volOpFlip.clear() |
|
687 | 687 | |
|
688 | 688 | @pyqtSignature("int") |
|
689 | 689 | def on_volOpCebCohInt_stateChanged(self, p0): |
|
690 | 690 | """ |
|
691 | 691 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
692 | 692 | """ |
|
693 | 693 | if p0 == 2: |
|
694 | 694 | self.volOpCohInt.setEnabled(True) |
|
695 | 695 | if p0 == 0: |
|
696 | 696 | self.volOpCohInt.setEnabled(False) |
|
697 | 697 | self.volOpCohInt.clear() |
|
698 | 698 | |
|
699 | 699 | @pyqtSignature("int") |
|
700 | 700 | def on_volOpCebRadarfrequency_stateChanged(self, p0): |
|
701 | 701 | """ |
|
702 | 702 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
703 | 703 | """ |
|
704 | 704 | if p0 == 2: |
|
705 | 705 | self.volOpRadarfrequency.setEnabled(True) |
|
706 | 706 | if p0 == 0: |
|
707 | 707 | self.volOpRadarfrequency.clear() |
|
708 | 708 | self.volOpRadarfrequency.setEnabled(False) |
|
709 | 709 | |
|
710 | 710 | @pyqtSignature("") |
|
711 | 711 | def on_volOutputToolPath_clicked(self): |
|
712 | 712 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
713 | 713 | self.volOutputPath.setText(dirOutPath) |
|
714 | 714 | |
|
715 | 715 | @pyqtSignature("") |
|
716 | 716 | def on_specOutputToolPath_clicked(self): |
|
717 | 717 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
718 | 718 | self.specOutputPath.setText(dirOutPath) |
|
719 | 719 | |
|
720 | 720 | @pyqtSignature("") |
|
721 | 721 | def on_specHeisOutputToolPath_clicked(self): |
|
722 | 722 | dirOutPath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
723 | 723 | self.specHeisOutputPath.setText(dirOutPath) |
|
724 | 724 | |
|
725 | 725 | @pyqtSignature("") |
|
726 | 726 | def on_specHeisOutputMetadaToolPath_clicked(self): |
|
727 | 727 | |
|
728 | 728 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) |
|
729 | 729 | self.specHeisOutputMetada.setText(filename) |
|
730 | 730 | |
|
731 | 731 | @pyqtSignature("") |
|
732 | 732 | def on_volOpOk_clicked(self): |
|
733 | 733 | """ |
|
734 | 734 | BUSCA EN LA LISTA DE OPERACIONES DEL TIPO VOLTAJE Y LES AοΏ½ADE EL PARAMETRO ADECUADO ESPERANDO LA ACEPTACION DEL USUARIO |
|
735 | 735 | PARA AGREGARLO AL ARCHIVO DE CONFIGURACION XML |
|
736 | 736 | """ |
|
737 | 737 | |
|
738 | 738 | checkPath = False |
|
739 | 739 | |
|
740 | 740 | self.actionSaveToolbar.setEnabled(False) |
|
741 | 741 | self.actionStarToolbar.setEnabled(False) |
|
742 | 742 | |
|
743 | 743 | self.console.clear() |
|
744 | 744 | self.console.append("Checking input parameters ...") |
|
745 | 745 | |
|
746 | 746 | puObj = self.getSelectedItemObj() |
|
747 | 747 | puObj.removeOperations() |
|
748 | 748 | |
|
749 | 749 | if self.volOpCebRadarfrequency.isChecked(): |
|
750 | 750 | value = str(self.volOpRadarfrequency.text()) |
|
751 | 751 | format = 'float' |
|
752 | 752 | name_operation = 'setRadarFrequency' |
|
753 | 753 | name_parameter = 'frequency' |
|
754 | 754 | if not value == "": |
|
755 | 755 | try: |
|
756 | 756 | radarfreq = float(self.volOpRadarfrequency.text())*1e6 |
|
757 | 757 | except: |
|
758 | 758 | self.console.clear() |
|
759 | 759 | self.console.append("Invalid value '%s' for Radar Frequency" %value) |
|
760 | 760 | return 0 |
|
761 | 761 | |
|
762 | 762 | opObj = puObj.addOperation(name=name_operation) |
|
763 | 763 | if not opObj.addParameter(name=name_parameter, value=radarfreq, format=format): |
|
764 | 764 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) |
|
765 | 765 | return 0 |
|
766 | 766 | |
|
767 | 767 | if self.volOpCebChannels.isChecked(): |
|
768 | 768 | value = str(self.volOpChannel.text()) |
|
769 | 769 | |
|
770 | 770 | if value == "": |
|
771 | 771 | print "Please fill channel list" |
|
772 | 772 | return 0 |
|
773 | 773 | |
|
774 | 774 | format = 'intlist' |
|
775 | 775 | if self.volOpComChannels.currentIndex() == 0: |
|
776 | 776 | name_operation = "selectChannels" |
|
777 | 777 | name_parameter = 'channelList' |
|
778 | 778 | else: |
|
779 | 779 | name_operation = "selectChannelsByIndex" |
|
780 | 780 | name_parameter = 'channelIndexList' |
|
781 | 781 | |
|
782 | 782 | opObj = puObj.addOperation(name=name_operation) |
|
783 | 783 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
784 | 784 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) |
|
785 | 785 | return 0 |
|
786 | 786 | |
|
787 | 787 | if self.volOpCebHeights.isChecked(): |
|
788 | 788 | value = str(self.volOpHeights.text()) |
|
789 | 789 | |
|
790 | 790 | if value == "": |
|
791 | 791 | print "Please fill height range" |
|
792 | 792 | return 0 |
|
793 | 793 | |
|
794 | 794 | valueList = value.split(',') |
|
795 | 795 | format = 'float' |
|
796 | 796 | if self.volOpComHeights.currentIndex() == 0: |
|
797 | 797 | name_operation = 'selectHeights' |
|
798 | 798 | name_parameter1 = 'minHei' |
|
799 | 799 | name_parameter2 = 'maxHei' |
|
800 | 800 | else: |
|
801 | 801 | name_operation = 'selectHeightsByIndex' |
|
802 | 802 | name_parameter1 = 'minIndex' |
|
803 | 803 | name_parameter2 = 'maxIndex' |
|
804 | 804 | |
|
805 | 805 | opObj = puObj.addOperation(name=name_operation) |
|
806 | 806 | opObj.addParameter(name=name_parameter1, value=valueList[0], format=format) |
|
807 | 807 | opObj.addParameter(name=name_parameter2, value=valueList[1], format=format) |
|
808 | 808 | |
|
809 | 809 | if self.volOpCebFilter.isChecked(): |
|
810 | 810 | value = str(self.volOpFilter.text()) |
|
811 | 811 | if value == "": |
|
812 | 812 | print "Please fill filter value" |
|
813 | 813 | return 0 |
|
814 | 814 | |
|
815 | 815 | format = 'int' |
|
816 | 816 | name_operation = 'filterByHeights' |
|
817 | 817 | name_parameter = 'window' |
|
818 | 818 | opObj = puObj.addOperation(name=name_operation) |
|
819 | 819 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
820 | 820 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) |
|
821 | 821 | return 0 |
|
822 | 822 | |
|
823 | 823 | if self.volOpCebProfile.isChecked(): |
|
824 | 824 | value = str(self.volOpProfile.text()) |
|
825 | 825 | |
|
826 | 826 | if value == "": |
|
827 | 827 | print "Please fill profile value" |
|
828 | 828 | return 0 |
|
829 | 829 | |
|
830 | 830 | format = 'intlist' |
|
831 | 831 | optype = 'other' |
|
832 | 832 | name_operation = 'ProfileSelector' |
|
833 | 833 | if self.volOpComProfile.currentIndex() == 0: |
|
834 | 834 | name_parameter = 'profileList' |
|
835 | 835 | if self.volOpComProfile.currentIndex() == 1: |
|
836 | 836 | name_parameter = 'profileRangeList' |
|
837 | 837 | if self.volOpComProfile.currentIndex() == 2: |
|
838 | 838 | name_parameter = 'rangeList' |
|
839 | 839 | |
|
840 | 840 | opObj = puObj.addOperation(name='ProfileSelector', optype='other') |
|
841 | 841 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
842 | 842 | self.console.append("Invalid value '%s' for %s" %(value,name_parameter)) |
|
843 | 843 | return 0 |
|
844 | 844 | |
|
845 | 845 | if self.volOpCebDecodification.isChecked(): |
|
846 | 846 | name_operation = 'Decoder' |
|
847 | 847 | opObj = puObj.addOperation(name=name_operation, optype='other') |
|
848 | 848 | |
|
849 | 849 | #User defined |
|
850 | 850 | nBaud = None |
|
851 | 851 | nCode = None |
|
852 | 852 | |
|
853 | 853 | code = str(self.volOpCode.text()) |
|
854 | 854 | try: |
|
855 | 855 | code_tmp = ast.literal_eval(code) |
|
856 | 856 | except: |
|
857 | 857 | code_tmp = [] |
|
858 | 858 | |
|
859 | 859 | if len(code_tmp) > 0: |
|
860 | 860 | |
|
861 | 861 | if type(code_tmp) not in (tuple, list): |
|
862 | 862 | self.console.append("Please write a right value for Code (Exmaple: [1,1,-1], [1,-1,1])") |
|
863 | 863 | return 0 |
|
864 | 864 | |
|
865 | 865 | if len(code_tmp) > 1 and type(code_tmp[0]) in (tuple, list): #[ [1,-1,1], [1,1,-1] ] |
|
866 | 866 | nBaud = len(code_tmp[0]) |
|
867 | 867 | nCode = len(code_tmp) |
|
868 | 868 | elif len(code_tmp) == 1 and type(code_tmp[0]) in (tuple, list): #[ [1,-1,1] ] |
|
869 | 869 | nBaud = len(code_tmp[0]) |
|
870 | 870 | nCode = 1 |
|
871 | 871 | elif type(code_tmp[0]) in (int, float): #[1,-1,1] or (1,-1,1) |
|
872 | 872 | nBaud = len(code_tmp) |
|
873 | 873 | nCode = 1 |
|
874 | 874 | else: |
|
875 | 875 | self.console.append("Please write a right value for Code (Exmaple: [1,1,-1], [1,-1,1])") |
|
876 | 876 | return 0 |
|
877 | 877 | |
|
878 | 878 | if not nBaud or not nCode: |
|
879 | 879 | self.console.append("Please write a right value for Code") |
|
880 | 880 | return 0 |
|
881 | 881 | |
|
882 | 882 | code = code.replace("(", "") |
|
883 | 883 | code = code.replace(")", "") |
|
884 | 884 | code = code.replace("[", "") |
|
885 | 885 | code = code.replace("]", "") |
|
886 | 886 | |
|
887 | 887 | if not opObj.addParameter(name='code', value=code, format='intlist'): |
|
888 | 888 | self.console.append("Please write a right value for Code") |
|
889 | 889 | return 0 |
|
890 | 890 | if not opObj.addParameter(name='nCode', value=nCode, format='int'): |
|
891 | 891 | self.console.append("Please write a right value for Code") |
|
892 | 892 | return 0 |
|
893 | 893 | if not opObj.addParameter(name='nBaud', value=nBaud, format='int'): |
|
894 | 894 | self.console.append("Please write a right value for Code") |
|
895 | 895 | return 0 |
|
896 | 896 | |
|
897 | 897 | name_parameter = 'mode' |
|
898 | 898 | format = 'int' |
|
899 | 899 | |
|
900 | 900 | value = str(self.volOpComMode.currentIndex()) |
|
901 | 901 | |
|
902 | 902 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
903 | 903 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) |
|
904 | 904 | return 0 |
|
905 | 905 | |
|
906 | 906 | |
|
907 | 907 | if self.volOpCebFlip.isChecked(): |
|
908 | 908 | name_operation = 'deFlip' |
|
909 | 909 | optype = 'self' |
|
910 | 910 | |
|
911 | 911 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
912 | 912 | |
|
913 | 913 | name_parameter = 'channelList' |
|
914 | 914 | format = 'intlist' |
|
915 | 915 | value = str(self.volOpFlip.text()) |
|
916 | 916 | |
|
917 | 917 | if value != "": |
|
918 | 918 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
919 | 919 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) |
|
920 | 920 | return 0 |
|
921 | 921 | |
|
922 | 922 | if self.volOpCebCohInt.isChecked(): |
|
923 | 923 | name_operation = 'CohInt' |
|
924 | 924 | optype = 'other' |
|
925 | 925 | value = str(self.volOpCohInt.text()) |
|
926 | 926 | |
|
927 | 927 | if value == "": |
|
928 | 928 | print "Please fill number of coherent integrations" |
|
929 | 929 | return 0 |
|
930 | 930 | |
|
931 | 931 | name_parameter = 'n' |
|
932 | 932 | format = 'float' |
|
933 | 933 | |
|
934 | 934 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
935 | 935 | |
|
936 | 936 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
937 | 937 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) |
|
938 | 938 | return 0 |
|
939 | 939 | |
|
940 | 940 | if self.volGraphCebshow.isChecked(): |
|
941 | 941 | name_operation = 'Scope' |
|
942 | 942 | optype = 'other' |
|
943 | 943 | name_parameter = 'type' |
|
944 | 944 | value = 'Scope' |
|
945 | 945 | if self.idImagscope == 0: |
|
946 | 946 | self.idImagscope = 100 |
|
947 | 947 | else: |
|
948 | 948 | self.idImagscope = self.idImagscope + 1 |
|
949 | 949 | |
|
950 | 950 | name_parameter1 = 'id' |
|
951 | 951 | value1 = int(self.idImagscope) |
|
952 | 952 | format1 = 'int' |
|
953 | 953 | format = 'str' |
|
954 | 954 | |
|
955 | 955 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
956 | 956 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
957 | 957 | opObj.addParameter(name=name_parameter1, value=opObj.id, format=format1) |
|
958 | 958 | |
|
959 | 959 | channelList = str(self.volGraphChannelList.text()).replace(" ","") |
|
960 | 960 | xvalue = str(self.volGraphfreqrange.text()).replace(" ","") |
|
961 | 961 | yvalue = str(self.volGraphHeightrange.text()).replace(" ","") |
|
962 | 962 | |
|
963 | 963 | if channelList: |
|
964 | 964 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
965 | 965 | |
|
966 | 966 | if xvalue: |
|
967 | 967 | xvalueList = xvalue.split(',') |
|
968 | 968 | try: |
|
969 | 969 | value0 = float(xvalueList[0]) |
|
970 | 970 | value1 = float(xvalueList[1]) |
|
971 | 971 | except: |
|
972 | 972 | return 0 |
|
973 | 973 | opObj.addParameter(name='xmin', value=value0, format='float') |
|
974 | 974 | opObj.addParameter(name='xmax', value=value1, format='float') |
|
975 | 975 | |
|
976 | 976 | |
|
977 | 977 | if not yvalue == "": |
|
978 | 978 | yvalueList = yvalue.split(",") |
|
979 | 979 | try: |
|
980 | 980 | value0 = int(yvalueList[0]) |
|
981 | 981 | value1 = int(yvalueList[1]) |
|
982 | 982 | except: |
|
983 | 983 | return 0 |
|
984 | 984 | |
|
985 | 985 | opObj.addParameter(name='ymin', value=value0, format='int') |
|
986 | 986 | opObj.addParameter(name='ymax', value=value1, format='int') |
|
987 | 987 | |
|
988 | 988 | if self.volGraphCebSave.isChecked(): |
|
989 | 989 | checkPath = True |
|
990 | 990 | opObj.addParameter(name='save', value='1', format='int') |
|
991 | 991 | opObj.addParameter(name='figpath', value=str(self.volGraphPath.text()), format='str') |
|
992 | 992 | value = str(self.volGraphPrefix.text()).replace(" ","") |
|
993 | 993 | if value: |
|
994 | 994 | opObj.addParameter(name='figfile', value=value, format='str') |
|
995 | 995 | |
|
996 | 996 | localfolder = None |
|
997 | 997 | if checkPath: |
|
998 | 998 | localfolder = str(self.volGraphPath.text()) |
|
999 | 999 | if localfolder == '': |
|
1000 | 1000 | self.console.clear() |
|
1001 | 1001 | self.console.append("Graphic path should be defined") |
|
1002 | 1002 | return 0 |
|
1003 | 1003 | |
|
1004 | 1004 | # if something happend |
|
1005 | 1005 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Voltage') |
|
1006 | 1006 | if parms_ok: |
|
1007 | 1007 | name_operation = 'VoltageWriter' |
|
1008 | 1008 | optype = 'other' |
|
1009 | 1009 | name_parameter1 = 'path' |
|
1010 | 1010 | name_parameter2 = 'blocksPerFile' |
|
1011 | 1011 | name_parameter3 = 'profilesPerBlock' |
|
1012 | 1012 | value1 = output_path |
|
1013 | 1013 | value2 = blocksperfile |
|
1014 | 1014 | value3 = profilesperblock |
|
1015 | 1015 | format = "int" |
|
1016 | 1016 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1017 | 1017 | opObj.addParameter(name=name_parameter1, value=value1) |
|
1018 | 1018 | opObj.addParameter(name=name_parameter2, value=value2, format=format) |
|
1019 | 1019 | opObj.addParameter(name=name_parameter3, value=value3, format=format) |
|
1020 | 1020 | |
|
1021 | 1021 | self.console.clear() |
|
1022 | 1022 | try: |
|
1023 | 1023 | self.refreshPUProperties(puObj) |
|
1024 | 1024 | except: |
|
1025 | 1025 | self.console.append("An error reading input parameters was found ...Check them!") |
|
1026 | 1026 | return 0 |
|
1027 | 1027 | |
|
1028 | 1028 | self.console.append("Save your project and press Play button to start signal processing") |
|
1029 | 1029 | |
|
1030 | 1030 | self.actionSaveToolbar.setEnabled(True) |
|
1031 | 1031 | self.actionStarToolbar.setEnabled(True) |
|
1032 | 1032 | |
|
1033 | 1033 | return 1 |
|
1034 | 1034 | |
|
1035 | 1035 | """ |
|
1036 | 1036 | Voltage Graph |
|
1037 | 1037 | """ |
|
1038 | 1038 | @pyqtSignature("int") |
|
1039 | 1039 | def on_volGraphCebSave_stateChanged(self, p0): |
|
1040 | 1040 | """ |
|
1041 | 1041 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
1042 | 1042 | """ |
|
1043 | 1043 | if p0 == 2: |
|
1044 | 1044 | self.volGraphPath.setEnabled(True) |
|
1045 | 1045 | self.volGraphPrefix.setEnabled(True) |
|
1046 | 1046 | self.volGraphToolPath.setEnabled(True) |
|
1047 | 1047 | |
|
1048 | 1048 | if p0 == 0: |
|
1049 | 1049 | self.volGraphPath.setEnabled(False) |
|
1050 | 1050 | self.volGraphPrefix.setEnabled(False) |
|
1051 | 1051 | self.volGraphToolPath.setEnabled(False) |
|
1052 | 1052 | |
|
1053 | 1053 | @pyqtSignature("") |
|
1054 | 1054 | def on_volGraphToolPath_clicked(self): |
|
1055 | 1055 | """ |
|
1056 | 1056 | Donde se guardan los DATOS |
|
1057 | 1057 | """ |
|
1058 | 1058 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
1059 | 1059 | self.volGraphPath.setText(save_path) |
|
1060 | 1060 | |
|
1061 | 1061 | if not os.path.exists(save_path): |
|
1062 | 1062 | self.console.clear() |
|
1063 | 1063 | self.console.append("Set a valid path") |
|
1064 | 1064 | self.volGraphOk.setEnabled(False) |
|
1065 | 1065 | return |
|
1066 | 1066 | |
|
1067 | 1067 | @pyqtSignature("int") |
|
1068 | 1068 | def on_volGraphCebshow_stateChanged(self, p0): |
|
1069 | 1069 | """ |
|
1070 | 1070 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
1071 | 1071 | """ |
|
1072 | 1072 | if p0 == 0: |
|
1073 | 1073 | |
|
1074 | 1074 | self.volGraphChannelList.setEnabled(False) |
|
1075 | 1075 | self.volGraphfreqrange.setEnabled(False) |
|
1076 | 1076 | self.volGraphHeightrange.setEnabled(False) |
|
1077 | 1077 | if p0 == 2: |
|
1078 | 1078 | |
|
1079 | 1079 | self.volGraphChannelList.setEnabled(True) |
|
1080 | 1080 | self.volGraphfreqrange.setEnabled(True) |
|
1081 | 1081 | self.volGraphHeightrange.setEnabled(True) |
|
1082 | 1082 | |
|
1083 | 1083 | """ |
|
1084 | 1084 | Spectra operation |
|
1085 | 1085 | """ |
|
1086 | 1086 | @pyqtSignature("int") |
|
1087 | 1087 | def on_specOpCebRadarfrequency_stateChanged(self, p0): |
|
1088 | 1088 | """ |
|
1089 | 1089 | Check Box habilita ingresode del numero de Integraciones a realizar |
|
1090 | 1090 | """ |
|
1091 | 1091 | if p0 == 2: |
|
1092 | 1092 | self.specOpRadarfrequency.setEnabled(True) |
|
1093 | 1093 | if p0 == 0: |
|
1094 | 1094 | self.specOpRadarfrequency.clear() |
|
1095 | 1095 | self.specOpRadarfrequency.setEnabled(False) |
|
1096 | 1096 | |
|
1097 | 1097 | |
|
1098 | 1098 | @pyqtSignature("int") |
|
1099 | 1099 | def on_specOpCebCrossSpectra_stateChanged(self, p0): |
|
1100 | 1100 | """ |
|
1101 | 1101 | Habilita la opcion de aοΏ½adir el parοΏ½metro CrossSpectra a la Unidad de Procesamiento . |
|
1102 | 1102 | """ |
|
1103 | 1103 | if p0 == 2: |
|
1104 | 1104 | # self.specOpnFFTpoints.setEnabled(True) |
|
1105 | 1105 | self.specOppairsList.setEnabled(True) |
|
1106 | 1106 | if p0 == 0: |
|
1107 | 1107 | # self.specOpnFFTpoints.setEnabled(False) |
|
1108 | 1108 | self.specOppairsList.setEnabled(False) |
|
1109 | 1109 | |
|
1110 | 1110 | @pyqtSignature("int") |
|
1111 | 1111 | def on_specOpCebChannel_stateChanged(self, p0): |
|
1112 | 1112 | """ |
|
1113 | 1113 | Habilita la opcion de aοΏ½adir el parοΏ½metro numero de Canales a la Unidad de Procesamiento . |
|
1114 | 1114 | """ |
|
1115 | 1115 | if p0 == 2: |
|
1116 | 1116 | self.specOpChannel.setEnabled(True) |
|
1117 | 1117 | self.specOpComChannel.setEnabled(True) |
|
1118 | 1118 | if p0 == 0: |
|
1119 | 1119 | self.specOpChannel.setEnabled(False) |
|
1120 | 1120 | self.specOpComChannel.setEnabled(False) |
|
1121 | 1121 | |
|
1122 | 1122 | @pyqtSignature("int") |
|
1123 | 1123 | def on_specOpCebHeights_stateChanged(self, p0): |
|
1124 | 1124 | """ |
|
1125 | 1125 | Habilita la opcion de aοΏ½adir el parοΏ½metro de alturas a la Unidad de Procesamiento . |
|
1126 | 1126 | """ |
|
1127 | 1127 | if p0 == 2: |
|
1128 | 1128 | self.specOpComHeights.setEnabled(True) |
|
1129 | 1129 | self.specOpHeights.setEnabled(True) |
|
1130 | 1130 | if p0 == 0: |
|
1131 | 1131 | self.specOpComHeights.setEnabled(False) |
|
1132 | 1132 | self.specOpHeights.setEnabled(False) |
|
1133 | 1133 | |
|
1134 | 1134 | |
|
1135 | 1135 | @pyqtSignature("int") |
|
1136 | 1136 | def on_specOpCebIncoherent_stateChanged(self, p0): |
|
1137 | 1137 | """ |
|
1138 | 1138 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . |
|
1139 | 1139 | """ |
|
1140 | 1140 | if p0 == 2: |
|
1141 | 1141 | self.specOpIncoherent.setEnabled(True) |
|
1142 | 1142 | if p0 == 0: |
|
1143 | 1143 | self.specOpIncoherent.setEnabled(False) |
|
1144 | 1144 | |
|
1145 | 1145 | @pyqtSignature("int") |
|
1146 | 1146 | def on_specOpCebRemoveDC_stateChanged(self, p0): |
|
1147 | 1147 | """ |
|
1148 | 1148 | Habilita la opcion de aοΏ½adir el parοΏ½metro remover DC a la Unidad de Procesamiento . |
|
1149 | 1149 | """ |
|
1150 | 1150 | if p0 == 2: |
|
1151 | 1151 | self.specOpComRemoveDC.setEnabled(True) |
|
1152 | 1152 | if p0 == 0: |
|
1153 | 1153 | self.specOpComRemoveDC.setEnabled(False) |
|
1154 | 1154 | |
|
1155 | 1155 | @pyqtSignature("int") |
|
1156 | 1156 | def on_specOpCebgetNoise_stateChanged(self, p0): |
|
1157 | 1157 | """ |
|
1158 | 1158 | Habilita la opcion de aοΏ½adir la estimacion de ruido a la Unidad de Procesamiento . |
|
1159 | 1159 | """ |
|
1160 | 1160 | if p0 == 2: |
|
1161 | 1161 | self.specOpgetNoise.setEnabled(True) |
|
1162 | 1162 | |
|
1163 | 1163 | if p0 == 0: |
|
1164 | 1164 | self.specOpgetNoise.setEnabled(False) |
|
1165 | 1165 | |
|
1166 | 1166 | @pyqtSignature("") |
|
1167 | 1167 | def on_specOpOk_clicked(self): |
|
1168 | 1168 | """ |
|
1169 | 1169 | AΓADE OPERACION SPECTRA |
|
1170 | 1170 | """ |
|
1171 | 1171 | |
|
1172 | 1172 | addFTP = False |
|
1173 | 1173 | checkPath = False |
|
1174 | 1174 | |
|
1175 | 1175 | self.actionSaveToolbar.setEnabled(False) |
|
1176 | 1176 | self.actionStarToolbar.setEnabled(False) |
|
1177 | 1177 | |
|
1178 | 1178 | self.console.clear() |
|
1179 | 1179 | self.console.append("Checking input parameters ...") |
|
1180 | 1180 | |
|
1181 | 1181 | projectObj = self.getSelectedProjectObj() |
|
1182 | 1182 | |
|
1183 | 1183 | if not projectObj: |
|
1184 | 1184 | self.console.append("Please select a project before update it") |
|
1185 | 1185 | return |
|
1186 | 1186 | |
|
1187 | 1187 | puObj = self.getSelectedItemObj() |
|
1188 | 1188 | |
|
1189 | 1189 | puObj.removeOperations() |
|
1190 | 1190 | |
|
1191 | 1191 | if self.specOpCebRadarfrequency.isChecked(): |
|
1192 | 1192 | value = str(self.specOpRadarfrequency.text()) |
|
1193 | 1193 | format = 'float' |
|
1194 | 1194 | name_operation = 'setRadarFrequency' |
|
1195 | 1195 | name_parameter = 'frequency' |
|
1196 | 1196 | |
|
1197 | 1197 | if not isFloat(value): |
|
1198 | 1198 | self.console.clear() |
|
1199 | 1199 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
1200 | 1200 | return 0 |
|
1201 | 1201 | |
|
1202 | 1202 | radarfreq = float(value)*1e6 |
|
1203 | 1203 | opObj = puObj.addOperation(name=name_operation) |
|
1204 | 1204 | opObj.addParameter(name=name_parameter, value=radarfreq, format=format) |
|
1205 | 1205 | |
|
1206 | 1206 | inputId = puObj.getInputId() |
|
1207 | 1207 | inputPuObj = projectObj.getProcUnitObj(inputId) |
|
1208 | 1208 | |
|
1209 | 1209 | if inputPuObj.datatype == 'Voltage' or inputPuObj.datatype == 'USRP': |
|
1210 | 1210 | |
|
1211 | 1211 | value = str(self.specOpnFFTpoints.text()) |
|
1212 | 1212 | |
|
1213 | 1213 | if not isInt(value): |
|
1214 | 1214 | self.console.append("Invalid value '%s' for '%s'" %(value, 'nFFTPoints')) |
|
1215 | 1215 | return 0 |
|
1216 | 1216 | |
|
1217 | 1217 | puObj.addParameter(name='nFFTPoints', value=value, format='int') |
|
1218 | 1218 | |
|
1219 | 1219 | value = str(self.specOpProfiles.text()) |
|
1220 | 1220 | if not isInt(value): |
|
1221 | 1221 | self.console.append("Please write a value on Profiles field") |
|
1222 | 1222 | else: |
|
1223 | 1223 | puObj.addParameter(name='nProfiles', value=value, format='int') |
|
1224 | 1224 | |
|
1225 | 1225 | value = str(self.specOpippFactor.text()) |
|
1226 | 1226 | if not isInt(value): |
|
1227 | 1227 | self.console.append("Please write a value on IppFactor field") |
|
1228 | 1228 | else: |
|
1229 | 1229 | puObj.addParameter(name='ippFactor' , value=value , format='int') |
|
1230 | 1230 | |
|
1231 | 1231 | if self.specOpCebCrossSpectra.isChecked(): |
|
1232 | 1232 | name_parameter = 'pairsList' |
|
1233 | 1233 | format = 'pairslist' |
|
1234 | 1234 | value = str(self.specOppairsList.text()) |
|
1235 | 1235 | |
|
1236 | 1236 | if value == "": |
|
1237 | 1237 | print "Please fill the pairs list field" |
|
1238 | 1238 | return 0 |
|
1239 | 1239 | |
|
1240 | 1240 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
1241 | 1241 | self.console.append("Invalid value '%s' for '%s'" %(value,name_parameter)) |
|
1242 | 1242 | return 0 |
|
1243 | 1243 | |
|
1244 | 1244 | if self.specOpCebHeights.isChecked(): |
|
1245 | 1245 | value = str(self.specOpHeights.text()) |
|
1246 | 1246 | |
|
1247 | 1247 | if value == "": |
|
1248 | 1248 | self.console.append("Empty value for '%s'" %(value, "Height range")) |
|
1249 | 1249 | return 0 |
|
1250 | 1250 | |
|
1251 | 1251 | valueList = value.split(',') |
|
1252 | 1252 | format = 'float' |
|
1253 | 1253 | value0 = valueList[0] |
|
1254 | 1254 | value1 = valueList[1] |
|
1255 | 1255 | |
|
1256 | 1256 | if not isFloat(value0) or not isFloat(value1): |
|
1257 | 1257 | self.console.append("Invalid value '%s' for '%s'" %(value, "Height range")) |
|
1258 | 1258 | return 0 |
|
1259 | 1259 | |
|
1260 | 1260 | if self.specOpComHeights.currentIndex() == 0: |
|
1261 | 1261 | name_operation = 'selectHeights' |
|
1262 | 1262 | name_parameter1 = 'minHei' |
|
1263 | 1263 | name_parameter2 = 'maxHei' |
|
1264 | 1264 | else: |
|
1265 | 1265 | name_operation = 'selectHeightsByIndex' |
|
1266 | 1266 | name_parameter1 = 'minIndex' |
|
1267 | 1267 | name_parameter2 = 'maxIndex' |
|
1268 | 1268 | |
|
1269 | 1269 | opObj = puObj.addOperation(name=name_operation) |
|
1270 | 1270 | opObj.addParameter(name=name_parameter1, value=value0, format=format) |
|
1271 | 1271 | opObj.addParameter(name=name_parameter2, value=value1, format=format) |
|
1272 | 1272 | |
|
1273 | 1273 | if self.specOpCebChannel.isChecked(): |
|
1274 | 1274 | |
|
1275 | 1275 | if self.specOpComChannel.currentIndex() == 0: |
|
1276 | 1276 | name_operation = "selectChannels" |
|
1277 | 1277 | name_parameter = 'channelList' |
|
1278 | 1278 | else: |
|
1279 | 1279 | name_operation = "selectChannelsByIndex" |
|
1280 | 1280 | name_parameter = 'channelIndexList' |
|
1281 | 1281 | |
|
1282 | 1282 | format = 'intlist' |
|
1283 | 1283 | value = str(self.specOpChannel.text()) |
|
1284 | 1284 | |
|
1285 | 1285 | if value == "": |
|
1286 | 1286 | print "Please fill channel list" |
|
1287 | 1287 | return 0 |
|
1288 | 1288 | |
|
1289 | 1289 | if not isList(value): |
|
1290 | 1290 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
1291 | 1291 | return 0 |
|
1292 | 1292 | |
|
1293 | 1293 | opObj = puObj.addOperation(name=name_operation) |
|
1294 | 1294 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1295 | 1295 | |
|
1296 | 1296 | if self.specOpCebIncoherent.isChecked(): |
|
1297 | 1297 | |
|
1298 | 1298 | name_operation = 'IncohInt' |
|
1299 | 1299 | optype = 'other' |
|
1300 | 1300 | |
|
1301 | 1301 | if self.specOpCobIncInt.currentIndex() == 0: |
|
1302 | 1302 | name_parameter = 'timeInterval' |
|
1303 | 1303 | format = 'float' |
|
1304 | 1304 | else: |
|
1305 | 1305 | name_parameter = 'n' |
|
1306 | 1306 | format = 'float' |
|
1307 | 1307 | |
|
1308 | 1308 | value = str(self.specOpIncoherent.text()) |
|
1309 | 1309 | |
|
1310 | 1310 | if value == "": |
|
1311 | 1311 | print "Please fill Incoherent integration value" |
|
1312 | 1312 | return 0 |
|
1313 | 1313 | |
|
1314 | 1314 | if not isFloat(value): |
|
1315 | 1315 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
1316 | 1316 | return 0 |
|
1317 | 1317 | |
|
1318 | 1318 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
1319 | 1319 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1320 | 1320 | |
|
1321 | 1321 | if self.specOpCebRemoveDC.isChecked(): |
|
1322 | 1322 | name_operation = 'removeDC' |
|
1323 | 1323 | name_parameter = 'mode' |
|
1324 | 1324 | format = 'int' |
|
1325 | 1325 | if self.specOpComRemoveDC.currentIndex() == 0: |
|
1326 | 1326 | value = 1 |
|
1327 | 1327 | else: |
|
1328 | 1328 | value = 2 |
|
1329 | 1329 | opObj = puObj.addOperation(name=name_operation) |
|
1330 | 1330 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1331 | 1331 | |
|
1332 | 1332 | if self.specOpCebRemoveInt.isChecked(): |
|
1333 | 1333 | name_operation = 'removeInterference' |
|
1334 | 1334 | opObj = puObj.addOperation(name=name_operation) |
|
1335 | 1335 | |
|
1336 | 1336 | |
|
1337 | 1337 | if self.specOpCebgetNoise.isChecked(): |
|
1338 | 1338 | value = str(self.specOpgetNoise.text()) |
|
1339 | 1339 | valueList = value.split(',') |
|
1340 | 1340 | format = 'float' |
|
1341 | 1341 | name_operation = "getNoise" |
|
1342 | 1342 | opObj = puObj.addOperation(name=name_operation) |
|
1343 | 1343 | |
|
1344 | 1344 | if not value == '': |
|
1345 | 1345 | valueList = value.split(',') |
|
1346 | 1346 | length = len(valueList) |
|
1347 | 1347 | if length == 1: |
|
1348 | 1348 | try: |
|
1349 | 1349 | value1 = float(valueList[0]) |
|
1350 | 1350 | except: |
|
1351 | 1351 | self.console.clear() |
|
1352 | 1352 | self.console.append("Please Write correct parameter Get Noise") |
|
1353 | 1353 | return 0 |
|
1354 | 1354 | name1 = 'minHei' |
|
1355 | 1355 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1356 | 1356 | elif length == 2: |
|
1357 | 1357 | try: |
|
1358 | 1358 | value1 = float(valueList[0]) |
|
1359 | 1359 | value2 = float(valueList[1]) |
|
1360 | 1360 | except: |
|
1361 | 1361 | self.console.clear() |
|
1362 | 1362 | self.console.append("Please Write corrects parameter Get Noise") |
|
1363 | 1363 | return 0 |
|
1364 | 1364 | name1 = 'minHei' |
|
1365 | 1365 | name2 = 'maxHei' |
|
1366 | 1366 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1367 | 1367 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1368 | 1368 | |
|
1369 | 1369 | elif length == 3: |
|
1370 | 1370 | try: |
|
1371 | 1371 | value1 = float(valueList[0]) |
|
1372 | 1372 | value2 = float(valueList[1]) |
|
1373 | 1373 | value3 = float(valueList[2]) |
|
1374 | 1374 | except: |
|
1375 | 1375 | self.console.clear() |
|
1376 | 1376 | self.console.append("Please Write corrects parameter Get Noise") |
|
1377 | 1377 | return 0 |
|
1378 | 1378 | name1 = 'minHei' |
|
1379 | 1379 | name2 = 'maxHei' |
|
1380 | 1380 | name3 = 'minVel' |
|
1381 | 1381 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1382 | 1382 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1383 | 1383 | opObj.addParameter(name=name3, value=value3, format=format) |
|
1384 | 1384 | |
|
1385 | 1385 | elif length == 4: |
|
1386 | 1386 | try: |
|
1387 | 1387 | value1 = float(valueList[0]) |
|
1388 | 1388 | value2 = float(valueList[1]) |
|
1389 | 1389 | value3 = float(valueList[2]) |
|
1390 | 1390 | value4 = float(valueList[3]) |
|
1391 | 1391 | except: |
|
1392 | 1392 | self.console.clear() |
|
1393 | 1393 | self.console.append("Please Write corrects parameter Get Noise") |
|
1394 | 1394 | return 0 |
|
1395 | 1395 | name1 = 'minHei' |
|
1396 | 1396 | name2 = 'maxHei' |
|
1397 | 1397 | name3 = 'minVel' |
|
1398 | 1398 | name4 = 'maxVel' |
|
1399 | 1399 | opObj.addParameter(name=name1, value=value1, format=format) |
|
1400 | 1400 | opObj.addParameter(name=name2, value=value2, format=format) |
|
1401 | 1401 | opObj.addParameter(name=name3, value=value3, format=format) |
|
1402 | 1402 | opObj.addParameter(name=name4, value=value4, format=format) |
|
1403 | 1403 | |
|
1404 | 1404 | elif length > 4: |
|
1405 | 1405 | self.console.clear() |
|
1406 | 1406 | self.console.append("Get Noise Operation only accepts 4 parameters") |
|
1407 | 1407 | return 0 |
|
1408 | 1408 | |
|
1409 | 1409 | channelList = str(self.specGgraphChannelList.text()).replace(" ","") |
|
1410 | 1410 | vel_range = str(self.specGgraphFreq.text()).replace(" ","") |
|
1411 | 1411 | hei_range = str(self.specGgraphHeight.text()).replace(" ","") |
|
1412 | 1412 | db_range = str(self.specGgraphDbsrange.text()).replace(" ","") |
|
1413 | 1413 | |
|
1414 | 1414 | trange = str(self.specGgraphTminTmax.text()).replace(" ","") |
|
1415 | 1415 | magrange = str(self.specGgraphmagnitud.text()).replace(" ","") |
|
1416 | 1416 | phaserange = str(self.specGgraphPhase.text()).replace(" ","") |
|
1417 | 1417 | # timerange = str(self.specGgraphTimeRange.text()).replace(" ","") |
|
1418 | 1418 | |
|
1419 | 1419 | figpath = str(self.specGraphPath.text()) |
|
1420 | 1420 | figfile = str(self.specGraphPrefix.text()).replace(" ","") |
|
1421 | 1421 | try: |
|
1422 | 1422 | wrperiod = int(str(self.specGgraphftpratio.text()).replace(" ","")) |
|
1423 | 1423 | except: |
|
1424 | 1424 | wrperiod = None |
|
1425 | 1425 | |
|
1426 | 1426 | #-----Spectra Plot----- |
|
1427 | 1427 | if self.specGraphCebSpectraplot.isChecked(): |
|
1428 | 1428 | |
|
1429 | 1429 | opObj = puObj.addOperation(name='SpectraPlot', optype='other') |
|
1430 | 1430 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1431 | 1431 | |
|
1432 | 1432 | if not channelList == '': |
|
1433 | 1433 | |
|
1434 | 1434 | if not isList(channelList): |
|
1435 | 1435 | self.console.append("Invalid channelList") |
|
1436 | 1436 | return 0 |
|
1437 | 1437 | |
|
1438 | 1438 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1439 | 1439 | |
|
1440 | 1440 | if not vel_range == '': |
|
1441 | 1441 | xvalueList = vel_range.split(',') |
|
1442 | 1442 | try: |
|
1443 | 1443 | value1 = float(xvalueList[0]) |
|
1444 | 1444 | value2 = float(xvalueList[1]) |
|
1445 | 1445 | except: |
|
1446 | 1446 | self.console.clear() |
|
1447 | 1447 | self.console.append("Invalid velocity/frequency range") |
|
1448 | 1448 | return 0 |
|
1449 | 1449 | |
|
1450 | 1450 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1451 | 1451 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1452 | 1452 | |
|
1453 | 1453 | if not hei_range == '': |
|
1454 | 1454 | yvalueList = hei_range.split(",") |
|
1455 | 1455 | try: |
|
1456 | 1456 | value1 = float(yvalueList[0]) |
|
1457 | 1457 | value2 = float(yvalueList[1]) |
|
1458 | 1458 | except: |
|
1459 | 1459 | self.console.clear() |
|
1460 | 1460 | self.console.append("Invalid height range") |
|
1461 | 1461 | return 0 |
|
1462 | 1462 | |
|
1463 | 1463 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1464 | 1464 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1465 | 1465 | |
|
1466 | 1466 | if not db_range == '': |
|
1467 | 1467 | zvalueList = db_range.split(",") |
|
1468 | 1468 | try: |
|
1469 | 1469 | value1 = float(zvalueList[0]) |
|
1470 | 1470 | value2 = float(zvalueList[1]) |
|
1471 | 1471 | except: |
|
1472 | 1472 | self.console.clear() |
|
1473 | 1473 | self.console.append("Invalid db range") |
|
1474 | 1474 | return 0 |
|
1475 | 1475 | |
|
1476 | 1476 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1477 | 1477 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1478 | 1478 | |
|
1479 | 1479 | if self.specGraphSaveSpectra.isChecked(): |
|
1480 | 1480 | checkPath = True |
|
1481 | 1481 | opObj.addParameter(name='save', value=1 , format='bool') |
|
1482 | 1482 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1483 | 1483 | if figfile: |
|
1484 | 1484 | opObj.addParameter(name='figfile', value=figfile, format='str') |
|
1485 | 1485 | if wrperiod: |
|
1486 | 1486 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1487 | 1487 | |
|
1488 | 1488 | if self.specGraphftpSpectra.isChecked(): |
|
1489 | 1489 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1490 | 1490 | self.addFTPConf2Operation(puObj, opObj) |
|
1491 | 1491 | addFTP = True |
|
1492 | 1492 | |
|
1493 | 1493 | if self.specGraphCebCrossSpectraplot.isChecked(): |
|
1494 | 1494 | |
|
1495 | 1495 | opObj = puObj.addOperation(name='CrossSpectraPlot', optype='other') |
|
1496 | 1496 | # opObj.addParameter(name='power_cmap', value='jet', format='str') |
|
1497 | 1497 | # opObj.addParameter(name='coherence_cmap', value='jet', format='str') |
|
1498 | 1498 | # opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') |
|
1499 | 1499 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1500 | 1500 | |
|
1501 | 1501 | if not vel_range == '': |
|
1502 | 1502 | xvalueList = vel_range.split(',') |
|
1503 | 1503 | try: |
|
1504 | 1504 | value1 = float(xvalueList[0]) |
|
1505 | 1505 | value2 = float(xvalueList[1]) |
|
1506 | 1506 | except: |
|
1507 | 1507 | self.console.clear() |
|
1508 | 1508 | self.console.append("Invalid velocity/frequency range") |
|
1509 | 1509 | return 0 |
|
1510 | 1510 | |
|
1511 | 1511 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1512 | 1512 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1513 | 1513 | |
|
1514 | 1514 | if not hei_range == '': |
|
1515 | 1515 | yvalueList = hei_range.split(",") |
|
1516 | 1516 | try: |
|
1517 | 1517 | value1 = float(yvalueList[0]) |
|
1518 | 1518 | value2 = float(yvalueList[1]) |
|
1519 | 1519 | except: |
|
1520 | 1520 | self.console.clear() |
|
1521 | 1521 | self.console.append("Invalid height range") |
|
1522 | 1522 | return 0 |
|
1523 | 1523 | |
|
1524 | 1524 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1525 | 1525 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1526 | 1526 | |
|
1527 | 1527 | if not db_range == '': |
|
1528 | 1528 | zvalueList = db_range.split(",") |
|
1529 | 1529 | try: |
|
1530 | 1530 | value1 = float(zvalueList[0]) |
|
1531 | 1531 | value2 = float(zvalueList[1]) |
|
1532 | 1532 | except: |
|
1533 | 1533 | self.console.clear() |
|
1534 | 1534 | self.console.append("Invalid db range") |
|
1535 | 1535 | return 0 |
|
1536 | 1536 | |
|
1537 | 1537 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1538 | 1538 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1539 | 1539 | |
|
1540 | 1540 | if not magrange == '': |
|
1541 | 1541 | zvalueList = magrange.split(",") |
|
1542 | 1542 | try: |
|
1543 | 1543 | value1 = float(zvalueList[0]) |
|
1544 | 1544 | value2 = float(zvalueList[1]) |
|
1545 | 1545 | except: |
|
1546 | 1546 | self.console.clear() |
|
1547 | 1547 | self.console.append("Invalid magnitude range") |
|
1548 | 1548 | return 0 |
|
1549 | 1549 | |
|
1550 | 1550 | opObj.addParameter(name='coh_min', value=value1, format='float') |
|
1551 | 1551 | opObj.addParameter(name='coh_max', value=value2, format='float') |
|
1552 | 1552 | |
|
1553 | 1553 | if not phaserange == '': |
|
1554 | 1554 | zvalueList = phaserange.split(",") |
|
1555 | 1555 | try: |
|
1556 | 1556 | value1 = float(zvalueList[0]) |
|
1557 | 1557 | value2 = float(zvalueList[1]) |
|
1558 | 1558 | except: |
|
1559 | 1559 | self.console.clear() |
|
1560 | 1560 | self.console.append("Invalid phase range") |
|
1561 | 1561 | return 0 |
|
1562 | 1562 | |
|
1563 | 1563 | opObj.addParameter(name='phase_min', value=value1, format='float') |
|
1564 | 1564 | opObj.addParameter(name='phase_max', value=value2, format='float') |
|
1565 | 1565 | |
|
1566 | 1566 | if self.specGraphSaveCross.isChecked(): |
|
1567 | 1567 | checkPath = True |
|
1568 | 1568 | opObj.addParameter(name='save', value='1', format='bool') |
|
1569 | 1569 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1570 | 1570 | if figfile: |
|
1571 | 1571 | opObj.addParameter(name='figfile', value=figfile, format='str') |
|
1572 | 1572 | if wrperiod: |
|
1573 | 1573 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1574 | 1574 | |
|
1575 | 1575 | if self.specGraphftpCross.isChecked(): |
|
1576 | 1576 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1577 | 1577 | self.addFTPConf2Operation(puObj, opObj) |
|
1578 | 1578 | addFTP = True |
|
1579 | 1579 | |
|
1580 | 1580 | if self.specGraphCebRTIplot.isChecked(): |
|
1581 | 1581 | |
|
1582 | 1582 | opObj = puObj.addOperation(name='RTIPlot', optype='other') |
|
1583 | 1583 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1584 | 1584 | |
|
1585 | 1585 | if not channelList == '': |
|
1586 | 1586 | if not isList(channelList): |
|
1587 | 1587 | self.console.append("Invalid channelList") |
|
1588 | 1588 | return 0 |
|
1589 | 1589 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1590 | 1590 | |
|
1591 | 1591 | if not trange == '': |
|
1592 | 1592 | xvalueList = trange.split(',') |
|
1593 | 1593 | try: |
|
1594 | 1594 | value1 = float(xvalueList[0]) |
|
1595 | 1595 | value2 = float(xvalueList[1]) |
|
1596 | 1596 | except: |
|
1597 | 1597 | self.console.clear() |
|
1598 | 1598 | self.console.append("Invalid time range") |
|
1599 | 1599 | return 0 |
|
1600 | 1600 | |
|
1601 | 1601 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1602 | 1602 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1603 | 1603 | |
|
1604 | 1604 | # if not timerange == '': |
|
1605 | 1605 | # try: |
|
1606 | 1606 | # timerange = float(timerange) |
|
1607 | 1607 | # except: |
|
1608 | 1608 | # self.console.clear() |
|
1609 | 1609 | # self.console.append("Invalid time range") |
|
1610 | 1610 | # return 0 |
|
1611 | 1611 | # |
|
1612 | 1612 | # opObj.addParameter(name='timerange', value=timerange, format='float') |
|
1613 | 1613 | |
|
1614 | 1614 | if not hei_range == '': |
|
1615 | 1615 | yvalueList = hei_range.split(",") |
|
1616 | 1616 | try: |
|
1617 | 1617 | value1 = float(yvalueList[0]) |
|
1618 | 1618 | value2 = float(yvalueList[1]) |
|
1619 | 1619 | except: |
|
1620 | 1620 | self.console.clear() |
|
1621 | 1621 | self.console.append("Invalid height range") |
|
1622 | 1622 | return 0 |
|
1623 | 1623 | |
|
1624 | 1624 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1625 | 1625 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1626 | 1626 | |
|
1627 | 1627 | if not db_range == '': |
|
1628 | 1628 | zvalueList = db_range.split(",") |
|
1629 | 1629 | try: |
|
1630 | 1630 | value1 = float(zvalueList[0]) |
|
1631 | 1631 | value2 = float(zvalueList[1]) |
|
1632 | 1632 | except: |
|
1633 | 1633 | self.console.clear() |
|
1634 | 1634 | self.console.append("Invalid db range") |
|
1635 | 1635 | return 0 |
|
1636 | 1636 | |
|
1637 | 1637 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1638 | 1638 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1639 | 1639 | |
|
1640 | 1640 | if self.specGraphSaveRTIplot.isChecked(): |
|
1641 | 1641 | checkPath = True |
|
1642 | 1642 | opObj.addParameter(name='save', value='1', format='bool') |
|
1643 | 1643 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1644 | 1644 | if figfile: |
|
1645 | 1645 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1646 | 1646 | if wrperiod: |
|
1647 | 1647 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1648 | 1648 | |
|
1649 | 1649 | if self.specGraphftpRTIplot.isChecked(): |
|
1650 | 1650 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1651 | 1651 | self.addFTPConf2Operation(puObj, opObj) |
|
1652 | 1652 | addFTP = True |
|
1653 | 1653 | |
|
1654 | 1654 | if self.specGraphCebCoherencmap.isChecked(): |
|
1655 | 1655 | |
|
1656 | 1656 | opObj = puObj.addOperation(name='CoherenceMap', optype='other') |
|
1657 | 1657 | # opObj.addParameter(name=name_parameter, value=value, format=format) |
|
1658 | 1658 | # opObj.addParameter(name='coherence_cmap', value='jet', format='str') |
|
1659 | 1659 | # opObj.addParameter(name='phase_cmap', value='RdBu_r', format='str') |
|
1660 | 1660 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1661 | 1661 | |
|
1662 | 1662 | # if not timerange == '': |
|
1663 | 1663 | # try: |
|
1664 | 1664 | # timerange = int(timerange) |
|
1665 | 1665 | # except: |
|
1666 | 1666 | # self.console.clear() |
|
1667 | 1667 | # self.console.append("Invalid time range") |
|
1668 | 1668 | # return 0 |
|
1669 | 1669 | # |
|
1670 | 1670 | # opObj.addParameter(name='timerange', value=timerange, format='int') |
|
1671 | 1671 | |
|
1672 | 1672 | if not trange == '': |
|
1673 | 1673 | xvalueList = trange.split(',') |
|
1674 | 1674 | try: |
|
1675 | 1675 | value1 = float(xvalueList[0]) |
|
1676 | 1676 | value2 = float(xvalueList[1]) |
|
1677 | 1677 | except: |
|
1678 | 1678 | self.console.clear() |
|
1679 | 1679 | self.console.append("Invalid time range") |
|
1680 | 1680 | return 0 |
|
1681 | 1681 | |
|
1682 | 1682 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1683 | 1683 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1684 | 1684 | |
|
1685 | 1685 | if not hei_range == '': |
|
1686 | 1686 | yvalueList = hei_range.split(",") |
|
1687 | 1687 | try: |
|
1688 | 1688 | value1 = float(yvalueList[0]) |
|
1689 | 1689 | value2 = float(yvalueList[1]) |
|
1690 | 1690 | except: |
|
1691 | 1691 | self.console.clear() |
|
1692 | 1692 | self.console.append("Invalid height range") |
|
1693 | 1693 | return 0 |
|
1694 | 1694 | |
|
1695 | 1695 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1696 | 1696 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1697 | 1697 | |
|
1698 | 1698 | if not magrange == '': |
|
1699 | 1699 | zvalueList = magrange.split(",") |
|
1700 | 1700 | try: |
|
1701 | 1701 | value1 = float(zvalueList[0]) |
|
1702 | 1702 | value2 = float(zvalueList[1]) |
|
1703 | 1703 | except: |
|
1704 | 1704 | self.console.clear() |
|
1705 | 1705 | self.console.append("Invalid magnitude range") |
|
1706 | 1706 | return 0 |
|
1707 | 1707 | |
|
1708 | 1708 | opObj.addParameter(name='zmin', value=value1, format='float') |
|
1709 | 1709 | opObj.addParameter(name='zmax', value=value2, format='float') |
|
1710 | 1710 | |
|
1711 | 1711 | if not phaserange == '': |
|
1712 | 1712 | zvalueList = phaserange.split(",") |
|
1713 | 1713 | try: |
|
1714 | 1714 | value1 = float(zvalueList[0]) |
|
1715 | 1715 | value2 = float(zvalueList[1]) |
|
1716 | 1716 | except: |
|
1717 | 1717 | self.console.clear() |
|
1718 | 1718 | self.console.append("Invalid phase range") |
|
1719 | 1719 | return 0 |
|
1720 | 1720 | |
|
1721 | 1721 | opObj.addParameter(name='phase_min', value=value1, format='float') |
|
1722 | 1722 | opObj.addParameter(name='phase_max', value=value2, format='float') |
|
1723 | 1723 | |
|
1724 | 1724 | if self.specGraphSaveCoherencemap.isChecked(): |
|
1725 | 1725 | checkPath = True |
|
1726 | 1726 | opObj.addParameter(name='save', value='1', format='bool') |
|
1727 | 1727 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1728 | 1728 | if figfile: |
|
1729 | 1729 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1730 | 1730 | if wrperiod: |
|
1731 | 1731 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1732 | 1732 | |
|
1733 | 1733 | if self.specGraphftpCoherencemap.isChecked(): |
|
1734 | 1734 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1735 | 1735 | self.addFTPConf2Operation(puObj, opObj) |
|
1736 | 1736 | addFTP = True |
|
1737 | 1737 | |
|
1738 | 1738 | if self.specGraphPowerprofile.isChecked(): |
|
1739 | 1739 | |
|
1740 | 1740 | opObj = puObj.addOperation(name='PowerProfilePlot', optype='other') |
|
1741 | 1741 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1742 | 1742 | |
|
1743 | 1743 | if not channelList == '': |
|
1744 | 1744 | if not isList(channelList): |
|
1745 | 1745 | self.console.append("Invalid channelList") |
|
1746 | 1746 | return 0 |
|
1747 | 1747 | |
|
1748 | 1748 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1749 | 1749 | |
|
1750 | 1750 | if not db_range == '': |
|
1751 | 1751 | xvalueList = db_range.split(',') |
|
1752 | 1752 | try: |
|
1753 | 1753 | value1 = float(xvalueList[0]) |
|
1754 | 1754 | value2 = float(xvalueList[1]) |
|
1755 | 1755 | except: |
|
1756 | 1756 | self.console.clear() |
|
1757 | 1757 | self.console.append("Invalid db range") |
|
1758 | 1758 | return 0 |
|
1759 | 1759 | |
|
1760 | 1760 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1761 | 1761 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1762 | 1762 | |
|
1763 | 1763 | if not hei_range == '': |
|
1764 | 1764 | yvalueList = hei_range.split(",") |
|
1765 | 1765 | try: |
|
1766 | 1766 | value1 = float(yvalueList[0]) |
|
1767 | 1767 | value2 = float(yvalueList[1]) |
|
1768 | 1768 | except: |
|
1769 | 1769 | self.console.clear() |
|
1770 | 1770 | self.console.append("Invalid height range") |
|
1771 | 1771 | return 0 |
|
1772 | 1772 | |
|
1773 | 1773 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1774 | 1774 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1775 | 1775 | |
|
1776 | 1776 | if self.specGraphSavePowerprofile.isChecked(): |
|
1777 | 1777 | checkPath = True |
|
1778 | 1778 | opObj.addParameter(name='save', value='1', format='bool') |
|
1779 | 1779 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1780 | 1780 | if figfile: |
|
1781 | 1781 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1782 | 1782 | if wrperiod: |
|
1783 | 1783 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1784 | 1784 | |
|
1785 | 1785 | if self.specGraphftpPowerprofile.isChecked(): |
|
1786 | 1786 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1787 | 1787 | self.addFTPConf2Operation(puObj, opObj) |
|
1788 | 1788 | addFTP = True |
|
1789 | 1789 | # rti noise |
|
1790 | 1790 | |
|
1791 | 1791 | if self.specGraphCebRTInoise.isChecked(): |
|
1792 | 1792 | |
|
1793 | 1793 | opObj = puObj.addOperation(name='Noise', optype='other') |
|
1794 | 1794 | opObj.addParameter(name='id', value=opObj.id, format='int') |
|
1795 | 1795 | |
|
1796 | 1796 | if not channelList == '': |
|
1797 | 1797 | if not isList(channelList): |
|
1798 | 1798 | self.console.append("Invalid channelList") |
|
1799 | 1799 | return 0 |
|
1800 | 1800 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
1801 | 1801 | |
|
1802 | 1802 | # if not timerange == '': |
|
1803 | 1803 | # try: |
|
1804 | 1804 | # timerange = float(timerange) |
|
1805 | 1805 | # except: |
|
1806 | 1806 | # self.console.clear() |
|
1807 | 1807 | # self.console.append("Invalid time range") |
|
1808 | 1808 | # return 0 |
|
1809 | 1809 | # |
|
1810 | 1810 | # opObj.addParameter(name='timerange', value=timerange, format='float') |
|
1811 | 1811 | |
|
1812 | 1812 | if not trange == '': |
|
1813 | 1813 | xvalueList = trange.split(',') |
|
1814 | 1814 | try: |
|
1815 | 1815 | value1 = float(xvalueList[0]) |
|
1816 | 1816 | value2 = float(xvalueList[1]) |
|
1817 | 1817 | except: |
|
1818 | 1818 | self.console.clear() |
|
1819 | 1819 | self.console.append("Invalid time range") |
|
1820 | 1820 | return 0 |
|
1821 | 1821 | |
|
1822 | 1822 | opObj.addParameter(name='xmin', value=value1, format='float') |
|
1823 | 1823 | opObj.addParameter(name='xmax', value=value2, format='float') |
|
1824 | 1824 | |
|
1825 | 1825 | if not db_range == '': |
|
1826 | 1826 | yvalueList = db_range.split(",") |
|
1827 | 1827 | try: |
|
1828 | 1828 | value1 = float(yvalueList[0]) |
|
1829 | 1829 | value2 = float(yvalueList[1]) |
|
1830 | 1830 | except: |
|
1831 | 1831 | self.console.clear() |
|
1832 | 1832 | self.console.append("Invalid db range") |
|
1833 | 1833 | return 0 |
|
1834 | 1834 | |
|
1835 | 1835 | opObj.addParameter(name='ymin', value=value1, format='float') |
|
1836 | 1836 | opObj.addParameter(name='ymax', value=value2, format='float') |
|
1837 | 1837 | |
|
1838 | 1838 | if self.specGraphSaveRTInoise.isChecked(): |
|
1839 | 1839 | checkPath = True |
|
1840 | 1840 | opObj.addParameter(name='save', value='1', format='bool') |
|
1841 | 1841 | opObj.addParameter(name='figpath', value=figpath, format='str') |
|
1842 | 1842 | if figfile: |
|
1843 | 1843 | opObj.addParameter(name='figfile', value=value, format='str') |
|
1844 | 1844 | if wrperiod: |
|
1845 | 1845 | opObj.addParameter(name='wr_period', value=wrperiod,format='int') |
|
1846 | 1846 | |
|
1847 | 1847 | # test_ftp |
|
1848 | 1848 | if self.specGraphftpRTInoise.isChecked(): |
|
1849 | 1849 | opObj.addParameter(name='ftp', value='1', format='int') |
|
1850 | 1850 | self.addFTPConf2Operation(puObj, opObj) |
|
1851 | 1851 | addFTP = True |
|
1852 | 1852 | |
|
1853 | 1853 | if checkPath: |
|
1854 | 1854 | if not figpath: |
|
1855 | 1855 | self.console.clear() |
|
1856 | 1856 | self.console.append("Graphic path should be defined") |
|
1857 | 1857 | return 0 |
|
1858 | 1858 | |
|
1859 | 1859 | if addFTP and not figpath: |
|
1860 | 1860 | self.console.clear() |
|
1861 | 1861 | self.console.append("You have to save the plots before sending them to FTP Server") |
|
1862 | 1862 | return 0 |
|
1863 | 1863 | |
|
1864 | 1864 | # if something happend |
|
1865 | 1865 | parms_ok, output_path, blocksperfile, profilesperblock = self.checkInputsPUSave(datatype='Spectra') |
|
1866 | 1866 | if parms_ok: |
|
1867 | 1867 | opObj = puObj.addOperation(name='SpectraWriter', optype='other') |
|
1868 | 1868 | opObj.addParameter(name='path', value=output_path) |
|
1869 | 1869 | opObj.addParameter(name='blocksPerFile', value=blocksperfile, format='int') |
|
1870 | 1870 | |
|
1871 | 1871 | self.console.clear() |
|
1872 | 1872 | try: |
|
1873 | 1873 | self.refreshPUProperties(puObj) |
|
1874 | 1874 | except: |
|
1875 | 1875 | self.console.append("An error reading input parameters was found ... Check them!") |
|
1876 | 1876 | return 0 |
|
1877 | 1877 | |
|
1878 | 1878 | self.console.append("Save your project and press Play button to start signal processing") |
|
1879 | 1879 | |
|
1880 | 1880 | self.actionSaveToolbar.setEnabled(True) |
|
1881 | 1881 | self.actionStarToolbar.setEnabled(True) |
|
1882 | 1882 | |
|
1883 | 1883 | return 1 |
|
1884 | 1884 | |
|
1885 | 1885 | """ |
|
1886 | 1886 | Spectra Graph |
|
1887 | 1887 | """ |
|
1888 | 1888 | @pyqtSignature("int") |
|
1889 | 1889 | def on_specGraphCebSpectraplot_stateChanged(self, p0): |
|
1890 | 1890 | |
|
1891 | 1891 | self.__checkSpecGraphFilters() |
|
1892 | 1892 | |
|
1893 | 1893 | |
|
1894 | 1894 | @pyqtSignature("int") |
|
1895 | 1895 | def on_specGraphCebCrossSpectraplot_stateChanged(self, p0): |
|
1896 | 1896 | |
|
1897 | 1897 | self.__checkSpecGraphFilters() |
|
1898 | 1898 | |
|
1899 | 1899 | @pyqtSignature("int") |
|
1900 | 1900 | def on_specGraphCebRTIplot_stateChanged(self, p0): |
|
1901 | 1901 | |
|
1902 | 1902 | self.__checkSpecGraphFilters() |
|
1903 | 1903 | |
|
1904 | 1904 | |
|
1905 | 1905 | @pyqtSignature("int") |
|
1906 | 1906 | def on_specGraphCebRTInoise_stateChanged(self, p0): |
|
1907 | 1907 | |
|
1908 | 1908 | self.__checkSpecGraphFilters() |
|
1909 | 1909 | |
|
1910 | 1910 | |
|
1911 | 1911 | @pyqtSignature("int") |
|
1912 | 1912 | def on_specGraphCebCoherencmap_stateChanged(self, p0): |
|
1913 | 1913 | |
|
1914 | 1914 | self.__checkSpecGraphFilters() |
|
1915 | 1915 | |
|
1916 | 1916 | @pyqtSignature("int") |
|
1917 | 1917 | def on_specGraphPowerprofile_stateChanged(self, p0): |
|
1918 | 1918 | |
|
1919 | 1919 | self.__checkSpecGraphFilters() |
|
1920 | 1920 | |
|
1921 | 1921 | @pyqtSignature("int") |
|
1922 | 1922 | def on_specGraphPhase_stateChanged(self, p0): |
|
1923 | 1923 | |
|
1924 | 1924 | self.__checkSpecGraphFilters() |
|
1925 | 1925 | |
|
1926 | 1926 | @pyqtSignature("int") |
|
1927 | 1927 | def on_specGraphSaveSpectra_stateChanged(self, p0): |
|
1928 | 1928 | """ |
|
1929 | 1929 | """ |
|
1930 | 1930 | self.__checkSpecGraphSaving() |
|
1931 | 1931 | |
|
1932 | 1932 | @pyqtSignature("int") |
|
1933 | 1933 | def on_specGraphSaveCross_stateChanged(self, p0): |
|
1934 | 1934 | |
|
1935 | 1935 | self.__checkSpecGraphSaving() |
|
1936 | 1936 | |
|
1937 | 1937 | @pyqtSignature("int") |
|
1938 | 1938 | def on_specGraphSaveRTIplot_stateChanged(self, p0): |
|
1939 | 1939 | |
|
1940 | 1940 | self.__checkSpecGraphSaving() |
|
1941 | 1941 | |
|
1942 | 1942 | @pyqtSignature("int") |
|
1943 | 1943 | def on_specGraphSaveRTInoise_stateChanged(self, p0): |
|
1944 | 1944 | |
|
1945 | 1945 | self.__checkSpecGraphSaving() |
|
1946 | 1946 | |
|
1947 | 1947 | @pyqtSignature("int") |
|
1948 | 1948 | def on_specGraphSaveCoherencemap_stateChanged(self, p0): |
|
1949 | 1949 | |
|
1950 | 1950 | self.__checkSpecGraphSaving() |
|
1951 | 1951 | |
|
1952 | 1952 | @pyqtSignature("int") |
|
1953 | 1953 | def on_specGraphSavePowerprofile_stateChanged(self, p0): |
|
1954 | 1954 | |
|
1955 | 1955 | self.__checkSpecGraphSaving() |
|
1956 | 1956 | |
|
1957 | 1957 | @pyqtSignature("int") |
|
1958 | 1958 | def on_specGraphftpSpectra_stateChanged(self, p0): |
|
1959 | 1959 | """ |
|
1960 | 1960 | """ |
|
1961 | 1961 | self.__checkSpecGraphFTP() |
|
1962 | 1962 | |
|
1963 | 1963 | |
|
1964 | 1964 | @pyqtSignature("int") |
|
1965 | 1965 | def on_specGraphftpCross_stateChanged(self, p0): |
|
1966 | 1966 | |
|
1967 | 1967 | self.__checkSpecGraphFTP() |
|
1968 | 1968 | |
|
1969 | 1969 | @pyqtSignature("int") |
|
1970 | 1970 | def on_specGraphftpRTIplot_stateChanged(self, p0): |
|
1971 | 1971 | |
|
1972 | 1972 | self.__checkSpecGraphFTP() |
|
1973 | 1973 | |
|
1974 | 1974 | @pyqtSignature("int") |
|
1975 | 1975 | def on_specGraphftpRTInoise_stateChanged(self, p0): |
|
1976 | 1976 | |
|
1977 | 1977 | self.__checkSpecGraphFTP() |
|
1978 | 1978 | |
|
1979 | 1979 | @pyqtSignature("int") |
|
1980 | 1980 | def on_specGraphftpCoherencemap_stateChanged(self, p0): |
|
1981 | 1981 | |
|
1982 | 1982 | self.__checkSpecGraphFTP() |
|
1983 | 1983 | |
|
1984 | 1984 | @pyqtSignature("int") |
|
1985 | 1985 | def on_specGraphftpPowerprofile_stateChanged(self, p0): |
|
1986 | 1986 | |
|
1987 | 1987 | self.__checkSpecGraphFTP() |
|
1988 | 1988 | |
|
1989 | 1989 | @pyqtSignature("") |
|
1990 | 1990 | def on_specGraphToolPath_clicked(self): |
|
1991 | 1991 | """ |
|
1992 | 1992 | """ |
|
1993 | 1993 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
1994 | 1994 | self.specGraphPath.setText(save_path) |
|
1995 | 1995 | if not os.path.exists(save_path): |
|
1996 | 1996 | self.console.clear() |
|
1997 | 1997 | self.console.append("Write a valid path") |
|
1998 | 1998 | return |
|
1999 | 1999 | |
|
2000 | 2000 | @pyqtSignature("") |
|
2001 | 2001 | def on_specGraphClear_clicked(self): |
|
2002 | 2002 | return |
|
2003 | 2003 | |
|
2004 | 2004 | @pyqtSignature("") |
|
2005 | 2005 | def on_specHeisGraphToolPath_clicked(self): |
|
2006 | 2006 | """ |
|
2007 | 2007 | """ |
|
2008 | 2008 | save_path = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
2009 | 2009 | self.specHeisGraphPath.setText(save_path) |
|
2010 | 2010 | if not os.path.exists(save_path): |
|
2011 | 2011 | self.console.clear() |
|
2012 | 2012 | self.console.append("Write a valid path") |
|
2013 | 2013 | return |
|
2014 | 2014 | |
|
2015 | 2015 | @pyqtSignature("int") |
|
2016 | 2016 | def on_specHeisOpCebIncoherent_stateChanged(self, p0): |
|
2017 | 2017 | """ |
|
2018 | 2018 | Habilita la opcion de aοΏ½adir el parοΏ½metro integraciones incoherentes a la Unidad de Procesamiento . |
|
2019 | 2019 | """ |
|
2020 | 2020 | if p0 == 2: |
|
2021 | 2021 | self.specHeisOpIncoherent.setEnabled(True) |
|
2022 | 2022 | self.specHeisOpCobIncInt.setEnabled(True) |
|
2023 | 2023 | if p0 == 0: |
|
2024 | 2024 | self.specHeisOpIncoherent.setEnabled(False) |
|
2025 | 2025 | self.specHeisOpCobIncInt.setEnabled(False) |
|
2026 | 2026 | |
|
2027 | 2027 | @pyqtSignature("") |
|
2028 | 2028 | def on_specHeisOpOk_clicked(self): |
|
2029 | 2029 | """ |
|
2030 | 2030 | AΓADE OPERACION SPECTRAHEIS |
|
2031 | 2031 | """ |
|
2032 | 2032 | addFTP = False |
|
2033 | 2033 | checkPath = False |
|
2034 | 2034 | |
|
2035 | 2035 | self.actionSaveToolbar.setEnabled(False) |
|
2036 | 2036 | self.actionStarToolbar.setEnabled(False) |
|
2037 | 2037 | |
|
2038 | 2038 | self.console.clear() |
|
2039 | 2039 | self.console.append("Checking input parameters ...") |
|
2040 | 2040 | |
|
2041 | 2041 | puObj = self.getSelectedItemObj() |
|
2042 | 2042 | puObj.removeOperations() |
|
2043 | 2043 | |
|
2044 | 2044 | if self.specHeisOpCebIncoherent.isChecked(): |
|
2045 | 2045 | value = str(self.specHeisOpIncoherent.text()) |
|
2046 | 2046 | name_operation = 'IncohInt4SpectraHeis' |
|
2047 | 2047 | optype = 'other' |
|
2048 | 2048 | |
|
2049 | 2049 | name_parameter = 'timeInterval' |
|
2050 | 2050 | format = 'float' |
|
2051 | 2051 | |
|
2052 | 2052 | if self.specOpCobIncInt.currentIndex() == 0: |
|
2053 | 2053 | name_parameter = 'timeInterval' |
|
2054 | 2054 | format = 'float' |
|
2055 | 2055 | |
|
2056 | 2056 | if not isFloat(value): |
|
2057 | 2057 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
2058 | 2058 | return 0 |
|
2059 | 2059 | |
|
2060 | 2060 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2061 | 2061 | |
|
2062 | 2062 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
2063 | 2063 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
2064 | 2064 | return 0 |
|
2065 | 2065 | |
|
2066 | 2066 | channelList = str(self.specHeisGgraphChannelList.text()) |
|
2067 | 2067 | freq_range = str(self.specHeisGgraphXminXmax.text()) |
|
2068 | 2068 | power_range = str(self.specHeisGgraphYminYmax.text()) |
|
2069 | 2069 | time_range = str(self.specHeisGgraphTminTmax.text()) |
|
2070 | 2070 | timerange = str(self.specHeisGgraphTimeRange.text()) |
|
2071 | 2071 | |
|
2072 | 2072 | # ---- Spectra Plot----- |
|
2073 | 2073 | if self.specHeisGraphCebSpectraplot.isChecked(): |
|
2074 | 2074 | |
|
2075 | 2075 | name_operation = 'SpectraHeisScope' |
|
2076 | 2076 | optype = 'other' |
|
2077 | 2077 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2078 | 2078 | |
|
2079 | 2079 | name_parameter = 'id' |
|
2080 | 2080 | format = 'int' |
|
2081 | 2081 | value = opObj.id |
|
2082 | 2082 | |
|
2083 | 2083 | if not opObj.addParameter(name=name_parameter, value=value, format=format): |
|
2084 | 2084 | self.console.append("Invalid value '%s' for '%s'" %(value, name_parameter)) |
|
2085 | 2085 | return 0 |
|
2086 | 2086 | |
|
2087 | 2087 | if not (channelList == ''): |
|
2088 | 2088 | name_parameter = 'channelList' |
|
2089 | 2089 | format = 'intlist' |
|
2090 | 2090 | |
|
2091 | 2091 | if not isList(channelList): |
|
2092 | 2092 | self.console.append("Invalid value '%s' for '%s'" %(channelList, name_parameter)) |
|
2093 | 2093 | return 0 |
|
2094 | 2094 | |
|
2095 | 2095 | opObj.addParameter(name=name_parameter, value=channelList, format=format) |
|
2096 | 2096 | |
|
2097 | 2097 | if not freq_range == '': |
|
2098 | 2098 | xvalueList = freq_range.split(',') |
|
2099 | 2099 | |
|
2100 | 2100 | if len(xvalueList) != 2: |
|
2101 | 2101 | self.console.append("Invalid value '%s' for '%s'" %(freq_range, "xrange")) |
|
2102 | 2102 | return 0 |
|
2103 | 2103 | |
|
2104 | 2104 | value1 = xvalueList[0] |
|
2105 | 2105 | value2 = xvalueList[1] |
|
2106 | 2106 | |
|
2107 | 2107 | if not isFloat(value1) or not isFloat(value2): |
|
2108 | 2108 | self.console.append("Invalid value '%s' for '%s'" %(freq_range, "xrange")) |
|
2109 | 2109 | return 0 |
|
2110 | 2110 | |
|
2111 | 2111 | name1 = 'xmin' |
|
2112 | 2112 | name2 = 'xmax' |
|
2113 | 2113 | format = 'float' |
|
2114 | 2114 | |
|
2115 | 2115 | opObj.addParameter(name=name1, value=value1, format=format) |
|
2116 | 2116 | opObj.addParameter(name=name2, value=value2, format=format) |
|
2117 | 2117 | |
|
2118 | 2118 | #------specHeisGgraphYmin-Ymax--- |
|
2119 | 2119 | if not power_range == '': |
|
2120 | 2120 | yvalueList = power_range.split(",") |
|
2121 | 2121 | |
|
2122 | 2122 | if len(yvalueList) != 2: |
|
2123 | 2123 | self.console.append("Invalid value '%s' for '%s'" %(power_range, "xrange")) |
|
2124 | 2124 | return 0 |
|
2125 | 2125 | |
|
2126 | 2126 | value1 = yvalueList[0] |
|
2127 | 2127 | value2 = yvalueList[1] |
|
2128 | 2128 | |
|
2129 | 2129 | if not isFloat(value1) or not isFloat(value2): |
|
2130 | 2130 | self.console.append("Invalid value '%s' for '%s'" %(power_range, "yrange")) |
|
2131 | 2131 | return 0 |
|
2132 | 2132 | |
|
2133 | 2133 | name1 = 'ymin' |
|
2134 | 2134 | name2 = 'ymax' |
|
2135 | 2135 | format = 'float' |
|
2136 | 2136 | opObj.addParameter(name=name1, value=value1, format=format) |
|
2137 | 2137 | opObj.addParameter(name=name2, value=value2, format=format) |
|
2138 | 2138 | |
|
2139 | 2139 | if self.specHeisGraphSaveSpectra.isChecked(): |
|
2140 | 2140 | checkPath = True |
|
2141 | 2141 | name_parameter1 = 'save' |
|
2142 | 2142 | name_parameter2 = 'figpath' |
|
2143 | 2143 | name_parameter3 = 'figfile' |
|
2144 | 2144 | value1 = '1' |
|
2145 | 2145 | value2 = str(self.specHeisGraphPath.text()) |
|
2146 | 2146 | value3 = str(self.specHeisGraphPrefix.text()) |
|
2147 | 2147 | format1 = 'bool' |
|
2148 | 2148 | format2 = 'str' |
|
2149 | 2149 | opObj.addParameter(name=name_parameter1, value=value1 , format=format1) |
|
2150 | 2150 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) |
|
2151 | 2151 | if not value3 == "": |
|
2152 | 2152 | try: |
|
2153 | 2153 | value3 = str(self.specHeisGraphPrefix.text()) |
|
2154 | 2154 | except: |
|
2155 | 2155 | self.console.clear() |
|
2156 | 2156 | self.console.append("Please Write prefix") |
|
2157 | 2157 | return 0 |
|
2158 | 2158 | opObj.addParameter(name='figfile', value=str(self.specHeisGraphPrefix.text()), format='str') |
|
2159 | 2159 | |
|
2160 | 2160 | # opObj.addParameter(name=name_parameter3, value=value3, format=format2) |
|
2161 | 2161 | # opObj.addParameter(name='wr_period', value='5',format='int') |
|
2162 | 2162 | |
|
2163 | 2163 | if self.specHeisGraphftpSpectra.isChecked(): |
|
2164 | 2164 | opObj.addParameter(name='ftp', value='1', format='int') |
|
2165 | 2165 | self.addFTPConf2Operation(puObj, opObj) |
|
2166 | 2166 | addFTP = True |
|
2167 | 2167 | |
|
2168 | 2168 | if self.specHeisGraphCebRTIplot.isChecked(): |
|
2169 | 2169 | name_operation = 'RTIfromSpectraHeis' |
|
2170 | 2170 | optype = 'other' |
|
2171 | 2171 | |
|
2172 | 2172 | name_parameter = 'id' |
|
2173 | 2173 | format = 'int' |
|
2174 | 2174 | |
|
2175 | 2175 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2176 | 2176 | value = opObj.id |
|
2177 | 2177 | opObj.addParameter(name=name_parameter, value=value, format=format) |
|
2178 | 2178 | |
|
2179 | 2179 | if not channelList == '': |
|
2180 | 2180 | opObj.addParameter(name='channelList', value=channelList, format='intlist') |
|
2181 | 2181 | |
|
2182 | 2182 | if not time_range == '': |
|
2183 | 2183 | xvalueList = time_range.split(',') |
|
2184 | 2184 | try: |
|
2185 | 2185 | value = float(xvalueList[0]) |
|
2186 | 2186 | value = float(xvalueList[1]) |
|
2187 | 2187 | except: |
|
2188 | 2188 | return 0 |
|
2189 | 2189 | format = 'float' |
|
2190 | 2190 | opObj.addParameter(name='xmin', value=xvalueList[0], format=format) |
|
2191 | 2191 | opObj.addParameter(name='xmax', value=xvalueList[1], format=format) |
|
2192 | 2192 | |
|
2193 | 2193 | if not timerange == '': |
|
2194 | 2194 | format = 'int' |
|
2195 | 2195 | try: |
|
2196 | 2196 | timerange = int(timerange) |
|
2197 | 2197 | except: |
|
2198 | 2198 | return 0 |
|
2199 | 2199 | opObj.addParameter(name='timerange', value=timerange, format=format) |
|
2200 | 2200 | |
|
2201 | 2201 | |
|
2202 | 2202 | if not power_range == '': |
|
2203 | 2203 | yvalueList = power_range.split(",") |
|
2204 | 2204 | try: |
|
2205 | 2205 | value = float(yvalueList[0]) |
|
2206 | 2206 | value = float(yvalueList[1]) |
|
2207 | 2207 | except: |
|
2208 | 2208 | return 0 |
|
2209 | 2209 | |
|
2210 | 2210 | format = 'float' |
|
2211 | 2211 | opObj.addParameter(name='ymin', value=yvalueList[0], format=format) |
|
2212 | 2212 | opObj.addParameter(name='ymax', value=yvalueList[1], format=format) |
|
2213 | 2213 | |
|
2214 | 2214 | if self.specHeisGraphSaveRTIplot.isChecked(): |
|
2215 | 2215 | checkPath = True |
|
2216 | 2216 | opObj.addParameter(name='save', value='1', format='bool') |
|
2217 | 2217 | opObj.addParameter(name='figpath', value=str(self.specHeisGraphPath.text()), format='str') |
|
2218 | 2218 | value = str(self.specHeisGraphPrefix.text()) |
|
2219 | 2219 | if not value == "": |
|
2220 | 2220 | try: |
|
2221 | 2221 | value = str(self.specHeisGraphPrefix.text()) |
|
2222 | 2222 | except: |
|
2223 | 2223 | self.console.clear() |
|
2224 | 2224 | self.console.append("Please Write prefix") |
|
2225 | 2225 | return 0 |
|
2226 | 2226 | opObj.addParameter(name='figfile', value=value, format='str') |
|
2227 | 2227 | |
|
2228 | 2228 | # test_ftp |
|
2229 | 2229 | if self.specHeisGraphftpRTIplot.isChecked(): |
|
2230 | 2230 | opObj.addParameter(name='ftp', value='1', format='int') |
|
2231 | 2231 | self.addFTPConf2Operation(puObj, opObj) |
|
2232 | 2232 | addFTP = True |
|
2233 | 2233 | |
|
2234 | 2234 | localfolder = None |
|
2235 | 2235 | if checkPath: |
|
2236 | 2236 | localfolder = str(self.specHeisGraphPath.text()) |
|
2237 | 2237 | if localfolder == '': |
|
2238 | 2238 | self.console.clear() |
|
2239 | 2239 | self.console.append("Graphic path should be defined") |
|
2240 | 2240 | return 0 |
|
2241 | 2241 | |
|
2242 | 2242 | if addFTP and not localfolder: |
|
2243 | 2243 | self.console.clear() |
|
2244 | 2244 | self.console.append("You should save plots before send them to FTP Server") |
|
2245 | 2245 | return 0 |
|
2246 | 2246 | |
|
2247 | 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 | 2249 | if parms_ok: |
|
2250 | 2250 | name_operation = 'FitsWriter' |
|
2251 | 2251 | optype = 'other' |
|
2252 | 2252 | name_parameter1 = 'path' |
|
2253 | 2253 | name_parameter2 = 'dataBlocksPerFile' |
|
2254 | 2254 | name_parameter3 = 'metadatafile' |
|
2255 | 2255 | value1 = output_path |
|
2256 | 2256 | value2 = blocksperfile |
|
2257 | value3 = metada | |
|
2257 | value3 = metadata_file | |
|
2258 | 2258 | format2 = "int" |
|
2259 | 2259 | format3 = "str" |
|
2260 | 2260 | opObj = puObj.addOperation(name=name_operation, optype=optype) |
|
2261 | ||
|
2261 | 2262 | opObj.addParameter(name=name_parameter1, value=value1) |
|
2262 | opObj.addParameter(name=name_parameter2, value=value2, format=format2) | |
|
2263 | opObj.addParameter(name=name_parameter3, value=value3, format=format3) | |
|
2263 | ||
|
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 | 2270 | self.console.clear() |
|
2266 | 2271 | try: |
|
2267 | 2272 | self.refreshPUProperties(puObj) |
|
2268 | 2273 | except: |
|
2269 | 2274 | self.console.append("An error reading input parameters was found ... Check them!") |
|
2270 | 2275 | return 0 |
|
2271 | 2276 | |
|
2272 | 2277 | self.console.append("Save your project and press Play button to start signal processing") |
|
2273 | 2278 | |
|
2274 | 2279 | self.actionSaveToolbar.setEnabled(True) |
|
2275 | 2280 | self.actionStarToolbar.setEnabled(True) |
|
2276 | 2281 | |
|
2277 | 2282 | return 1 |
|
2278 | 2283 | @pyqtSignature("int") |
|
2279 | 2284 | def on_specHeisGraphCebSpectraplot_stateChanged(self, p0): |
|
2280 | 2285 | |
|
2281 | 2286 | if p0 == 2: |
|
2282 | 2287 | self.specHeisGgraphChannelList.setEnabled(True) |
|
2283 | 2288 | self.specHeisGgraphXminXmax.setEnabled(True) |
|
2284 | 2289 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
2285 | 2290 | if p0 == 0: |
|
2286 | 2291 | self.specHeisGgraphXminXmax.setEnabled(False) |
|
2287 | 2292 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
2288 | 2293 | |
|
2289 | 2294 | @pyqtSignature("int") |
|
2290 | 2295 | def on_specHeisGraphCebRTIplot_stateChanged(self, p0): |
|
2291 | 2296 | |
|
2292 | 2297 | if p0 == 2: |
|
2293 | 2298 | self.specHeisGgraphChannelList.setEnabled(True) |
|
2294 | 2299 | self.specHeisGgraphTminTmax.setEnabled(True) |
|
2295 | 2300 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
2296 | 2301 | self.specHeisGgraphTimeRange.setEnabled(True) |
|
2297 | 2302 | |
|
2298 | 2303 | if p0 == 0: |
|
2299 | 2304 | self.specHeisGgraphTminTmax.setEnabled(False) |
|
2300 | 2305 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
2301 | 2306 | self.specHeisGgraphTimeRange.setEnabled(False) |
|
2302 | 2307 | |
|
2303 | 2308 | @pyqtSignature("int") |
|
2304 | 2309 | def on_specHeisGraphSaveSpectra_stateChanged(self, p0): |
|
2305 | 2310 | """ |
|
2306 | 2311 | """ |
|
2307 | 2312 | if p0 == 2: |
|
2308 | 2313 | self.specHeisGraphPath.setEnabled(True) |
|
2309 | 2314 | self.specHeisGraphPrefix.setEnabled(True) |
|
2310 | 2315 | self.specHeisGraphToolPath.setEnabled(True) |
|
2311 | 2316 | if p0 == 0: |
|
2312 | 2317 | self.specHeisGraphPath.setEnabled(False) |
|
2313 | 2318 | self.specHeisGraphPrefix.setEnabled(False) |
|
2314 | 2319 | self.specHeisGraphToolPath.setEnabled(False) |
|
2315 | 2320 | |
|
2316 | 2321 | @pyqtSignature("int") |
|
2317 | 2322 | def on_specHeisGraphSaveRTIplot_stateChanged(self, p0): |
|
2318 | 2323 | if p0 == 2: |
|
2319 | 2324 | self.specHeisGraphPath.setEnabled(True) |
|
2320 | 2325 | self.specHeisGraphPrefix.setEnabled(True) |
|
2321 | 2326 | self.specHeisGraphToolPath.setEnabled(True) |
|
2322 | 2327 | |
|
2323 | 2328 | @pyqtSignature("int") |
|
2324 | 2329 | def on_specHeisGraphftpSpectra_stateChanged(self, p0): |
|
2325 | 2330 | """ |
|
2326 | 2331 | """ |
|
2327 | 2332 | if p0 == 2: |
|
2328 | 2333 | self.specHeisGgraphftpratio.setEnabled(True) |
|
2329 | 2334 | |
|
2330 | 2335 | if p0 == 0: |
|
2331 | 2336 | self.specHeisGgraphftpratio.setEnabled(False) |
|
2332 | 2337 | |
|
2333 | 2338 | @pyqtSignature("int") |
|
2334 | 2339 | def on_specHeisGraphftpRTIplot_stateChanged(self, p0): |
|
2335 | 2340 | if p0 == 2: |
|
2336 | 2341 | self.specHeisGgraphftpratio.setEnabled(True) |
|
2337 | 2342 | |
|
2338 | 2343 | @pyqtSignature("") |
|
2339 | 2344 | def on_specHeisGraphClear_clicked(self): |
|
2340 | 2345 | pass |
|
2341 | 2346 | |
|
2342 | 2347 | def __checkSpecGraphSaving(self): |
|
2343 | 2348 | |
|
2344 | 2349 | enable = False |
|
2345 | 2350 | |
|
2346 | 2351 | if self.specGraphSaveSpectra.checkState(): |
|
2347 | 2352 | enable = True |
|
2348 | 2353 | |
|
2349 | 2354 | if self.specGraphSaveCross.checkState(): |
|
2350 | 2355 | enable = True |
|
2351 | 2356 | |
|
2352 | 2357 | if self.specGraphSaveRTIplot.checkState(): |
|
2353 | 2358 | enable = True |
|
2354 | 2359 | |
|
2355 | 2360 | if self.specGraphSaveCoherencemap.checkState(): |
|
2356 | 2361 | enable = True |
|
2357 | 2362 | |
|
2358 | 2363 | if self.specGraphSavePowerprofile.checkState(): |
|
2359 | 2364 | enable = True |
|
2360 | 2365 | |
|
2361 | 2366 | if self.specGraphSaveRTInoise.checkState(): |
|
2362 | 2367 | enable = True |
|
2363 | 2368 | |
|
2364 | 2369 | self.specGraphPath.setEnabled(enable) |
|
2365 | 2370 | self.specGraphPrefix.setEnabled(enable) |
|
2366 | 2371 | self.specGraphToolPath.setEnabled(enable) |
|
2367 | 2372 | |
|
2368 | 2373 | self.specGgraphftpratio.setEnabled(enable) |
|
2369 | 2374 | |
|
2370 | 2375 | def __checkSpecGraphFTP(self): |
|
2371 | 2376 | |
|
2372 | 2377 | enable = False |
|
2373 | 2378 | |
|
2374 | 2379 | if self.specGraphftpSpectra.checkState(): |
|
2375 | 2380 | enable = True |
|
2376 | 2381 | |
|
2377 | 2382 | if self.specGraphftpCross.checkState(): |
|
2378 | 2383 | enable = True |
|
2379 | 2384 | |
|
2380 | 2385 | if self.specGraphftpRTIplot.checkState(): |
|
2381 | 2386 | enable = True |
|
2382 | 2387 | |
|
2383 | 2388 | if self.specGraphftpCoherencemap.checkState(): |
|
2384 | 2389 | enable = True |
|
2385 | 2390 | |
|
2386 | 2391 | if self.specGraphftpPowerprofile.checkState(): |
|
2387 | 2392 | enable = True |
|
2388 | 2393 | |
|
2389 | 2394 | if self.specGraphftpRTInoise.checkState(): |
|
2390 | 2395 | enable = True |
|
2391 | 2396 | |
|
2392 | 2397 | # self.specGgraphftpratio.setEnabled(enable) |
|
2393 | 2398 | |
|
2394 | 2399 | def __checkSpecGraphFilters(self): |
|
2395 | 2400 | |
|
2396 | 2401 | freq = False |
|
2397 | 2402 | height = False |
|
2398 | 2403 | db = False |
|
2399 | 2404 | time = False |
|
2400 | 2405 | magnitud = False |
|
2401 | 2406 | phase = False |
|
2402 | 2407 | channelList = False |
|
2403 | 2408 | |
|
2404 | 2409 | if self.specGraphCebSpectraplot.checkState(): |
|
2405 | 2410 | freq = True |
|
2406 | 2411 | height = True |
|
2407 | 2412 | db = True |
|
2408 | 2413 | channelList = True |
|
2409 | 2414 | |
|
2410 | 2415 | if self.specGraphCebCrossSpectraplot.checkState(): |
|
2411 | 2416 | freq = True |
|
2412 | 2417 | height = True |
|
2413 | 2418 | db = True |
|
2414 | 2419 | magnitud = True |
|
2415 | 2420 | phase = True |
|
2416 | 2421 | |
|
2417 | 2422 | if self.specGraphCebRTIplot.checkState(): |
|
2418 | 2423 | height = True |
|
2419 | 2424 | db = True |
|
2420 | 2425 | time = True |
|
2421 | 2426 | channelList = True |
|
2422 | 2427 | |
|
2423 | 2428 | if self.specGraphCebCoherencmap.checkState(): |
|
2424 | 2429 | height = True |
|
2425 | 2430 | time = True |
|
2426 | 2431 | magnitud = True |
|
2427 | 2432 | phase = True |
|
2428 | 2433 | |
|
2429 | 2434 | if self.specGraphPowerprofile.checkState(): |
|
2430 | 2435 | height = True |
|
2431 | 2436 | db = True |
|
2432 | 2437 | channelList = True |
|
2433 | 2438 | |
|
2434 | 2439 | if self.specGraphCebRTInoise.checkState(): |
|
2435 | 2440 | db = True |
|
2436 | 2441 | time = True |
|
2437 | 2442 | channelList = True |
|
2438 | 2443 | |
|
2439 | 2444 | |
|
2440 | 2445 | self.specGgraphFreq.setEnabled(freq) |
|
2441 | 2446 | self.specGgraphHeight.setEnabled(height) |
|
2442 | 2447 | self.specGgraphDbsrange.setEnabled(db) |
|
2443 | 2448 | self.specGgraphTminTmax.setEnabled(time) |
|
2444 | 2449 | |
|
2445 | 2450 | self.specGgraphmagnitud.setEnabled(magnitud) |
|
2446 | 2451 | self.specGgraphPhase.setEnabled(phase) |
|
2447 | 2452 | self.specGgraphChannelList.setEnabled(channelList) |
|
2448 | 2453 | |
|
2449 | 2454 | def __getParmsFromProjectWindow(self): |
|
2450 | 2455 | """ |
|
2451 | 2456 | Check Inputs Project: |
|
2452 | 2457 | - project_name |
|
2453 | 2458 | - datatype |
|
2454 | 2459 | - ext |
|
2455 | 2460 | - data_path |
|
2456 | 2461 | - readmode |
|
2457 | 2462 | - delay |
|
2458 | 2463 | - set |
|
2459 | 2464 | - walk |
|
2460 | 2465 | """ |
|
2461 | 2466 | parms_ok = True |
|
2462 | 2467 | |
|
2463 | 2468 | project_name = str(self.proName.text()) |
|
2464 | 2469 | |
|
2465 | 2470 | if project_name == '' or project_name == None: |
|
2466 | 2471 | outputstr = "Enter a project Name" |
|
2467 | 2472 | self.console.append(outputstr) |
|
2468 | 2473 | parms_ok = False |
|
2469 | 2474 | project_name = None |
|
2470 | 2475 | |
|
2471 | 2476 | description = str(self.proDescription.toPlainText()) |
|
2472 | 2477 | |
|
2473 | 2478 | datatype = str(self.proComDataType.currentText()) |
|
2474 | 2479 | |
|
2475 | 2480 | ext = str(self.proDataType.text()) |
|
2476 | 2481 | |
|
2477 | 2482 | dpath = str(self.proDataPath.text()) |
|
2478 | 2483 | |
|
2479 | 2484 | if dpath == '': |
|
2480 | 2485 | outputstr = 'Datapath is empty' |
|
2481 | 2486 | self.console.append(outputstr) |
|
2482 | 2487 | parms_ok = False |
|
2483 | 2488 | dpath = None |
|
2484 | 2489 | |
|
2485 | 2490 | if dpath != None: |
|
2486 | 2491 | if not os.path.isdir(dpath): |
|
2487 | 2492 | outputstr = 'Datapath (%s) does not exist' % dpath |
|
2488 | 2493 | self.console.append(outputstr) |
|
2489 | 2494 | parms_ok = False |
|
2490 | 2495 | dpath = None |
|
2491 | 2496 | |
|
2492 | 2497 | online = int(self.proComReadMode.currentIndex()) |
|
2493 | 2498 | |
|
2494 | 2499 | delay = None |
|
2495 | 2500 | if online==1: |
|
2496 | 2501 | try: |
|
2497 | 2502 | delay = int(str(self.proDelay.text())) |
|
2498 | 2503 | except: |
|
2499 | 2504 | outputstr = 'Delay value (%s) must be a integer number' %str(self.proDelay.text()) |
|
2500 | 2505 | self.console.append(outputstr) |
|
2501 | 2506 | parms_ok = False |
|
2502 | 2507 | |
|
2503 | 2508 | |
|
2504 | 2509 | set = None |
|
2505 | 2510 | value = str(self.proSet.text()) |
|
2506 | 2511 | try: |
|
2507 | 2512 | set = int(value) |
|
2508 | 2513 | except: |
|
2509 | 2514 | pass |
|
2510 | 2515 | |
|
2511 | 2516 | ippKm = None |
|
2512 | 2517 | |
|
2513 | 2518 | value = str(self.proIPPKm.text()) |
|
2514 | 2519 | |
|
2515 | 2520 | try: |
|
2516 | 2521 | ippKm = float(value) |
|
2517 | 2522 | except: |
|
2518 | 2523 | if datatype=="USRP": |
|
2519 | 2524 | outputstr = 'IPP value "%s" must be a float number' % str(self.proIPPKm.text()) |
|
2520 | 2525 | self.console.append(outputstr) |
|
2521 | 2526 | parms_ok = False |
|
2522 | 2527 | |
|
2523 | 2528 | walk = int(self.proComWalk.currentIndex()) |
|
2524 | 2529 | expLabel = str(self.proExpLabel.text()) |
|
2525 | 2530 | |
|
2526 | 2531 | startDate = str(self.proComStartDate.currentText()) |
|
2527 | 2532 | endDate = str(self.proComEndDate.currentText()) |
|
2528 | 2533 | |
|
2529 | 2534 | # startDateList = startDate.split("/") |
|
2530 | 2535 | # endDateList = endDate.split("/") |
|
2531 | 2536 | # |
|
2532 | 2537 | # startDate = datetime.date(int(startDateList[0]), int(startDateList[1]), int(startDateList[2])) |
|
2533 | 2538 | # endDate = datetime.date(int(endDateList[0]), int(endDateList[1]), int(endDateList[2])) |
|
2534 | 2539 | |
|
2535 | 2540 | startTime = self.proStartTime.time() |
|
2536 | 2541 | endTime = self.proEndTime.time() |
|
2537 | 2542 | |
|
2538 | 2543 | startTime = str(startTime.toString("H:m:s")) |
|
2539 | 2544 | endTime = str(endTime.toString("H:m:s")) |
|
2540 | 2545 | |
|
2541 | 2546 | projectParms = ProjectParms() |
|
2542 | 2547 | |
|
2543 | 2548 | projectParms.name = project_name |
|
2544 | 2549 | projectParms.description = description |
|
2545 | 2550 | projectParms.datatype = datatype |
|
2546 | 2551 | projectParms.ext = ext |
|
2547 | 2552 | projectParms.dpath = dpath |
|
2548 | 2553 | projectParms.online = online |
|
2549 | 2554 | projectParms.startDate = startDate |
|
2550 | 2555 | projectParms.endDate = endDate |
|
2551 | 2556 | projectParms.startTime = startTime |
|
2552 | 2557 | projectParms.endTime = endTime |
|
2553 | 2558 | projectParms.delay = delay |
|
2554 | 2559 | projectParms.walk = walk |
|
2555 | 2560 | projectParms.expLabel = expLabel |
|
2556 | 2561 | projectParms.set = set |
|
2557 | 2562 | projectParms.ippKm = ippKm |
|
2558 | 2563 | projectParms.parmsOk = parms_ok |
|
2559 | 2564 | |
|
2560 | 2565 | return projectParms |
|
2561 | 2566 | |
|
2562 | 2567 | |
|
2563 | 2568 | def __getParmsFromProjectObj(self, projectObjView): |
|
2564 | 2569 | |
|
2565 | 2570 | parms_ok = True |
|
2566 | 2571 | |
|
2567 | 2572 | project_name, description = projectObjView.name, projectObjView.description |
|
2568 | 2573 | |
|
2569 | 2574 | readUnitObj = projectObjView.getReadUnitObj() |
|
2570 | 2575 | datatype = readUnitObj.datatype |
|
2571 | 2576 | |
|
2572 | 2577 | operationObj = readUnitObj.getOperationObj(name='run') |
|
2573 | 2578 | |
|
2574 | 2579 | dpath = operationObj.getParameterValue(parameterName='path') |
|
2575 | 2580 | startDate = operationObj.getParameterValue(parameterName='startDate') |
|
2576 | 2581 | endDate = operationObj.getParameterValue(parameterName='endDate') |
|
2577 | 2582 | |
|
2578 | 2583 | startDate = startDate.strftime("%Y/%m/%d") |
|
2579 | 2584 | endDate = endDate.strftime("%Y/%m/%d") |
|
2580 | 2585 | |
|
2581 | 2586 | startTime = operationObj.getParameterValue(parameterName='startTime') |
|
2582 | 2587 | endTime = operationObj.getParameterValue(parameterName='endTime') |
|
2583 | 2588 | |
|
2584 | 2589 | startTime = startTime.strftime("%H:%M:%S") |
|
2585 | 2590 | endTime = endTime.strftime("%H:%M:%S") |
|
2586 | 2591 | |
|
2587 | 2592 | online = 0 |
|
2588 | 2593 | try: |
|
2589 | 2594 | online = operationObj.getParameterValue(parameterName='online') |
|
2590 | 2595 | except: |
|
2591 | 2596 | pass |
|
2592 | 2597 | |
|
2593 | 2598 | delay = '' |
|
2594 | 2599 | try: |
|
2595 | 2600 | delay = operationObj.getParameterValue(parameterName='delay') |
|
2596 | 2601 | except: |
|
2597 | 2602 | pass |
|
2598 | 2603 | |
|
2599 | 2604 | walk = 0 |
|
2600 | 2605 | try: |
|
2601 | 2606 | walk = operationObj.getParameterValue(parameterName='walk') |
|
2602 | 2607 | except: |
|
2603 | 2608 | pass |
|
2604 | 2609 | |
|
2605 | 2610 | set = '' |
|
2606 | 2611 | try: |
|
2607 | 2612 | set = operationObj.getParameterValue(parameterName='set') |
|
2608 | 2613 | except: |
|
2609 | 2614 | pass |
|
2610 | 2615 | |
|
2611 | 2616 | expLabel = '' |
|
2612 | 2617 | try: |
|
2613 | 2618 | expLabel = operationObj.getParameterValue(parameterName='expLabel') |
|
2614 | 2619 | except: |
|
2615 | 2620 | pass |
|
2616 | 2621 | |
|
2617 | 2622 | ippKm = '' |
|
2618 | 2623 | if datatype.lower() == 'usrp': |
|
2619 | 2624 | try: |
|
2620 | 2625 | ippKm = operationObj.getParameterValue(parameterName='ippKm') |
|
2621 | 2626 | except: |
|
2622 | 2627 | pass |
|
2623 | 2628 | |
|
2624 | 2629 | projectParms = ProjectParms() |
|
2625 | 2630 | |
|
2626 | 2631 | projectParms.name = project_name |
|
2627 | 2632 | projectParms.description = description |
|
2628 | 2633 | projectParms.datatype = datatype |
|
2629 | 2634 | projectParms.ext = None |
|
2630 | 2635 | projectParms.dpath = dpath |
|
2631 | 2636 | projectParms.online = online |
|
2632 | 2637 | projectParms.startDate = startDate |
|
2633 | 2638 | projectParms.endDate = endDate |
|
2634 | 2639 | projectParms.startTime = startTime |
|
2635 | 2640 | projectParms.endTime = endTime |
|
2636 | 2641 | projectParms.delay=delay |
|
2637 | 2642 | projectParms.walk=walk |
|
2638 | 2643 | projectParms.set=set |
|
2639 | 2644 | projectParms.ippKm=ippKm |
|
2640 | 2645 | projectParms.expLabel = expLabel |
|
2641 | 2646 | projectParms.parmsOk=parms_ok |
|
2642 | 2647 | |
|
2643 | 2648 | return projectParms |
|
2644 | 2649 | |
|
2645 | 2650 | def refreshProjectWindow(self, projectObjView): |
|
2646 | 2651 | |
|
2647 | 2652 | projectParms = self.__getParmsFromProjectObj(projectObjView) |
|
2648 | 2653 | |
|
2649 | 2654 | index = projectParms.getDatatypeIndex() |
|
2650 | 2655 | |
|
2651 | 2656 | self.proName.setText(projectParms.name) |
|
2652 | 2657 | self.proDescription.clear() |
|
2653 | 2658 | self.proDescription.append(projectParms.description) |
|
2654 | 2659 | |
|
2655 | 2660 | self.on_proComDataType_activated(index=index) |
|
2656 | 2661 | self.proDataPath.setText(projectParms.dpath) |
|
2657 | 2662 | self.proComDataType.setCurrentIndex(index) |
|
2658 | 2663 | self.proComReadMode.setCurrentIndex(projectParms.online) |
|
2659 | 2664 | self.proDelay.setText(str(projectParms.delay)) |
|
2660 | 2665 | self.proSet.setText(str(projectParms.set)) |
|
2661 | 2666 | self.proIPPKm.setText(str(projectParms.ippKm)) |
|
2662 | 2667 | self.proComWalk.setCurrentIndex(projectParms.walk) |
|
2663 | 2668 | self.proExpLabel.setText(str(projectParms.expLabel).strip()) |
|
2664 | 2669 | |
|
2665 | 2670 | dateList = self.loadDays(data_path = projectParms.dpath, |
|
2666 | 2671 | ext = projectParms.getExt(), |
|
2667 | 2672 | walk = projectParms.walk, |
|
2668 | 2673 | expLabel = projectParms.expLabel) |
|
2669 | 2674 | |
|
2670 | 2675 | try: |
|
2671 | 2676 | startDateIndex = dateList.index(projectParms.startDate) |
|
2672 | 2677 | except: |
|
2673 | 2678 | startDateIndex = 0 |
|
2674 | 2679 | |
|
2675 | 2680 | try: |
|
2676 | 2681 | endDateIndex = dateList.index(projectParms.endDate) |
|
2677 | 2682 | except: |
|
2678 | 2683 | endDateIndex = int(self.proComEndDate.count()-1) |
|
2679 | 2684 | |
|
2680 | 2685 | self.proComStartDate.setCurrentIndex(startDateIndex) |
|
2681 | 2686 | self.proComEndDate.setCurrentIndex(endDateIndex) |
|
2682 | 2687 | |
|
2683 | 2688 | startlist = projectParms.startTime.split(":") |
|
2684 | 2689 | endlist = projectParms.endTime.split(":") |
|
2685 | 2690 | |
|
2686 | 2691 | self.time.setHMS(int(startlist[0]), int(startlist[1]), int(startlist[2])) |
|
2687 | 2692 | self.proStartTime.setTime(self.time) |
|
2688 | 2693 | |
|
2689 | 2694 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
2690 | 2695 | self.proEndTime.setTime(self.time) |
|
2691 | 2696 | |
|
2692 | 2697 | |
|
2693 | 2698 | def __refreshVoltageWindow(self, puObj): |
|
2694 | 2699 | |
|
2695 | 2700 | opObj = puObj.getOperationObj(name='setRadarFrequency') |
|
2696 | 2701 | if opObj == None: |
|
2697 | 2702 | self.volOpRadarfrequency.clear() |
|
2698 | 2703 | self.volOpCebRadarfrequency.setCheckState(0) |
|
2699 | 2704 | else: |
|
2700 | 2705 | value = opObj.getParameterValue(parameterName='frequency') |
|
2701 | 2706 | value = str(float(value)/1e6) |
|
2702 | 2707 | self.volOpRadarfrequency.setText(value) |
|
2703 | 2708 | self.volOpRadarfrequency.setEnabled(True) |
|
2704 | 2709 | self.volOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) |
|
2705 | 2710 | |
|
2706 | 2711 | opObj = puObj.getOperationObj(name="selectChannels") |
|
2707 | 2712 | |
|
2708 | 2713 | if opObj == None: |
|
2709 | 2714 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") |
|
2710 | 2715 | |
|
2711 | 2716 | if opObj == None: |
|
2712 | 2717 | self.volOpChannel.clear() |
|
2713 | 2718 | self.volOpCebChannels.setCheckState(0) |
|
2714 | 2719 | else: |
|
2715 | 2720 | channelEnabled = False |
|
2716 | 2721 | try: |
|
2717 | 2722 | value = opObj.getParameterValue(parameterName='channelList') |
|
2718 | 2723 | value = str(value)[1:-1] |
|
2719 | 2724 | channelEnabled = True |
|
2720 | 2725 | channelMode = 0 |
|
2721 | 2726 | except: |
|
2722 | 2727 | pass |
|
2723 | 2728 | try: |
|
2724 | 2729 | value = opObj.getParameterValue(parameterName='channelIndexList') |
|
2725 | 2730 | value = str(value)[1:-1] |
|
2726 | 2731 | channelEnabled = True |
|
2727 | 2732 | channelMode = 1 |
|
2728 | 2733 | except: |
|
2729 | 2734 | pass |
|
2730 | 2735 | |
|
2731 | 2736 | if channelEnabled: |
|
2732 | 2737 | self.volOpChannel.setText(value) |
|
2733 | 2738 | self.volOpChannel.setEnabled(True) |
|
2734 | 2739 | self.volOpCebChannels.setCheckState(QtCore.Qt.Checked) |
|
2735 | 2740 | self.volOpComChannels.setCurrentIndex(channelMode) |
|
2736 | 2741 | |
|
2737 | 2742 | opObj = puObj.getOperationObj(name="selectHeights") |
|
2738 | 2743 | if opObj == None: |
|
2739 | 2744 | self.volOpHeights.clear() |
|
2740 | 2745 | self.volOpCebHeights.setCheckState(0) |
|
2741 | 2746 | else: |
|
2742 | 2747 | value1 = int(opObj.getParameterValue(parameterName='minHei')) |
|
2743 | 2748 | value1 = str(value1) |
|
2744 | 2749 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) |
|
2745 | 2750 | value2 = str(value2) |
|
2746 | 2751 | value = value1 + "," + value2 |
|
2747 | 2752 | self.volOpHeights.setText(value) |
|
2748 | 2753 | self.volOpHeights.setEnabled(True) |
|
2749 | 2754 | self.volOpCebHeights.setCheckState(QtCore.Qt.Checked) |
|
2750 | 2755 | |
|
2751 | 2756 | opObj = puObj.getOperationObj(name="filterByHeights") |
|
2752 | 2757 | if opObj == None: |
|
2753 | 2758 | self.volOpFilter.clear() |
|
2754 | 2759 | self.volOpCebFilter.setCheckState(0) |
|
2755 | 2760 | else: |
|
2756 | 2761 | value = opObj.getParameterValue(parameterName='window') |
|
2757 | 2762 | value = str(value) |
|
2758 | 2763 | self.volOpFilter.setText(value) |
|
2759 | 2764 | self.volOpFilter.setEnabled(True) |
|
2760 | 2765 | self.volOpCebFilter.setCheckState(QtCore.Qt.Checked) |
|
2761 | 2766 | |
|
2762 | 2767 | opObj = puObj.getOperationObj(name="ProfileSelector") |
|
2763 | 2768 | if opObj == None: |
|
2764 | 2769 | self.volOpProfile.clear() |
|
2765 | 2770 | self.volOpCebProfile.setCheckState(0) |
|
2766 | 2771 | else: |
|
2767 | 2772 | for parmObj in opObj.getParameterObjList(): |
|
2768 | 2773 | |
|
2769 | 2774 | if parmObj.name == "profileList": |
|
2770 | 2775 | value = parmObj.getValue() |
|
2771 | 2776 | value = str(value)[1:-1] |
|
2772 | 2777 | self.volOpProfile.setText(value) |
|
2773 | 2778 | self.volOpProfile.setEnabled(True) |
|
2774 | 2779 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2775 | 2780 | self.volOpComProfile.setCurrentIndex(0) |
|
2776 | 2781 | |
|
2777 | 2782 | if parmObj.name == "profileRangeList": |
|
2778 | 2783 | value = parmObj.getValue() |
|
2779 | 2784 | value = str(value)[1:-1] |
|
2780 | 2785 | self.volOpProfile.setText(value) |
|
2781 | 2786 | self.volOpProfile.setEnabled(True) |
|
2782 | 2787 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2783 | 2788 | self.volOpComProfile.setCurrentIndex(1) |
|
2784 | 2789 | |
|
2785 | 2790 | if parmObj.name == "rangeList": |
|
2786 | 2791 | value = parmObj.getValue() |
|
2787 | 2792 | value = str(value)[1:-1] |
|
2788 | 2793 | self.volOpProfile.setText(value) |
|
2789 | 2794 | self.volOpProfile.setEnabled(True) |
|
2790 | 2795 | self.volOpCebProfile.setCheckState(QtCore.Qt.Checked) |
|
2791 | 2796 | self.volOpComProfile.setCurrentIndex(2) |
|
2792 | 2797 | |
|
2793 | 2798 | opObj = puObj.getOperationObj(name="Decoder") |
|
2794 | 2799 | self.volOpCode.setText("") |
|
2795 | 2800 | if opObj == None: |
|
2796 | 2801 | self.volOpCebDecodification.setCheckState(0) |
|
2797 | 2802 | else: |
|
2798 | 2803 | self.volOpCebDecodification.setCheckState(QtCore.Qt.Checked) |
|
2799 | 2804 | |
|
2800 | 2805 | parmObj = opObj.getParameterObj('code') |
|
2801 | 2806 | |
|
2802 | 2807 | if parmObj == None: |
|
2803 | 2808 | self.volOpComCode.setCurrentIndex(0) |
|
2804 | 2809 | else: |
|
2805 | 2810 | |
|
2806 | 2811 | parmObj1 = opObj.getParameterObj('nCode') |
|
2807 | 2812 | parmObj2 = opObj.getParameterObj('nBaud') |
|
2808 | 2813 | |
|
2809 | 2814 | if parmObj1 == None or parmObj2 == None: |
|
2810 | 2815 | self.volOpComCode.setCurrentIndex(0) |
|
2811 | 2816 | else: |
|
2812 | 2817 | code = ast.literal_eval(str(parmObj.getValue())) |
|
2813 | 2818 | nCode = parmObj1.getValue() |
|
2814 | 2819 | nBaud = parmObj2.getValue() |
|
2815 | 2820 | |
|
2816 | 2821 | code = numpy.asarray(code).reshape((nCode, nBaud)).tolist() |
|
2817 | 2822 | |
|
2818 | 2823 | #User defined by default |
|
2819 | 2824 | self.volOpComCode.setCurrentIndex(13) |
|
2820 | 2825 | self.volOpCode.setText(str(code)) |
|
2821 | 2826 | |
|
2822 | 2827 | if nCode == 1: |
|
2823 | 2828 | if nBaud == 3: |
|
2824 | 2829 | self.volOpComCode.setCurrentIndex(1) |
|
2825 | 2830 | if nBaud == 4: |
|
2826 | 2831 | self.volOpComCode.setCurrentIndex(2) |
|
2827 | 2832 | if nBaud == 5: |
|
2828 | 2833 | self.volOpComCode.setCurrentIndex(3) |
|
2829 | 2834 | if nBaud == 7: |
|
2830 | 2835 | self.volOpComCode.setCurrentIndex(4) |
|
2831 | 2836 | if nBaud == 11: |
|
2832 | 2837 | self.volOpComCode.setCurrentIndex(5) |
|
2833 | 2838 | if nBaud == 13: |
|
2834 | 2839 | self.volOpComCode.setCurrentIndex(6) |
|
2835 | 2840 | |
|
2836 | 2841 | if nCode == 2: |
|
2837 | 2842 | if nBaud == 3: |
|
2838 | 2843 | self.volOpComCode.setCurrentIndex(7) |
|
2839 | 2844 | if nBaud == 4: |
|
2840 | 2845 | self.volOpComCode.setCurrentIndex(8) |
|
2841 | 2846 | if nBaud == 5: |
|
2842 | 2847 | self.volOpComCode.setCurrentIndex(9) |
|
2843 | 2848 | if nBaud == 7: |
|
2844 | 2849 | self.volOpComCode.setCurrentIndex(10) |
|
2845 | 2850 | if nBaud == 11: |
|
2846 | 2851 | self.volOpComCode.setCurrentIndex(11) |
|
2847 | 2852 | if nBaud == 13: |
|
2848 | 2853 | self.volOpComCode.setCurrentIndex(12) |
|
2849 | 2854 | |
|
2850 | 2855 | |
|
2851 | 2856 | opObj = puObj.getOperationObj(name="deFlip") |
|
2852 | 2857 | if opObj == None: |
|
2853 | 2858 | self.volOpFlip.clear() |
|
2854 | 2859 | self.volOpFlip.setEnabled(False) |
|
2855 | 2860 | self.volOpCebFlip.setCheckState(0) |
|
2856 | 2861 | else: |
|
2857 | 2862 | try: |
|
2858 | 2863 | value = opObj.getParameterValue(parameterName='channelList') |
|
2859 | 2864 | value = str(value)[1:-1] |
|
2860 | 2865 | except: |
|
2861 | 2866 | value = "" |
|
2862 | 2867 | |
|
2863 | 2868 | self.volOpFlip.setText(value) |
|
2864 | 2869 | self.volOpFlip.setEnabled(True) |
|
2865 | 2870 | self.volOpCebFlip.setCheckState(QtCore.Qt.Checked) |
|
2866 | 2871 | |
|
2867 | 2872 | opObj = puObj.getOperationObj(name="CohInt") |
|
2868 | 2873 | if opObj == None: |
|
2869 | 2874 | self.volOpCohInt.clear() |
|
2870 | 2875 | self.volOpCebCohInt.setCheckState(0) |
|
2871 | 2876 | else: |
|
2872 | 2877 | value = opObj.getParameterValue(parameterName='n') |
|
2873 | 2878 | self.volOpCohInt.setText(str(value)) |
|
2874 | 2879 | self.volOpCohInt.setEnabled(True) |
|
2875 | 2880 | self.volOpCebCohInt.setCheckState(QtCore.Qt.Checked) |
|
2876 | 2881 | |
|
2877 | 2882 | opObj = puObj.getOperationObj(name='Scope') |
|
2878 | 2883 | if opObj == None: |
|
2879 | 2884 | self.volGraphCebshow.setCheckState(0) |
|
2880 | 2885 | else: |
|
2881 | 2886 | self.volGraphCebshow.setCheckState(QtCore.Qt.Checked) |
|
2882 | 2887 | |
|
2883 | 2888 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
2884 | 2889 | |
|
2885 | 2890 | if parmObj == None: |
|
2886 | 2891 | self.volGraphChannelList.clear() |
|
2887 | 2892 | else: |
|
2888 | 2893 | value = parmObj.getValue() |
|
2889 | 2894 | value = str(value) |
|
2890 | 2895 | self.volGraphChannelList.setText(value) |
|
2891 | 2896 | self.volOpProfile.setEnabled(True) |
|
2892 | 2897 | |
|
2893 | 2898 | parmObj1 = opObj.getParameterObj(parameterName='xmin') |
|
2894 | 2899 | parmObj2 = opObj.getParameterObj(parameterName='xmax') |
|
2895 | 2900 | |
|
2896 | 2901 | if parmObj1 == None or parmObj2 ==None: |
|
2897 | 2902 | self.volGraphfreqrange.clear() |
|
2898 | 2903 | else: |
|
2899 | 2904 | value1 = parmObj1.getValue() |
|
2900 | 2905 | value1 = str(value1) |
|
2901 | 2906 | value2 = parmObj2.getValue() |
|
2902 | 2907 | value2 = str(value2) |
|
2903 | 2908 | value = value1 + "," + value2 |
|
2904 | 2909 | self.volGraphfreqrange.setText(value) |
|
2905 | 2910 | |
|
2906 | 2911 | parmObj1 = opObj.getParameterObj(parameterName='ymin') |
|
2907 | 2912 | parmObj2 = opObj.getParameterObj(parameterName='ymax') |
|
2908 | 2913 | |
|
2909 | 2914 | if parmObj1 == None or parmObj2 ==None: |
|
2910 | 2915 | self.volGraphHeightrange.clear() |
|
2911 | 2916 | else: |
|
2912 | 2917 | value1 = parmObj1.getValue() |
|
2913 | 2918 | value1 = str(value1) |
|
2914 | 2919 | value2 = parmObj2.getValue() |
|
2915 | 2920 | value2 = str(value2) |
|
2916 | 2921 | value = value1 + "," + value2 |
|
2917 | 2922 | value2 = str(value2) |
|
2918 | 2923 | self.volGraphHeightrange.setText(value) |
|
2919 | 2924 | |
|
2920 | 2925 | parmObj = opObj.getParameterObj(parameterName='save') |
|
2921 | 2926 | |
|
2922 | 2927 | if parmObj == None: |
|
2923 | 2928 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) |
|
2924 | 2929 | else: |
|
2925 | 2930 | value = parmObj.getValue() |
|
2926 | 2931 | if int(value): |
|
2927 | 2932 | self.volGraphCebSave.setCheckState(QtCore.Qt.Checked) |
|
2928 | 2933 | else: |
|
2929 | 2934 | self.volGraphCebSave.setCheckState(QtCore.Qt.Unchecked) |
|
2930 | 2935 | |
|
2931 | 2936 | parmObj = opObj.getParameterObj(parameterName='figpath') |
|
2932 | 2937 | if parmObj == None: |
|
2933 | 2938 | self.volGraphPath.clear() |
|
2934 | 2939 | else: |
|
2935 | 2940 | value = parmObj.getValue() |
|
2936 | 2941 | path = str(value) |
|
2937 | 2942 | self.volGraphPath.setText(path) |
|
2938 | 2943 | |
|
2939 | 2944 | parmObj = opObj.getParameterObj(parameterName='figfile') |
|
2940 | 2945 | if parmObj == None: |
|
2941 | 2946 | self.volGraphPrefix.clear() |
|
2942 | 2947 | else: |
|
2943 | 2948 | value = parmObj.getValue() |
|
2944 | 2949 | figfile = str(value) |
|
2945 | 2950 | self.volGraphPrefix.setText(figfile) |
|
2946 | 2951 | |
|
2947 | 2952 | # outputVoltageWrite |
|
2948 | 2953 | opObj = puObj.getOperationObj(name='VoltageWriter') |
|
2949 | 2954 | |
|
2950 | 2955 | if opObj == None: |
|
2951 | 2956 | self.volOutputPath.clear() |
|
2952 | 2957 | self.volOutputblocksperfile.clear() |
|
2953 | 2958 | self.volOutputprofilesperblock.clear() |
|
2954 | 2959 | else: |
|
2955 | 2960 | parmObj = opObj.getParameterObj(parameterName='path') |
|
2956 | 2961 | if parmObj == None: |
|
2957 | 2962 | self.volOutputPath.clear() |
|
2958 | 2963 | else: |
|
2959 | 2964 | value = parmObj.getValue() |
|
2960 | 2965 | path = str(value) |
|
2961 | 2966 | self.volOutputPath.setText(path) |
|
2962 | 2967 | |
|
2963 | 2968 | parmObj = opObj.getParameterObj(parameterName='blocksPerFile') |
|
2964 | 2969 | if parmObj == None: |
|
2965 | 2970 | self.volOutputblocksperfile.clear() |
|
2966 | 2971 | else: |
|
2967 | 2972 | value = parmObj.getValue() |
|
2968 | 2973 | blocksperfile = str(value) |
|
2969 | 2974 | self.volOutputblocksperfile.setText(blocksperfile) |
|
2970 | 2975 | |
|
2971 | 2976 | parmObj = opObj.getParameterObj(parameterName='profilesPerBlock') |
|
2972 | 2977 | if parmObj == None: |
|
2973 | 2978 | self.volOutputprofilesperblock.clear() |
|
2974 | 2979 | else: |
|
2975 | 2980 | value = parmObj.getValue() |
|
2976 | 2981 | profilesPerBlock = str(value) |
|
2977 | 2982 | self.volOutputprofilesperblock.setText(profilesPerBlock) |
|
2978 | 2983 | |
|
2979 | 2984 | return |
|
2980 | 2985 | |
|
2981 | 2986 | def __refreshSpectraWindow(self, puObj): |
|
2982 | 2987 | |
|
2983 | 2988 | inputId = puObj.getInputId() |
|
2984 | 2989 | inputPUObj = self.__puObjDict[inputId] |
|
2985 | 2990 | |
|
2986 | 2991 | if inputPUObj.datatype == 'Voltage': |
|
2987 | 2992 | self.specOpnFFTpoints.setEnabled(True) |
|
2988 | 2993 | self.specOpProfiles.setEnabled(True) |
|
2989 | 2994 | self.specOpippFactor.setEnabled(True) |
|
2990 | 2995 | else: |
|
2991 | 2996 | self.specOpnFFTpoints.setEnabled(False) |
|
2992 | 2997 | self.specOpProfiles.setEnabled(False) |
|
2993 | 2998 | self.specOpippFactor.setEnabled(False) |
|
2994 | 2999 | |
|
2995 | 3000 | opObj = puObj.getOperationObj(name='setRadarFrequency') |
|
2996 | 3001 | if opObj == None: |
|
2997 | 3002 | self.specOpRadarfrequency.clear() |
|
2998 | 3003 | self.specOpCebRadarfrequency.setCheckState(0) |
|
2999 | 3004 | else: |
|
3000 | 3005 | value = opObj.getParameterValue(parameterName='frequency') |
|
3001 | 3006 | value = str(float(value)/1e6) |
|
3002 | 3007 | self.specOpRadarfrequency.setText(value) |
|
3003 | 3008 | self.specOpRadarfrequency.setEnabled(True) |
|
3004 | 3009 | self.specOpCebRadarfrequency.setCheckState(QtCore.Qt.Checked) |
|
3005 | 3010 | |
|
3006 | 3011 | opObj = puObj.getOperationObj(name="run") |
|
3007 | 3012 | if opObj == None: |
|
3008 | 3013 | self.specOpnFFTpoints.clear() |
|
3009 | 3014 | self.specOpProfiles.clear() |
|
3010 | 3015 | self.specOpippFactor.clear() |
|
3011 | 3016 | else: |
|
3012 | 3017 | parmObj = opObj.getParameterObj(parameterName='nFFTPoints') |
|
3013 | 3018 | if parmObj == None: |
|
3014 | 3019 | self.specOpnFFTpoints.clear() |
|
3015 | 3020 | else: |
|
3016 | 3021 | self.specOpnFFTpoints.setEnabled(True) |
|
3017 | 3022 | value = opObj.getParameterValue(parameterName='nFFTPoints') |
|
3018 | 3023 | self.specOpnFFTpoints.setText(str(value)) |
|
3019 | 3024 | |
|
3020 | 3025 | parmObj = opObj.getParameterObj(parameterName='nProfiles') |
|
3021 | 3026 | if parmObj == None: |
|
3022 | 3027 | self.specOpProfiles.clear() |
|
3023 | 3028 | else: |
|
3024 | 3029 | self.specOpProfiles.setEnabled(True) |
|
3025 | 3030 | value = opObj.getParameterValue(parameterName='nProfiles') |
|
3026 | 3031 | self.specOpProfiles.setText(str(value)) |
|
3027 | 3032 | |
|
3028 | 3033 | parmObj = opObj.getParameterObj(parameterName='ippFactor') |
|
3029 | 3034 | if parmObj == None: |
|
3030 | 3035 | self.specOpippFactor.clear() |
|
3031 | 3036 | else: |
|
3032 | 3037 | self.specOpippFactor.setEnabled(True) |
|
3033 | 3038 | value = opObj.getParameterValue(parameterName='ippFactor') |
|
3034 | 3039 | self.specOpippFactor.setText(str(value)) |
|
3035 | 3040 | |
|
3036 | 3041 | opObj = puObj.getOperationObj(name="run") |
|
3037 | 3042 | if opObj == None: |
|
3038 | 3043 | self.specOppairsList.clear() |
|
3039 | 3044 | self.specOpCebCrossSpectra.setCheckState(0) |
|
3040 | 3045 | else: |
|
3041 | 3046 | parmObj = opObj.getParameterObj(parameterName='pairsList') |
|
3042 | 3047 | if parmObj == None: |
|
3043 | 3048 | self.specOppairsList.clear() |
|
3044 | 3049 | self.specOpCebCrossSpectra.setCheckState(0) |
|
3045 | 3050 | else: |
|
3046 | 3051 | value = opObj.getParameterValue(parameterName='pairsList') |
|
3047 | 3052 | value = str(value)[1:-1] |
|
3048 | 3053 | self.specOppairsList.setText(str(value)) |
|
3049 | 3054 | self.specOppairsList.setEnabled(True) |
|
3050 | 3055 | self.specOpCebCrossSpectra.setCheckState(QtCore.Qt.Checked) |
|
3051 | 3056 | |
|
3052 | 3057 | opObj = puObj.getOperationObj(name="selectChannels") |
|
3053 | 3058 | |
|
3054 | 3059 | if opObj == None: |
|
3055 | 3060 | opObj = puObj.getOperationObj(name="selectChannelsByIndex") |
|
3056 | 3061 | |
|
3057 | 3062 | if opObj == None: |
|
3058 | 3063 | self.specOpChannel.clear() |
|
3059 | 3064 | self.specOpCebChannel.setCheckState(0) |
|
3060 | 3065 | else: |
|
3061 | 3066 | channelEnabled = False |
|
3062 | 3067 | try: |
|
3063 | 3068 | value = opObj.getParameterValue(parameterName='channelList') |
|
3064 | 3069 | value = str(value)[1:-1] |
|
3065 | 3070 | channelEnabled = True |
|
3066 | 3071 | channelMode = 0 |
|
3067 | 3072 | except: |
|
3068 | 3073 | pass |
|
3069 | 3074 | try: |
|
3070 | 3075 | value = opObj.getParameterValue(parameterName='channelIndexList') |
|
3071 | 3076 | value = str(value)[1:-1] |
|
3072 | 3077 | channelEnabled = True |
|
3073 | 3078 | channelMode = 1 |
|
3074 | 3079 | except: |
|
3075 | 3080 | pass |
|
3076 | 3081 | |
|
3077 | 3082 | if channelEnabled: |
|
3078 | 3083 | self.specOpChannel.setText(value) |
|
3079 | 3084 | self.specOpChannel.setEnabled(True) |
|
3080 | 3085 | self.specOpCebChannel.setCheckState(QtCore.Qt.Checked) |
|
3081 | 3086 | self.specOpComChannel.setCurrentIndex(channelMode) |
|
3082 | 3087 | |
|
3083 | 3088 | opObj = puObj.getOperationObj(name="selectHeights") |
|
3084 | 3089 | if opObj == None: |
|
3085 | 3090 | self.specOpHeights.clear() |
|
3086 | 3091 | self.specOpCebHeights.setCheckState(0) |
|
3087 | 3092 | else: |
|
3088 | 3093 | value1 = int(opObj.getParameterValue(parameterName='minHei')) |
|
3089 | 3094 | value1 = str(value1) |
|
3090 | 3095 | value2 = int(opObj.getParameterValue(parameterName='maxHei')) |
|
3091 | 3096 | value2 = str(value2) |
|
3092 | 3097 | value = value1 + "," + value2 |
|
3093 | 3098 | self.specOpHeights.setText(value) |
|
3094 | 3099 | self.specOpHeights.setEnabled(True) |
|
3095 | 3100 | self.specOpCebHeights.setCheckState(QtCore.Qt.Checked) |
|
3096 | 3101 | |
|
3097 | 3102 | opObj = puObj.getOperationObj(name="IncohInt") |
|
3098 | 3103 | if opObj == None: |
|
3099 | 3104 | self.specOpIncoherent.clear() |
|
3100 | 3105 | self.specOpCebIncoherent.setCheckState(0) |
|
3101 | 3106 | else: |
|
3102 | 3107 | for parmObj in opObj.getParameterObjList(): |
|
3103 | 3108 | if parmObj.name == 'timeInterval': |
|
3104 | 3109 | value = opObj.getParameterValue(parameterName='timeInterval') |
|
3105 | 3110 | value = float(value) |
|
3106 | 3111 | self.specOpIncoherent.setText(str(value)) |
|
3107 | 3112 | self.specOpIncoherent.setEnabled(True) |
|
3108 | 3113 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3109 | 3114 | self.specOpCobIncInt.setCurrentIndex(0) |
|
3110 | 3115 | |
|
3111 | 3116 | if parmObj.name == 'n': |
|
3112 | 3117 | value = opObj.getParameterValue(parameterName='n') |
|
3113 | 3118 | value = float(value) |
|
3114 | 3119 | self.specOpIncoherent.setText(str(value)) |
|
3115 | 3120 | self.specOpIncoherent.setEnabled(True) |
|
3116 | 3121 | self.specOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3117 | 3122 | self.specOpCobIncInt.setCurrentIndex(1) |
|
3118 | 3123 | |
|
3119 | 3124 | opObj = puObj.getOperationObj(name="removeDC") |
|
3120 | 3125 | if opObj == None: |
|
3121 | 3126 | self.specOpCebRemoveDC.setCheckState(0) |
|
3122 | 3127 | else: |
|
3123 | 3128 | self.specOpCebRemoveDC.setCheckState(QtCore.Qt.Checked) |
|
3124 | 3129 | value = opObj.getParameterValue(parameterName='mode') |
|
3125 | 3130 | if value == 1: |
|
3126 | 3131 | self.specOpComRemoveDC.setCurrentIndex(0) |
|
3127 | 3132 | elif value == 2: |
|
3128 | 3133 | self.specOpComRemoveDC.setCurrentIndex(1) |
|
3129 | 3134 | |
|
3130 | 3135 | opObj = puObj.getOperationObj(name="removeInterference") |
|
3131 | 3136 | if opObj == None: |
|
3132 | 3137 | self.specOpCebRemoveInt.setCheckState(0) |
|
3133 | 3138 | else: |
|
3134 | 3139 | self.specOpCebRemoveInt.setCheckState(QtCore.Qt.Checked) |
|
3135 | 3140 | |
|
3136 | 3141 | opObj = puObj.getOperationObj(name='getNoise') |
|
3137 | 3142 | if opObj == None: |
|
3138 | 3143 | self.specOpCebgetNoise.setCheckState(0) |
|
3139 | 3144 | self.specOpgetNoise.clear() |
|
3140 | 3145 | else: |
|
3141 | 3146 | self.specOpCebgetNoise.setCheckState(QtCore.Qt.Checked) |
|
3142 | 3147 | parmObj = opObj.getParameterObj(parameterName='minHei') |
|
3143 | 3148 | if parmObj == None: |
|
3144 | 3149 | self.specOpgetNoise.clear() |
|
3145 | 3150 | value1 = None |
|
3146 | 3151 | else: |
|
3147 | 3152 | value1 = opObj.getParameterValue(parameterName='minHei') |
|
3148 | 3153 | value1 = str(value1) |
|
3149 | 3154 | parmObj = opObj.getParameterObj(parameterName='maxHei') |
|
3150 | 3155 | if parmObj == None: |
|
3151 | 3156 | value2 = None |
|
3152 | 3157 | value = value1 |
|
3153 | 3158 | self.specOpgetNoise.setText(value) |
|
3154 | 3159 | self.specOpgetNoise.setEnabled(True) |
|
3155 | 3160 | else: |
|
3156 | 3161 | value2 = opObj.getParameterValue(parameterName='maxHei') |
|
3157 | 3162 | value2 = str(value2) |
|
3158 | 3163 | parmObj = opObj.getParameterObj(parameterName='minVel') |
|
3159 | 3164 | if parmObj == None: |
|
3160 | 3165 | value3 = None |
|
3161 | 3166 | value = value1 + "," + value2 |
|
3162 | 3167 | self.specOpgetNoise.setText(value) |
|
3163 | 3168 | self.specOpgetNoise.setEnabled(True) |
|
3164 | 3169 | else: |
|
3165 | 3170 | value3 = opObj.getParameterValue(parameterName='minVel') |
|
3166 | 3171 | value3 = str(value3) |
|
3167 | 3172 | parmObj = opObj.getParameterObj(parameterName='maxVel') |
|
3168 | 3173 | if parmObj == None: |
|
3169 | 3174 | value4 = None |
|
3170 | 3175 | value = value1 + "," + value2 + "," + value3 |
|
3171 | 3176 | self.specOpgetNoise.setText(value) |
|
3172 | 3177 | self.specOpgetNoise.setEnabled(True) |
|
3173 | 3178 | else: |
|
3174 | 3179 | value4 = opObj.getParameterValue(parameterName='maxVel') |
|
3175 | 3180 | value4 = str(value4) |
|
3176 | 3181 | value = value1 + "," + value2 + "," + value3 + ',' + value4 |
|
3177 | 3182 | self.specOpgetNoise.setText(value) |
|
3178 | 3183 | self.specOpgetNoise.setEnabled(True) |
|
3179 | 3184 | |
|
3180 | 3185 | self.specGraphPath.clear() |
|
3181 | 3186 | self.specGraphPrefix.clear() |
|
3182 | 3187 | self.specGgraphFreq.clear() |
|
3183 | 3188 | self.specGgraphHeight.clear() |
|
3184 | 3189 | self.specGgraphDbsrange.clear() |
|
3185 | 3190 | self.specGgraphmagnitud.clear() |
|
3186 | 3191 | self.specGgraphPhase.clear() |
|
3187 | 3192 | self.specGgraphChannelList.clear() |
|
3188 | 3193 | self.specGgraphTminTmax.clear() |
|
3189 | 3194 | self.specGgraphTimeRange.clear() |
|
3190 | 3195 | self.specGgraphftpratio.clear() |
|
3191 | 3196 | |
|
3192 | 3197 | opObj = puObj.getOperationObj(name='SpectraPlot') |
|
3193 | 3198 | |
|
3194 | 3199 | if opObj == None: |
|
3195 | 3200 | self.specGraphCebSpectraplot.setCheckState(0) |
|
3196 | 3201 | self.specGraphSaveSpectra.setCheckState(0) |
|
3197 | 3202 | self.specGraphftpSpectra.setCheckState(0) |
|
3198 | 3203 | else: |
|
3199 | 3204 | operationSpectraPlot = "Enable" |
|
3200 | 3205 | self.specGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3201 | 3206 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3202 | 3207 | if parmObj == None: |
|
3203 | 3208 | self.specGgraphChannelList.clear() |
|
3204 | 3209 | else: |
|
3205 | 3210 | value = opObj.getParameterValue(parameterName='channelList') |
|
3206 | 3211 | channelListSpectraPlot = str(value)[1:-1] |
|
3207 | 3212 | self.specGgraphChannelList.setText(channelListSpectraPlot) |
|
3208 | 3213 | self.specGgraphChannelList.setEnabled(True) |
|
3209 | 3214 | |
|
3210 | 3215 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3211 | 3216 | if parmObj == None: |
|
3212 | 3217 | self.specGgraphFreq.clear() |
|
3213 | 3218 | else: |
|
3214 | 3219 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3215 | 3220 | value1 = str(value1) |
|
3216 | 3221 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3217 | 3222 | value2 = str(value2) |
|
3218 | 3223 | value = value1 + "," + value2 |
|
3219 | 3224 | self.specGgraphFreq.setText(value) |
|
3220 | 3225 | self.specGgraphFreq.setEnabled(True) |
|
3221 | 3226 | |
|
3222 | 3227 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3223 | 3228 | if parmObj == None: |
|
3224 | 3229 | self.specGgraphHeight.clear() |
|
3225 | 3230 | else: |
|
3226 | 3231 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3227 | 3232 | value1 = str(value1) |
|
3228 | 3233 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3229 | 3234 | value2 = str(value2) |
|
3230 | 3235 | value = value1 + "," + value2 |
|
3231 | 3236 | self.specGgraphHeight.setText(value) |
|
3232 | 3237 | self.specGgraphHeight.setEnabled(True) |
|
3233 | 3238 | |
|
3234 | 3239 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3235 | 3240 | if parmObj == None: |
|
3236 | 3241 | self.specGgraphDbsrange.clear() |
|
3237 | 3242 | else: |
|
3238 | 3243 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3239 | 3244 | value1 = str(value1) |
|
3240 | 3245 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3241 | 3246 | value2 = str(value2) |
|
3242 | 3247 | value = value1 + "," + value2 |
|
3243 | 3248 | self.specGgraphDbsrange.setText(value) |
|
3244 | 3249 | self.specGgraphDbsrange.setEnabled(True) |
|
3245 | 3250 | |
|
3246 | 3251 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3247 | 3252 | if parmObj == None: |
|
3248 | 3253 | self.specGraphSaveSpectra.setCheckState(0) |
|
3249 | 3254 | else: |
|
3250 | 3255 | self.specGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) |
|
3251 | 3256 | |
|
3252 | 3257 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3253 | 3258 | if parmObj == None: |
|
3254 | 3259 | self.specGraphftpSpectra.setCheckState(0) |
|
3255 | 3260 | else: |
|
3256 | 3261 | self.specGraphftpSpectra.setCheckState(QtCore.Qt.Checked) |
|
3257 | 3262 | |
|
3258 | 3263 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3259 | 3264 | if parmObj: |
|
3260 | 3265 | value = parmObj.getValue() |
|
3261 | 3266 | self.specGraphPath.setText(value) |
|
3262 | 3267 | |
|
3263 | 3268 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3264 | 3269 | if parmObj: |
|
3265 | 3270 | value = parmObj.getValue() |
|
3266 | 3271 | self.specGgraphftpratio.setText(str(value)) |
|
3267 | 3272 | |
|
3268 | 3273 | opObj = puObj.getOperationObj(name='CrossSpectraPlot') |
|
3269 | 3274 | |
|
3270 | 3275 | if opObj == None: |
|
3271 | 3276 | self.specGraphCebCrossSpectraplot.setCheckState(0) |
|
3272 | 3277 | self.specGraphSaveCross.setCheckState(0) |
|
3273 | 3278 | self.specGraphftpCross.setCheckState(0) |
|
3274 | 3279 | else: |
|
3275 | 3280 | operationCrossSpectraPlot = "Enable" |
|
3276 | 3281 | self.specGraphCebCrossSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3277 | 3282 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3278 | 3283 | if parmObj == None: |
|
3279 | 3284 | self.specGgraphFreq.clear() |
|
3280 | 3285 | else: |
|
3281 | 3286 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3282 | 3287 | value1 = str(value1) |
|
3283 | 3288 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3284 | 3289 | value2 = str(value2) |
|
3285 | 3290 | value = value1 + "," + value2 |
|
3286 | 3291 | self.specGgraphFreq.setText(value) |
|
3287 | 3292 | self.specGgraphFreq.setEnabled(True) |
|
3288 | 3293 | |
|
3289 | 3294 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3290 | 3295 | if parmObj == None: |
|
3291 | 3296 | self.specGgraphHeight.clear() |
|
3292 | 3297 | else: |
|
3293 | 3298 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3294 | 3299 | value1 = str(value1) |
|
3295 | 3300 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3296 | 3301 | value2 = str(value2) |
|
3297 | 3302 | value = value1 + "," + value2 |
|
3298 | 3303 | self.specGgraphHeight.setText(value) |
|
3299 | 3304 | self.specGgraphHeight.setEnabled(True) |
|
3300 | 3305 | |
|
3301 | 3306 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3302 | 3307 | if parmObj == None: |
|
3303 | 3308 | self.specGgraphDbsrange.clear() |
|
3304 | 3309 | else: |
|
3305 | 3310 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3306 | 3311 | value1 = str(value1) |
|
3307 | 3312 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3308 | 3313 | value2 = str(value2) |
|
3309 | 3314 | value = value1 + "," + value2 |
|
3310 | 3315 | self.specGgraphDbsrange.setText(value) |
|
3311 | 3316 | self.specGgraphDbsrange.setEnabled(True) |
|
3312 | 3317 | |
|
3313 | 3318 | parmObj = opObj.getParameterObj(parameterName='coh_min') |
|
3314 | 3319 | if parmObj == None: |
|
3315 | 3320 | self.specGgraphmagnitud.clear() |
|
3316 | 3321 | else: |
|
3317 | 3322 | value1 = opObj.getParameterValue(parameterName='coh_min') |
|
3318 | 3323 | value1 = str(value1) |
|
3319 | 3324 | value2 = opObj.getParameterValue(parameterName='coh_max') |
|
3320 | 3325 | value2 = str(value2) |
|
3321 | 3326 | value = value1 + "," + value2 |
|
3322 | 3327 | self.specGgraphmagnitud.setText(value) |
|
3323 | 3328 | self.specGgraphmagnitud.setEnabled(True) |
|
3324 | 3329 | |
|
3325 | 3330 | parmObj = opObj.getParameterObj(parameterName='phase_min') |
|
3326 | 3331 | if parmObj == None: |
|
3327 | 3332 | self.specGgraphPhase.clear() |
|
3328 | 3333 | else: |
|
3329 | 3334 | value1 = opObj.getParameterValue(parameterName='phase_min') |
|
3330 | 3335 | value1 = str(value1) |
|
3331 | 3336 | value2 = opObj.getParameterValue(parameterName='phase_max') |
|
3332 | 3337 | value2 = str(value2) |
|
3333 | 3338 | value = value1 + "," + value2 |
|
3334 | 3339 | self.specGgraphPhase.setText(value) |
|
3335 | 3340 | self.specGgraphPhase.setEnabled(True) |
|
3336 | 3341 | |
|
3337 | 3342 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3338 | 3343 | if parmObj == None: |
|
3339 | 3344 | self.specGraphSaveCross.setCheckState(0) |
|
3340 | 3345 | else: |
|
3341 | 3346 | self.specGraphSaveCross.setCheckState(QtCore.Qt.Checked) |
|
3342 | 3347 | |
|
3343 | 3348 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3344 | 3349 | if parmObj == None: |
|
3345 | 3350 | self.specGraphftpCross.setCheckState(0) |
|
3346 | 3351 | else: |
|
3347 | 3352 | self.specGraphftpCross.setCheckState(QtCore.Qt.Checked) |
|
3348 | 3353 | |
|
3349 | 3354 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3350 | 3355 | if parmObj: |
|
3351 | 3356 | value = parmObj.getValue() |
|
3352 | 3357 | self.specGraphPath.setText(value) |
|
3353 | 3358 | |
|
3354 | 3359 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3355 | 3360 | if parmObj: |
|
3356 | 3361 | value = parmObj.getValue() |
|
3357 | 3362 | self.specGgraphftpratio.setText(str(value)) |
|
3358 | 3363 | |
|
3359 | 3364 | opObj = puObj.getOperationObj(name='RTIPlot') |
|
3360 | 3365 | |
|
3361 | 3366 | if opObj == None: |
|
3362 | 3367 | self.specGraphCebRTIplot.setCheckState(0) |
|
3363 | 3368 | self.specGraphSaveRTIplot.setCheckState(0) |
|
3364 | 3369 | self.specGraphftpRTIplot.setCheckState(0) |
|
3365 | 3370 | else: |
|
3366 | 3371 | self.specGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3367 | 3372 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3368 | 3373 | if parmObj == None: |
|
3369 | 3374 | self.specGgraphChannelList.clear() |
|
3370 | 3375 | else: |
|
3371 | 3376 | value = opObj.getParameterValue(parameterName='channelList') |
|
3372 | 3377 | channelListRTIPlot = str(value)[1:-1] |
|
3373 | 3378 | self.specGgraphChannelList.setText(channelListRTIPlot) |
|
3374 | 3379 | self.specGgraphChannelList.setEnabled(True) |
|
3375 | 3380 | |
|
3376 | 3381 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3377 | 3382 | if parmObj == None: |
|
3378 | 3383 | self.specGgraphTminTmax.clear() |
|
3379 | 3384 | else: |
|
3380 | 3385 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3381 | 3386 | value1 = str(value1) |
|
3382 | 3387 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3383 | 3388 | value2 = str(value2) |
|
3384 | 3389 | value = value1 + "," + value2 |
|
3385 | 3390 | self.specGgraphTminTmax.setText(value) |
|
3386 | 3391 | self.specGgraphTminTmax.setEnabled(True) |
|
3387 | 3392 | |
|
3388 | 3393 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3389 | 3394 | if parmObj == None: |
|
3390 | 3395 | self.specGgraphTimeRange.clear() |
|
3391 | 3396 | else: |
|
3392 | 3397 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3393 | 3398 | value1 = str(value1) |
|
3394 | 3399 | self.specGgraphTimeRange.setText(value1) |
|
3395 | 3400 | self.specGgraphTimeRange.setEnabled(True) |
|
3396 | 3401 | |
|
3397 | 3402 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3398 | 3403 | if parmObj == None: |
|
3399 | 3404 | self.specGgraphHeight.clear() |
|
3400 | 3405 | else: |
|
3401 | 3406 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3402 | 3407 | value1 = str(value1) |
|
3403 | 3408 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3404 | 3409 | value2 = str(value2) |
|
3405 | 3410 | value = value1 + "," + value2 |
|
3406 | 3411 | self.specGgraphHeight.setText(value) |
|
3407 | 3412 | self.specGgraphHeight.setEnabled(True) |
|
3408 | 3413 | |
|
3409 | 3414 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3410 | 3415 | if parmObj == None: |
|
3411 | 3416 | self.specGgraphDbsrange.clear() |
|
3412 | 3417 | else: |
|
3413 | 3418 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3414 | 3419 | value1 = str(value1) |
|
3415 | 3420 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3416 | 3421 | value2 = str(value2) |
|
3417 | 3422 | value = value1 + "," + value2 |
|
3418 | 3423 | self.specGgraphDbsrange.setText(value) |
|
3419 | 3424 | self.specGgraphDbsrange.setEnabled(True) |
|
3420 | 3425 | |
|
3421 | 3426 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3422 | 3427 | if parmObj == None: |
|
3423 | 3428 | self.specGraphSaveRTIplot.setCheckState(0) |
|
3424 | 3429 | else: |
|
3425 | 3430 | self.specGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3426 | 3431 | |
|
3427 | 3432 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3428 | 3433 | if parmObj == None: |
|
3429 | 3434 | self.specGraphftpRTIplot.setCheckState(0) |
|
3430 | 3435 | else: |
|
3431 | 3436 | self.specGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3432 | 3437 | |
|
3433 | 3438 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3434 | 3439 | if parmObj: |
|
3435 | 3440 | value = parmObj.getValue() |
|
3436 | 3441 | self.specGraphPath.setText(value) |
|
3437 | 3442 | |
|
3438 | 3443 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3439 | 3444 | if parmObj: |
|
3440 | 3445 | value = parmObj.getValue() |
|
3441 | 3446 | self.specGgraphftpratio.setText(str(value)) |
|
3442 | 3447 | |
|
3443 | 3448 | opObj = puObj.getOperationObj(name='CoherenceMap') |
|
3444 | 3449 | |
|
3445 | 3450 | if opObj == None: |
|
3446 | 3451 | self.specGraphCebCoherencmap.setCheckState(0) |
|
3447 | 3452 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
3448 | 3453 | self.specGraphftpCoherencemap.setCheckState(0) |
|
3449 | 3454 | else: |
|
3450 | 3455 | operationCoherenceMap = "Enable" |
|
3451 | 3456 | self.specGraphCebCoherencmap.setCheckState(QtCore.Qt.Checked) |
|
3452 | 3457 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3453 | 3458 | if parmObj == None: |
|
3454 | 3459 | self.specGgraphTminTmax.clear() |
|
3455 | 3460 | else: |
|
3456 | 3461 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3457 | 3462 | value1 = str(value1) |
|
3458 | 3463 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3459 | 3464 | value2 = str(value2) |
|
3460 | 3465 | value = value1 + "," + value2 |
|
3461 | 3466 | self.specGgraphTminTmax.setText(value) |
|
3462 | 3467 | self.specGgraphTminTmax.setEnabled(True) |
|
3463 | 3468 | |
|
3464 | 3469 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3465 | 3470 | if parmObj == None: |
|
3466 | 3471 | self.specGgraphTimeRange.clear() |
|
3467 | 3472 | else: |
|
3468 | 3473 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3469 | 3474 | value1 = str(value1) |
|
3470 | 3475 | self.specGgraphTimeRange.setText(value1) |
|
3471 | 3476 | self.specGgraphTimeRange.setEnabled(True) |
|
3472 | 3477 | |
|
3473 | 3478 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3474 | 3479 | if parmObj == None: |
|
3475 | 3480 | self.specGgraphHeight.clear() |
|
3476 | 3481 | else: |
|
3477 | 3482 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3478 | 3483 | value1 = str(value1) |
|
3479 | 3484 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3480 | 3485 | value2 = str(value2) |
|
3481 | 3486 | value = value1 + "," + value2 |
|
3482 | 3487 | self.specGgraphHeight.setText(value) |
|
3483 | 3488 | self.specGgraphHeight.setEnabled(True) |
|
3484 | 3489 | |
|
3485 | 3490 | parmObj = opObj.getParameterObj(parameterName='zmin') |
|
3486 | 3491 | if parmObj == None: |
|
3487 | 3492 | self.specGgraphmagnitud.clear() |
|
3488 | 3493 | else: |
|
3489 | 3494 | value1 = opObj.getParameterValue(parameterName='zmin') |
|
3490 | 3495 | value1 = str(value1) |
|
3491 | 3496 | value2 = opObj.getParameterValue(parameterName='zmax') |
|
3492 | 3497 | value2 = str(value2) |
|
3493 | 3498 | value = value1 + "," + value2 |
|
3494 | 3499 | self.specGgraphmagnitud.setText(value) |
|
3495 | 3500 | self.specGgraphmagnitud.setEnabled(True) |
|
3496 | 3501 | |
|
3497 | 3502 | parmObj = opObj.getParameterObj(parameterName='coh_min') |
|
3498 | 3503 | if parmObj == None: |
|
3499 | 3504 | self.specGgraphmagnitud.clear() |
|
3500 | 3505 | else: |
|
3501 | 3506 | value1 = opObj.getParameterValue(parameterName='coh_min') |
|
3502 | 3507 | value1 = str(value1) |
|
3503 | 3508 | value2 = opObj.getParameterValue(parameterName='coh_max') |
|
3504 | 3509 | value2 = str(value2) |
|
3505 | 3510 | value = value1 + "," + value2 |
|
3506 | 3511 | self.specGgraphmagnitud.setText(value) |
|
3507 | 3512 | self.specGgraphmagnitud.setEnabled(True) |
|
3508 | 3513 | |
|
3509 | 3514 | parmObj = opObj.getParameterObj(parameterName='phase_min') |
|
3510 | 3515 | if parmObj == None: |
|
3511 | 3516 | self.specGgraphPhase.clear() |
|
3512 | 3517 | else: |
|
3513 | 3518 | value1 = opObj.getParameterValue(parameterName='phase_min') |
|
3514 | 3519 | value1 = str(value1) |
|
3515 | 3520 | value2 = opObj.getParameterValue(parameterName='phase_max') |
|
3516 | 3521 | value2 = str(value2) |
|
3517 | 3522 | value = value1 + "," + value2 |
|
3518 | 3523 | self.specGgraphPhase.setText(value) |
|
3519 | 3524 | self.specGgraphPhase.setEnabled(True) |
|
3520 | 3525 | |
|
3521 | 3526 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3522 | 3527 | if parmObj == None: |
|
3523 | 3528 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
3524 | 3529 | else: |
|
3525 | 3530 | self.specGraphSaveCoherencemap.setCheckState(QtCore.Qt.Checked) |
|
3526 | 3531 | |
|
3527 | 3532 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3528 | 3533 | if parmObj == None: |
|
3529 | 3534 | self.specGraphftpCoherencemap.setCheckState(0) |
|
3530 | 3535 | else: |
|
3531 | 3536 | self.specGraphftpCoherencemap.setCheckState(QtCore.Qt.Checked) |
|
3532 | 3537 | |
|
3533 | 3538 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3534 | 3539 | if parmObj: |
|
3535 | 3540 | value = parmObj.getValue() |
|
3536 | 3541 | self.specGraphPath.setText(value) |
|
3537 | 3542 | |
|
3538 | 3543 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3539 | 3544 | if parmObj: |
|
3540 | 3545 | value = parmObj.getValue() |
|
3541 | 3546 | self.specGgraphftpratio.setText(str(value)) |
|
3542 | 3547 | |
|
3543 | 3548 | opObj = puObj.getOperationObj(name='PowerProfilePlot') |
|
3544 | 3549 | |
|
3545 | 3550 | if opObj == None: |
|
3546 | 3551 | self.specGraphPowerprofile.setCheckState(0) |
|
3547 | 3552 | self.specGraphSavePowerprofile.setCheckState(0) |
|
3548 | 3553 | self.specGraphftpPowerprofile.setCheckState(0) |
|
3549 | 3554 | operationPowerProfilePlot = "Disabled" |
|
3550 | 3555 | channelList = None |
|
3551 | 3556 | freq_vel = None |
|
3552 | 3557 | heightsrange = None |
|
3553 | 3558 | else: |
|
3554 | 3559 | operationPowerProfilePlot = "Enable" |
|
3555 | 3560 | self.specGraphPowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3556 | 3561 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3557 | 3562 | if parmObj == None: |
|
3558 | 3563 | self.specGgraphDbsrange.clear() |
|
3559 | 3564 | else: |
|
3560 | 3565 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3561 | 3566 | value1 = str(value1) |
|
3562 | 3567 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3563 | 3568 | value2 = str(value2) |
|
3564 | 3569 | value = value1 + "," + value2 |
|
3565 | 3570 | self.specGgraphDbsrange.setText(value) |
|
3566 | 3571 | self.specGgraphDbsrange.setEnabled(True) |
|
3567 | 3572 | |
|
3568 | 3573 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3569 | 3574 | if parmObj == None: |
|
3570 | 3575 | self.specGgraphHeight.clear() |
|
3571 | 3576 | else: |
|
3572 | 3577 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3573 | 3578 | value1 = str(value1) |
|
3574 | 3579 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3575 | 3580 | value2 = str(value2) |
|
3576 | 3581 | value = value1 + "," + value2 |
|
3577 | 3582 | self.specGgraphHeight.setText(value) |
|
3578 | 3583 | self.specGgraphHeight.setEnabled(True) |
|
3579 | 3584 | |
|
3580 | 3585 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3581 | 3586 | if parmObj == None: |
|
3582 | 3587 | self.specGraphSavePowerprofile.setCheckState(0) |
|
3583 | 3588 | else: |
|
3584 | 3589 | self.specGraphSavePowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3585 | 3590 | |
|
3586 | 3591 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3587 | 3592 | if parmObj == None: |
|
3588 | 3593 | self.specGraphftpPowerprofile.setCheckState(0) |
|
3589 | 3594 | else: |
|
3590 | 3595 | self.specGraphftpPowerprofile.setCheckState(QtCore.Qt.Checked) |
|
3591 | 3596 | |
|
3592 | 3597 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3593 | 3598 | if parmObj: |
|
3594 | 3599 | value = parmObj.getValue() |
|
3595 | 3600 | self.specGraphPath.setText(value) |
|
3596 | 3601 | |
|
3597 | 3602 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3598 | 3603 | if parmObj: |
|
3599 | 3604 | value = parmObj.getValue() |
|
3600 | 3605 | self.specGgraphftpratio.setText(str(value)) |
|
3601 | 3606 | |
|
3602 | 3607 | opObj = puObj.getOperationObj(name='Noise') |
|
3603 | 3608 | |
|
3604 | 3609 | if opObj == None: |
|
3605 | 3610 | self.specGraphCebRTInoise.setCheckState(0) |
|
3606 | 3611 | self.specGraphSaveRTInoise.setCheckState(0) |
|
3607 | 3612 | self.specGraphftpRTInoise.setCheckState(0) |
|
3608 | 3613 | else: |
|
3609 | 3614 | self.specGraphCebRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3610 | 3615 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3611 | 3616 | if parmObj == None: |
|
3612 | 3617 | self.specGgraphChannelList.clear() |
|
3613 | 3618 | else: |
|
3614 | 3619 | value = opObj.getParameterValue(parameterName='channelList') |
|
3615 | 3620 | channelListRTINoise = str(value)[1:-1] |
|
3616 | 3621 | self.specGgraphChannelList.setText(channelListRTINoise) |
|
3617 | 3622 | self.specGgraphChannelList.setEnabled(True) |
|
3618 | 3623 | |
|
3619 | 3624 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3620 | 3625 | if parmObj == None: |
|
3621 | 3626 | self.specGgraphTminTmax.clear() |
|
3622 | 3627 | else: |
|
3623 | 3628 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3624 | 3629 | value1 = str(value1) |
|
3625 | 3630 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3626 | 3631 | value2 = str(value2) |
|
3627 | 3632 | value = value1 + "," + value2 |
|
3628 | 3633 | self.specGgraphTminTmax.setText(value) |
|
3629 | 3634 | self.specGgraphTminTmax.setEnabled(True) |
|
3630 | 3635 | |
|
3631 | 3636 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3632 | 3637 | if parmObj == None: |
|
3633 | 3638 | self.specGgraphTimeRange.clear() |
|
3634 | 3639 | else: |
|
3635 | 3640 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3636 | 3641 | value1 = str(value1) |
|
3637 | 3642 | self.specGgraphTimeRange.setText(value1) |
|
3638 | 3643 | self.specGgraphTimeRange.setEnabled(True) |
|
3639 | 3644 | |
|
3640 | 3645 | |
|
3641 | 3646 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3642 | 3647 | if parmObj == None: |
|
3643 | 3648 | self.specGgraphDbsrange.clear() |
|
3644 | 3649 | else: |
|
3645 | 3650 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3646 | 3651 | value1 = str(value1) |
|
3647 | 3652 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3648 | 3653 | value2 = str(value2) |
|
3649 | 3654 | value = value1 + "," + value2 |
|
3650 | 3655 | self.specGgraphDbsrange.setText(value) |
|
3651 | 3656 | self.specGgraphDbsrange.setEnabled(True) |
|
3652 | 3657 | |
|
3653 | 3658 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3654 | 3659 | if parmObj == None: |
|
3655 | 3660 | self.specGraphSaveRTInoise.setCheckState(0) |
|
3656 | 3661 | else: |
|
3657 | 3662 | self.specGraphSaveRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3658 | 3663 | |
|
3659 | 3664 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3660 | 3665 | if parmObj == None: |
|
3661 | 3666 | self.specGraphftpRTInoise.setCheckState(0) |
|
3662 | 3667 | else: |
|
3663 | 3668 | self.specGraphftpRTInoise.setCheckState(QtCore.Qt.Checked) |
|
3664 | 3669 | |
|
3665 | 3670 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3666 | 3671 | if parmObj: |
|
3667 | 3672 | value = parmObj.getValue() |
|
3668 | 3673 | self.specGraphPath.setText(value) |
|
3669 | 3674 | |
|
3670 | 3675 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3671 | 3676 | if parmObj: |
|
3672 | 3677 | value = parmObj.getValue() |
|
3673 | 3678 | self.specGgraphftpratio.setText(str(value)) |
|
3674 | 3679 | |
|
3675 | 3680 | opObj = puObj.getOperationObj(name='SpectraWriter') |
|
3676 | 3681 | if opObj == None: |
|
3677 | 3682 | self.specOutputPath.clear() |
|
3678 | 3683 | self.specOutputblocksperfile.clear() |
|
3679 | 3684 | else: |
|
3680 | 3685 | value = opObj.getParameterObj(parameterName='path') |
|
3681 | 3686 | if value == None: |
|
3682 | 3687 | self.specOutputPath.clear() |
|
3683 | 3688 | else: |
|
3684 | 3689 | value = opObj.getParameterValue(parameterName='path') |
|
3685 | 3690 | path = str(value) |
|
3686 | 3691 | self.specOutputPath.setText(path) |
|
3687 | 3692 | value = opObj.getParameterObj(parameterName='blocksPerFile') |
|
3688 | 3693 | if value == None: |
|
3689 | 3694 | self.specOutputblocksperfile.clear() |
|
3690 | 3695 | else: |
|
3691 | 3696 | value = opObj.getParameterValue(parameterName='blocksPerFile') |
|
3692 | 3697 | blocksperfile = str(value) |
|
3693 | 3698 | self.specOutputblocksperfile.setText(blocksperfile) |
|
3694 | 3699 | |
|
3695 | 3700 | return |
|
3696 | 3701 | |
|
3697 | 3702 | def __refreshSpectraHeisWindow(self, puObj): |
|
3698 | 3703 | |
|
3699 | 3704 | opObj = puObj.getOperationObj(name="IncohInt4SpectraHeis") |
|
3700 | 3705 | if opObj == None: |
|
3701 | 3706 | self.specHeisOpIncoherent.clear() |
|
3702 | 3707 | self.specHeisOpCebIncoherent.setCheckState(0) |
|
3703 | 3708 | else: |
|
3704 | 3709 | for parmObj in opObj.getParameterObjList(): |
|
3705 | 3710 | if parmObj.name == 'timeInterval': |
|
3706 | 3711 | value = opObj.getParameterValue(parameterName='timeInterval') |
|
3707 | 3712 | value = float(value) |
|
3708 | 3713 | self.specHeisOpIncoherent.setText(str(value)) |
|
3709 | 3714 | self.specHeisOpIncoherent.setEnabled(True) |
|
3710 | 3715 | self.specHeisOpCebIncoherent.setCheckState(QtCore.Qt.Checked) |
|
3711 | 3716 | self.specHeisOpCobIncInt.setCurrentIndex(0) |
|
3712 | 3717 | |
|
3713 | 3718 | # SpectraHeis Graph |
|
3714 | 3719 | |
|
3715 | 3720 | self.specHeisGgraphXminXmax.clear() |
|
3716 | 3721 | self.specHeisGgraphYminYmax.clear() |
|
3717 | 3722 | |
|
3718 | 3723 | self.specHeisGgraphChannelList.clear() |
|
3719 | 3724 | self.specHeisGgraphTminTmax.clear() |
|
3720 | 3725 | self.specHeisGgraphTimeRange.clear() |
|
3721 | 3726 | self.specHeisGgraphftpratio.clear() |
|
3722 | 3727 | |
|
3723 | 3728 | opObj = puObj.getOperationObj(name='SpectraHeisScope') |
|
3724 | 3729 | if opObj == None: |
|
3725 | 3730 | self.specHeisGraphCebSpectraplot.setCheckState(0) |
|
3726 | 3731 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
3727 | 3732 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
3728 | 3733 | else: |
|
3729 | 3734 | operationSpectraHeisScope = "Enable" |
|
3730 | 3735 | self.specHeisGraphCebSpectraplot.setCheckState(QtCore.Qt.Checked) |
|
3731 | 3736 | |
|
3732 | 3737 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3733 | 3738 | if parmObj == None: |
|
3734 | 3739 | self.specHeisGgraphChannelList.clear() |
|
3735 | 3740 | else: |
|
3736 | 3741 | value = opObj.getParameterValue(parameterName='channelList') |
|
3737 | 3742 | channelListSpectraHeisScope = str(value)[1:-1] |
|
3738 | 3743 | self.specHeisGgraphChannelList.setText(channelListSpectraHeisScope) |
|
3739 | 3744 | self.specHeisGgraphChannelList.setEnabled(True) |
|
3740 | 3745 | |
|
3741 | 3746 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3742 | 3747 | if parmObj == None: |
|
3743 | 3748 | self.specHeisGgraphXminXmax.clear() |
|
3744 | 3749 | else: |
|
3745 | 3750 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3746 | 3751 | value1 = str(value1) |
|
3747 | 3752 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3748 | 3753 | value2 = str(value2) |
|
3749 | 3754 | value = value1 + "," + value2 |
|
3750 | 3755 | self.specHeisGgraphXminXmax.setText(value) |
|
3751 | 3756 | self.specHeisGgraphXminXmax.setEnabled(True) |
|
3752 | 3757 | |
|
3753 | 3758 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3754 | 3759 | if parmObj == None: |
|
3755 | 3760 | self.specHeisGgraphYminYmax.clear() |
|
3756 | 3761 | else: |
|
3757 | 3762 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3758 | 3763 | value1 = str(value1) |
|
3759 | 3764 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3760 | 3765 | value2 = str(value2) |
|
3761 | 3766 | value = value1 + "," + value2 |
|
3762 | 3767 | self.specHeisGgraphYminYmax.setText(value) |
|
3763 | 3768 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
3764 | 3769 | |
|
3765 | 3770 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3766 | 3771 | if parmObj == None: |
|
3767 | 3772 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
3768 | 3773 | else: |
|
3769 | 3774 | self.specHeisGraphSaveSpectra.setCheckState(QtCore.Qt.Checked) |
|
3770 | 3775 | |
|
3771 | 3776 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3772 | 3777 | if parmObj == None: |
|
3773 | 3778 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
3774 | 3779 | else: |
|
3775 | 3780 | self.specHeisGraphftpSpectra.setCheckState(QtCore.Qt.Checked) |
|
3776 | 3781 | |
|
3777 | 3782 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3778 | 3783 | if parmObj: |
|
3779 | 3784 | value = parmObj.getValue() |
|
3780 | 3785 | self.specHeisGraphPath.setText(value) |
|
3781 | 3786 | |
|
3782 | 3787 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3783 | 3788 | if parmObj: |
|
3784 | 3789 | value = parmObj.getValue() |
|
3785 | 3790 | self.specHeisGgraphftpratio.setText(str(value)) |
|
3786 | 3791 | |
|
3787 | 3792 | opObj = puObj.getOperationObj(name='RTIfromSpectraHeis') |
|
3788 | 3793 | |
|
3789 | 3794 | if opObj == None: |
|
3790 | 3795 | self.specHeisGraphCebRTIplot.setCheckState(0) |
|
3791 | 3796 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
3792 | 3797 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
3793 | 3798 | else: |
|
3794 | 3799 | self.specHeisGraphCebRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3795 | 3800 | parmObj = opObj.getParameterObj(parameterName='channelList') |
|
3796 | 3801 | if parmObj == None: |
|
3797 | 3802 | self.specHeisGgraphChannelList.clear() |
|
3798 | 3803 | else: |
|
3799 | 3804 | value = opObj.getParameterValue(parameterName='channelList') |
|
3800 | 3805 | channelListRTIPlot = str(value)[1:-1] |
|
3801 | 3806 | self.specGgraphChannelList.setText(channelListRTIPlot) |
|
3802 | 3807 | self.specGgraphChannelList.setEnabled(True) |
|
3803 | 3808 | |
|
3804 | 3809 | parmObj = opObj.getParameterObj(parameterName='xmin') |
|
3805 | 3810 | if parmObj == None: |
|
3806 | 3811 | self.specHeisGgraphTminTmax.clear() |
|
3807 | 3812 | else: |
|
3808 | 3813 | value1 = opObj.getParameterValue(parameterName='xmin') |
|
3809 | 3814 | value1 = str(value1) |
|
3810 | 3815 | value2 = opObj.getParameterValue(parameterName='xmax') |
|
3811 | 3816 | value2 = str(value2) |
|
3812 | 3817 | value = value1 + "," + value2 |
|
3813 | 3818 | self.specHeisGgraphTminTmax.setText(value) |
|
3814 | 3819 | self.specHeisGgraphTminTmax.setEnabled(True) |
|
3815 | 3820 | |
|
3816 | 3821 | parmObj = opObj.getParameterObj(parameterName='timerange') |
|
3817 | 3822 | if parmObj == None: |
|
3818 | 3823 | self.specGgraphTimeRange.clear() |
|
3819 | 3824 | else: |
|
3820 | 3825 | value1 = opObj.getParameterValue(parameterName='timerange') |
|
3821 | 3826 | value1 = str(value1) |
|
3822 | 3827 | self.specHeisGgraphTimeRange.setText(value1) |
|
3823 | 3828 | self.specHeisGgraphTimeRange.setEnabled(True) |
|
3824 | 3829 | |
|
3825 | 3830 | parmObj = opObj.getParameterObj(parameterName='ymin') |
|
3826 | 3831 | if parmObj == None: |
|
3827 | 3832 | self.specHeisGgraphYminYmax.clear() |
|
3828 | 3833 | else: |
|
3829 | 3834 | value1 = opObj.getParameterValue(parameterName='ymin') |
|
3830 | 3835 | value1 = str(value1) |
|
3831 | 3836 | value2 = opObj.getParameterValue(parameterName='ymax') |
|
3832 | 3837 | value2 = str(value2) |
|
3833 | 3838 | value = value1 + "," + value2 |
|
3834 | 3839 | self.specHeisGgraphYminYmax.setText(value) |
|
3835 | 3840 | self.specHeisGgraphYminYmax.setEnabled(True) |
|
3836 | 3841 | |
|
3837 | 3842 | parmObj = opObj.getParameterObj(parameterName="save") |
|
3838 | 3843 | if parmObj == None: |
|
3839 | 3844 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
3840 | 3845 | else: |
|
3841 | 3846 | self.specHeisGraphSaveRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3842 | 3847 | |
|
3843 | 3848 | parmObj = opObj.getParameterObj(parameterName="ftp") |
|
3844 | 3849 | if parmObj == None: |
|
3845 | 3850 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
3846 | 3851 | else: |
|
3847 | 3852 | self.specHeisGraphftpRTIplot.setCheckState(QtCore.Qt.Checked) |
|
3848 | 3853 | |
|
3849 | 3854 | parmObj = opObj.getParameterObj(parameterName="figpath") |
|
3850 | 3855 | if parmObj: |
|
3851 | 3856 | value = parmObj.getValue() |
|
3852 | 3857 | self.specHeisGraphPath.setText(value) |
|
3853 | 3858 | |
|
3854 | 3859 | parmObj = opObj.getParameterObj(parameterName="wr_period") |
|
3855 | 3860 | if parmObj: |
|
3856 | 3861 | value = parmObj.getValue() |
|
3857 | 3862 | self.specHeisGgraphftpratio.setText(str(value)) |
|
3858 | 3863 | |
|
3859 | 3864 | # outputSpectraHeisWrite |
|
3860 | 3865 | opObj = puObj.getOperationObj(name='FitsWriter') |
|
3861 | 3866 | if opObj == None: |
|
3862 | 3867 | self.specHeisOutputPath.clear() |
|
3863 | 3868 | self.specHeisOutputblocksperfile.clear() |
|
3864 | 3869 | self.specHeisOutputMetada.clear() |
|
3865 | 3870 | else: |
|
3866 | 3871 | value = opObj.getParameterObj(parameterName='path') |
|
3867 | 3872 | if value == None: |
|
3868 | 3873 | self.specHeisOutputPath.clear() |
|
3869 | 3874 | else: |
|
3870 | 3875 | value = opObj.getParameterValue(parameterName='path') |
|
3871 | 3876 | path = str(value) |
|
3872 | 3877 | self.specHeisOutputPath.setText(path) |
|
3873 | 3878 | value = opObj.getParameterObj(parameterName='dataBlocksPerFile') |
|
3874 | 3879 | if value == None: |
|
3875 | 3880 | self.specHeisOutputblocksperfile.clear() |
|
3876 | 3881 | else: |
|
3877 | 3882 | value = opObj.getParameterValue(parameterName='dataBlocksPerFile') |
|
3878 | 3883 | blocksperfile = str(value) |
|
3879 | 3884 | self.specHeisOutputblocksperfile.setText(blocksperfile) |
|
3880 | 3885 | value = opObj.getParameterObj(parameterName='metadatafile') |
|
3881 | 3886 | if value == None: |
|
3882 | 3887 | self.specHeisOutputMetada.clear() |
|
3883 | 3888 | else: |
|
3884 | 3889 | value = opObj.getParameterValue(parameterName='metadatafile') |
|
3885 | metada = str(value) | |
|
3886 | self.specHeisOutputMetada.setText(metada) | |
|
3890 | metadata_file = str(value) | |
|
3891 | self.specHeisOutputMetada.setText(metadata_file) | |
|
3887 | 3892 | |
|
3888 | 3893 | return |
|
3889 | 3894 | |
|
3890 | 3895 | def __refreshCorrelationWindow(self, puObj): |
|
3891 | 3896 | pass |
|
3892 | 3897 | |
|
3893 | 3898 | def refreshPUWindow(self, puObj): |
|
3894 | 3899 | |
|
3895 | 3900 | if puObj.datatype == 'Voltage': |
|
3896 | 3901 | self.__refreshVoltageWindow(puObj) |
|
3897 | 3902 | |
|
3898 | 3903 | if puObj.datatype == 'Spectra': |
|
3899 | 3904 | self.__refreshSpectraWindow(puObj) |
|
3900 | 3905 | |
|
3901 | 3906 | if puObj.datatype == 'SpectraHeis': |
|
3902 | 3907 | self.__refreshSpectraHeisWindow(puObj) |
|
3903 | 3908 | |
|
3904 | 3909 | def refreshProjectProperties(self, projectObjView): |
|
3905 | 3910 | |
|
3906 | 3911 | propertyBuffObj = PropertyBuffer() |
|
3907 | 3912 | name = projectObjView.name |
|
3908 | 3913 | |
|
3909 | 3914 | propertyBuffObj.append("Properties", "Name", projectObjView.name), |
|
3910 | 3915 | propertyBuffObj.append("Properties", "Description", projectObjView.description) |
|
3911 | 3916 | propertyBuffObj.append("Properties", "Workspace", self.pathWorkSpace) |
|
3912 | 3917 | |
|
3913 | 3918 | readUnitObj = projectObjView.getReadUnitObj() |
|
3914 | 3919 | runOperationObj = readUnitObj.getOperationObj(name='run') |
|
3915 | 3920 | |
|
3916 | 3921 | for thisParmObj in runOperationObj.getParameterObjList(): |
|
3917 | 3922 | propertyBuffObj.append("Reading parms", thisParmObj.name, str(thisParmObj.getValue())) |
|
3918 | 3923 | |
|
3919 | 3924 | propertiesModel = propertyBuffObj.getPropertyModel() |
|
3920 | 3925 | |
|
3921 | 3926 | self.treeProjectProperties.setModel(propertiesModel) |
|
3922 | 3927 | self.treeProjectProperties.expandAll() |
|
3923 | 3928 | self.treeProjectProperties.resizeColumnToContents(0) |
|
3924 | 3929 | self.treeProjectProperties.resizeColumnToContents(1) |
|
3925 | 3930 | |
|
3926 | 3931 | def refreshPUProperties(self, puObjView): |
|
3927 | 3932 | |
|
3928 | 3933 | ############ FTP CONFIG ################################ |
|
3929 | 3934 | #Deleting FTP Conf. This processing unit have not got any |
|
3930 | 3935 | #FTP configuration by default |
|
3931 | 3936 | if puObjView.id in self.__puLocalFolder2FTP.keys(): |
|
3932 | 3937 | self.__puLocalFolder2FTP.pop(puObjView.id) |
|
3933 | 3938 | ######################################################## |
|
3934 | 3939 | |
|
3935 | 3940 | propertyBuffObj = PropertyBuffer() |
|
3936 | 3941 | |
|
3937 | 3942 | for thisOp in puObjView.getOperationObjList(): |
|
3938 | 3943 | |
|
3939 | 3944 | operationName = thisOp.name |
|
3940 | 3945 | |
|
3941 | 3946 | if operationName == 'run': |
|
3942 | 3947 | operationName = 'Properties' |
|
3943 | 3948 | |
|
3944 | 3949 | else: |
|
3945 | 3950 | if not thisOp.getParameterObjList(): |
|
3946 | 3951 | propertyBuffObj.append(operationName, '--', '--') |
|
3947 | 3952 | continue |
|
3948 | 3953 | |
|
3949 | 3954 | for thisParmObj in thisOp.getParameterObjList(): |
|
3950 | 3955 | propertyBuffObj.append(operationName, thisParmObj.name, str(thisParmObj.getValue())) |
|
3951 | 3956 | |
|
3952 | 3957 | ############ FTP CONFIG ################################ |
|
3953 | 3958 | if thisParmObj.name == "ftp_wei" and thisParmObj.getValue(): |
|
3954 | 3959 | value = thisParmObj.getValue() |
|
3955 | 3960 | self.temporalFTP.ftp_wei = value |
|
3956 | 3961 | |
|
3957 | 3962 | if thisParmObj.name == "exp_code" and thisParmObj.getValue(): |
|
3958 | 3963 | value = thisParmObj.getValue() |
|
3959 | 3964 | self.temporalFTP.exp_code = value |
|
3960 | 3965 | |
|
3961 | 3966 | if thisParmObj.name == "sub_exp_code" and thisParmObj.getValue(): |
|
3962 | 3967 | value = thisParmObj.getValue() |
|
3963 | 3968 | self.temporalFTP.sub_exp_code = value |
|
3964 | 3969 | |
|
3965 | 3970 | if thisParmObj.name == "plot_pos" and thisParmObj.getValue(): |
|
3966 | 3971 | value = thisParmObj.getValue() |
|
3967 | 3972 | self.temporalFTP.plot_pos = value |
|
3968 | 3973 | |
|
3969 | 3974 | if thisParmObj.name == 'ftp' and thisParmObj.getValue(): |
|
3970 | 3975 | figpathObj = thisOp.getParameterObj('figpath') |
|
3971 | 3976 | if figpathObj: |
|
3972 | 3977 | self.__puLocalFolder2FTP[puObjView.id] = figpathObj.getValue() |
|
3973 | 3978 | |
|
3974 | 3979 | ######################################################## |
|
3975 | 3980 | |
|
3976 | 3981 | propertiesModel = propertyBuffObj.getPropertyModel() |
|
3977 | 3982 | |
|
3978 | 3983 | self.treeProjectProperties.setModel(propertiesModel) |
|
3979 | 3984 | self.treeProjectProperties.expandAll() |
|
3980 | 3985 | self.treeProjectProperties.resizeColumnToContents(0) |
|
3981 | 3986 | self.treeProjectProperties.resizeColumnToContents(1) |
|
3982 | 3987 | |
|
3983 | 3988 | def refreshGraphicsId(self): |
|
3984 | 3989 | |
|
3985 | 3990 | projectObj = self.getSelectedProjectObj() |
|
3986 | 3991 | |
|
3987 | 3992 | if not projectObj: |
|
3988 | 3993 | return |
|
3989 | 3994 | |
|
3990 | 3995 | for idPU, puObj in projectObj.procUnitConfObjDict.items(): |
|
3991 | 3996 | |
|
3992 | 3997 | for opObj in puObj.getOperationObjList(): |
|
3993 | 3998 | |
|
3994 | 3999 | if opObj.name not in ('Scope', 'SpectraPlot', 'CrossSpectraPlot', 'RTIPlot', 'CoherenceMap', 'PowerProfilePlot', 'Noise', 'SpectraHeisScope', 'RTIfromSpectraHeis'): |
|
3995 | 4000 | continue |
|
3996 | 4001 | |
|
3997 | 4002 | opObj.changeParameter(name='id', value=opObj.id, format='int') |
|
3998 | 4003 | |
|
3999 | 4004 | def on_click(self, index): |
|
4000 | 4005 | |
|
4001 | 4006 | self.selectedItemTree = self.projectExplorerModel.itemFromIndex(index) |
|
4002 | 4007 | |
|
4003 | 4008 | projectObjView = self.getSelectedProjectObj() |
|
4004 | 4009 | |
|
4005 | 4010 | if not projectObjView: |
|
4006 | 4011 | return |
|
4007 | 4012 | |
|
4008 | 4013 | self.create = False |
|
4009 | 4014 | selectedObjView = self.getSelectedItemObj() |
|
4010 | 4015 | |
|
4011 | 4016 | #A project has been selected |
|
4012 | 4017 | if projectObjView == selectedObjView: |
|
4013 | 4018 | |
|
4014 | 4019 | self.refreshProjectWindow(projectObjView) |
|
4015 | 4020 | self.refreshProjectProperties(projectObjView) |
|
4016 | 4021 | |
|
4017 | 4022 | self.tabProject.setEnabled(True) |
|
4018 | 4023 | self.tabVoltage.setEnabled(False) |
|
4019 | 4024 | self.tabSpectra.setEnabled(False) |
|
4020 | 4025 | self.tabCorrelation.setEnabled(False) |
|
4021 | 4026 | self.tabSpectraHeis.setEnabled(False) |
|
4022 | 4027 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
4023 | 4028 | |
|
4024 | 4029 | return |
|
4025 | 4030 | |
|
4026 | 4031 | #A processing unit has been selected |
|
4027 | 4032 | voltEnable = False |
|
4028 | 4033 | specEnable = False |
|
4029 | 4034 | corrEnable = False |
|
4030 | 4035 | specHeisEnable = False |
|
4031 | 4036 | tabSelected = self.tabProject |
|
4032 | 4037 | |
|
4033 | 4038 | puObj = selectedObjView |
|
4034 | 4039 | |
|
4035 | 4040 | self.refreshPUWindow(puObj) |
|
4036 | 4041 | self.refreshPUProperties(puObj) |
|
4037 | 4042 | self.showtabPUCreated(puObj.datatype) |
|
4038 | 4043 | |
|
4039 | 4044 | def on_right_click(self, pos): |
|
4040 | 4045 | |
|
4041 | 4046 | self.menu = QtGui.QMenu() |
|
4042 | 4047 | quitAction0 = self.menu.addAction("Create a New Project") |
|
4043 | 4048 | quitAction1 = self.menu.addAction("Create a New Processing Unit") |
|
4044 | 4049 | quitAction2 = self.menu.addAction("Delete Item") |
|
4045 | 4050 | quitAction3 = self.menu.addAction("Quit") |
|
4046 | 4051 | |
|
4047 | 4052 | if len(self.__itemTreeDict) == 0: |
|
4048 | 4053 | quitAction2.setEnabled(False) |
|
4049 | 4054 | else: |
|
4050 | 4055 | quitAction2.setEnabled(True) |
|
4051 | 4056 | |
|
4052 | 4057 | action = self.menu.exec_(self.mapToGlobal(pos)) |
|
4053 | 4058 | |
|
4054 | 4059 | if action == quitAction0: |
|
4055 | 4060 | self. setInputsProject_View() |
|
4056 | 4061 | self.create = True |
|
4057 | 4062 | |
|
4058 | 4063 | if action == quitAction1: |
|
4059 | 4064 | if len(self.__projectObjDict) == 0: |
|
4060 | 4065 | outputstr = "You need to create a Project before adding a Processing Unit" |
|
4061 | 4066 | self.console.clear() |
|
4062 | 4067 | self.console.append(outputstr) |
|
4063 | 4068 | return 0 |
|
4064 | 4069 | else: |
|
4065 | 4070 | self.addPUWindow() |
|
4066 | 4071 | self.console.clear() |
|
4067 | 4072 | self.console.append("Please, Choose the type of Processing Unit") |
|
4068 | 4073 | # self.console.append("If your Datatype is rawdata, you will start with processing unit Type Voltage") |
|
4069 | 4074 | # self.console.append("If your Datatype is pdata, you will choose between processing unit Type Spectra or Correlation") |
|
4070 | 4075 | # self.console.append("If your Datatype is fits, you will start with processing unit Type SpectraHeis") |
|
4071 | 4076 | |
|
4072 | 4077 | if action == quitAction2: |
|
4073 | 4078 | index = self.selectedItemTree |
|
4074 | 4079 | try: |
|
4075 | 4080 | index.parent() |
|
4076 | 4081 | except: |
|
4077 | 4082 | self.console.append('Please first select a Project or Processing Unit') |
|
4078 | 4083 | return 0 |
|
4079 | 4084 | # print index.parent(),index |
|
4080 | 4085 | if index.parent() == None: |
|
4081 | 4086 | self.projectExplorerModel.removeRow(index.row()) |
|
4082 | 4087 | else: |
|
4083 | 4088 | index.parent().removeRow(index.row()) |
|
4084 | 4089 | self.removeItemTreeFromProject() |
|
4085 | 4090 | self.console.clear() |
|
4086 | 4091 | # for i in self.projectExplorerTree.selectionModel().selection().indexes(): |
|
4087 | 4092 | # print i.row() |
|
4088 | 4093 | |
|
4089 | 4094 | if action == quitAction3: |
|
4090 | 4095 | self.close() |
|
4091 | 4096 | return 0 |
|
4092 | 4097 | |
|
4093 | 4098 | def createProjectView(self, id): |
|
4094 | 4099 | |
|
4095 | 4100 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
4096 | 4101 | id = str(id) |
|
4097 | 4102 | projectParms = self.__getParmsFromProjectWindow() |
|
4098 | 4103 | |
|
4099 | 4104 | if not projectParms.isValid(): |
|
4100 | 4105 | return None |
|
4101 | 4106 | |
|
4102 | 4107 | projectObjView = Project() |
|
4103 | 4108 | projectObjView.setup(id=id, name=projectParms.name, description=projectParms.description) |
|
4104 | 4109 | |
|
4105 | 4110 | self.__projectObjDict[id] = projectObjView |
|
4106 | 4111 | self.addProject2ProjectExplorer(id=id, name=projectObjView.name) |
|
4107 | 4112 | |
|
4108 | 4113 | return projectObjView |
|
4109 | 4114 | |
|
4110 | 4115 | def updateProjectView(self): |
|
4111 | 4116 | |
|
4112 | 4117 | # project_name, description, datatype, data_path, starDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
4113 | 4118 | |
|
4114 | 4119 | projectParms = self.__getParmsFromProjectWindow() |
|
4115 | 4120 | |
|
4116 | 4121 | if not projectParms.isValid(): |
|
4117 | 4122 | return None |
|
4118 | 4123 | |
|
4119 | 4124 | projectObjView = self.getSelectedProjectObj() |
|
4120 | 4125 | |
|
4121 | 4126 | if not projectObjView: |
|
4122 | 4127 | self.console.append("Please select a project before update it") |
|
4123 | 4128 | return None |
|
4124 | 4129 | |
|
4125 | 4130 | projectObjView.update(name=projectParms.name, description=projectParms.description) |
|
4126 | 4131 | |
|
4127 | 4132 | return projectObjView |
|
4128 | 4133 | |
|
4129 | 4134 | def createReadUnitView(self, projectObjView): |
|
4130 | 4135 | |
|
4131 | 4136 | # project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk, set = self.getParmsFromProjectWindow() |
|
4132 | 4137 | |
|
4133 | 4138 | projectParms = self.__getParmsFromProjectWindow() |
|
4134 | 4139 | |
|
4135 | 4140 | if not projectParms.isValid(): |
|
4136 | 4141 | return None |
|
4137 | 4142 | |
|
4138 | 4143 | if projectParms.datatype in ("Voltage", "Spectra", "Fits"): |
|
4139 | 4144 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, |
|
4140 | 4145 | path=projectParms.dpath, |
|
4141 | 4146 | startDate=projectParms.startDate, |
|
4142 | 4147 | endDate=projectParms.endDate, |
|
4143 | 4148 | startTime=projectParms.startTime, |
|
4144 | 4149 | endTime=projectParms.endTime, |
|
4145 | 4150 | online=projectParms.online, |
|
4146 | 4151 | walk=projectParms.walk |
|
4147 | 4152 | ) |
|
4148 | 4153 | |
|
4149 | 4154 | if projectParms.set: |
|
4150 | 4155 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") |
|
4151 | 4156 | |
|
4152 | 4157 | if projectParms.delay: |
|
4153 | 4158 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4154 | 4159 | |
|
4155 | 4160 | if projectParms.expLabel: |
|
4156 | 4161 | readUnitConfObj.addParameter(name="expLabel", value=projectParms.expLabel) |
|
4157 | 4162 | |
|
4158 | 4163 | readUnitConfObj.addOperation(name="printInfo") |
|
4159 | 4164 | |
|
4160 | 4165 | if projectParms.datatype == "USRP": |
|
4161 | 4166 | readUnitConfObj = projectObjView.addReadUnit(datatype=projectParms.datatype, |
|
4162 | 4167 | path=projectParms.dpath, |
|
4163 | 4168 | startDate=projectParms.startDate, |
|
4164 | 4169 | endDate=projectParms.endDate, |
|
4165 | 4170 | startTime=projectParms.startTime, |
|
4166 | 4171 | endTime=projectParms.endTime, |
|
4167 | 4172 | online=projectParms.online, |
|
4168 | 4173 | ippKm=projectParms.ippKm |
|
4169 | 4174 | ) |
|
4170 | 4175 | |
|
4171 | 4176 | if projectParms.delay: |
|
4172 | 4177 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4173 | 4178 | |
|
4174 | 4179 | return readUnitConfObj |
|
4175 | 4180 | |
|
4176 | 4181 | def updateReadUnitView(self, projectObjView, idReadUnit): |
|
4177 | 4182 | |
|
4178 | 4183 | # project_name, description, datatype, data_path, startDate, endDate, startTime, endTime, online, delay, walk , set = self.getParmsFromProjectWindow() |
|
4179 | 4184 | |
|
4180 | 4185 | readUnitConfObj = projectObjView.getProcUnitObj(idReadUnit) |
|
4181 | 4186 | |
|
4182 | 4187 | projectParms = self.__getParmsFromProjectWindow() |
|
4183 | 4188 | |
|
4184 | 4189 | if not projectParms.isValid(): |
|
4185 | 4190 | return None |
|
4186 | 4191 | |
|
4187 | 4192 | if projectParms.datatype in ["Voltage", "Spectra", "Fits"]: |
|
4188 | 4193 | readUnitConfObj.update(datatype=projectParms.datatype, |
|
4189 | 4194 | path=projectParms.dpath, |
|
4190 | 4195 | startDate=projectParms.startDate, |
|
4191 | 4196 | endDate=projectParms.endDate, |
|
4192 | 4197 | startTime=projectParms.startTime, |
|
4193 | 4198 | endTime=projectParms.endTime, |
|
4194 | 4199 | online=projectParms.online, |
|
4195 | 4200 | walk=projectParms.walk |
|
4196 | 4201 | ) |
|
4197 | 4202 | if projectParms.set: |
|
4198 | 4203 | readUnitConfObj.addParameter(name="set", value=projectParms.set, format="int") |
|
4199 | 4204 | |
|
4200 | 4205 | if projectParms.delay: |
|
4201 | 4206 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4202 | 4207 | |
|
4203 | 4208 | if projectParms.expLabel: |
|
4204 | 4209 | readUnitConfObj.addParameter(name="expLabel", value=projectParms.expLabel) |
|
4205 | 4210 | |
|
4206 | 4211 | readUnitConfObj.addOperation(name="printInfo") |
|
4207 | 4212 | |
|
4208 | 4213 | if projectParms.datatype == "USRP": |
|
4209 | 4214 | readUnitConfObj.update(datatype=projectParms.datatype, |
|
4210 | 4215 | path=projectParms.dpath, |
|
4211 | 4216 | startDate=projectParms.startDate, |
|
4212 | 4217 | endDate=projectParms.endDate, |
|
4213 | 4218 | startTime=projectParms.startTime, |
|
4214 | 4219 | endTime=projectParms.endTime, |
|
4215 | 4220 | online=projectParms.online, |
|
4216 | 4221 | ippKm=projectParms.ippKm |
|
4217 | 4222 | ) |
|
4218 | 4223 | |
|
4219 | 4224 | if projectParms.delay: |
|
4220 | 4225 | readUnitConfObj.addParameter(name="delay", value=projectParms.delay, format="int") |
|
4221 | 4226 | |
|
4222 | 4227 | return readUnitConfObj |
|
4223 | 4228 | |
|
4224 | 4229 | def createProcUnitView(self, projectObjView, datatype, inputId): |
|
4225 | 4230 | |
|
4226 | 4231 | procUnitConfObj = projectObjView.addProcUnit(datatype=datatype, inputId=inputId) |
|
4227 | 4232 | |
|
4228 | 4233 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
4229 | 4234 | |
|
4230 | 4235 | return procUnitConfObj |
|
4231 | 4236 | |
|
4232 | 4237 | def updateProcUnitView(self, id): |
|
4233 | 4238 | |
|
4234 | 4239 | procUnitConfObj = projectObjView.getProcUnitObj(id) |
|
4235 | 4240 | procUnitConfObj.removeOperations() |
|
4236 | 4241 | |
|
4237 | 4242 | return procUnitConfObj |
|
4238 | 4243 | |
|
4239 | 4244 | def addPUWindow(self): |
|
4240 | 4245 | |
|
4241 | 4246 | self.configUPWindowObj = UnitProcessWindow(self) |
|
4242 | 4247 | fatherObj = self.getSelectedItemObj() |
|
4243 | 4248 | try: |
|
4244 | 4249 | fatherObj.getElementName() |
|
4245 | 4250 | except: |
|
4246 | 4251 | self.console.append("First left click on Project or Processing Unit") |
|
4247 | 4252 | return 0 |
|
4248 | 4253 | |
|
4249 | 4254 | if fatherObj.getElementName() == 'Project': |
|
4250 | 4255 | readUnitConfObj = fatherObj.getReadUnitObj() |
|
4251 | 4256 | self.configUPWindowObj.dataTypeProject = str(readUnitConfObj.datatype) |
|
4252 | 4257 | |
|
4253 | 4258 | self.configUPWindowObj.getfromWindowList.append(fatherObj) |
|
4254 | 4259 | self.configUPWindowObj.loadTotalList() |
|
4255 | 4260 | self.configUPWindowObj.show() |
|
4256 | 4261 | self.configUPWindowObj.closed.connect(self.createPUWindow) |
|
4257 | 4262 | |
|
4258 | 4263 | def createPUWindow(self): |
|
4259 | 4264 | |
|
4260 | 4265 | if not self.configUPWindowObj.create: |
|
4261 | 4266 | return |
|
4262 | 4267 | |
|
4263 | 4268 | fatherObj = self.configUPWindowObj.getFromWindow |
|
4264 | 4269 | datatype = self.configUPWindowObj.typeofUP |
|
4265 | 4270 | |
|
4266 | 4271 | if fatherObj.getElementName() == 'Project': |
|
4267 | 4272 | inputId = fatherObj.getReadUnitId() |
|
4268 | 4273 | projectObjView = fatherObj |
|
4269 | 4274 | else: |
|
4270 | 4275 | inputId = fatherObj.getId() |
|
4271 | 4276 | projectObjView = self.getSelectedProjectObj() |
|
4272 | 4277 | |
|
4273 | 4278 | if not projectObjView: |
|
4274 | 4279 | return |
|
4275 | 4280 | |
|
4276 | 4281 | puObj = self.createProcUnitView(projectObjView, datatype, inputId) |
|
4277 | 4282 | |
|
4278 | 4283 | self.addPU2ProjectExplorer(puObj) |
|
4279 | 4284 | |
|
4280 | 4285 | self.showtabPUCreated(datatype) |
|
4281 | 4286 | |
|
4282 | 4287 | self.clearPUWindow(datatype) |
|
4283 | 4288 | |
|
4284 | 4289 | self.showPUinitView() |
|
4285 | 4290 | |
|
4286 | 4291 | def addFTPConf2Operation(self, puObj, opObj): |
|
4287 | 4292 | |
|
4288 | 4293 | if not self.temporalFTP.create: |
|
4289 | 4294 | self.temporalFTP.setwithoutconfiguration() |
|
4290 | 4295 | |
|
4291 | 4296 | # opObj.addParameter(name='server', value=self.temporalFTP.server, format='str') |
|
4292 | 4297 | # opObj.addParameter(name='remotefolder', value=self.temporalFTP.remotefolder, format='str') |
|
4293 | 4298 | # opObj.addParameter(name='username', value=self.temporalFTP.username, format='str') |
|
4294 | 4299 | # opObj.addParameter(name='password', value=self.temporalFTP.password, format='str') |
|
4295 | 4300 | |
|
4296 | 4301 | if self.temporalFTP.ftp_wei: |
|
4297 | 4302 | opObj.addParameter(name='ftp_wei', value=int(self.temporalFTP.ftp_wei), format='int') |
|
4298 | 4303 | if self.temporalFTP.exp_code: |
|
4299 | 4304 | opObj.addParameter(name='exp_code', value=int(self.temporalFTP.exp_code), format='int') |
|
4300 | 4305 | if self.temporalFTP.sub_exp_code: |
|
4301 | 4306 | opObj.addParameter(name='sub_exp_code', value=int(self.temporalFTP.sub_exp_code), format='int') |
|
4302 | 4307 | if self.temporalFTP.plot_pos: |
|
4303 | 4308 | opObj.addParameter(name='plot_pos', value=int(self.temporalFTP.plot_pos), format='int') |
|
4304 | 4309 | |
|
4305 | 4310 | # def __checkFTPProcUnit(self, projectObj, localfolder): |
|
4306 | 4311 | # |
|
4307 | 4312 | # puId = None |
|
4308 | 4313 | # puObj = None |
|
4309 | 4314 | # |
|
4310 | 4315 | # for thisPuId, thisPuObj in projectObj.procUnitItems(): |
|
4311 | 4316 | # |
|
4312 | 4317 | # if not thisPuObj.name == "SendToServer": |
|
4313 | 4318 | # continue |
|
4314 | 4319 | # |
|
4315 | 4320 | # opObj = thisPuObj.getOperationObj(name='run') |
|
4316 | 4321 | # |
|
4317 | 4322 | # parmObj = opObj.getParameterObj('localfolder') |
|
4318 | 4323 | # |
|
4319 | 4324 | # #localfolder parameter should always be set, if it is not set then ProcUnit should be removed |
|
4320 | 4325 | # if not parmObj: |
|
4321 | 4326 | # projectObj.removeProcUnit(thisPuId) |
|
4322 | 4327 | # continue |
|
4323 | 4328 | # |
|
4324 | 4329 | # thisLocalfolder = parmObj.getValue() |
|
4325 | 4330 | # |
|
4326 | 4331 | # if localfolder != thisLocalfolder: |
|
4327 | 4332 | # continue |
|
4328 | 4333 | # |
|
4329 | 4334 | # puId = thisPuId |
|
4330 | 4335 | # puObj = thisPuObj |
|
4331 | 4336 | # break |
|
4332 | 4337 | # |
|
4333 | 4338 | # return puObj |
|
4334 | 4339 | |
|
4335 | 4340 | def createFTPProcUnitView(self): |
|
4336 | 4341 | |
|
4337 | 4342 | if not self.temporalFTP.create: |
|
4338 | 4343 | self.temporalFTP.setwithoutconfiguration() |
|
4339 | 4344 | |
|
4340 | 4345 | projectObj = self.getSelectedProjectObj() |
|
4341 | 4346 | |
|
4342 | 4347 | if not projectObj: |
|
4343 | 4348 | return |
|
4344 | 4349 | |
|
4345 | 4350 | self.removeAllFTPProcUnitView(projectObj) |
|
4346 | 4351 | |
|
4347 | 4352 | if not self.__puLocalFolder2FTP: |
|
4348 | 4353 | return |
|
4349 | 4354 | |
|
4350 | 4355 | folderList = ",".join(self.__puLocalFolder2FTP.values()) |
|
4351 | 4356 | |
|
4352 | 4357 | procUnitConfObj = projectObj.addProcUnit(name="SendToServer") |
|
4353 | 4358 | |
|
4354 | 4359 | procUnitConfObj.addParameter(name='server', value=self.temporalFTP.server, format='str') |
|
4355 | 4360 | procUnitConfObj.addParameter(name='username', value=self.temporalFTP.username, format='str') |
|
4356 | 4361 | procUnitConfObj.addParameter(name='password', value=self.temporalFTP.password, format='str') |
|
4357 | 4362 | procUnitConfObj.addParameter(name='localfolder', value=folderList, format='list') |
|
4358 | 4363 | procUnitConfObj.addParameter(name='remotefolder', value=self.temporalFTP.remotefolder, format='str') |
|
4359 | 4364 | procUnitConfObj.addParameter(name='ext', value=self.temporalFTP.extension, format='str') |
|
4360 | 4365 | procUnitConfObj.addParameter(name='period', value=self.temporalFTP.period, format='int') |
|
4361 | 4366 | procUnitConfObj.addParameter(name='protocol', value=self.temporalFTP.protocol, format='str') |
|
4362 | 4367 | |
|
4363 | 4368 | procUnitConfObj.addParameter(name='ftp_wei', value=self.temporalFTP.ftp_wei, format='int') |
|
4364 | 4369 | procUnitConfObj.addParameter(name='exp_code', value=self.temporalFTP.exp_code, format='int') |
|
4365 | 4370 | procUnitConfObj.addParameter(name='sub_exp_code', value=self.temporalFTP.sub_exp_code, format='int') |
|
4366 | 4371 | procUnitConfObj.addParameter(name='plot_pos', value=self.temporalFTP.plot_pos, format='int') |
|
4367 | 4372 | |
|
4368 | 4373 | self.__puObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
4369 | 4374 | |
|
4370 | 4375 | def removeAllFTPProcUnitView(self, projectObj): |
|
4371 | 4376 | |
|
4372 | 4377 | for thisPuId, thisPuObj in projectObj.procUnitItems(): |
|
4373 | 4378 | |
|
4374 | 4379 | if not thisPuObj.name == "SendToServer": |
|
4375 | 4380 | continue |
|
4376 | 4381 | |
|
4377 | 4382 | projectObj.removeProcUnit(thisPuId) |
|
4378 | 4383 | |
|
4379 | 4384 | if thisPuId not in self.__puObjDict.keys(): |
|
4380 | 4385 | continue |
|
4381 | 4386 | |
|
4382 | 4387 | self.__puObjDict.pop(thisPuId) |
|
4383 | 4388 | |
|
4384 | 4389 | def showPUinitView(self): |
|
4385 | 4390 | |
|
4386 | 4391 | self.propertiesModel = TreeModel() |
|
4387 | 4392 | self.propertiesModel.initPUVoltageView() |
|
4388 | 4393 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
4389 | 4394 | self.treeProjectProperties.expandAll() |
|
4390 | 4395 | self.treeProjectProperties.allColumnsShowFocus() |
|
4391 | 4396 | self.treeProjectProperties.resizeColumnToContents(1) |
|
4392 | 4397 | |
|
4393 | 4398 | def saveFTPFromOpObj(self, operationObj): |
|
4394 | 4399 | |
|
4395 | 4400 | if operationObj.name != "SendByFTP": |
|
4396 | 4401 | return |
|
4397 | 4402 | |
|
4398 | 4403 | server = operationObj.getParameterValue("server") |
|
4399 | 4404 | username = operationObj.getParameterValue("username") |
|
4400 | 4405 | password = operationObj.getParameterValue("password") |
|
4401 | 4406 | localfolder = operationObj.getParameterValue("localfolder") |
|
4402 | 4407 | remotefolder = operationObj.getParameterValue("remotefolder") |
|
4403 | 4408 | ext = operationObj.getParameterValue("ext") |
|
4404 | 4409 | period = operationObj.getParameterValue("period") |
|
4405 | 4410 | |
|
4406 | 4411 | self.temporalFTP.save(server=server, |
|
4407 | 4412 | remotefolder=remotefolder, |
|
4408 | 4413 | username=username, |
|
4409 | 4414 | password=password, |
|
4410 | 4415 | localfolder=localfolder, |
|
4411 | 4416 | extension=ext) |
|
4412 | 4417 | |
|
4413 | 4418 | return |
|
4414 | 4419 | |
|
4415 | 4420 | def saveFTPFromProcUnitObj(self, puObj): |
|
4416 | 4421 | |
|
4417 | 4422 | opObj = puObj.getOperationObj(name="run") |
|
4418 | 4423 | |
|
4419 | 4424 | parmObj = opObj.getParameterObj(parameterName="server") |
|
4420 | 4425 | if parmObj == None: |
|
4421 | 4426 | server = 'jro-app.igp.gob.pe' |
|
4422 | 4427 | else: |
|
4423 | 4428 | server = parmObj.getValue() |
|
4424 | 4429 | |
|
4425 | 4430 | parmObj = opObj.getParameterObj(parameterName="remotefolder") |
|
4426 | 4431 | if parmObj == None: |
|
4427 | 4432 | remotefolder = '/home/wmaster/graficos' |
|
4428 | 4433 | else: |
|
4429 | 4434 | remotefolder = parmObj.getValue() |
|
4430 | 4435 | |
|
4431 | 4436 | parmObj = opObj.getParameterObj(parameterName="username") |
|
4432 | 4437 | if parmObj == None: |
|
4433 | 4438 | username = 'wmaster' |
|
4434 | 4439 | else: |
|
4435 | 4440 | username = parmObj.getValue() |
|
4436 | 4441 | |
|
4437 | 4442 | parmObj = opObj.getParameterObj(parameterName="password") |
|
4438 | 4443 | if parmObj == None: |
|
4439 | 4444 | password = 'mst2010vhf' |
|
4440 | 4445 | else: |
|
4441 | 4446 | password = parmObj.getValue() |
|
4442 | 4447 | |
|
4443 | 4448 | parmObj = opObj.getParameterObj(parameterName="ftp_wei") |
|
4444 | 4449 | if parmObj == None: |
|
4445 | 4450 | ftp_wei = 0 |
|
4446 | 4451 | else: |
|
4447 | 4452 | ftp_wei = parmObj.getValue() |
|
4448 | 4453 | |
|
4449 | 4454 | parmObj = opObj.getParameterObj(parameterName="exp_code") |
|
4450 | 4455 | if parmObj == None: |
|
4451 | 4456 | exp_code = 0 |
|
4452 | 4457 | else: |
|
4453 | 4458 | exp_code = parmObj.getValue() |
|
4454 | 4459 | |
|
4455 | 4460 | parmObj = opObj.getParameterObj(parameterName="sub_exp_code") |
|
4456 | 4461 | if parmObj == None: |
|
4457 | 4462 | sub_exp_code = 0 |
|
4458 | 4463 | else: |
|
4459 | 4464 | sub_exp_code = parmObj.getValue() |
|
4460 | 4465 | |
|
4461 | 4466 | parmObj = opObj.getParameterObj(parameterName="plot_pos") |
|
4462 | 4467 | if parmObj == None: |
|
4463 | 4468 | plot_pos = 0 |
|
4464 | 4469 | else: |
|
4465 | 4470 | plot_pos = parmObj.getValue() |
|
4466 | 4471 | |
|
4467 | 4472 | parmObj = opObj.getParameterObj(parameterName="localfolder") |
|
4468 | 4473 | if parmObj == None: |
|
4469 | 4474 | localfolder = None |
|
4470 | 4475 | else: |
|
4471 | 4476 | localfolder = parmObj.getValue() |
|
4472 | 4477 | |
|
4473 | 4478 | parmObj = opObj.getParameterObj(parameterName="ext") |
|
4474 | 4479 | if parmObj == None: |
|
4475 | 4480 | extension = '.png' |
|
4476 | 4481 | else: |
|
4477 | 4482 | extension = parmObj.getValue() |
|
4478 | 4483 | |
|
4479 | 4484 | self.temporalFTP.save(server=server, |
|
4480 | 4485 | remotefolder=remotefolder, |
|
4481 | 4486 | username=username, |
|
4482 | 4487 | password=password, |
|
4483 | 4488 | ftp_wei=ftp_wei, |
|
4484 | 4489 | exp_code=exp_code, |
|
4485 | 4490 | sub_exp_code=sub_exp_code, |
|
4486 | 4491 | plot_pos=plot_pos, |
|
4487 | 4492 | localfolder=localfolder, |
|
4488 | 4493 | extension=extension) |
|
4489 | 4494 | |
|
4490 | 4495 | def addProject2ProjectExplorer(self, id, name): |
|
4491 | 4496 | |
|
4492 | 4497 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4493 | 4498 | |
|
4494 | 4499 | parentItem = self.projectExplorerModel.invisibleRootItem() |
|
4495 | 4500 | parentItem.appendRow(itemTree) |
|
4496 | 4501 | |
|
4497 | 4502 | self.projectExplorerTree.setCurrentIndex(itemTree.index()) |
|
4498 | 4503 | |
|
4499 | 4504 | self.selectedItemTree = itemTree |
|
4500 | 4505 | |
|
4501 | 4506 | self.__itemTreeDict[id] = itemTree |
|
4502 | 4507 | |
|
4503 | 4508 | def addPU2ProjectExplorer(self, puObj): |
|
4504 | 4509 | |
|
4505 | 4510 | id, name = puObj.id, puObj.datatype |
|
4506 | 4511 | |
|
4507 | 4512 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4508 | 4513 | |
|
4509 | 4514 | parentItem = self.selectedItemTree |
|
4510 | 4515 | parentItem.appendRow(itemTree) |
|
4511 | 4516 | self.projectExplorerTree.expandAll() |
|
4512 | 4517 | |
|
4513 | 4518 | self.projectExplorerTree.setCurrentIndex(itemTree.index()) |
|
4514 | 4519 | |
|
4515 | 4520 | self.selectedItemTree = itemTree |
|
4516 | 4521 | |
|
4517 | 4522 | self.__itemTreeDict[id] = itemTree |
|
4518 | 4523 | |
|
4519 | 4524 | def addPU2PELoadXML(self, puObj): |
|
4520 | 4525 | |
|
4521 | 4526 | id, name, inputId = puObj.id, puObj.datatype, puObj.inputId |
|
4522 | 4527 | |
|
4523 | 4528 | itemTree = QtGui.QStandardItem(QtCore.QString(str(name))) |
|
4524 | 4529 | |
|
4525 | 4530 | if self.__itemTreeDict.has_key(inputId): |
|
4526 | 4531 | parentItem = self.__itemTreeDict[inputId] |
|
4527 | 4532 | else: |
|
4528 | 4533 | #If parent is a Reader object |
|
4529 | 4534 | parentItem = self.__itemTreeDict[id[:-1]] |
|
4530 | 4535 | |
|
4531 | 4536 | parentItem.appendRow(itemTree) |
|
4532 | 4537 | self.projectExplorerTree.expandAll() |
|
4533 | 4538 | parentItem = itemTree |
|
4534 | 4539 | self.projectExplorerTree.setCurrentIndex(parentItem.index()) |
|
4535 | 4540 | |
|
4536 | 4541 | self.__itemTreeDict[id] = itemTree |
|
4537 | 4542 | self.selectedItemTree = itemTree |
|
4538 | 4543 | |
|
4539 | 4544 | def getSelectedProjectObj(self): |
|
4540 | 4545 | """ |
|
4541 | 4546 | Return the current project object selected. If a processing unit is |
|
4542 | 4547 | actually selected this function returns associated project. |
|
4543 | 4548 | |
|
4544 | 4549 | None if any project or processing unit is selected |
|
4545 | 4550 | """ |
|
4546 | 4551 | for key in self.__itemTreeDict.keys(): |
|
4547 | 4552 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
4548 | 4553 | continue |
|
4549 | 4554 | |
|
4550 | 4555 | if self.__projectObjDict.has_key(key): |
|
4551 | 4556 | projectObj = self.__projectObjDict[key] |
|
4552 | 4557 | return projectObj |
|
4553 | 4558 | |
|
4554 | 4559 | puObj = self.__puObjDict[key] |
|
4555 | 4560 | |
|
4556 | 4561 | if puObj.parentId == None: |
|
4557 | 4562 | projectId = puObj.getId()[0] |
|
4558 | 4563 | else: |
|
4559 | 4564 | projectId = puObj.parentId |
|
4560 | 4565 | |
|
4561 | 4566 | projectObj = self.__projectObjDict[projectId] |
|
4562 | 4567 | return projectObj |
|
4563 | 4568 | |
|
4564 | 4569 | return None |
|
4565 | 4570 | |
|
4566 | 4571 | def getSelectedItemObj(self): |
|
4567 | 4572 | """ |
|
4568 | 4573 | Return the current project or processing unit object selected |
|
4569 | 4574 | |
|
4570 | 4575 | None if any project or processing unit is selected |
|
4571 | 4576 | """ |
|
4572 | 4577 | for key in self.__itemTreeDict.keys(): |
|
4573 | 4578 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
4574 | 4579 | continue |
|
4575 | 4580 | |
|
4576 | 4581 | if self.__projectObjDict.has_key(key) == True: |
|
4577 | 4582 | fatherObj = self.__projectObjDict[key] |
|
4578 | 4583 | else: |
|
4579 | 4584 | fatherObj = self.__puObjDict[key] |
|
4580 | 4585 | |
|
4581 | 4586 | return fatherObj |
|
4582 | 4587 | |
|
4583 | 4588 | return None |
|
4584 | 4589 | |
|
4585 | 4590 | def _WarningWindow(self, text, information): |
|
4586 | 4591 | |
|
4587 | 4592 | msgBox = QtGui.QMessageBox() |
|
4588 | 4593 | msgBox.setText(text) |
|
4589 | 4594 | msgBox.setInformativeText(information) |
|
4590 | 4595 | msgBox.setStandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel) |
|
4591 | 4596 | msgBox.setDefaultButton(QtGui.QMessageBox.Ok) |
|
4592 | 4597 | ret = msgBox.exec_() |
|
4593 | 4598 | |
|
4594 | 4599 | answer = False |
|
4595 | 4600 | |
|
4596 | 4601 | if ret == QtGui.QMessageBox.Ok: |
|
4597 | 4602 | answer = True |
|
4598 | 4603 | |
|
4599 | 4604 | return answer |
|
4600 | 4605 | |
|
4601 | 4606 | def __getNewProjectId(self): |
|
4602 | 4607 | |
|
4603 | 4608 | loadProject = False |
|
4604 | 4609 | |
|
4605 | 4610 | for thisId in range(1,10): |
|
4606 | 4611 | newId = str(thisId) |
|
4607 | 4612 | if newId in self.__projectObjDict.keys(): |
|
4608 | 4613 | continue |
|
4609 | 4614 | |
|
4610 | 4615 | loadProject = True |
|
4611 | 4616 | projectId = newId |
|
4612 | 4617 | break |
|
4613 | 4618 | |
|
4614 | 4619 | if not loadProject: |
|
4615 | 4620 | self.console.clear() |
|
4616 | 4621 | self.console.append("The maximum number of projects has been loaded, a new project can not be loaded") |
|
4617 | 4622 | return None |
|
4618 | 4623 | |
|
4619 | 4624 | return projectId |
|
4620 | 4625 | |
|
4621 | 4626 | def openProject(self): |
|
4622 | 4627 | |
|
4623 | 4628 | self.actionStart.setEnabled(False) |
|
4624 | 4629 | self.actionStarToolbar.setEnabled(False) |
|
4625 | 4630 | |
|
4626 | 4631 | self.frame_2.setEnabled(True) |
|
4627 | 4632 | |
|
4628 | 4633 | # print self.dir |
|
4629 | 4634 | filename = str(QtGui.QFileDialog.getOpenFileName(self, "Open text file", self.pathWorkSpace, self.tr("Text Files (*.xml)"))) |
|
4630 | 4635 | |
|
4631 | 4636 | projectObjLoad = Project() |
|
4632 | 4637 | |
|
4633 | 4638 | try: |
|
4634 | 4639 | projectObjLoad.readXml(filename) |
|
4635 | 4640 | except: |
|
4636 | 4641 | self.console.clear() |
|
4637 | 4642 | self.console.append("The selected xml file could not be loaded ...") |
|
4638 | 4643 | return 0 |
|
4639 | 4644 | |
|
4640 | 4645 | self.create = False |
|
4641 | 4646 | self.refreshProjectWindow(projectObjLoad) |
|
4642 | 4647 | self.refreshProjectProperties(projectObjLoad) |
|
4643 | 4648 | |
|
4644 | 4649 | projectId = projectObjLoad.id |
|
4645 | 4650 | |
|
4646 | 4651 | if projectId in self.__projectObjDict.keys(): |
|
4647 | 4652 | |
|
4648 | 4653 | # answer = self._WarningWindow("You already have a project loaded with the same Id", |
|
4649 | 4654 | # "Do you want to load the file anyway?") |
|
4650 | 4655 | # if not answer: |
|
4651 | 4656 | # return |
|
4652 | 4657 | |
|
4653 | 4658 | projectId = self.__getNewProjectId() |
|
4654 | 4659 | |
|
4655 | 4660 | if not projectId: |
|
4656 | 4661 | return |
|
4657 | 4662 | |
|
4658 | 4663 | projectObjLoad.updateId(projectId) |
|
4659 | 4664 | |
|
4660 | 4665 | self.__projectObjDict[projectId] = projectObjLoad |
|
4661 | 4666 | |
|
4662 | 4667 | self.addProject2ProjectExplorer(id=projectId, name=projectObjLoad.name) |
|
4663 | 4668 | |
|
4664 | 4669 | self.tabWidgetProject.setEnabled(True) |
|
4665 | 4670 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
4666 | 4671 | # Disable tabProject after finish the creation |
|
4667 | 4672 | self.tabProject.setEnabled(True) |
|
4668 | 4673 | puObjorderList = OrderedDict(sorted(projectObjLoad.procUnitConfObjDict.items(), key=lambda x: x[0])) |
|
4669 | 4674 | |
|
4670 | 4675 | for puId, puObj in puObjorderList.items(): |
|
4671 | 4676 | |
|
4672 | 4677 | self.__puObjDict[puId] = puObj |
|
4673 | 4678 | |
|
4674 | 4679 | if puObj.name == "SendToServer": |
|
4675 | 4680 | self.saveFTPFromProcUnitObj(puObj) |
|
4676 | 4681 | |
|
4677 | 4682 | ############## COMPATIBLE WITH OLD VERSIONS ################ |
|
4678 | 4683 | operationObj = puObj.getOperationObj("SendByFTP") |
|
4679 | 4684 | |
|
4680 | 4685 | if operationObj: |
|
4681 | 4686 | self.saveFTPFromOpObj(operationObj) |
|
4682 | 4687 | ############################################################ |
|
4683 | 4688 | |
|
4684 | 4689 | if puObj.inputId == '0': |
|
4685 | 4690 | continue |
|
4686 | 4691 | |
|
4687 | 4692 | self.addPU2PELoadXML(puObj) |
|
4688 | 4693 | |
|
4689 | 4694 | self.refreshPUWindow(puObj) |
|
4690 | 4695 | self.refreshPUProperties(puObj) |
|
4691 | 4696 | self.showtabPUCreated(datatype=puObj.datatype) |
|
4692 | 4697 | |
|
4693 | 4698 | self.console.clear() |
|
4694 | 4699 | self.console.append("The selected xml file has been loaded successfully") |
|
4695 | 4700 | |
|
4696 | 4701 | self.actionStart.setEnabled(True) |
|
4697 | 4702 | self.actionStarToolbar.setEnabled(True) |
|
4698 | 4703 | |
|
4699 | 4704 | def create_updating_timer(self): |
|
4700 | 4705 | self.comm_data_timer = QtCore.QTimer(self) |
|
4701 | 4706 | self.comm_data_timer.timeout.connect(self.on_comm_updating_timer) |
|
4702 | 4707 | self.comm_data_timer.start(1000) |
|
4703 | 4708 | |
|
4704 | 4709 | def on_comm_updating_timer(self): |
|
4705 | 4710 | # Verifica si algun proceso ha sido inicializado y sigue ejecutandose |
|
4706 | 4711 | # Si el proceso se ha parado actualizar el GUI (stopProject) |
|
4707 | 4712 | if not self.__enable: |
|
4708 | 4713 | return |
|
4709 | 4714 | |
|
4710 | 4715 | if self.controllerThread.isFinished(): |
|
4711 | 4716 | self.stopProject() |
|
4712 | 4717 | |
|
4713 | 4718 | # def jobStartedFromThread(self, success): |
|
4714 | 4719 | # |
|
4715 | 4720 | # self.console.clear() |
|
4716 | 4721 | # self.console.append("Job started") |
|
4717 | 4722 | # |
|
4718 | 4723 | # def jobFinishedFromThread(self, success): |
|
4719 | 4724 | # |
|
4720 | 4725 | # self.stopProject() |
|
4721 | 4726 | |
|
4722 | 4727 | def playProject(self, ext=".xml", save=1): |
|
4723 | 4728 | |
|
4724 | 4729 | projectObj = self.getSelectedProjectObj() |
|
4725 | 4730 | |
|
4726 | 4731 | if not projectObj: |
|
4727 | 4732 | self.console.append("Please select a project before pressing PLAY button") |
|
4728 | 4733 | return |
|
4729 | 4734 | |
|
4730 | 4735 | if save: |
|
4731 | 4736 | filename = self.saveProject() |
|
4732 | 4737 | if filename == None: |
|
4733 | 4738 | self.console.append("Process did not initialize.") |
|
4734 | 4739 | return |
|
4735 | 4740 | else: |
|
4736 | 4741 | filename = TEMPORAL_FILE |
|
4737 | 4742 | projectObj.writeXml( os.path.join(self.pathWorkSpace,filename) ) |
|
4738 | 4743 | |
|
4739 | 4744 | self.actionStart.setEnabled(False) |
|
4740 | 4745 | self.actionPause.setEnabled(True) |
|
4741 | 4746 | self.actionStop.setEnabled(True) |
|
4742 | 4747 | |
|
4743 | 4748 | self.actionStarToolbar.setEnabled(False) |
|
4744 | 4749 | self.actionPauseToolbar.setEnabled(True) |
|
4745 | 4750 | self.actionStopToolbar.setEnabled(True) |
|
4746 | 4751 | |
|
4747 | 4752 | self.console.append("Please Wait...") |
|
4748 | 4753 | |
|
4749 | 4754 | self.controllerThread = ControllerThread(filename) |
|
4750 | 4755 | |
|
4751 | 4756 | # QObject.connect( self.controllerThread, SIGNAL( "jobFinished( PyQt_PyObject )" ), self.jobFinishedFromThread ) |
|
4752 | 4757 | # QObject.connect( self.controllerThread, SIGNAL( "jobStarted( PyQt_PyObject )" ), self.jobStartedFromThread ) |
|
4753 | 4758 | self.console.clear() |
|
4754 | 4759 | self.controllerThread.start() |
|
4755 | 4760 | sleep(0.5) |
|
4756 | 4761 | self.__enable = True |
|
4757 | 4762 | |
|
4758 | 4763 | def stopProject(self): |
|
4759 | 4764 | |
|
4760 | 4765 | self.__enable = False |
|
4761 | 4766 | |
|
4762 | 4767 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.STOP, True)) |
|
4763 | 4768 | self.controllerThread.stop() |
|
4764 | 4769 | |
|
4765 | 4770 | while self.controllerThread.isRunning(): |
|
4766 | 4771 | sleep(0.5) |
|
4767 | 4772 | |
|
4768 | 4773 | self.actionStart.setEnabled(True) |
|
4769 | 4774 | self.actionPause.setEnabled(False) |
|
4770 | 4775 | self.actionStop.setEnabled(False) |
|
4771 | 4776 | |
|
4772 | 4777 | self.actionStarToolbar.setEnabled(True) |
|
4773 | 4778 | self.actionPauseToolbar.setEnabled(False) |
|
4774 | 4779 | self.actionStopToolbar.setEnabled(False) |
|
4775 | 4780 | |
|
4776 | 4781 | self.restorePauseIcon() |
|
4777 | 4782 | |
|
4778 | 4783 | def pauseProject(self): |
|
4779 | 4784 | |
|
4780 | 4785 | # self.commCtrlPThread.cmd_q.put(ProcessCommand(ProcessCommand.PAUSE, data=True)) |
|
4781 | 4786 | self.controllerThread.pause() |
|
4782 | 4787 | |
|
4783 | 4788 | self.actionStart.setEnabled(False) |
|
4784 | 4789 | self.actionPause.setEnabled(True) |
|
4785 | 4790 | self.actionStop.setEnabled(True) |
|
4786 | 4791 | |
|
4787 | 4792 | self.actionStarToolbar.setEnabled(False) |
|
4788 | 4793 | self.actionPauseToolbar.setEnabled(True) |
|
4789 | 4794 | self.actionStopToolbar.setEnabled(True) |
|
4790 | 4795 | |
|
4791 | 4796 | def saveProject(self, filename=None): |
|
4792 | 4797 | |
|
4793 | 4798 | self.actionStart.setEnabled(False) |
|
4794 | 4799 | self.actionStarToolbar.setEnabled(False) |
|
4795 | 4800 | |
|
4796 | 4801 | projectObj = self.getSelectedProjectObj() |
|
4797 | 4802 | |
|
4798 | 4803 | if not projectObj: |
|
4799 | 4804 | |
|
4800 | 4805 | if self.create: |
|
4801 | 4806 | self.console.append("Please press Ok before save it") |
|
4802 | 4807 | else: |
|
4803 | 4808 | self.console.append("Please select a project before save it") |
|
4804 | 4809 | return |
|
4805 | 4810 | |
|
4806 | 4811 | self.refreshGraphicsId() |
|
4807 | 4812 | |
|
4808 | 4813 | sts = True |
|
4809 | 4814 | selectedItemObj = self.getSelectedItemObj() |
|
4810 | 4815 | |
|
4811 | 4816 | #A Processing Unit has been selected |
|
4812 | 4817 | if projectObj == selectedItemObj: |
|
4813 | 4818 | if not self.on_proOk_clicked(): |
|
4814 | 4819 | return None |
|
4815 | 4820 | |
|
4816 | 4821 | #A Processing Unit has been selected |
|
4817 | 4822 | if projectObj != selectedItemObj: |
|
4818 | 4823 | puObj = selectedItemObj |
|
4819 | 4824 | |
|
4820 | 4825 | if puObj.name == 'VoltageProc': |
|
4821 | 4826 | sts = self.on_volOpOk_clicked() |
|
4822 | 4827 | if puObj.name == 'SpectraProc': |
|
4823 | 4828 | sts = self.on_specOpOk_clicked() |
|
4824 | 4829 | if puObj.name == 'SpectraHeisProc': |
|
4825 | 4830 | sts = self.on_specHeisOpOk_clicked() |
|
4826 | 4831 | |
|
4827 | 4832 | if not sts: |
|
4828 | 4833 | return None |
|
4829 | 4834 | |
|
4830 | 4835 | self.createFTPProcUnitView() |
|
4831 | 4836 | |
|
4832 | 4837 | if not filename: |
|
4833 | 4838 | filename = os.path.join( str(self.pathWorkSpace), "%s%s" %(str(projectObj.name), '.xml') ) |
|
4834 | 4839 | |
|
4835 | 4840 | projectObj.writeXml(filename) |
|
4836 | 4841 | self.console.clear() |
|
4837 | 4842 | self.console.append("Project saved") |
|
4838 | 4843 | self.console.append("Press Play button to start data processing ...") |
|
4839 | 4844 | |
|
4840 | 4845 | self.actionStart.setEnabled(True) |
|
4841 | 4846 | self.actionStarToolbar.setEnabled(True) |
|
4842 | 4847 | |
|
4843 | 4848 | return filename |
|
4844 | 4849 | |
|
4845 | 4850 | def removeItemTreeFromProject(self): |
|
4846 | 4851 | """ |
|
4847 | 4852 | Metodo para eliminar el proyecto en el dictionario de proyectos y en el dictionario de vista de arbol |
|
4848 | 4853 | """ |
|
4849 | 4854 | for key in self.__itemTreeDict.keys(): |
|
4850 | 4855 | |
|
4851 | 4856 | #Check again because an item can delete multiple items (childs) |
|
4852 | 4857 | if key not in self.__itemTreeDict.keys(): |
|
4853 | 4858 | continue |
|
4854 | 4859 | |
|
4855 | 4860 | if self.__itemTreeDict[key] != self.selectedItemTree: |
|
4856 | 4861 | continue |
|
4857 | 4862 | |
|
4858 | 4863 | if self.__projectObjDict.has_key(key) == True: |
|
4859 | 4864 | |
|
4860 | 4865 | del self.__projectObjDict[key] |
|
4861 | 4866 | del self.__itemTreeDict[key] |
|
4862 | 4867 | |
|
4863 | 4868 | else: |
|
4864 | 4869 | puObj = self.__puObjDict[key] |
|
4865 | 4870 | idProjectParent = puObj.parentId |
|
4866 | 4871 | projectObj = self.__projectObjDict[idProjectParent] |
|
4867 | 4872 | |
|
4868 | 4873 | del self.__puObjDict[key] |
|
4869 | 4874 | del self.__itemTreeDict[key] |
|
4870 | 4875 | del projectObj.procUnitConfObjDict[key] |
|
4871 | 4876 | |
|
4872 | 4877 | for key in projectObj.procUnitConfObjDict.keys(): |
|
4873 | 4878 | if projectObj.procUnitConfObjDict[key].inputId != puObj.getId(): |
|
4874 | 4879 | continue |
|
4875 | 4880 | del self.__puObjDict[projectObj.procUnitConfObjDict[key].getId()] |
|
4876 | 4881 | del self.__itemTreeDict[projectObj.procUnitConfObjDict[key].getId()] |
|
4877 | 4882 | del projectObj.procUnitConfObjDict[key] |
|
4878 | 4883 | # print projectObj.procUnitConfObjDict |
|
4879 | 4884 | # print self.__itemTreeDict,self.__projectObjDict,self.__puObjDict |
|
4880 | 4885 | |
|
4881 | 4886 | def setInputsProject_View(self): |
|
4882 | 4887 | |
|
4883 | 4888 | self.tabWidgetProject.setEnabled(True) |
|
4884 | 4889 | self.tabWidgetProject.setCurrentWidget(self.tabProject) |
|
4885 | 4890 | self.tabProject.setEnabled(True) |
|
4886 | 4891 | self.frame_2.setEnabled(False) |
|
4887 | 4892 | self.proName.clear() |
|
4888 | 4893 | self.proName.setFocus() |
|
4889 | 4894 | self.proName.setSelection(0, 0) |
|
4890 | 4895 | self.proName.setCursorPosition(0) |
|
4891 | 4896 | self.proDataType.setText('.r') |
|
4892 | 4897 | self.proDataPath.clear() |
|
4893 | 4898 | self.proComDataType.clear() |
|
4894 | 4899 | self.proComDataType.addItem("Voltage") |
|
4895 | 4900 | self.proComDataType.addItem("Spectra") |
|
4896 | 4901 | self.proComDataType.addItem("Fits") |
|
4897 | 4902 | self.proComDataType.addItem("USRP") |
|
4898 | 4903 | |
|
4899 | 4904 | self.proComStartDate.clear() |
|
4900 | 4905 | self.proComEndDate.clear() |
|
4901 | 4906 | |
|
4902 | 4907 | startTime = "00:00:00" |
|
4903 | 4908 | endTime = "23:59:59" |
|
4904 | 4909 | starlist = startTime.split(":") |
|
4905 | 4910 | endlist = endTime.split(":") |
|
4906 | 4911 | self.proDelay.setText("60") |
|
4907 | 4912 | self.proSet.setText("") |
|
4908 | 4913 | |
|
4909 | 4914 | self.labelSet.show() |
|
4910 | 4915 | self.proSet.show() |
|
4911 | 4916 | |
|
4912 | 4917 | self.labelIPPKm.hide() |
|
4913 | 4918 | self.proIPPKm.hide() |
|
4914 | 4919 | |
|
4915 | 4920 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) |
|
4916 | 4921 | self.proStartTime.setTime(self.time) |
|
4917 | 4922 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
4918 | 4923 | self.proEndTime.setTime(self.time) |
|
4919 | 4924 | self.proDescription.clear() |
|
4920 | 4925 | self.proOk.setEnabled(False) |
|
4921 | 4926 | # self.console.append("Please, Write a name Project") |
|
4922 | 4927 | # self.console.append("Introduce Project Parameters")DC |
|
4923 | 4928 | # self.console.append("Select data type Voltage( .rawdata) or Spectra(.pdata)") |
|
4924 | 4929 | |
|
4925 | 4930 | def clearPUWindow(self, datatype): |
|
4926 | 4931 | |
|
4927 | 4932 | projectObjView = self.getSelectedProjectObj() |
|
4928 | 4933 | |
|
4929 | 4934 | if not projectObjView: |
|
4930 | 4935 | return |
|
4931 | 4936 | |
|
4932 | 4937 | puObj = self.getSelectedItemObj() |
|
4933 | 4938 | inputId = puObj.getInputId() |
|
4934 | 4939 | inputPUObj = projectObjView.getProcUnitObj(inputId) |
|
4935 | 4940 | |
|
4936 | 4941 | if datatype == 'Voltage': |
|
4937 | 4942 | self.volOpComChannels.setEnabled(False) |
|
4938 | 4943 | self.volOpComHeights.setEnabled(False) |
|
4939 | 4944 | self.volOpFilter.setEnabled(False) |
|
4940 | 4945 | self.volOpComProfile.setEnabled(False) |
|
4941 | 4946 | self.volOpComCode.setEnabled(False) |
|
4942 | 4947 | self.volOpCohInt.setEnabled(False) |
|
4943 | 4948 | self.volOpChannel.setEnabled(False) |
|
4944 | 4949 | self.volOpHeights.setEnabled(False) |
|
4945 | 4950 | self.volOpProfile.setEnabled(False) |
|
4946 | 4951 | self.volOpRadarfrequency.setEnabled(False) |
|
4947 | 4952 | self.volOpCebChannels.setCheckState(0) |
|
4948 | 4953 | self.volOpCebRadarfrequency.setCheckState(0) |
|
4949 | 4954 | self.volOpCebHeights.setCheckState(0) |
|
4950 | 4955 | self.volOpCebFilter.setCheckState(0) |
|
4951 | 4956 | self.volOpCebProfile.setCheckState(0) |
|
4952 | 4957 | self.volOpCebDecodification.setCheckState(0) |
|
4953 | 4958 | self.volOpCebCohInt.setCheckState(0) |
|
4954 | 4959 | |
|
4955 | 4960 | self.volOpChannel.clear() |
|
4956 | 4961 | self.volOpHeights.clear() |
|
4957 | 4962 | self.volOpProfile.clear() |
|
4958 | 4963 | self.volOpFilter.clear() |
|
4959 | 4964 | self.volOpCohInt.clear() |
|
4960 | 4965 | self.volOpRadarfrequency.clear() |
|
4961 | 4966 | |
|
4962 | 4967 | if datatype == 'Spectra': |
|
4963 | 4968 | |
|
4964 | 4969 | if inputPUObj.datatype == 'Spectra': |
|
4965 | 4970 | self.specOpnFFTpoints.setEnabled(False) |
|
4966 | 4971 | self.specOpProfiles.setEnabled(False) |
|
4967 | 4972 | self.specOpippFactor.setEnabled(False) |
|
4968 | 4973 | else: |
|
4969 | 4974 | self.specOpnFFTpoints.setEnabled(True) |
|
4970 | 4975 | self.specOpProfiles.setEnabled(True) |
|
4971 | 4976 | self.specOpippFactor.setEnabled(True) |
|
4972 | 4977 | |
|
4973 | 4978 | self.specOpCebCrossSpectra.setCheckState(0) |
|
4974 | 4979 | self.specOpCebChannel.setCheckState(0) |
|
4975 | 4980 | self.specOpCebHeights.setCheckState(0) |
|
4976 | 4981 | self.specOpCebIncoherent.setCheckState(0) |
|
4977 | 4982 | self.specOpCebRemoveDC.setCheckState(0) |
|
4978 | 4983 | self.specOpCebRemoveInt.setCheckState(0) |
|
4979 | 4984 | self.specOpCebgetNoise.setCheckState(0) |
|
4980 | 4985 | self.specOpCebRadarfrequency.setCheckState(0) |
|
4981 | 4986 | |
|
4982 | 4987 | self.specOpRadarfrequency.setEnabled(False) |
|
4983 | 4988 | self.specOppairsList.setEnabled(False) |
|
4984 | 4989 | self.specOpChannel.setEnabled(False) |
|
4985 | 4990 | self.specOpHeights.setEnabled(False) |
|
4986 | 4991 | self.specOpIncoherent.setEnabled(False) |
|
4987 | 4992 | self.specOpgetNoise.setEnabled(False) |
|
4988 | 4993 | |
|
4989 | 4994 | self.specOpRadarfrequency.clear() |
|
4990 | 4995 | self.specOpnFFTpoints.clear() |
|
4991 | 4996 | self.specOpProfiles.clear() |
|
4992 | 4997 | self.specOpippFactor.clear |
|
4993 | 4998 | self.specOppairsList.clear() |
|
4994 | 4999 | self.specOpChannel.clear() |
|
4995 | 5000 | self.specOpHeights.clear() |
|
4996 | 5001 | self.specOpIncoherent.clear() |
|
4997 | 5002 | self.specOpgetNoise.clear() |
|
4998 | 5003 | |
|
4999 | 5004 | self.specGraphCebSpectraplot.setCheckState(0) |
|
5000 | 5005 | self.specGraphCebCrossSpectraplot.setCheckState(0) |
|
5001 | 5006 | self.specGraphCebRTIplot.setCheckState(0) |
|
5002 | 5007 | self.specGraphCebRTInoise.setCheckState(0) |
|
5003 | 5008 | self.specGraphCebCoherencmap.setCheckState(0) |
|
5004 | 5009 | self.specGraphPowerprofile.setCheckState(0) |
|
5005 | 5010 | |
|
5006 | 5011 | self.specGraphSaveSpectra.setCheckState(0) |
|
5007 | 5012 | self.specGraphSaveCross.setCheckState(0) |
|
5008 | 5013 | self.specGraphSaveRTIplot.setCheckState(0) |
|
5009 | 5014 | self.specGraphSaveRTInoise.setCheckState(0) |
|
5010 | 5015 | self.specGraphSaveCoherencemap.setCheckState(0) |
|
5011 | 5016 | self.specGraphSavePowerprofile.setCheckState(0) |
|
5012 | 5017 | |
|
5013 | 5018 | self.specGraphftpRTIplot.setCheckState(0) |
|
5014 | 5019 | self.specGraphftpRTInoise.setCheckState(0) |
|
5015 | 5020 | self.specGraphftpCoherencemap.setCheckState(0) |
|
5016 | 5021 | |
|
5017 | 5022 | self.specGraphPath.clear() |
|
5018 | 5023 | self.specGraphPrefix.clear() |
|
5019 | 5024 | |
|
5020 | 5025 | self.specGgraphftpratio.clear() |
|
5021 | 5026 | |
|
5022 | 5027 | self.specGgraphChannelList.clear() |
|
5023 | 5028 | self.specGgraphFreq.clear() |
|
5024 | 5029 | self.specGgraphHeight.clear() |
|
5025 | 5030 | self.specGgraphDbsrange.clear() |
|
5026 | 5031 | self.specGgraphmagnitud.clear() |
|
5027 | 5032 | self.specGgraphTminTmax.clear() |
|
5028 | 5033 | self.specGgraphTimeRange.clear() |
|
5029 | 5034 | |
|
5030 | 5035 | if datatype == 'SpectraHeis': |
|
5031 | 5036 | self.specHeisOpCebIncoherent.setCheckState(0) |
|
5032 | 5037 | self.specHeisOpIncoherent.setEnabled(False) |
|
5033 | 5038 | self.specHeisOpIncoherent.clear() |
|
5034 | 5039 | |
|
5035 | 5040 | self.specHeisGraphCebSpectraplot.setCheckState(0) |
|
5036 | 5041 | self.specHeisGraphCebRTIplot.setCheckState(0) |
|
5037 | 5042 | |
|
5038 | 5043 | self.specHeisGraphSaveSpectra.setCheckState(0) |
|
5039 | 5044 | self.specHeisGraphSaveRTIplot.setCheckState(0) |
|
5040 | 5045 | |
|
5041 | 5046 | self.specHeisGraphftpSpectra.setCheckState(0) |
|
5042 | 5047 | self.specHeisGraphftpRTIplot.setCheckState(0) |
|
5043 | 5048 | |
|
5044 | 5049 | self.specHeisGraphPath.clear() |
|
5045 | 5050 | self.specHeisGraphPrefix.clear() |
|
5046 | 5051 | self.specHeisGgraphChannelList.clear() |
|
5047 | 5052 | self.specHeisGgraphXminXmax.clear() |
|
5048 | 5053 | self.specHeisGgraphYminYmax.clear() |
|
5049 | 5054 | self.specHeisGgraphTminTmax.clear() |
|
5050 | 5055 | self.specHeisGgraphTimeRange.clear() |
|
5051 | 5056 | self.specHeisGgraphftpratio.clear() |
|
5052 | 5057 | |
|
5053 | 5058 | def showtabPUCreated(self, datatype): |
|
5054 | 5059 | |
|
5055 | 5060 | if datatype == "Voltage": |
|
5056 | 5061 | self.tabVoltage.setEnabled(True) |
|
5057 | 5062 | self.tabProject.setEnabled(False) |
|
5058 | 5063 | self.tabSpectra.setEnabled(False) |
|
5059 | 5064 | self.tabCorrelation.setEnabled(False) |
|
5060 | 5065 | self.tabSpectraHeis.setEnabled(False) |
|
5061 | 5066 | self.tabWidgetProject.setCurrentWidget(self.tabVoltage) |
|
5062 | 5067 | |
|
5063 | 5068 | if datatype == "Spectra": |
|
5064 | 5069 | self.tabVoltage.setEnabled(False) |
|
5065 | 5070 | self.tabProject.setEnabled(False) |
|
5066 | 5071 | self.tabSpectra.setEnabled(True) |
|
5067 | 5072 | self.tabCorrelation.setEnabled(False) |
|
5068 | 5073 | self.tabSpectraHeis.setEnabled(False) |
|
5069 | 5074 | self.tabWidgetProject.setCurrentWidget(self.tabSpectra) |
|
5070 | 5075 | |
|
5071 | 5076 | if datatype == "SpectraHeis": |
|
5072 | 5077 | self.tabVoltage.setEnabled(False) |
|
5073 | 5078 | self.tabProject.setEnabled(False) |
|
5074 | 5079 | self.tabSpectra.setEnabled(False) |
|
5075 | 5080 | self.tabCorrelation.setEnabled(False) |
|
5076 | 5081 | self.tabSpectraHeis.setEnabled(True) |
|
5077 | 5082 | self.tabWidgetProject.setCurrentWidget(self.tabSpectraHeis) |
|
5078 | 5083 | |
|
5079 | 5084 | def checkInputsProject(self): |
|
5080 | 5085 | """ |
|
5081 | 5086 | Check Inputs Project: |
|
5082 | 5087 | - project_name |
|
5083 | 5088 | - datatype |
|
5084 | 5089 | - ext |
|
5085 | 5090 | - data_path |
|
5086 | 5091 | - readmode |
|
5087 | 5092 | - delay |
|
5088 | 5093 | - set |
|
5089 | 5094 | - walk |
|
5090 | 5095 | """ |
|
5091 | 5096 | parms_ok = True |
|
5092 | 5097 | project_name = str(self.proName.text()) |
|
5093 | 5098 | if project_name == '' or project_name == None: |
|
5094 | 5099 | outputstr = "Enter the Project Name" |
|
5095 | 5100 | self.console.append(outputstr) |
|
5096 | 5101 | parms_ok = False |
|
5097 | 5102 | project_name = None |
|
5098 | 5103 | |
|
5099 | 5104 | datatype = str(self.proComDataType.currentText()) |
|
5100 | 5105 | if not(datatype in ['Voltage', 'Spectra', 'Fits', 'USRP']): |
|
5101 | 5106 | outputstr = 'datatype = %s, this must be either Voltage, Spectra, SpectraHeis or USRP' % datatype |
|
5102 | 5107 | self.console.append(outputstr) |
|
5103 | 5108 | parms_ok = False |
|
5104 | 5109 | datatype = None |
|
5105 | 5110 | |
|
5106 | 5111 | ext = str(self.proDataType.text()) |
|
5107 | 5112 | if not(ext in ['.r', '.pdata', '.fits', '.hdf5']): |
|
5108 | 5113 | outputstr = "extension files must be .r , .pdata, .fits or .hdf5" |
|
5109 | 5114 | self.console.append(outputstr) |
|
5110 | 5115 | parms_ok = False |
|
5111 | 5116 | ext = None |
|
5112 | 5117 | |
|
5113 | 5118 | data_path = str(self.proDataPath.text()) |
|
5114 | 5119 | |
|
5115 | 5120 | if data_path == '': |
|
5116 | 5121 | outputstr = 'Datapath is empty' |
|
5117 | 5122 | self.console.append(outputstr) |
|
5118 | 5123 | parms_ok = False |
|
5119 | 5124 | data_path = None |
|
5120 | 5125 | |
|
5121 | 5126 | if data_path != None: |
|
5122 | 5127 | if not os.path.isdir(data_path): |
|
5123 | 5128 | outputstr = 'Datapath:%s does not exists' % data_path |
|
5124 | 5129 | self.console.append(outputstr) |
|
5125 | 5130 | parms_ok = False |
|
5126 | 5131 | data_path = None |
|
5127 | 5132 | |
|
5128 | 5133 | read_mode = str(self.proComReadMode.currentText()) |
|
5129 | 5134 | if not(read_mode in ['Online', 'Offline']): |
|
5130 | 5135 | outputstr = 'Read Mode: %s, this must be either Online or Offline' % read_mode |
|
5131 | 5136 | self.console.append(outputstr) |
|
5132 | 5137 | parms_ok = False |
|
5133 | 5138 | read_mode = None |
|
5134 | 5139 | |
|
5135 | 5140 | delay = None |
|
5136 | 5141 | if read_mode == "Online": |
|
5137 | 5142 | parms_ok = False |
|
5138 | 5143 | try: |
|
5139 | 5144 | delay = int(str(self.proDelay.text())) |
|
5140 | 5145 | parms_ok = True |
|
5141 | 5146 | except: |
|
5142 | 5147 | outputstr = 'Delay: %s, this must be a integer number' % str(self.proDelay.text()) |
|
5143 | 5148 | self.console.append(outputstr) |
|
5144 | 5149 | |
|
5145 | 5150 | try: |
|
5146 | 5151 | set = int(str(self.proSet.text())) |
|
5147 | 5152 | except: |
|
5148 | 5153 | # outputstr = 'Set: %s, this must be a integer number' % str(self.proName.text()) |
|
5149 | 5154 | # self.console.append(outputstr) |
|
5150 | 5155 | # parms_ok = False |
|
5151 | 5156 | set = None |
|
5152 | 5157 | |
|
5153 | 5158 | walk = int(self.proComWalk.currentIndex()) |
|
5154 | 5159 | expLabel = str(self.proExpLabel.text()) |
|
5155 | 5160 | |
|
5156 | 5161 | return parms_ok, project_name, datatype, ext, data_path, read_mode, delay, walk, set, expLabel |
|
5157 | 5162 | |
|
5158 | 5163 | def checkInputsPUSave(self, datatype): |
|
5159 | 5164 | """ |
|
5160 | 5165 | Check Inputs Spectra Save: |
|
5161 | 5166 | - path |
|
5162 | 5167 | - blocks Per File |
|
5163 | 5168 | - sufix |
|
5164 | 5169 | - dataformat |
|
5165 | 5170 | """ |
|
5166 | 5171 | parms_ok = True |
|
5167 | 5172 | |
|
5168 | 5173 | if datatype == "Voltage": |
|
5169 | 5174 | output_path = str(self.volOutputPath.text()) |
|
5170 | 5175 | blocksperfile = str(self.volOutputblocksperfile.text()) |
|
5171 | 5176 | profilesperblock = str(self.volOutputprofilesperblock.text()) |
|
5172 | 5177 | |
|
5173 | 5178 | if datatype == "Spectra": |
|
5174 | 5179 | output_path = str(self.specOutputPath.text()) |
|
5175 | 5180 | blocksperfile = str(self.specOutputblocksperfile.text()) |
|
5176 | 5181 | profilesperblock = 0 |
|
5177 | 5182 | |
|
5178 | 5183 | if datatype == "SpectraHeis": |
|
5179 | 5184 | output_path = str(self.specHeisOutputPath.text()) |
|
5180 | 5185 | blocksperfile = str(self.specHeisOutputblocksperfile.text()) |
|
5181 | metada = str(self.specHeisOutputMetada.text()) | |
|
5186 | metadata_file = str(self.specHeisOutputMetada.text()) | |
|
5182 | 5187 | |
|
5183 | 5188 | if output_path == '': |
|
5184 | 5189 | outputstr = 'Outputpath is empty' |
|
5185 | 5190 | self.console.append(outputstr) |
|
5186 | 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 | 5198 | try: |
|
5198 | 5199 | profilesperblock = int(profilesperblock) |
|
5199 | 5200 | except: |
|
5200 | 5201 | if datatype == "Voltage": |
|
5201 | 5202 | outputstr = 'Profilesperblock: %s, this must be a integer number' % str(self.volOutputprofilesperblock.text()) |
|
5202 | 5203 | self.console.append(outputstr) |
|
5203 | 5204 | parms_ok = False |
|
5204 | 5205 | profilesperblock = None |
|
5205 | 5206 | |
|
5206 | 5207 | try: |
|
5207 | 5208 | blocksperfile = int(blocksperfile) |
|
5208 | 5209 | except: |
|
5209 | 5210 | if datatype == "Voltage": |
|
5210 | 5211 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.volOutputblocksperfile.text()) |
|
5211 | 5212 | elif datatype == "Spectra": |
|
5212 | 5213 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.specOutputblocksperfile.text()) |
|
5213 | 5214 | elif datatype == "SpectraHeis": |
|
5214 | 5215 | outputstr = 'Blocksperfile: %s, this must be a integer number' % str(self.specHeisOutputblocksperfile.text()) |
|
5215 | 5216 | |
|
5216 | 5217 | self.console.append(outputstr) |
|
5217 | 5218 | parms_ok = False |
|
5218 | 5219 | blocksperfile = None |
|
5219 | 5220 | |
|
5220 | 5221 | if datatype == "SpectraHeis": |
|
5221 |
if metada |
|
|
5222 |
|
|
|
5223 | self.console.append(outputstr) | |
|
5224 | parms_ok = False | |
|
5225 | if metada != None: | |
|
5226 | if not os.path.isfile(metada): | |
|
5227 | outputstr = 'Metadata:%s does not exists' % metada | |
|
5222 | if metadata_file != '': | |
|
5223 | if not os.path.isfile(metadata_file): | |
|
5224 | outputstr = 'Metadata file %s does not exist' % metadata_file | |
|
5228 | 5225 | self.console.append(outputstr) |
|
5229 | 5226 | parms_ok = False |
|
5230 | output_path = None | |
|
5231 | 5227 | |
|
5232 | 5228 | if datatype == "Voltage": |
|
5233 | 5229 | return parms_ok, output_path, blocksperfile, profilesperblock |
|
5234 | 5230 | |
|
5235 | 5231 | |
|
5236 | 5232 | if datatype == "Spectra": |
|
5237 | 5233 | return parms_ok, output_path, blocksperfile, profilesperblock |
|
5238 | 5234 | |
|
5239 | 5235 | |
|
5240 | 5236 | if datatype == "SpectraHeis": |
|
5241 | return parms_ok, output_path, blocksperfile, metada | |
|
5237 | return parms_ok, output_path, blocksperfile, metadata_file | |
|
5242 | 5238 | |
|
5243 | 5239 | def findDatafiles(self, data_path, ext, walk, expLabel=''): |
|
5244 | 5240 | |
|
5245 | 5241 | dateList = [] |
|
5246 | 5242 | fileList = [] |
|
5247 | 5243 | |
|
5248 | 5244 | if ext == ".r": |
|
5249 | 5245 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5250 | 5246 | |
|
5251 | 5247 | readerObj = JRODataReader() |
|
5252 | 5248 | dateList = readerObj.findDatafiles(path=data_path, |
|
5253 | 5249 | expLabel=expLabel, |
|
5254 | 5250 | ext=ext, |
|
5255 | 5251 | walk=walk) |
|
5256 | 5252 | |
|
5257 | 5253 | if ext == ".pdata": |
|
5258 | 5254 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5259 | 5255 | |
|
5260 | 5256 | readerObj = JRODataReader() |
|
5261 | 5257 | dateList = readerObj.findDatafiles(path=data_path, |
|
5262 | 5258 | expLabel=expLabel, |
|
5263 | 5259 | ext=ext, |
|
5264 | 5260 | walk=walk) |
|
5265 | 5261 | |
|
5266 | 5262 | if ext == ".fits": |
|
5267 | 5263 | from schainpy.model.io.jroIO_base import JRODataReader |
|
5268 | 5264 | |
|
5269 | 5265 | readerObj = JRODataReader() |
|
5270 | 5266 | dateList = readerObj.findDatafiles(path=data_path, |
|
5271 | 5267 | expLabel=expLabel, |
|
5272 | 5268 | ext=ext, |
|
5273 | 5269 | walk=walk) |
|
5274 | 5270 | |
|
5275 | 5271 | if ext == ".hdf5": |
|
5276 | 5272 | from schainpy.model.io.jroIO_usrp import USRPReader |
|
5277 | 5273 | |
|
5278 | 5274 | readerObj = USRPReader() |
|
5279 | 5275 | dateList = readerObj.findDatafiles(path=data_path) |
|
5280 | 5276 | |
|
5281 | 5277 | return dateList |
|
5282 | 5278 | |
|
5283 | 5279 | def loadDays(self, data_path, ext, walk, expLabel=''): |
|
5284 | 5280 | """ |
|
5285 | 5281 | Method to loads day |
|
5286 | 5282 | """ |
|
5287 | 5283 | self.proOk.setEnabled(False) |
|
5288 | 5284 | self.proComStartDate.clear() |
|
5289 | 5285 | self.proComEndDate.clear() |
|
5290 | 5286 | |
|
5291 | 5287 | self.dateList = [] |
|
5292 | 5288 | |
|
5293 | 5289 | if not os.path.isdir(data_path): |
|
5294 | 5290 | return |
|
5295 | 5291 | |
|
5296 | 5292 | self.dataPath = data_path |
|
5297 | 5293 | |
|
5298 | 5294 | dateList = self.findDatafiles(data_path, ext=ext, walk=walk, expLabel=expLabel) |
|
5299 | 5295 | |
|
5300 | 5296 | if not dateList: |
|
5301 | 5297 | # self.console.clear() |
|
5302 | 5298 | if walk: |
|
5303 | 5299 | if expLabel: |
|
5304 | 5300 | outputstr = "No files (*%s) were found on %s/DOYPATH/%s" % (ext, data_path, expLabel) |
|
5305 | 5301 | else: |
|
5306 | 5302 | outputstr = "No files (*%s) were found on %s" % (ext, data_path) |
|
5307 | 5303 | else: |
|
5308 | 5304 | outputstr = "No files (*%s) were found on %s" % (ext, data_path) |
|
5309 | 5305 | |
|
5310 | 5306 | self.console.append(outputstr) |
|
5311 | 5307 | return |
|
5312 | 5308 | |
|
5313 | 5309 | dateStrList = [] |
|
5314 | 5310 | for thisDate in dateList: |
|
5315 | 5311 | dateStr = thisDate.strftime("%Y/%m/%d") |
|
5316 | 5312 | |
|
5317 | 5313 | self.proComStartDate.addItem(dateStr) |
|
5318 | 5314 | self.proComEndDate.addItem(dateStr) |
|
5319 | 5315 | dateStrList.append(dateStr) |
|
5320 | 5316 | |
|
5321 | 5317 | self.proComStartDate.setCurrentIndex(0) |
|
5322 | 5318 | self.proComEndDate.setCurrentIndex(self.proComEndDate.count() - 1) |
|
5323 | 5319 | |
|
5324 | 5320 | self.dateList = dateStrList |
|
5325 | 5321 | self.proOk.setEnabled(True) |
|
5326 | 5322 | |
|
5327 | 5323 | self.console.clear() |
|
5328 | 5324 | self.console.append("Successful load") |
|
5329 | 5325 | |
|
5330 | 5326 | return self.dateList |
|
5331 | 5327 | |
|
5332 | 5328 | def setWorkSpaceGUI(self, pathWorkSpace=None): |
|
5333 | 5329 | |
|
5334 | 5330 | if pathWorkSpace == None: |
|
5335 | 5331 | home = os.path.expanduser("~") |
|
5336 | 5332 | pathWorkSpace = os.path.join(home,'schain_workspace') |
|
5337 | 5333 | |
|
5338 | 5334 | self.pathWorkSpace = pathWorkSpace |
|
5339 | 5335 | |
|
5340 | 5336 | """ |
|
5341 | 5337 | Comandos Usados en Console |
|
5342 | 5338 | """ |
|
5343 | 5339 | def __del__(self): |
|
5344 | 5340 | sys.stdout = sys.__stdout__ |
|
5345 | 5341 | sys.stderr = sys.__stderr__ |
|
5346 | 5342 | |
|
5347 | 5343 | def normalOutputWritten(self, text): |
|
5348 | 5344 | color_black = QtGui.QColor(0,0,0) |
|
5349 | 5345 | self.console.setTextColor(color_black) |
|
5350 | 5346 | self.console.append(text) |
|
5351 | 5347 | |
|
5352 | 5348 | def errorOutputWritten(self, text): |
|
5353 | 5349 | color_red = QtGui.QColor(255,0,0) |
|
5354 | 5350 | color_black = QtGui.QColor(0,0,0) |
|
5355 | 5351 | |
|
5356 | 5352 | self.console.setTextColor(color_red) |
|
5357 | 5353 | self.console.append(text) |
|
5358 | 5354 | self.console.setTextColor(color_black) |
|
5359 | 5355 | |
|
5360 | 5356 | def setGUIStatus(self): |
|
5361 | 5357 | |
|
5362 | 5358 | self.setWindowTitle("ROJ-Signal Chain") |
|
5363 | 5359 | self.setWindowIcon(QtGui.QIcon( os.path.join(FIGURES_PATH,"adn.jpg") )) |
|
5364 | 5360 | |
|
5365 | 5361 | self.tabWidgetProject.setEnabled(False) |
|
5366 | 5362 | self.tabVoltage.setEnabled(False) |
|
5367 | 5363 | self.tabSpectra.setEnabled(False) |
|
5368 | 5364 | self.tabCorrelation.setEnabled(False) |
|
5369 | 5365 | self.frame_2.setEnabled(False) |
|
5370 | 5366 | |
|
5371 | 5367 | self.actionCreate.setShortcut('Ctrl+N') |
|
5372 | 5368 | self.actionOpen.setShortcut('Ctrl+O') |
|
5373 | 5369 | self.actionSave.setShortcut('Ctrl+S') |
|
5374 | 5370 | self.actionClose.setShortcut('Ctrl+X') |
|
5375 | 5371 | |
|
5376 | 5372 | self.actionStart.setShortcut('Ctrl+1') |
|
5377 | 5373 | self.actionPause.setShortcut('Ctrl+2') |
|
5378 | 5374 | self.actionStop.setShortcut('Ctrl+3') |
|
5379 | 5375 | |
|
5380 | 5376 | self.actionFTP.setShortcut('Ctrl+F') |
|
5381 | 5377 | |
|
5382 | 5378 | self.actionStart.setEnabled(False) |
|
5383 | 5379 | self.actionPause.setEnabled(False) |
|
5384 | 5380 | self.actionStop.setEnabled(False) |
|
5385 | 5381 | |
|
5386 | 5382 | self.actionStarToolbar.setEnabled(False) |
|
5387 | 5383 | self.actionPauseToolbar.setEnabled(False) |
|
5388 | 5384 | self.actionStopToolbar.setEnabled(False) |
|
5389 | 5385 | |
|
5390 | 5386 | self.proName.clear() |
|
5391 | 5387 | self.proDataPath.setText('') |
|
5392 | 5388 | self.console.setReadOnly(True) |
|
5393 | 5389 | self.console.append("Welcome to Signal Chain\nOpen a project or Create a new one") |
|
5394 | 5390 | self.proStartTime.setDisplayFormat("hh:mm:ss") |
|
5395 | 5391 | self.proDataType.setEnabled(False) |
|
5396 | 5392 | self.time = QtCore.QTime() |
|
5397 | 5393 | self.hour = 0 |
|
5398 | 5394 | self.min = 0 |
|
5399 | 5395 | self.sec = 0 |
|
5400 | 5396 | self.proEndTime.setDisplayFormat("hh:mm:ss") |
|
5401 | 5397 | startTime = "00:00:00" |
|
5402 | 5398 | endTime = "23:59:59" |
|
5403 | 5399 | starlist = startTime.split(":") |
|
5404 | 5400 | endlist = endTime.split(":") |
|
5405 | 5401 | self.time.setHMS(int(starlist[0]), int(starlist[1]), int(starlist[2])) |
|
5406 | 5402 | self.proStartTime.setTime(self.time) |
|
5407 | 5403 | self.time.setHMS(int(endlist[0]), int(endlist[1]), int(endlist[2])) |
|
5408 | 5404 | self.proEndTime.setTime(self.time) |
|
5409 | 5405 | self.proOk.setEnabled(False) |
|
5410 | 5406 | # set model Project Explorer |
|
5411 | 5407 | self.projectExplorerModel = QtGui.QStandardItemModel() |
|
5412 | 5408 | self.projectExplorerModel.setHorizontalHeaderLabels(("Project Explorer",)) |
|
5413 | 5409 | layout = QtGui.QVBoxLayout() |
|
5414 | 5410 | layout.addWidget(self.projectExplorerTree) |
|
5415 | 5411 | self.projectExplorerTree.setModel(self.projectExplorerModel) |
|
5416 | 5412 | self.projectExplorerTree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) |
|
5417 | 5413 | self.projectExplorerTree.customContextMenuRequested.connect(self.on_right_click) |
|
5418 | 5414 | self.projectExplorerTree.clicked.connect(self.on_click) |
|
5419 | 5415 | self.projectExplorerTree.expandAll() |
|
5420 | 5416 | # set model Project Properties |
|
5421 | 5417 | |
|
5422 | 5418 | self.propertiesModel = TreeModel() |
|
5423 | 5419 | self.propertiesModel.initProjectView() |
|
5424 | 5420 | self.treeProjectProperties.setModel(self.propertiesModel) |
|
5425 | 5421 | self.treeProjectProperties.expandAll() |
|
5426 | 5422 | self.treeProjectProperties.allColumnsShowFocus() |
|
5427 | 5423 | self.treeProjectProperties.resizeColumnToContents(1) |
|
5428 | 5424 | |
|
5429 | 5425 | # set Project |
|
5430 | 5426 | self.proExpLabel.setEnabled(True) |
|
5431 | 5427 | self.proDelay.setEnabled(False) |
|
5432 | 5428 | self.proSet.setEnabled(True) |
|
5433 | 5429 | self.proDataType.setReadOnly(True) |
|
5434 | 5430 | |
|
5435 | 5431 | # set Operation Voltage |
|
5436 | 5432 | self.volOpComChannels.setEnabled(False) |
|
5437 | 5433 | self.volOpComHeights.setEnabled(False) |
|
5438 | 5434 | self.volOpFilter.setEnabled(False) |
|
5439 | 5435 | self.volOpComProfile.setEnabled(False) |
|
5440 | 5436 | self.volOpComCode.setEnabled(False) |
|
5441 | 5437 | self.volOpFlip.setEnabled(False) |
|
5442 | 5438 | self.volOpCohInt.setEnabled(False) |
|
5443 | 5439 | self.volOpRadarfrequency.setEnabled(False) |
|
5444 | 5440 | |
|
5445 | 5441 | self.volOpChannel.setEnabled(False) |
|
5446 | 5442 | self.volOpHeights.setEnabled(False) |
|
5447 | 5443 | self.volOpProfile.setEnabled(False) |
|
5448 | 5444 | self.volOpComMode.setEnabled(False) |
|
5449 | 5445 | |
|
5450 | 5446 | self.volGraphPath.setEnabled(False) |
|
5451 | 5447 | self.volGraphPrefix.setEnabled(False) |
|
5452 | 5448 | self.volGraphToolPath.setEnabled(False) |
|
5453 | 5449 | |
|
5454 | 5450 | # set Graph Voltage |
|
5455 | 5451 | self.volGraphChannelList.setEnabled(False) |
|
5456 | 5452 | self.volGraphfreqrange.setEnabled(False) |
|
5457 | 5453 | self.volGraphHeightrange.setEnabled(False) |
|
5458 | 5454 | |
|
5459 | 5455 | # set Operation Spectra |
|
5460 | 5456 | self.specOpnFFTpoints.setEnabled(False) |
|
5461 | 5457 | self.specOpProfiles.setEnabled(False) |
|
5462 | 5458 | self.specOpippFactor.setEnabled(False) |
|
5463 | 5459 | self.specOppairsList.setEnabled(False) |
|
5464 | 5460 | self.specOpComChannel.setEnabled(False) |
|
5465 | 5461 | self.specOpComHeights.setEnabled(False) |
|
5466 | 5462 | self.specOpIncoherent.setEnabled(False) |
|
5467 | 5463 | self.specOpgetNoise.setEnabled(False) |
|
5468 | 5464 | self.specOpRadarfrequency.setEnabled(False) |
|
5469 | 5465 | |
|
5470 | 5466 | |
|
5471 | 5467 | self.specOpChannel.setEnabled(False) |
|
5472 | 5468 | self.specOpHeights.setEnabled(False) |
|
5473 | 5469 | # set Graph Spectra |
|
5474 | 5470 | self.specGgraphChannelList.setEnabled(False) |
|
5475 | 5471 | self.specGgraphFreq.setEnabled(False) |
|
5476 | 5472 | self.specGgraphHeight.setEnabled(False) |
|
5477 | 5473 | self.specGgraphDbsrange.setEnabled(False) |
|
5478 | 5474 | self.specGgraphmagnitud.setEnabled(False) |
|
5479 | 5475 | self.specGgraphTminTmax.setEnabled(False) |
|
5480 | 5476 | self.specGgraphTimeRange.setEnabled(False) |
|
5481 | 5477 | self.specGraphPath.setEnabled(False) |
|
5482 | 5478 | self.specGraphToolPath.setEnabled(False) |
|
5483 | 5479 | self.specGraphPrefix.setEnabled(False) |
|
5484 | 5480 | |
|
5485 | 5481 | self.specGgraphftpratio.setEnabled(False) |
|
5486 | 5482 | # set Operation SpectraHeis |
|
5487 | 5483 | self.specHeisOpIncoherent.setEnabled(False) |
|
5488 | 5484 | self.specHeisOpCobIncInt.setEnabled(False) |
|
5489 | 5485 | # set Graph SpectraHeis |
|
5490 | 5486 | self.specHeisGgraphChannelList.setEnabled(False) |
|
5491 | 5487 | self.specHeisGgraphXminXmax.setEnabled(False) |
|
5492 | 5488 | self.specHeisGgraphYminYmax.setEnabled(False) |
|
5493 | 5489 | self.specHeisGgraphTminTmax.setEnabled(False) |
|
5494 | 5490 | self.specHeisGgraphTimeRange.setEnabled(False) |
|
5495 | 5491 | self.specHeisGgraphftpratio.setEnabled(False) |
|
5496 | 5492 | self.specHeisGraphPath.setEnabled(False) |
|
5497 | 5493 | self.specHeisGraphPrefix.setEnabled(False) |
|
5498 | 5494 | self.specHeisGraphToolPath.setEnabled(False) |
|
5499 | 5495 | |
|
5500 | 5496 | |
|
5501 | 5497 | # tool tip gui |
|
5502 | 5498 | QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10)) |
|
5503 | 5499 | self.projectExplorerTree.setToolTip('Right clik to add Project or Unit Process') |
|
5504 | 5500 | # tool tip gui project |
|
5505 | 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 | 5502 | self.proComWalk.setCurrentIndex(0) |
|
5507 | 5503 | # tool tip gui volOp |
|
5508 | 5504 | self.volOpChannel.setToolTip('Example: 1,2,3,4,5') |
|
5509 | 5505 | self.volOpHeights.setToolTip('Example: 90,180') |
|
5510 | 5506 | self.volOpFilter.setToolTip('Example: 2') |
|
5511 | 5507 | self.volOpProfile.setToolTip('Example:0,127') |
|
5512 | 5508 | self.volOpCohInt.setToolTip('Example: 128') |
|
5513 | 5509 | self.volOpFlip.setToolTip('ChannelList where flip will be applied. Example: 0,2,3') |
|
5514 | 5510 | self.volOpOk.setToolTip('If you have finished, please Ok ') |
|
5515 | 5511 | # tool tip gui volGraph |
|
5516 | 5512 | self.volGraphfreqrange.setToolTip('Height range. Example: 50,100') |
|
5517 | 5513 | self.volGraphHeightrange.setToolTip('Amplitude. Example: 0,10000') |
|
5518 | 5514 | # tool tip gui specOp |
|
5519 | 5515 | self.specOpnFFTpoints.setToolTip('Example: 128') |
|
5520 | 5516 | self.specOpProfiles.setToolTip('Example: 128') |
|
5521 | 5517 | self.specOpippFactor.setToolTip('Example:1.0') |
|
5522 | 5518 | self.specOpIncoherent.setToolTip('Example: 10') |
|
5523 | 5519 | self.specOpgetNoise.setToolTip('Example:20,180,30,120 (minHei,maxHei,minVel,maxVel)') |
|
5524 | 5520 | |
|
5525 | 5521 | self.specOpChannel.setToolTip('Example: 0,1,2,3') |
|
5526 | 5522 | self.specOpHeights.setToolTip('Example: 90,180') |
|
5527 | 5523 | self.specOppairsList.setToolTip('Example: (0,1),(2,3)') |
|
5528 | 5524 | # tool tip gui specGraph |
|
5529 | 5525 | |
|
5530 | 5526 | self.specGgraphChannelList.setToolTip('Example: 0,3,4') |
|
5531 | 5527 | self.specGgraphFreq.setToolTip('Example: -20,20') |
|
5532 | 5528 | self.specGgraphHeight.setToolTip('Example: 100,400') |
|
5533 | 5529 | self.specGgraphDbsrange.setToolTip('Example: 30,170') |
|
5534 | 5530 | |
|
5535 | 5531 | self.specGraphPrefix.setToolTip('Example: EXPERIMENT_NAME') |
|
5536 | 5532 | |
|
5537 | 5533 | |
|
5538 | 5534 | self.specHeisOpIncoherent.setToolTip('Example: 10') |
|
5539 | 5535 | |
|
5540 | 5536 | self.specHeisGgraphChannelList.setToolTip('Example: 0,2,3') |
|
5541 | 5537 | self.specHeisGgraphXminXmax.setToolTip('Example (Hz): -1000, 1000') |
|
5542 | 5538 | self.specHeisGgraphYminYmax.setToolTip('Example (dB): 5, 35') |
|
5543 | 5539 | self.specHeisGgraphTminTmax.setToolTip('Example (hours): 0, 24') |
|
5544 | 5540 | self.specHeisGgraphTimeRange.setToolTip('Example (hours): 8') |
|
5545 | 5541 | |
|
5546 | 5542 | self.labelSet.show() |
|
5547 | 5543 | self.proSet.show() |
|
5548 | 5544 | |
|
5549 | 5545 | self.labelIPPKm.hide() |
|
5550 | 5546 | self.proIPPKm.hide() |
|
5551 | 5547 | |
|
5552 | 5548 | sys.stdout = ShowMeConsole(textWritten=self.normalOutputWritten) |
|
5553 | 5549 | # sys.stderr = ShowMeConsole(textWritten=self.errorOutputWritten) |
|
5554 | 5550 | |
|
5555 | 5551 | |
|
5556 | 5552 | class UnitProcessWindow(QMainWindow, Ui_UnitProcess): |
|
5557 | 5553 | """ |
|
5558 | 5554 | Class documentation goes here. |
|
5559 | 5555 | """ |
|
5560 | 5556 | closed = pyqtSignal() |
|
5561 | 5557 | create = False |
|
5562 | 5558 | |
|
5563 | 5559 | def __init__(self, parent=None): |
|
5564 | 5560 | """ |
|
5565 | 5561 | Constructor |
|
5566 | 5562 | """ |
|
5567 | 5563 | QMainWindow.__init__(self, parent) |
|
5568 | 5564 | self.setupUi(self) |
|
5569 | 5565 | self.getFromWindow = None |
|
5570 | 5566 | self.getfromWindowList = [] |
|
5571 | 5567 | self.dataTypeProject = None |
|
5572 | 5568 | |
|
5573 | 5569 | self.listUP = None |
|
5574 | 5570 | |
|
5575 | 5571 | @pyqtSignature("") |
|
5576 | 5572 | def on_unitPokbut_clicked(self): |
|
5577 | 5573 | """ |
|
5578 | 5574 | Slot documentation goes here. |
|
5579 | 5575 | """ |
|
5580 | 5576 | self.create = True |
|
5581 | 5577 | self.getFromWindow = self.getfromWindowList[int(self.comboInputBox.currentIndex())] |
|
5582 | 5578 | # self.nameofUP= str(self.nameUptxt.text()) |
|
5583 | 5579 | self.typeofUP = str(self.comboTypeBox.currentText()) |
|
5584 | 5580 | self.close() |
|
5585 | 5581 | |
|
5586 | 5582 | |
|
5587 | 5583 | @pyqtSignature("") |
|
5588 | 5584 | def on_unitPcancelbut_clicked(self): |
|
5589 | 5585 | """ |
|
5590 | 5586 | Slot documentation goes here. |
|
5591 | 5587 | """ |
|
5592 | 5588 | self.create = False |
|
5593 | 5589 | self.close() |
|
5594 | 5590 | |
|
5595 | 5591 | def loadTotalList(self): |
|
5596 | 5592 | self.comboInputBox.clear() |
|
5597 | 5593 | for i in self.getfromWindowList: |
|
5598 | 5594 | |
|
5599 | 5595 | name = i.getElementName() |
|
5600 | 5596 | if name == 'Project': |
|
5601 | 5597 | id = i.id |
|
5602 | 5598 | name = i.name |
|
5603 | 5599 | if self.dataTypeProject == 'Voltage': |
|
5604 | 5600 | self.comboTypeBox.clear() |
|
5605 | 5601 | self.comboTypeBox.addItem("Voltage") |
|
5606 | 5602 | |
|
5607 | 5603 | if self.dataTypeProject == 'Spectra': |
|
5608 | 5604 | self.comboTypeBox.clear() |
|
5609 | 5605 | self.comboTypeBox.addItem("Spectra") |
|
5610 | 5606 | self.comboTypeBox.addItem("Correlation") |
|
5611 | 5607 | if self.dataTypeProject == 'Fits': |
|
5612 | 5608 | self.comboTypeBox.clear() |
|
5613 | 5609 | self.comboTypeBox.addItem("SpectraHeis") |
|
5614 | 5610 | |
|
5615 | 5611 | |
|
5616 | 5612 | if name == 'ProcUnit': |
|
5617 | 5613 | id = int(i.id) - 1 |
|
5618 | 5614 | name = i.datatype |
|
5619 | 5615 | if name == 'Voltage': |
|
5620 | 5616 | self.comboTypeBox.clear() |
|
5621 | 5617 | self.comboTypeBox.addItem("Spectra") |
|
5622 | 5618 | self.comboTypeBox.addItem("SpectraHeis") |
|
5623 | 5619 | self.comboTypeBox.addItem("Correlation") |
|
5624 | 5620 | if name == 'Spectra': |
|
5625 | 5621 | self.comboTypeBox.clear() |
|
5626 | 5622 | self.comboTypeBox.addItem("Spectra") |
|
5627 | 5623 | self.comboTypeBox.addItem("SpectraHeis") |
|
5628 | 5624 | self.comboTypeBox.addItem("Correlation") |
|
5629 | 5625 | if name == 'SpectraHeis': |
|
5630 | 5626 | self.comboTypeBox.clear() |
|
5631 | 5627 | self.comboTypeBox.addItem("SpectraHeis") |
|
5632 | 5628 | |
|
5633 | 5629 | self.comboInputBox.addItem(str(name)) |
|
5634 | 5630 | # self.comboInputBox.addItem(str(name)+str(id)) |
|
5635 | 5631 | |
|
5636 | 5632 | def closeEvent(self, event): |
|
5637 | 5633 | self.closed.emit() |
|
5638 | 5634 | event.accept() |
|
5639 | 5635 | |
|
5640 | 5636 | class Ftp(QMainWindow, Ui_Ftp): |
|
5641 | 5637 | """ |
|
5642 | 5638 | Class documentation goes here. |
|
5643 | 5639 | """ |
|
5644 | 5640 | create = False |
|
5645 | 5641 | closed = pyqtSignal() |
|
5646 | 5642 | server = None |
|
5647 | 5643 | remotefolder = None |
|
5648 | 5644 | username = None |
|
5649 | 5645 | password = None |
|
5650 | 5646 | ftp_wei = None |
|
5651 | 5647 | exp_code = None |
|
5652 | 5648 | sub_exp_code = None |
|
5653 | 5649 | plot_pos = None |
|
5654 | 5650 | |
|
5655 | 5651 | def __init__(self, parent=None): |
|
5656 | 5652 | """ |
|
5657 | 5653 | Constructor |
|
5658 | 5654 | """ |
|
5659 | 5655 | QMainWindow.__init__(self, parent) |
|
5660 | 5656 | self.setupUi(self) |
|
5661 | 5657 | self.setGUIStatus() |
|
5662 | 5658 | |
|
5663 | 5659 | def setGUIStatus(self): |
|
5664 | 5660 | self.setWindowTitle("ROJ-Signal Chain") |
|
5665 | 5661 | self.serverFTP.setToolTip('Example: jro-app.igp.gob.pe') |
|
5666 | 5662 | self.folderFTP.setToolTip('Example: /home/wmaster/graficos') |
|
5667 | 5663 | self.usernameFTP.setToolTip('Example: myusername') |
|
5668 | 5664 | self.passwordFTP.setToolTip('Example: mypass ') |
|
5669 | 5665 | self.weightFTP.setToolTip('Example: 0') |
|
5670 | 5666 | self.expcodeFTP.setToolTip('Example: 0') |
|
5671 | 5667 | self.subexpFTP.setToolTip('Example: 0') |
|
5672 | 5668 | self.plotposFTP.setToolTip('Example: 0') |
|
5673 | 5669 | |
|
5674 | 5670 | def setParmsfromTemporal(self, server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos): |
|
5675 | 5671 | self.serverFTP.setText(str(server)) |
|
5676 | 5672 | self.folderFTP.setText(str(remotefolder)) |
|
5677 | 5673 | self.usernameFTP.setText(str(username)) |
|
5678 | 5674 | self.passwordFTP.setText(str(password)) |
|
5679 | 5675 | self.weightFTP.setText(str(ftp_wei)) |
|
5680 | 5676 | self.expcodeFTP.setText(str(exp_code)) |
|
5681 | 5677 | self.subexpFTP.setText(str(sub_exp_code)) |
|
5682 | 5678 | self.plotposFTP.setText(str(plot_pos)) |
|
5683 | 5679 | |
|
5684 | 5680 | def getParmsFromFtpWindow(self): |
|
5685 | 5681 | """ |
|
5686 | 5682 | Return Inputs Project: |
|
5687 | 5683 | - server |
|
5688 | 5684 | - remotefolder |
|
5689 | 5685 | - username |
|
5690 | 5686 | - password |
|
5691 | 5687 | - ftp_wei |
|
5692 | 5688 | - exp_code |
|
5693 | 5689 | - sub_exp_code |
|
5694 | 5690 | - plot_pos |
|
5695 | 5691 | """ |
|
5696 | 5692 | name_server_ftp = str(self.serverFTP.text()) |
|
5697 | 5693 | if not name_server_ftp: |
|
5698 | 5694 | self.console.clear() |
|
5699 | 5695 | self.console.append("Please Write a FTP Server") |
|
5700 | 5696 | return 0 |
|
5701 | 5697 | |
|
5702 | 5698 | folder_server_ftp = str(self.folderFTP.text()) |
|
5703 | 5699 | if not folder_server_ftp: |
|
5704 | 5700 | self.console.clear() |
|
5705 | 5701 | self.console.append("Please Write a Folder") |
|
5706 | 5702 | return 0 |
|
5707 | 5703 | |
|
5708 | 5704 | username_ftp = str(self.usernameFTP.text()) |
|
5709 | 5705 | if not username_ftp: |
|
5710 | 5706 | self.console.clear() |
|
5711 | 5707 | self.console.append("Please Write a User Name") |
|
5712 | 5708 | return 0 |
|
5713 | 5709 | |
|
5714 | 5710 | password_ftp = str(self.passwordFTP.text()) |
|
5715 | 5711 | if not password_ftp: |
|
5716 | 5712 | self.console.clear() |
|
5717 | 5713 | self.console.append("Please Write a passwordFTP") |
|
5718 | 5714 | return 0 |
|
5719 | 5715 | |
|
5720 | 5716 | ftp_wei = str(self.weightFTP.text()) |
|
5721 | 5717 | if not ftp_wei == "": |
|
5722 | 5718 | try: |
|
5723 | 5719 | ftp_wei = int(self.weightFTP.text()) |
|
5724 | 5720 | except: |
|
5725 | 5721 | self.console.clear() |
|
5726 | 5722 | self.console.append("Please Write a ftp_wei number") |
|
5727 | 5723 | return 0 |
|
5728 | 5724 | |
|
5729 | 5725 | exp_code = str(self.expcodeFTP.text()) |
|
5730 | 5726 | if not exp_code == "": |
|
5731 | 5727 | try: |
|
5732 | 5728 | exp_code = int(self.expcodeFTP.text()) |
|
5733 | 5729 | except: |
|
5734 | 5730 | self.console.clear() |
|
5735 | 5731 | self.console.append("Please Write a exp_code number") |
|
5736 | 5732 | return 0 |
|
5737 | 5733 | |
|
5738 | 5734 | |
|
5739 | 5735 | sub_exp_code = str(self.subexpFTP.text()) |
|
5740 | 5736 | if not sub_exp_code == "": |
|
5741 | 5737 | try: |
|
5742 | 5738 | sub_exp_code = int(self.subexpFTP.text()) |
|
5743 | 5739 | except: |
|
5744 | 5740 | self.console.clear() |
|
5745 | 5741 | self.console.append("Please Write a sub_exp_code number") |
|
5746 | 5742 | return 0 |
|
5747 | 5743 | |
|
5748 | 5744 | plot_pos = str(self.plotposFTP.text()) |
|
5749 | 5745 | if not plot_pos == "": |
|
5750 | 5746 | try: |
|
5751 | 5747 | plot_pos = int(self.plotposFTP.text()) |
|
5752 | 5748 | except: |
|
5753 | 5749 | self.console.clear() |
|
5754 | 5750 | self.console.append("Please Write a plot_pos number") |
|
5755 | 5751 | return 0 |
|
5756 | 5752 | |
|
5757 | 5753 | return name_server_ftp, folder_server_ftp, username_ftp, password_ftp, ftp_wei, exp_code, sub_exp_code, plot_pos |
|
5758 | 5754 | |
|
5759 | 5755 | @pyqtSignature("") |
|
5760 | 5756 | def on_ftpOkButton_clicked(self): |
|
5761 | 5757 | server, remotefolder, username, password, ftp_wei, exp_code, sub_exp_code, plot_pos = self.getParmsFromFtpWindow() |
|
5762 | 5758 | self.create = True |
|
5763 | 5759 | self.close() |
|
5764 | 5760 | |
|
5765 | 5761 | @pyqtSignature("") |
|
5766 | 5762 | def on_ftpCancelButton_clicked(self): |
|
5767 | 5763 | self.create = False |
|
5768 | 5764 | self.close() |
|
5769 | 5765 | |
|
5770 | 5766 | def closeEvent(self, event): |
|
5771 | 5767 | self.closed.emit() |
|
5772 | 5768 | event.accept() |
|
5773 | 5769 | |
|
5774 | 5770 | class ftpBuffer(): |
|
5775 | 5771 | |
|
5776 | 5772 | server = None |
|
5777 | 5773 | remotefolder = None |
|
5778 | 5774 | username = None |
|
5779 | 5775 | password = None |
|
5780 | 5776 | ftp_wei = None |
|
5781 | 5777 | exp_code = None |
|
5782 | 5778 | sub_exp_code = None |
|
5783 | 5779 | plot_pos = None |
|
5784 | 5780 | create = False |
|
5785 | 5781 | withoutconfig = False |
|
5786 | 5782 | createforView = False |
|
5787 | 5783 | localfolder = None |
|
5788 | 5784 | extension = None |
|
5789 | 5785 | period = None |
|
5790 | 5786 | protocol = None |
|
5791 | 5787 | |
|
5792 | 5788 | def __init__(self): |
|
5793 | 5789 | |
|
5794 | 5790 | self.create = False |
|
5795 | 5791 | self.server = None |
|
5796 | 5792 | self.remotefolder = None |
|
5797 | 5793 | self.username = None |
|
5798 | 5794 | self.password = None |
|
5799 | 5795 | self.ftp_wei = None |
|
5800 | 5796 | self.exp_code = None |
|
5801 | 5797 | self.sub_exp_code = None |
|
5802 | 5798 | self.plot_pos = None |
|
5803 | 5799 | # self.create = False |
|
5804 | 5800 | self.localfolder = None |
|
5805 | 5801 | self.extension = None |
|
5806 | 5802 | self.period = None |
|
5807 | 5803 | self.protocol = None |
|
5808 | 5804 | |
|
5809 | 5805 | def setwithoutconfiguration(self): |
|
5810 | 5806 | |
|
5811 | 5807 | self.create = False |
|
5812 | 5808 | self.server = "jro-app.igp.gob.pe" |
|
5813 | 5809 | self.remotefolder = "/home/wmaster/graficos" |
|
5814 | 5810 | self.username = "wmaster" |
|
5815 | 5811 | self.password = "mst2010vhf" |
|
5816 | 5812 | self.withoutconfig = True |
|
5817 | 5813 | self.localfolder = './' |
|
5818 | 5814 | self.extension = '.png' |
|
5819 | 5815 | self.period = 60 |
|
5820 | 5816 | self.protocol = 'ftp' |
|
5821 | 5817 | self.createforView = True |
|
5822 | 5818 | |
|
5823 | 5819 | if not self.ftp_wei: |
|
5824 | 5820 | self.ftp_wei = 0 |
|
5825 | 5821 | |
|
5826 | 5822 | if not self.exp_code: |
|
5827 | 5823 | self.exp_code = 0 |
|
5828 | 5824 | |
|
5829 | 5825 | if not self.sub_exp_code: |
|
5830 | 5826 | self.sub_exp_code = 0 |
|
5831 | 5827 | |
|
5832 | 5828 | if not self.plot_pos: |
|
5833 | 5829 | self.plot_pos = 0 |
|
5834 | 5830 | |
|
5835 | 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 | 5833 | self.server = server |
|
5838 | 5834 | self.remotefolder = remotefolder |
|
5839 | 5835 | self.username = username |
|
5840 | 5836 | self.password = password |
|
5841 | 5837 | self.ftp_wei = ftp_wei |
|
5842 | 5838 | self.exp_code = exp_code |
|
5843 | 5839 | self.sub_exp_code = sub_exp_code |
|
5844 | 5840 | self.plot_pos = plot_pos |
|
5845 | 5841 | self.create = True |
|
5846 | 5842 | self.withoutconfig = False |
|
5847 | 5843 | self.createforView = True |
|
5848 | 5844 | self.localfolder = localfolder |
|
5849 | 5845 | self.extension = extension |
|
5850 | 5846 | self.period = period |
|
5851 | 5847 | self.protocol = protocol |
|
5852 | 5848 | |
|
5853 | 5849 | def recover(self): |
|
5854 | 5850 | |
|
5855 | 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 | 5853 | class ShowMeConsole(QtCore.QObject): |
|
5858 | 5854 | |
|
5859 | 5855 | textWritten = QtCore.pyqtSignal(str) |
|
5860 | 5856 | |
|
5861 | 5857 | def write(self, text): |
|
5862 | 5858 | |
|
5863 | 5859 | if text[-1] == "\n": |
|
5864 | 5860 | text = text[:-1] |
|
5865 | 5861 | |
|
5866 | 5862 | self.textWritten.emit(str(text)) |
@@ -1,240 +1,240 | |||
|
1 | 1 | from PyQt4 import QtCore, QtGui |
|
2 | 2 | |
|
3 | 3 | try: |
|
4 | 4 | _fromUtf8 = QtCore.QString.fromUtf8 |
|
5 | 5 | except AttributeError: |
|
6 | 6 | def _fromUtf8(s): |
|
7 | 7 | return s |
|
8 | 8 | |
|
9 | 9 | try: |
|
10 | 10 | _encoding = QtGui.QApplication.UnicodeUTF8 |
|
11 | 11 | def _translate(context, text, disambig): |
|
12 | 12 | return QtGui.QApplication.translate(context, text, disambig, _encoding) |
|
13 | 13 | except AttributeError: |
|
14 | 14 | def _translate(context, text, disambig): |
|
15 | 15 | return QtGui.QApplication.translate(context, text, disambig) |
|
16 | 16 | |
|
17 | 17 | class Ui_SpectraHeisTab(object): |
|
18 | 18 | |
|
19 | 19 | def setupUi(self): |
|
20 | 20 | |
|
21 | 21 | self.tabSpectraHeis = QtGui.QWidget() |
|
22 | 22 | self.tabSpectraHeis.setObjectName(_fromUtf8("tabSpectraHeis")) |
|
23 | 23 | self.gridLayout_23 = QtGui.QGridLayout(self.tabSpectraHeis) |
|
24 | 24 | self.gridLayout_23.setObjectName(_fromUtf8("gridLayout_23")) |
|
25 | 25 | self.frame_6 = QtGui.QFrame(self.tabSpectraHeis) |
|
26 | 26 | self.frame_6.setFrameShape(QtGui.QFrame.StyledPanel) |
|
27 | 27 | self.frame_6.setFrameShadow(QtGui.QFrame.Raised) |
|
28 | 28 | self.frame_6.setObjectName(_fromUtf8("frame_6")) |
|
29 | 29 | self.gridLayout_22 = QtGui.QGridLayout(self.frame_6) |
|
30 | 30 | self.gridLayout_22.setObjectName(_fromUtf8("gridLayout_22")) |
|
31 | 31 | self.specHeisGraphClear = QtGui.QPushButton(self.frame_6) |
|
32 | 32 | self.specHeisGraphClear.setObjectName(_fromUtf8("specHeisGraphClear")) |
|
33 | 33 | self.gridLayout_22.addWidget(self.specHeisGraphClear, 0, 1, 1, 1) |
|
34 | 34 | self.specHeisOpOk = QtGui.QPushButton(self.frame_6) |
|
35 | 35 | self.specHeisOpOk.setObjectName(_fromUtf8("specHeisOpOk")) |
|
36 | 36 | self.gridLayout_22.addWidget(self.specHeisOpOk, 0, 0, 1, 1) |
|
37 | 37 | self.gridLayout_23.addWidget(self.frame_6, 1, 0, 1, 1) |
|
38 | 38 | self.tabWidgetSpectraHeis = QtGui.QTabWidget(self.tabSpectraHeis) |
|
39 | 39 | self.tabWidgetSpectraHeis.setObjectName(_fromUtf8("tabWidgetSpectraHeis")) |
|
40 | 40 | self.tabopSpectraHeis = QtGui.QWidget() |
|
41 | 41 | self.tabopSpectraHeis.setObjectName(_fromUtf8("tabopSpectraHeis")) |
|
42 | 42 | self.gridLayout_21 = QtGui.QGridLayout(self.tabopSpectraHeis) |
|
43 | 43 | self.gridLayout_21.setObjectName(_fromUtf8("gridLayout_21")) |
|
44 | 44 | spacerItem21 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
45 | 45 | self.gridLayout_21.addItem(spacerItem21, 0, 1, 1, 1) |
|
46 | 46 | self.specHeisOpCobIncInt = QtGui.QComboBox(self.tabopSpectraHeis) |
|
47 | 47 | self.specHeisOpCobIncInt.setObjectName(_fromUtf8("specHeisOpCobIncInt")) |
|
48 | 48 | self.specHeisOpCobIncInt.addItem(_fromUtf8("")) |
|
49 | 49 | self.gridLayout_21.addWidget(self.specHeisOpCobIncInt, 1, 0, 1, 1) |
|
50 | 50 | self.specHeisOpCebIncoherent = QtGui.QCheckBox(self.tabopSpectraHeis) |
|
51 | 51 | self.specHeisOpCebIncoherent.setObjectName(_fromUtf8("specHeisOpCebIncoherent")) |
|
52 | 52 | self.gridLayout_21.addWidget(self.specHeisOpCebIncoherent, 0, 0, 1, 1) |
|
53 | 53 | self.specHeisOpIncoherent = QtGui.QLineEdit(self.tabopSpectraHeis) |
|
54 | 54 | self.specHeisOpIncoherent.setObjectName(_fromUtf8("specHeisOpIncoherent")) |
|
55 | 55 | self.gridLayout_21.addWidget(self.specHeisOpIncoherent, 1, 1, 1, 1) |
|
56 | 56 | spacerItem22 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) |
|
57 | 57 | self.gridLayout_21.addItem(spacerItem22, 2, 0, 1, 1) |
|
58 | 58 | self.tabWidgetSpectraHeis.addTab(self.tabopSpectraHeis, _fromUtf8("")) |
|
59 | 59 | self.tabgraphSpectraHeis = QtGui.QWidget() |
|
60 | 60 | self.tabgraphSpectraHeis.setObjectName(_fromUtf8("tabgraphSpectraHeis")) |
|
61 | 61 | self.gridLayout_20 = QtGui.QGridLayout(self.tabgraphSpectraHeis) |
|
62 | 62 | self.gridLayout_20.setObjectName(_fromUtf8("gridLayout_20")) |
|
63 | 63 | self.label_54 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
64 | 64 | self.label_54.setObjectName(_fromUtf8("label_54")) |
|
65 | 65 | self.gridLayout_20.addWidget(self.label_54, 1, 0, 1, 1) |
|
66 | 66 | self.specHeisGraphToolPath = QtGui.QToolButton(self.tabgraphSpectraHeis) |
|
67 | 67 | self.specHeisGraphToolPath.setObjectName(_fromUtf8("specHeisGraphToolPath")) |
|
68 | 68 | self.gridLayout_20.addWidget(self.specHeisGraphToolPath, 0, 6, 1, 1) |
|
69 | 69 | self.specHeisGraphCebRTIplot = QtGui.QCheckBox(self.tabgraphSpectraHeis) |
|
70 | 70 | self.specHeisGraphCebRTIplot.setText(_fromUtf8("")) |
|
71 | 71 | self.specHeisGraphCebRTIplot.setObjectName(_fromUtf8("specHeisGraphCebRTIplot")) |
|
72 | 72 | self.gridLayout_20.addWidget(self.specHeisGraphCebRTIplot, 4, 2, 1, 1) |
|
73 | 73 | self.label_62 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
74 | 74 | self.label_62.setObjectName(_fromUtf8("label_62")) |
|
75 | 75 | self.gridLayout_20.addWidget(self.label_62, 7, 0, 1, 1) |
|
76 | 76 | self.label_63 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
77 | 77 | self.label_63.setObjectName(_fromUtf8("label_63")) |
|
78 | 78 | self.gridLayout_20.addWidget(self.label_63, 8, 0, 1, 1) |
|
79 | 79 | self.label_64 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
80 | 80 | self.label_64.setObjectName(_fromUtf8("label_64")) |
|
81 | 81 | self.gridLayout_20.addWidget(self.label_64, 9, 0, 1, 1) |
|
82 | 82 | self.label_65 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
83 | 83 | self.label_65.setObjectName(_fromUtf8("label_65")) |
|
84 | 84 | self.gridLayout_20.addWidget(self.label_65, 10, 0, 1, 1) |
|
85 | 85 | spacerItem23 = QtGui.QSpacerItem(134, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
86 | 86 | self.gridLayout_20.addItem(spacerItem23, 11, 0, 1, 2) |
|
87 | 87 | self.specHeisGgraphftpratio = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
88 | 88 | self.specHeisGgraphftpratio.setObjectName(_fromUtf8("specHeisGgraphftpratio")) |
|
89 | 89 | self.gridLayout_20.addWidget(self.specHeisGgraphftpratio, 10, 1, 1, 6) |
|
90 | 90 | self.specHeisGraphftpRTIplot = QtGui.QCheckBox(self.tabgraphSpectraHeis) |
|
91 | 91 | self.specHeisGraphftpRTIplot.setText(_fromUtf8("")) |
|
92 | 92 | self.specHeisGraphftpRTIplot.setObjectName(_fromUtf8("specHeisGraphftpRTIplot")) |
|
93 | 93 | self.gridLayout_20.addWidget(self.specHeisGraphftpRTIplot, 4, 6, 1, 1) |
|
94 | 94 | self.specHeisGgraphTminTmax = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
95 | 95 | self.specHeisGgraphTminTmax.setObjectName(_fromUtf8("specHeisGgraphTminTmax")) |
|
96 | 96 | self.gridLayout_20.addWidget(self.specHeisGgraphTminTmax, 8, 1, 1, 6) |
|
97 | 97 | self.label_60 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
98 | 98 | self.label_60.setObjectName(_fromUtf8("label_60")) |
|
99 | 99 | self.gridLayout_20.addWidget(self.label_60, 5, 0, 1, 1) |
|
100 | 100 | self.label_61 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
101 | 101 | self.label_61.setObjectName(_fromUtf8("label_61")) |
|
102 | 102 | self.gridLayout_20.addWidget(self.label_61, 6, 0, 1, 1) |
|
103 | 103 | self.specHeisGraphPrefix = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
104 | 104 | self.specHeisGraphPrefix.setObjectName(_fromUtf8("specHeisGraphPrefix")) |
|
105 | 105 | self.gridLayout_20.addWidget(self.specHeisGraphPrefix, 1, 1, 1, 6) |
|
106 | 106 | self.label_56 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
107 | 107 | self.label_56.setObjectName(_fromUtf8("label_56")) |
|
108 | 108 | self.gridLayout_20.addWidget(self.label_56, 2, 4, 1, 1) |
|
109 | 109 | self.label_57 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
110 | 110 | self.label_57.setObjectName(_fromUtf8("label_57")) |
|
111 | 111 | self.gridLayout_20.addWidget(self.label_57, 2, 6, 1, 1) |
|
112 | 112 | self.label_58 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
113 | 113 | self.label_58.setObjectName(_fromUtf8("label_58")) |
|
114 | 114 | self.gridLayout_20.addWidget(self.label_58, 3, 0, 1, 1) |
|
115 | 115 | self.specHeisGraphCebSpectraplot = QtGui.QCheckBox(self.tabgraphSpectraHeis) |
|
116 | 116 | self.specHeisGraphCebSpectraplot.setText(_fromUtf8("")) |
|
117 | 117 | self.specHeisGraphCebSpectraplot.setObjectName(_fromUtf8("specHeisGraphCebSpectraplot")) |
|
118 | 118 | self.gridLayout_20.addWidget(self.specHeisGraphCebSpectraplot, 3, 2, 1, 1) |
|
119 | 119 | self.specHeisGgraphYminYmax = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
120 | 120 | self.specHeisGgraphYminYmax.setObjectName(_fromUtf8("specHeisGgraphYminYmax")) |
|
121 | 121 | self.gridLayout_20.addWidget(self.specHeisGgraphYminYmax, 7, 1, 1, 6) |
|
122 | 122 | self.label_53 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
123 | 123 | self.label_53.setObjectName(_fromUtf8("label_53")) |
|
124 | 124 | self.gridLayout_20.addWidget(self.label_53, 0, 0, 1, 1) |
|
125 | 125 | self.label_55 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
126 | 126 | self.label_55.setObjectName(_fromUtf8("label_55")) |
|
127 | 127 | self.gridLayout_20.addWidget(self.label_55, 2, 2, 1, 1) |
|
128 | 128 | self.specHeisGraphSaveRTIplot = QtGui.QCheckBox(self.tabgraphSpectraHeis) |
|
129 | 129 | self.specHeisGraphSaveRTIplot.setText(_fromUtf8("")) |
|
130 | 130 | self.specHeisGraphSaveRTIplot.setObjectName(_fromUtf8("specHeisGraphSaveRTIplot")) |
|
131 | 131 | self.gridLayout_20.addWidget(self.specHeisGraphSaveRTIplot, 4, 4, 1, 1) |
|
132 | 132 | spacerItem24 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
133 | 133 | self.gridLayout_20.addItem(spacerItem24, 2, 3, 1, 1) |
|
134 | 134 | self.specHeisGgraphXminXmax = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
135 | 135 | self.specHeisGgraphXminXmax.setObjectName(_fromUtf8("specHeisGgraphXminXmax")) |
|
136 | 136 | self.gridLayout_20.addWidget(self.specHeisGgraphXminXmax, 6, 1, 1, 6) |
|
137 | 137 | self.specHeisGgraphChannelList = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
138 | 138 | self.specHeisGgraphChannelList.setObjectName(_fromUtf8("specHeisGgraphChannelList")) |
|
139 | 139 | self.gridLayout_20.addWidget(self.specHeisGgraphChannelList, 5, 1, 1, 6) |
|
140 | 140 | self.specHeisGgraphTimeRange = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
141 | 141 | self.specHeisGgraphTimeRange.setObjectName(_fromUtf8("specHeisGgraphTimeRange")) |
|
142 | 142 | self.gridLayout_20.addWidget(self.specHeisGgraphTimeRange, 9, 1, 1, 6) |
|
143 | 143 | spacerItem25 = QtGui.QSpacerItem(106, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
144 | 144 | self.gridLayout_20.addItem(spacerItem25, 11, 3, 1, 3) |
|
145 | 145 | self.specHeisGraphSaveSpectra = QtGui.QCheckBox(self.tabgraphSpectraHeis) |
|
146 | 146 | self.specHeisGraphSaveSpectra.setText(_fromUtf8("")) |
|
147 | 147 | self.specHeisGraphSaveSpectra.setObjectName(_fromUtf8("specHeisGraphSaveSpectra")) |
|
148 | 148 | self.gridLayout_20.addWidget(self.specHeisGraphSaveSpectra, 3, 4, 1, 1) |
|
149 | 149 | self.specHeisGraphftpSpectra = QtGui.QCheckBox(self.tabgraphSpectraHeis) |
|
150 | 150 | self.specHeisGraphftpSpectra.setText(_fromUtf8("")) |
|
151 | 151 | self.specHeisGraphftpSpectra.setObjectName(_fromUtf8("specHeisGraphftpSpectra")) |
|
152 | 152 | self.gridLayout_20.addWidget(self.specHeisGraphftpSpectra, 3, 6, 1, 1) |
|
153 | 153 | self.label_59 = QtGui.QLabel(self.tabgraphSpectraHeis) |
|
154 | 154 | self.label_59.setObjectName(_fromUtf8("label_59")) |
|
155 | 155 | self.gridLayout_20.addWidget(self.label_59, 4, 0, 1, 1) |
|
156 | 156 | spacerItem26 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) |
|
157 | 157 | self.gridLayout_20.addItem(spacerItem26, 2, 5, 1, 1) |
|
158 | 158 | self.specHeisGraphPath = QtGui.QLineEdit(self.tabgraphSpectraHeis) |
|
159 | 159 | self.specHeisGraphPath.setObjectName(_fromUtf8("specHeisGraphPath")) |
|
160 | 160 | self.gridLayout_20.addWidget(self.specHeisGraphPath, 0, 1, 1, 5) |
|
161 | 161 | self.tabWidgetSpectraHeis.addTab(self.tabgraphSpectraHeis, _fromUtf8("")) |
|
162 | 162 | self.taboutputSpectraHeis = QtGui.QWidget() |
|
163 | 163 | self.taboutputSpectraHeis.setObjectName(_fromUtf8("taboutputSpectraHeis")) |
|
164 | 164 | self.gridLayout_19 = QtGui.QGridLayout(self.taboutputSpectraHeis) |
|
165 | 165 | self.gridLayout_19.setObjectName(_fromUtf8("gridLayout_19")) |
|
166 | 166 | self.label_67 = QtGui.QLabel(self.taboutputSpectraHeis) |
|
167 | 167 | self.label_67.setObjectName(_fromUtf8("label_67")) |
|
168 | 168 | self.gridLayout_19.addWidget(self.label_67, 1, 0, 1, 1) |
|
169 | 169 | self.label_68 = QtGui.QLabel(self.taboutputSpectraHeis) |
|
170 | 170 | self.label_68.setObjectName(_fromUtf8("label_68")) |
|
171 | 171 | self.gridLayout_19.addWidget(self.label_68, 2, 0, 1, 2) |
|
172 | 172 | self.label_66 = QtGui.QLabel(self.taboutputSpectraHeis) |
|
173 | 173 | self.label_66.setObjectName(_fromUtf8("label_66")) |
|
174 | 174 | self.gridLayout_19.addWidget(self.label_66, 0, 0, 1, 1) |
|
175 | 175 | spacerItem27 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) |
|
176 | 176 | self.gridLayout_19.addItem(spacerItem27, 4, 0, 1, 1) |
|
177 | 177 | self.specHeisOutputToolPath = QtGui.QToolButton(self.taboutputSpectraHeis) |
|
178 | 178 | self.specHeisOutputToolPath.setObjectName(_fromUtf8("specHeisOutputToolPath")) |
|
179 | 179 | self.gridLayout_19.addWidget(self.specHeisOutputToolPath, 1, 4, 1, 1) |
|
180 | 180 | self.specHeisOutputPath = QtGui.QLineEdit(self.taboutputSpectraHeis) |
|
181 | 181 | self.specHeisOutputPath.setObjectName(_fromUtf8("specHeisOutputPath")) |
|
182 | 182 | self.gridLayout_19.addWidget(self.specHeisOutputPath, 1, 3, 1, 1) |
|
183 | 183 | self.specHeisOutputComdata = QtGui.QComboBox(self.taboutputSpectraHeis) |
|
184 | 184 | self.specHeisOutputComdata.setObjectName(_fromUtf8("specHeisOutputComdata")) |
|
185 | 185 | self.specHeisOutputComdata.addItem(_fromUtf8("")) |
|
186 | 186 | self.gridLayout_19.addWidget(self.specHeisOutputComdata, 0, 3, 1, 2) |
|
187 | 187 | self.label_69 = QtGui.QLabel(self.taboutputSpectraHeis) |
|
188 | 188 | self.label_69.setObjectName(_fromUtf8("label_69")) |
|
189 | 189 | self.gridLayout_19.addWidget(self.label_69, 3, 0, 1, 2) |
|
190 | 190 | self.specHeisOutputblocksperfile = QtGui.QLineEdit(self.taboutputSpectraHeis) |
|
191 | 191 | self.specHeisOutputblocksperfile.setObjectName(_fromUtf8("specHeisOutputblocksperfile")) |
|
192 | 192 | self.gridLayout_19.addWidget(self.specHeisOutputblocksperfile, 2, 3, 1, 1) |
|
193 | 193 | self.specHeisOutputMetada = QtGui.QLineEdit(self.taboutputSpectraHeis) |
|
194 | 194 | self.specHeisOutputMetada.setObjectName(_fromUtf8("specHeisOutputMetada")) |
|
195 | 195 | self.gridLayout_19.addWidget(self.specHeisOutputMetada, 3, 3, 1, 1) |
|
196 | 196 | self.specHeisOutputMetadaToolPath = QtGui.QToolButton(self.taboutputSpectraHeis) |
|
197 | 197 | self.specHeisOutputMetadaToolPath.setObjectName(_fromUtf8("specHeisOutputMetadaToolPath")) |
|
198 | 198 | self.gridLayout_19.addWidget(self.specHeisOutputMetadaToolPath, 3, 4, 1, 1) |
|
199 | 199 | self.tabWidgetSpectraHeis.addTab(self.taboutputSpectraHeis, _fromUtf8("")) |
|
200 | 200 | self.gridLayout_23.addWidget(self.tabWidgetSpectraHeis, 0, 0, 1, 1) |
|
201 | 201 | |
|
202 | 202 | self.tabWidgetProject.addTab(self.tabSpectraHeis, _fromUtf8("")) |
|
203 | 203 | |
|
204 | 204 | self.tabWidgetSpectraHeis.setCurrentIndex(0) |
|
205 | 205 | |
|
206 | 206 | def retranslateUi(self): |
|
207 | 207 | |
|
208 | 208 | self.specHeisGraphClear.setText(_translate("MainWindow", "Clear", None)) |
|
209 | 209 | self.specHeisOpOk.setText(_translate("MainWindow", "Ok", None)) |
|
210 | 210 | self.specHeisOpCobIncInt.setItemText(0, _translate("MainWindow", "Time Interval", None)) |
|
211 | 211 | self.specHeisOpCebIncoherent.setText(_translate("MainWindow", "Incoherent Intergration", None)) |
|
212 | 212 | |
|
213 | 213 | self.tabWidgetSpectraHeis.setTabText(self.tabWidgetSpectraHeis.indexOf(self.tabopSpectraHeis), _translate("MainWindow", "Operation", None)) |
|
214 | 214 | self.label_54.setText(_translate("MainWindow", "Prefix", None)) |
|
215 | 215 | self.specHeisGraphToolPath.setText(_translate("MainWindow", "...", None)) |
|
216 | 216 | self.label_62.setText(_translate("MainWindow", "Intensity range (dB)", None)) |
|
217 | 217 | self.label_63.setText(_translate("MainWindow", "Time range (hours):", None)) |
|
218 | 218 | self.label_64.setText(_translate("MainWindow", "Time interval:", None)) |
|
219 | 219 | self.label_65.setText(_translate("MainWindow", "Wr Period", None)) |
|
220 | 220 | self.label_60.setText(_translate("MainWindow", "Channel List:", None)) |
|
221 | 221 | self.label_61.setText(_translate("MainWindow", "Frequency range", None)) |
|
222 | 222 | self.label_56.setText(_translate("MainWindow", "Save", None)) |
|
223 | 223 | self.label_57.setText(_translate("MainWindow", "ftp", None)) |
|
224 | 224 | self.label_58.setText(_translate("MainWindow", "Spectra Plot", None)) |
|
225 | 225 | self.label_53.setText(_translate("MainWindow", "Path", None)) |
|
226 | 226 | self.label_55.setText(_translate("MainWindow", "Show", None)) |
|
227 | 227 | self.label_59.setText(_translate("MainWindow", "RTI Plot", None)) |
|
228 | 228 | |
|
229 | 229 | self.tabWidgetSpectraHeis.setTabText(self.tabWidgetSpectraHeis.indexOf(self.tabgraphSpectraHeis), _translate("MainWindow", "Graphics", None)) |
|
230 | 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 | 232 | self.label_66.setText(_translate("MainWindow", "Type:", None)) |
|
233 | 233 | |
|
234 | 234 | self.tabWidgetSpectraHeis.setTabText(self.tabWidgetSpectraHeis.indexOf(self.taboutputSpectraHeis), _translate("MainWindow", "Output", None)) |
|
235 | 235 | self.specHeisOutputToolPath.setText(_translate("MainWindow", "...", None)) |
|
236 | 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 | 238 | self.specHeisOutputMetadaToolPath.setText(_translate("MainWindow", "...", None)) |
|
239 | 239 | |
|
240 | 240 | self.tabWidgetProject.setTabText(self.tabWidgetProject.indexOf(self.tabSpectraHeis), _translate("MainWindow", "SpectraHeis", None)) |
@@ -1,1132 +1,1128 | |||
|
1 | 1 | ''' |
|
2 | 2 | |
|
3 | 3 | $Author: murco $ |
|
4 | 4 | $Id: JROData.py 173 2012-11-20 15:06:21Z murco $ |
|
5 | 5 | ''' |
|
6 | 6 | |
|
7 | 7 | import copy |
|
8 | 8 | import numpy |
|
9 | 9 | import datetime |
|
10 | 10 | |
|
11 | 11 | from jroheaderIO import SystemHeader, RadarControllerHeader |
|
12 | 12 | |
|
13 | 13 | def getNumpyDtype(dataTypeCode): |
|
14 | 14 | |
|
15 | 15 | if dataTypeCode == 0: |
|
16 | 16 | numpyDtype = numpy.dtype([('real','<i1'),('imag','<i1')]) |
|
17 | 17 | elif dataTypeCode == 1: |
|
18 | 18 | numpyDtype = numpy.dtype([('real','<i2'),('imag','<i2')]) |
|
19 | 19 | elif dataTypeCode == 2: |
|
20 | 20 | numpyDtype = numpy.dtype([('real','<i4'),('imag','<i4')]) |
|
21 | 21 | elif dataTypeCode == 3: |
|
22 | 22 | numpyDtype = numpy.dtype([('real','<i8'),('imag','<i8')]) |
|
23 | 23 | elif dataTypeCode == 4: |
|
24 | 24 | numpyDtype = numpy.dtype([('real','<f4'),('imag','<f4')]) |
|
25 | 25 | elif dataTypeCode == 5: |
|
26 | 26 | numpyDtype = numpy.dtype([('real','<f8'),('imag','<f8')]) |
|
27 | 27 | else: |
|
28 | 28 | raise ValueError, 'dataTypeCode was not defined' |
|
29 | 29 | |
|
30 | 30 | return numpyDtype |
|
31 | 31 | |
|
32 | 32 | def getDataTypeCode(numpyDtype): |
|
33 | 33 | |
|
34 | 34 | if numpyDtype == numpy.dtype([('real','<i1'),('imag','<i1')]): |
|
35 | 35 | datatype = 0 |
|
36 | 36 | elif numpyDtype == numpy.dtype([('real','<i2'),('imag','<i2')]): |
|
37 | 37 | datatype = 1 |
|
38 | 38 | elif numpyDtype == numpy.dtype([('real','<i4'),('imag','<i4')]): |
|
39 | 39 | datatype = 2 |
|
40 | 40 | elif numpyDtype == numpy.dtype([('real','<i8'),('imag','<i8')]): |
|
41 | 41 | datatype = 3 |
|
42 | 42 | elif numpyDtype == numpy.dtype([('real','<f4'),('imag','<f4')]): |
|
43 | 43 | datatype = 4 |
|
44 | 44 | elif numpyDtype == numpy.dtype([('real','<f8'),('imag','<f8')]): |
|
45 | 45 | datatype = 5 |
|
46 | 46 | else: |
|
47 | 47 | datatype = None |
|
48 | 48 | |
|
49 | 49 | return datatype |
|
50 | 50 | |
|
51 | 51 | def hildebrand_sekhon(data, navg): |
|
52 | 52 | """ |
|
53 | 53 | This method is for the objective determination of the noise level in Doppler spectra. This |
|
54 | 54 | implementation technique is based on the fact that the standard deviation of the spectral |
|
55 | 55 | densities is equal to the mean spectral density for white Gaussian noise |
|
56 | 56 | |
|
57 | 57 | Inputs: |
|
58 | 58 | Data : heights |
|
59 | 59 | navg : numbers of averages |
|
60 | 60 | |
|
61 | 61 | Return: |
|
62 | 62 | -1 : any error |
|
63 | 63 | anoise : noise's level |
|
64 | 64 | """ |
|
65 | 65 | |
|
66 | 66 | sortdata = numpy.sort(data,axis=None) |
|
67 | 67 | lenOfData = len(sortdata) |
|
68 | 68 | nums_min = lenOfData/10 |
|
69 | 69 | |
|
70 | 70 | if (lenOfData/10) > 2: |
|
71 | 71 | nums_min = lenOfData/10 |
|
72 | 72 | else: |
|
73 | 73 | nums_min = 2 |
|
74 | 74 | |
|
75 | 75 | sump = 0. |
|
76 | 76 | |
|
77 | 77 | sumq = 0. |
|
78 | 78 | |
|
79 | 79 | j = 0 |
|
80 | 80 | |
|
81 | 81 | cont = 1 |
|
82 | 82 | |
|
83 | 83 | while((cont==1)and(j<lenOfData)): |
|
84 | 84 | |
|
85 | 85 | sump += sortdata[j] |
|
86 | 86 | |
|
87 | 87 | sumq += sortdata[j]**2 |
|
88 | 88 | |
|
89 | 89 | if j > nums_min: |
|
90 | 90 | rtest = float(j)/(j-1) + 1.0/navg |
|
91 | 91 | if ((sumq*j) > (rtest*sump**2)): |
|
92 | 92 | j = j - 1 |
|
93 | 93 | sump = sump - sortdata[j] |
|
94 | 94 | sumq = sumq - sortdata[j]**2 |
|
95 | 95 | cont = 0 |
|
96 | 96 | |
|
97 | 97 | j += 1 |
|
98 | 98 | |
|
99 | 99 | lnoise = sump /j |
|
100 | 100 | stdv = numpy.sqrt((sumq - lnoise**2)/(j - 1)) |
|
101 | 101 | return lnoise |
|
102 | 102 | |
|
103 | 103 | class Beam: |
|
104 | 104 | def __init__(self): |
|
105 | 105 | self.codeList = [] |
|
106 | 106 | self.azimuthList = [] |
|
107 | 107 | self.zenithList = [] |
|
108 | 108 | |
|
109 | 109 | class GenericData(object): |
|
110 | 110 | |
|
111 | 111 | flagNoData = True |
|
112 | 112 | |
|
113 | 113 | def __init__(self): |
|
114 | 114 | |
|
115 | 115 | raise ValueError, "This class has not been implemented" |
|
116 | 116 | |
|
117 | 117 | def copy(self, inputObj=None): |
|
118 | 118 | |
|
119 | 119 | if inputObj == None: |
|
120 | 120 | return copy.deepcopy(self) |
|
121 | 121 | |
|
122 | 122 | for key in inputObj.__dict__.keys(): |
|
123 | 123 | self.__dict__[key] = inputObj.__dict__[key] |
|
124 | 124 | |
|
125 | 125 | def deepcopy(self): |
|
126 | 126 | |
|
127 | 127 | return copy.deepcopy(self) |
|
128 | 128 | |
|
129 | 129 | def isEmpty(self): |
|
130 | 130 | |
|
131 | 131 | return self.flagNoData |
|
132 | 132 | |
|
133 | 133 | class JROData(GenericData): |
|
134 | 134 | |
|
135 | 135 | # m_BasicHeader = BasicHeader() |
|
136 | 136 | # m_ProcessingHeader = ProcessingHeader() |
|
137 | 137 | |
|
138 | 138 | systemHeaderObj = SystemHeader() |
|
139 | 139 | |
|
140 | 140 | radarControllerHeaderObj = RadarControllerHeader() |
|
141 | 141 | |
|
142 | 142 | # data = None |
|
143 | 143 | |
|
144 | 144 | type = None |
|
145 | 145 | |
|
146 | 146 | datatype = None #dtype but in string |
|
147 | 147 | |
|
148 | 148 | # dtype = None |
|
149 | 149 | |
|
150 | 150 | # nChannels = None |
|
151 | 151 | |
|
152 | 152 | # nHeights = None |
|
153 | 153 | |
|
154 | 154 | nProfiles = None |
|
155 | 155 | |
|
156 | 156 | heightList = None |
|
157 | 157 | |
|
158 | 158 | channelList = None |
|
159 | 159 | |
|
160 | 160 | flagDiscontinuousBlock = False |
|
161 | 161 | |
|
162 | 162 | useLocalTime = False |
|
163 | 163 | |
|
164 | 164 | utctime = None |
|
165 | 165 | |
|
166 | 166 | timeZone = None |
|
167 | 167 | |
|
168 | 168 | dstFlag = None |
|
169 | 169 | |
|
170 | 170 | errorCount = None |
|
171 | 171 | |
|
172 | 172 | blocksize = None |
|
173 | 173 | |
|
174 | 174 | # nCode = None |
|
175 | 175 | # |
|
176 | 176 | # nBaud = None |
|
177 | 177 | # |
|
178 | 178 | # code = None |
|
179 | 179 | |
|
180 | 180 | flagDecodeData = False #asumo q la data no esta decodificada |
|
181 | 181 | |
|
182 | 182 | flagDeflipData = False #asumo q la data no esta sin flip |
|
183 | 183 | |
|
184 | 184 | flagShiftFFT = False |
|
185 | 185 | |
|
186 | 186 | # ippSeconds = None |
|
187 | 187 | |
|
188 | 188 | # timeInterval = None |
|
189 | 189 | |
|
190 | 190 | nCohInt = None |
|
191 | 191 | |
|
192 | 192 | # noise = None |
|
193 | 193 | |
|
194 | 194 | windowOfFilter = 1 |
|
195 | 195 | |
|
196 | 196 | #Speed of ligth |
|
197 | 197 | C = 3e8 |
|
198 | 198 | |
|
199 | 199 | frequency = 49.92e6 |
|
200 | 200 | |
|
201 | 201 | realtime = False |
|
202 | 202 | |
|
203 | 203 | beacon_heiIndexList = None |
|
204 | 204 | |
|
205 | 205 | last_block = None |
|
206 | 206 | |
|
207 | 207 | blocknow = None |
|
208 | 208 | |
|
209 | 209 | azimuth = None |
|
210 | 210 | |
|
211 | 211 | zenith = None |
|
212 | 212 | |
|
213 | 213 | beam = Beam() |
|
214 | 214 | |
|
215 | 215 | profileIndex = None |
|
216 | 216 | |
|
217 | 217 | def __init__(self): |
|
218 | 218 | |
|
219 | 219 | raise ValueError, "This class has not been implemented" |
|
220 | 220 | |
|
221 | 221 | def getNoise(self): |
|
222 | 222 | |
|
223 | 223 | raise ValueError, "Not implemented" |
|
224 | 224 | |
|
225 | 225 | def getNChannels(self): |
|
226 | 226 | |
|
227 | 227 | return len(self.channelList) |
|
228 | 228 | |
|
229 | 229 | def getChannelIndexList(self): |
|
230 | 230 | |
|
231 | 231 | return range(self.nChannels) |
|
232 | 232 | |
|
233 | 233 | def getNHeights(self): |
|
234 | 234 | |
|
235 | 235 | return len(self.heightList) |
|
236 | 236 | |
|
237 | 237 | def getHeiRange(self, extrapoints=0): |
|
238 | 238 | |
|
239 | 239 | heis = self.heightList |
|
240 | 240 | # deltah = self.heightList[1] - self.heightList[0] |
|
241 | 241 | # |
|
242 | 242 | # heis.append(self.heightList[-1]) |
|
243 | 243 | |
|
244 | 244 | return heis |
|
245 | 245 | |
|
246 | 246 | def getltctime(self): |
|
247 | 247 | |
|
248 | 248 | if self.useLocalTime: |
|
249 | 249 | return self.utctime - self.timeZone*60 |
|
250 | 250 | |
|
251 | 251 | return self.utctime |
|
252 | 252 | |
|
253 | 253 | def getDatatime(self): |
|
254 | 254 | |
|
255 | 255 | datatimeValue = datetime.datetime.utcfromtimestamp(self.ltctime) |
|
256 | 256 | return datatimeValue |
|
257 | 257 | |
|
258 | 258 | def getTimeRange(self): |
|
259 | 259 | |
|
260 | 260 | datatime = [] |
|
261 | 261 | |
|
262 | 262 | datatime.append(self.ltctime) |
|
263 | 263 | datatime.append(self.ltctime + self.timeInterval+60) |
|
264 | 264 | |
|
265 | 265 | datatime = numpy.array(datatime) |
|
266 | 266 | |
|
267 | 267 | return datatime |
|
268 | 268 | |
|
269 | 269 | def getFmax(self): |
|
270 | 270 | |
|
271 | 271 | PRF = 1./(self.ippSeconds * self.nCohInt) |
|
272 | 272 | |
|
273 | 273 | fmax = PRF/2. |
|
274 | 274 | |
|
275 | 275 | return fmax |
|
276 | 276 | |
|
277 | 277 | def getVmax(self): |
|
278 | 278 | |
|
279 | 279 | _lambda = self.C/self.frequency |
|
280 | 280 | |
|
281 | 281 | vmax = self.getFmax() * _lambda |
|
282 | 282 | |
|
283 | 283 | return vmax |
|
284 | 284 | |
|
285 | 285 | def get_ippSeconds(self): |
|
286 | 286 | ''' |
|
287 | 287 | ''' |
|
288 | 288 | return self.radarControllerHeaderObj.ippSeconds |
|
289 | 289 | |
|
290 | 290 | def set_ippSeconds(self, ippSeconds): |
|
291 | 291 | ''' |
|
292 | 292 | ''' |
|
293 | 293 | |
|
294 | 294 | self.radarControllerHeaderObj.ippSeconds = ippSeconds |
|
295 | 295 | |
|
296 | 296 | return |
|
297 | 297 | |
|
298 | 298 | def get_dtype(self): |
|
299 | 299 | ''' |
|
300 | 300 | ''' |
|
301 | 301 | return getNumpyDtype(self.datatype) |
|
302 | 302 | |
|
303 | 303 | def set_dtype(self, numpyDtype): |
|
304 | 304 | ''' |
|
305 | 305 | ''' |
|
306 | 306 | |
|
307 | 307 | self.datatype = getDataTypeCode(numpyDtype) |
|
308 | 308 | |
|
309 | 309 | def get_code(self): |
|
310 | 310 | ''' |
|
311 | 311 | ''' |
|
312 | 312 | return self.radarControllerHeaderObj.code |
|
313 | 313 | |
|
314 | 314 | def set_code(self, code): |
|
315 | 315 | ''' |
|
316 | 316 | ''' |
|
317 | 317 | self.radarControllerHeaderObj.code = code |
|
318 | 318 | |
|
319 | 319 | return |
|
320 | 320 | |
|
321 | 321 | def get_ncode(self): |
|
322 | 322 | ''' |
|
323 | 323 | ''' |
|
324 | 324 | return self.radarControllerHeaderObj.nCode |
|
325 | 325 | |
|
326 | 326 | def set_ncode(self, nCode): |
|
327 | 327 | ''' |
|
328 | 328 | ''' |
|
329 | 329 | self.radarControllerHeaderObj.nCode = nCode |
|
330 | 330 | |
|
331 | 331 | return |
|
332 | 332 | |
|
333 | 333 | def get_nbaud(self): |
|
334 | 334 | ''' |
|
335 | 335 | ''' |
|
336 | 336 | return self.radarControllerHeaderObj.nBaud |
|
337 | 337 | |
|
338 | 338 | def set_nbaud(self, nBaud): |
|
339 | 339 | ''' |
|
340 | 340 | ''' |
|
341 | 341 | self.radarControllerHeaderObj.nBaud = nBaud |
|
342 | 342 | |
|
343 | 343 | return |
|
344 | 344 | # def getTimeInterval(self): |
|
345 | 345 | # |
|
346 | 346 | # raise IOError, "This method should be implemented inside each Class" |
|
347 | 347 | |
|
348 | 348 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") |
|
349 | 349 | channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") |
|
350 | 350 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") |
|
351 | 351 | #noise = property(getNoise, "I'm the 'nHeights' property.") |
|
352 | 352 | datatime = property(getDatatime, "I'm the 'datatime' property") |
|
353 | 353 | ltctime = property(getltctime, "I'm the 'ltctime' property") |
|
354 | 354 | ippSeconds = property(get_ippSeconds, set_ippSeconds) |
|
355 | 355 | dtype = property(get_dtype, set_dtype) |
|
356 | 356 | # timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
357 | 357 | code = property(get_code, set_code) |
|
358 | 358 | nCode = property(get_ncode, set_ncode) |
|
359 | 359 | nBaud = property(get_nbaud, set_nbaud) |
|
360 | 360 | |
|
361 | 361 | class Voltage(JROData): |
|
362 | 362 | |
|
363 | 363 | #data es un numpy array de 2 dmensiones (canales, alturas) |
|
364 | 364 | data = None |
|
365 | 365 | |
|
366 | 366 | def __init__(self): |
|
367 | 367 | ''' |
|
368 | 368 | Constructor |
|
369 | 369 | ''' |
|
370 | 370 | |
|
371 | 371 | self.useLocalTime = True |
|
372 | 372 | |
|
373 | 373 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
374 | 374 | |
|
375 | 375 | self.systemHeaderObj = SystemHeader() |
|
376 | 376 | |
|
377 | 377 | self.type = "Voltage" |
|
378 | 378 | |
|
379 | 379 | self.data = None |
|
380 | 380 | |
|
381 | 381 | # self.dtype = None |
|
382 | 382 | |
|
383 | 383 | # self.nChannels = 0 |
|
384 | 384 | |
|
385 | 385 | # self.nHeights = 0 |
|
386 | 386 | |
|
387 | 387 | self.nProfiles = None |
|
388 | 388 | |
|
389 | 389 | self.heightList = None |
|
390 | 390 | |
|
391 | 391 | self.channelList = None |
|
392 | 392 | |
|
393 | 393 | # self.channelIndexList = None |
|
394 | 394 | |
|
395 | 395 | self.flagNoData = True |
|
396 | 396 | |
|
397 | 397 | self.flagDiscontinuousBlock = False |
|
398 | 398 | |
|
399 | 399 | self.utctime = None |
|
400 | 400 | |
|
401 | 401 | self.timeZone = None |
|
402 | 402 | |
|
403 | 403 | self.dstFlag = None |
|
404 | 404 | |
|
405 | 405 | self.errorCount = None |
|
406 | 406 | |
|
407 | 407 | self.nCohInt = None |
|
408 | 408 | |
|
409 | 409 | self.blocksize = None |
|
410 | 410 | |
|
411 | 411 | self.flagDecodeData = False #asumo q la data no esta decodificada |
|
412 | 412 | |
|
413 | 413 | self.flagDeflipData = False #asumo q la data no esta sin flip |
|
414 | 414 | |
|
415 | 415 | self.flagShiftFFT = False |
|
416 | 416 | |
|
417 | 417 | self.flagDataAsBlock = False #Asumo que la data es leida perfil a perfil |
|
418 | 418 | |
|
419 | 419 | self.profileIndex = 0 |
|
420 | 420 | |
|
421 | 421 | def getNoisebyHildebrand(self, channel = None): |
|
422 | 422 | """ |
|
423 | 423 | Determino el nivel de ruido usando el metodo Hildebrand-Sekhon |
|
424 | 424 | |
|
425 | 425 | Return: |
|
426 | 426 | noiselevel |
|
427 | 427 | """ |
|
428 | 428 | |
|
429 | 429 | if channel != None: |
|
430 | 430 | data = self.data[channel] |
|
431 | 431 | nChannels = 1 |
|
432 | 432 | else: |
|
433 | 433 | data = self.data |
|
434 | 434 | nChannels = self.nChannels |
|
435 | 435 | |
|
436 | 436 | noise = numpy.zeros(nChannels) |
|
437 | 437 | power = data * numpy.conjugate(data) |
|
438 | 438 | |
|
439 | 439 | for thisChannel in range(nChannels): |
|
440 | 440 | if nChannels == 1: |
|
441 | 441 | daux = power[:].real |
|
442 | 442 | else: |
|
443 | 443 | daux = power[thisChannel,:].real |
|
444 | 444 | noise[thisChannel] = hildebrand_sekhon(daux, self.nCohInt) |
|
445 | 445 | |
|
446 | 446 | return noise |
|
447 | 447 | |
|
448 | 448 | def getNoise(self, type = 1, channel = None): |
|
449 | 449 | |
|
450 | 450 | if type == 1: |
|
451 | 451 | noise = self.getNoisebyHildebrand(channel) |
|
452 | 452 | |
|
453 | 453 | return 10*numpy.log10(noise) |
|
454 | 454 | |
|
455 | 455 | def getPower(self, channel = None): |
|
456 | 456 | |
|
457 | 457 | if channel != None: |
|
458 | 458 | data = self.data[channel] |
|
459 | 459 | else: |
|
460 | 460 | data = self.data |
|
461 | 461 | |
|
462 | 462 | power = data * numpy.conjugate(data) |
|
463 | 463 | |
|
464 | 464 | return 10*numpy.log10(power.real) |
|
465 | 465 | |
|
466 | 466 | def getTimeInterval(self): |
|
467 | 467 | |
|
468 | 468 | timeInterval = self.ippSeconds * self.nCohInt |
|
469 | 469 | |
|
470 | 470 | return timeInterval |
|
471 | 471 | |
|
472 | 472 | noise = property(getNoise, "I'm the 'nHeights' property.") |
|
473 | 473 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
474 | 474 | |
|
475 | 475 | class Spectra(JROData): |
|
476 | 476 | |
|
477 | 477 | #data es un numpy array de 2 dmensiones (canales, perfiles, alturas) |
|
478 | 478 | data_spc = None |
|
479 | 479 | |
|
480 | 480 | #data es un numpy array de 2 dmensiones (canales, pares, alturas) |
|
481 | 481 | data_cspc = None |
|
482 | 482 | |
|
483 | 483 | #data es un numpy array de 2 dmensiones (canales, alturas) |
|
484 | 484 | data_dc = None |
|
485 | 485 | |
|
486 | 486 | nFFTPoints = None |
|
487 | 487 | |
|
488 | 488 | # nPairs = None |
|
489 | 489 | |
|
490 | 490 | pairsList = None |
|
491 | 491 | |
|
492 | 492 | nIncohInt = None |
|
493 | 493 | |
|
494 | 494 | wavelength = None #Necesario para cacular el rango de velocidad desde la frecuencia |
|
495 | 495 | |
|
496 | 496 | nCohInt = None #se requiere para determinar el valor de timeInterval |
|
497 | 497 | |
|
498 | 498 | ippFactor = None |
|
499 | 499 | |
|
500 | 500 | profileIndex = 0 |
|
501 | 501 | |
|
502 | 502 | def __init__(self): |
|
503 | 503 | ''' |
|
504 | 504 | Constructor |
|
505 | 505 | ''' |
|
506 | 506 | |
|
507 | 507 | self.useLocalTime = True |
|
508 | 508 | |
|
509 | 509 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
510 | 510 | |
|
511 | 511 | self.systemHeaderObj = SystemHeader() |
|
512 | 512 | |
|
513 | 513 | self.type = "Spectra" |
|
514 | 514 | |
|
515 | 515 | # self.data = None |
|
516 | 516 | |
|
517 | 517 | # self.dtype = None |
|
518 | 518 | |
|
519 | 519 | # self.nChannels = 0 |
|
520 | 520 | |
|
521 | 521 | # self.nHeights = 0 |
|
522 | 522 | |
|
523 | 523 | self.nProfiles = None |
|
524 | 524 | |
|
525 | 525 | self.heightList = None |
|
526 | 526 | |
|
527 | 527 | self.channelList = None |
|
528 | 528 | |
|
529 | 529 | # self.channelIndexList = None |
|
530 | 530 | |
|
531 | 531 | self.pairsList = None |
|
532 | 532 | |
|
533 | 533 | self.flagNoData = True |
|
534 | 534 | |
|
535 | 535 | self.flagDiscontinuousBlock = False |
|
536 | 536 | |
|
537 | 537 | self.utctime = None |
|
538 | 538 | |
|
539 | 539 | self.nCohInt = None |
|
540 | 540 | |
|
541 | 541 | self.nIncohInt = None |
|
542 | 542 | |
|
543 | 543 | self.blocksize = None |
|
544 | 544 | |
|
545 | 545 | self.nFFTPoints = None |
|
546 | 546 | |
|
547 | 547 | self.wavelength = None |
|
548 | 548 | |
|
549 | 549 | self.flagDecodeData = False #asumo q la data no esta decodificada |
|
550 | 550 | |
|
551 | 551 | self.flagDeflipData = False #asumo q la data no esta sin flip |
|
552 | 552 | |
|
553 | 553 | self.flagShiftFFT = False |
|
554 | 554 | |
|
555 | 555 | self.ippFactor = 1 |
|
556 | 556 | |
|
557 | 557 | #self.noise = None |
|
558 | 558 | |
|
559 | 559 | self.beacon_heiIndexList = [] |
|
560 | 560 | |
|
561 | 561 | self.noise_estimation = None |
|
562 | 562 | |
|
563 | 563 | |
|
564 | 564 | def getNoisebyHildebrand(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): |
|
565 | 565 | """ |
|
566 | 566 | Determino el nivel de ruido usando el metodo Hildebrand-Sekhon |
|
567 | 567 | |
|
568 | 568 | Return: |
|
569 | 569 | noiselevel |
|
570 | 570 | """ |
|
571 | 571 | |
|
572 | 572 | noise = numpy.zeros(self.nChannels) |
|
573 | 573 | |
|
574 | 574 | for channel in range(self.nChannels): |
|
575 | 575 | daux = self.data_spc[channel,xmin_index:xmax_index,ymin_index:ymax_index] |
|
576 | 576 | noise[channel] = hildebrand_sekhon(daux, self.nIncohInt) |
|
577 | 577 | |
|
578 | 578 | return noise |
|
579 | 579 | |
|
580 | 580 | def getNoise(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): |
|
581 | 581 | |
|
582 | 582 | if self.noise_estimation != None: |
|
583 | 583 | return self.noise_estimation #this was estimated by getNoise Operation defined in jroproc_spectra.py |
|
584 | 584 | else: |
|
585 | 585 | noise = self.getNoisebyHildebrand(xmin_index, xmax_index, ymin_index, ymax_index) |
|
586 | 586 | return noise |
|
587 | 587 | |
|
588 | 588 | |
|
589 | 589 | def getFreqRange(self, extrapoints=0): |
|
590 | 590 | |
|
591 | 591 | deltafreq = self.getFmax() / (self.nFFTPoints*self.ippFactor) |
|
592 | 592 | freqrange = deltafreq*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltafreq/2 |
|
593 | 593 | |
|
594 | 594 | return freqrange |
|
595 | 595 | |
|
596 | 596 | def getVelRange(self, extrapoints=0): |
|
597 | 597 | |
|
598 | 598 | deltav = self.getVmax() / (self.nFFTPoints*self.ippFactor) |
|
599 | 599 | velrange = deltav*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltav/2 |
|
600 | 600 | |
|
601 | 601 | return velrange |
|
602 | 602 | |
|
603 | 603 | def getNPairs(self): |
|
604 | 604 | |
|
605 | 605 | return len(self.pairsList) |
|
606 | 606 | |
|
607 | 607 | def getPairsIndexList(self): |
|
608 | 608 | |
|
609 | 609 | return range(self.nPairs) |
|
610 | 610 | |
|
611 | 611 | def getNormFactor(self): |
|
612 | 612 | |
|
613 | 613 | pwcode = 1 |
|
614 | 614 | |
|
615 | 615 | if self.flagDecodeData: |
|
616 | 616 | pwcode = numpy.sum(self.code[0]**2) |
|
617 | 617 | #normFactor = min(self.nFFTPoints,self.nProfiles)*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter |
|
618 | 618 | normFactor = self.nProfiles*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter |
|
619 | 619 | |
|
620 | 620 | return normFactor |
|
621 | 621 | |
|
622 | 622 | def getFlagCspc(self): |
|
623 | 623 | |
|
624 | 624 | if self.data_cspc is None: |
|
625 | 625 | return True |
|
626 | 626 | |
|
627 | 627 | return False |
|
628 | 628 | |
|
629 | 629 | def getFlagDc(self): |
|
630 | 630 | |
|
631 | 631 | if self.data_dc is None: |
|
632 | 632 | return True |
|
633 | 633 | |
|
634 | 634 | return False |
|
635 | 635 | |
|
636 | 636 | def getTimeInterval(self): |
|
637 | 637 | |
|
638 | 638 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt * self.nProfiles |
|
639 | 639 | |
|
640 | 640 | return timeInterval |
|
641 | 641 | |
|
642 | 642 | def setValue(self, value): |
|
643 | 643 | |
|
644 | 644 | print "This property should not be initialized" |
|
645 | 645 | |
|
646 | 646 | return |
|
647 | 647 | |
|
648 | 648 | nPairs = property(getNPairs, setValue, "I'm the 'nPairs' property.") |
|
649 | 649 | pairsIndexList = property(getPairsIndexList, setValue, "I'm the 'pairsIndexList' property.") |
|
650 | 650 | normFactor = property(getNormFactor, setValue, "I'm the 'getNormFactor' property.") |
|
651 | 651 | flag_cspc = property(getFlagCspc, setValue) |
|
652 | 652 | flag_dc = property(getFlagDc, setValue) |
|
653 | 653 | noise = property(getNoise, setValue, "I'm the 'nHeights' property.") |
|
654 | 654 | timeInterval = property(getTimeInterval, setValue, "I'm the 'timeInterval' property") |
|
655 | 655 | |
|
656 | 656 | class SpectraHeis(Spectra): |
|
657 | 657 | |
|
658 | 658 | data_spc = None |
|
659 | 659 | |
|
660 | 660 | data_cspc = None |
|
661 | 661 | |
|
662 | 662 | data_dc = None |
|
663 | 663 | |
|
664 | 664 | nFFTPoints = None |
|
665 | 665 | |
|
666 | 666 | # nPairs = None |
|
667 | 667 | |
|
668 | 668 | pairsList = None |
|
669 | 669 | |
|
670 | 670 | nCohInt = None |
|
671 | 671 | |
|
672 | 672 | nIncohInt = None |
|
673 | 673 | |
|
674 | 674 | def __init__(self): |
|
675 | 675 | |
|
676 | 676 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
677 | 677 | |
|
678 | 678 | self.systemHeaderObj = SystemHeader() |
|
679 | 679 | |
|
680 | 680 | self.type = "SpectraHeis" |
|
681 | 681 | |
|
682 | 682 | # self.dtype = None |
|
683 | 683 | |
|
684 | 684 | # self.nChannels = 0 |
|
685 | 685 | |
|
686 | 686 | # self.nHeights = 0 |
|
687 | 687 | |
|
688 | 688 | self.nProfiles = None |
|
689 | 689 | |
|
690 | 690 | self.heightList = None |
|
691 | 691 | |
|
692 | 692 | self.channelList = None |
|
693 | 693 | |
|
694 | 694 | # self.channelIndexList = None |
|
695 | 695 | |
|
696 | 696 | self.flagNoData = True |
|
697 | 697 | |
|
698 | 698 | self.flagDiscontinuousBlock = False |
|
699 | 699 | |
|
700 | 700 | # self.nPairs = 0 |
|
701 | 701 | |
|
702 | 702 | self.utctime = None |
|
703 | 703 | |
|
704 | 704 | self.blocksize = None |
|
705 | 705 | |
|
706 | 706 | self.profileIndex = 0 |
|
707 | 707 | |
|
708 | 708 | self.nCohInt = 1 |
|
709 | 709 | |
|
710 | 710 | self.nIncohInt = 1 |
|
711 | 711 | |
|
712 | 712 | def getNormFactor(self): |
|
713 | 713 | pwcode = 1 |
|
714 | 714 | if self.flagDecodeData: |
|
715 | 715 | pwcode = numpy.sum(self.code[0]**2) |
|
716 | 716 | |
|
717 | 717 | normFactor = self.nIncohInt*self.nCohInt*pwcode |
|
718 | 718 | |
|
719 | 719 | return normFactor |
|
720 | 720 | |
|
721 | 721 | def getTimeInterval(self): |
|
722 | 722 | |
|
723 | 723 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt |
|
724 | 724 | |
|
725 | 725 | return timeInterval |
|
726 | 726 | |
|
727 | 727 | normFactor = property(getNormFactor, "I'm the 'getNormFactor' property.") |
|
728 | 728 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
729 | 729 | |
|
730 | 730 | class Fits(JROData): |
|
731 | 731 | |
|
732 | 732 | heightList = None |
|
733 | 733 | |
|
734 | 734 | channelList = None |
|
735 | 735 | |
|
736 | 736 | flagNoData = True |
|
737 | 737 | |
|
738 | 738 | flagDiscontinuousBlock = False |
|
739 | 739 | |
|
740 | 740 | useLocalTime = False |
|
741 | 741 | |
|
742 | 742 | utctime = None |
|
743 | 743 | |
|
744 | 744 | timeZone = None |
|
745 | 745 | |
|
746 | 746 | # ippSeconds = None |
|
747 | 747 | |
|
748 | 748 | # timeInterval = None |
|
749 | 749 | |
|
750 | 750 | nCohInt = None |
|
751 | 751 | |
|
752 | 752 | nIncohInt = None |
|
753 | 753 | |
|
754 | 754 | noise = None |
|
755 | 755 | |
|
756 | 756 | windowOfFilter = 1 |
|
757 | 757 | |
|
758 | 758 | #Speed of ligth |
|
759 | 759 | C = 3e8 |
|
760 | 760 | |
|
761 | 761 | frequency = 49.92e6 |
|
762 | 762 | |
|
763 | 763 | realtime = False |
|
764 | 764 | |
|
765 | 765 | |
|
766 | 766 | def __init__(self): |
|
767 | 767 | |
|
768 | 768 | self.type = "Fits" |
|
769 | 769 | |
|
770 | 770 | self.nProfiles = None |
|
771 | 771 | |
|
772 | 772 | self.heightList = None |
|
773 | 773 | |
|
774 | 774 | self.channelList = None |
|
775 | 775 | |
|
776 | 776 | # self.channelIndexList = None |
|
777 | 777 | |
|
778 | 778 | self.flagNoData = True |
|
779 | 779 | |
|
780 | 780 | self.utctime = None |
|
781 | 781 | |
|
782 | 782 | self.nCohInt = 1 |
|
783 | 783 | |
|
784 | 784 | self.nIncohInt = 1 |
|
785 | 785 | |
|
786 | 786 | self.useLocalTime = True |
|
787 | 787 | |
|
788 | 788 | self.profileIndex = 0 |
|
789 | 789 | |
|
790 | 790 | # self.utctime = None |
|
791 | 791 | # self.timeZone = None |
|
792 | 792 | # self.ltctime = None |
|
793 | 793 | # self.timeInterval = None |
|
794 | 794 | # self.header = None |
|
795 | 795 | # self.data_header = None |
|
796 | 796 | # self.data = None |
|
797 | 797 | # self.datatime = None |
|
798 | 798 | # self.flagNoData = False |
|
799 | 799 | # self.expName = '' |
|
800 | 800 | # self.nChannels = None |
|
801 | 801 | # self.nSamples = None |
|
802 | 802 | # self.dataBlocksPerFile = None |
|
803 | 803 | # self.comments = '' |
|
804 | 804 | # |
|
805 | 805 | |
|
806 | 806 | |
|
807 | 807 | def getltctime(self): |
|
808 | 808 | |
|
809 | 809 | if self.useLocalTime: |
|
810 | 810 | return self.utctime - self.timeZone*60 |
|
811 | 811 | |
|
812 | 812 | return self.utctime |
|
813 | 813 | |
|
814 | 814 | def getDatatime(self): |
|
815 | 815 | |
|
816 | 816 | datatime = datetime.datetime.utcfromtimestamp(self.ltctime) |
|
817 | 817 | return datatime |
|
818 | 818 | |
|
819 | 819 | def getTimeRange(self): |
|
820 | 820 | |
|
821 | 821 | datatime = [] |
|
822 | 822 | |
|
823 | 823 | datatime.append(self.ltctime) |
|
824 | 824 | datatime.append(self.ltctime + self.timeInterval) |
|
825 | 825 | |
|
826 | 826 | datatime = numpy.array(datatime) |
|
827 | 827 | |
|
828 | 828 | return datatime |
|
829 | 829 | |
|
830 | 830 | def getHeiRange(self): |
|
831 | 831 | |
|
832 | 832 | heis = self.heightList |
|
833 | 833 | |
|
834 | 834 | return heis |
|
835 | 835 | |
|
836 | def isEmpty(self): | |
|
837 | ||
|
838 | return self.flagNoData | |
|
839 | ||
|
840 | 836 | def getNHeights(self): |
|
841 | 837 | |
|
842 | 838 | return len(self.heightList) |
|
843 | 839 | |
|
844 | 840 | def getNChannels(self): |
|
845 | 841 | |
|
846 | 842 | return len(self.channelList) |
|
847 | 843 | |
|
848 | 844 | def getChannelIndexList(self): |
|
849 | 845 | |
|
850 | 846 | return range(self.nChannels) |
|
851 | 847 | |
|
852 | 848 | def getNoise(self, type = 1): |
|
853 | 849 | |
|
854 | 850 | #noise = numpy.zeros(self.nChannels) |
|
855 | 851 | |
|
856 | 852 | if type == 1: |
|
857 | 853 | noise = self.getNoisebyHildebrand() |
|
858 | 854 | |
|
859 | 855 | if type == 2: |
|
860 | 856 | noise = self.getNoisebySort() |
|
861 | 857 | |
|
862 | 858 | if type == 3: |
|
863 | 859 | noise = self.getNoisebyWindow() |
|
864 | 860 | |
|
865 | 861 | return noise |
|
866 | 862 | |
|
867 | 863 | def getTimeInterval(self): |
|
868 | 864 | |
|
869 | 865 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt |
|
870 | 866 | |
|
871 | 867 | return timeInterval |
|
872 | 868 | |
|
873 | 869 | datatime = property(getDatatime, "I'm the 'datatime' property") |
|
874 | 870 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") |
|
875 | 871 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") |
|
876 | 872 | channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") |
|
877 | 873 | noise = property(getNoise, "I'm the 'nHeights' property.") |
|
878 | 874 | |
|
879 | 875 | ltctime = property(getltctime, "I'm the 'ltctime' property") |
|
880 | 876 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
881 | 877 | |
|
882 | 878 | class Correlation(JROData): |
|
883 | 879 | |
|
884 | 880 | noise = None |
|
885 | 881 | |
|
886 | 882 | SNR = None |
|
887 | 883 | |
|
888 | 884 | pairsAutoCorr = None #Pairs of Autocorrelation |
|
889 | 885 | |
|
890 | 886 | #-------------------------------------------------- |
|
891 | 887 | |
|
892 | 888 | data_corr = None |
|
893 | 889 | |
|
894 | 890 | data_volt = None |
|
895 | 891 | |
|
896 | 892 | lagT = None # each element value is a profileIndex |
|
897 | 893 | |
|
898 | 894 | lagR = None # each element value is in km |
|
899 | 895 | |
|
900 | 896 | pairsList = None |
|
901 | 897 | |
|
902 | 898 | calculateVelocity = None |
|
903 | 899 | |
|
904 | 900 | nPoints = None |
|
905 | 901 | |
|
906 | 902 | nAvg = None |
|
907 | 903 | |
|
908 | 904 | bufferSize = None |
|
909 | 905 | |
|
910 | 906 | def __init__(self): |
|
911 | 907 | ''' |
|
912 | 908 | Constructor |
|
913 | 909 | ''' |
|
914 | 910 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
915 | 911 | |
|
916 | 912 | self.systemHeaderObj = SystemHeader() |
|
917 | 913 | |
|
918 | 914 | self.type = "Correlation" |
|
919 | 915 | |
|
920 | 916 | self.data = None |
|
921 | 917 | |
|
922 | 918 | self.dtype = None |
|
923 | 919 | |
|
924 | 920 | self.nProfiles = None |
|
925 | 921 | |
|
926 | 922 | self.heightList = None |
|
927 | 923 | |
|
928 | 924 | self.channelList = None |
|
929 | 925 | |
|
930 | 926 | self.flagNoData = True |
|
931 | 927 | |
|
932 | 928 | self.flagDiscontinuousBlock = False |
|
933 | 929 | |
|
934 | 930 | self.utctime = None |
|
935 | 931 | |
|
936 | 932 | self.timeZone = None |
|
937 | 933 | |
|
938 | 934 | self.dstFlag = None |
|
939 | 935 | |
|
940 | 936 | self.errorCount = None |
|
941 | 937 | |
|
942 | 938 | self.blocksize = None |
|
943 | 939 | |
|
944 | 940 | self.flagDecodeData = False #asumo q la data no esta decodificada |
|
945 | 941 | |
|
946 | 942 | self.flagDeflipData = False #asumo q la data no esta sin flip |
|
947 | 943 | |
|
948 | 944 | self.pairsList = None |
|
949 | 945 | |
|
950 | 946 | self.nPoints = None |
|
951 | 947 | |
|
952 | 948 | def getLagTRange(self, extrapoints=0): |
|
953 | 949 | |
|
954 | 950 | lagTRange = self.lagT |
|
955 | 951 | diff = lagTRange[1] - lagTRange[0] |
|
956 | 952 | extra = numpy.arange(1,extrapoints + 1)*diff + lagTRange[-1] |
|
957 | 953 | lagTRange = numpy.hstack((lagTRange, extra)) |
|
958 | 954 | |
|
959 | 955 | return lagTRange |
|
960 | 956 | |
|
961 | 957 | def getLagRRange(self, extrapoints=0): |
|
962 | 958 | |
|
963 | 959 | return self.lagR |
|
964 | 960 | |
|
965 | 961 | def getPairsList(self): |
|
966 | 962 | |
|
967 | 963 | return self.pairsList |
|
968 | 964 | |
|
969 | 965 | def getCalculateVelocity(self): |
|
970 | 966 | |
|
971 | 967 | return self.calculateVelocity |
|
972 | 968 | |
|
973 | 969 | def getNPoints(self): |
|
974 | 970 | |
|
975 | 971 | return self.nPoints |
|
976 | 972 | |
|
977 | 973 | def getNAvg(self): |
|
978 | 974 | |
|
979 | 975 | return self.nAvg |
|
980 | 976 | |
|
981 | 977 | def getBufferSize(self): |
|
982 | 978 | |
|
983 | 979 | return self.bufferSize |
|
984 | 980 | |
|
985 | 981 | def getPairsAutoCorr(self): |
|
986 | 982 | pairsList = self.pairsList |
|
987 | 983 | pairsAutoCorr = numpy.zeros(self.nChannels, dtype = 'int')*numpy.nan |
|
988 | 984 | |
|
989 | 985 | for l in range(len(pairsList)): |
|
990 | 986 | firstChannel = pairsList[l][0] |
|
991 | 987 | secondChannel = pairsList[l][1] |
|
992 | 988 | |
|
993 | 989 | #Obteniendo pares de Autocorrelacion |
|
994 | 990 | if firstChannel == secondChannel: |
|
995 | 991 | pairsAutoCorr[firstChannel] = int(l) |
|
996 | 992 | |
|
997 | 993 | pairsAutoCorr = pairsAutoCorr.astype(int) |
|
998 | 994 | |
|
999 | 995 | return pairsAutoCorr |
|
1000 | 996 | |
|
1001 | 997 | def getNoise(self, mode = 2): |
|
1002 | 998 | |
|
1003 | 999 | indR = numpy.where(self.lagR == 0)[0][0] |
|
1004 | 1000 | indT = numpy.where(self.lagT == 0)[0][0] |
|
1005 | 1001 | |
|
1006 | 1002 | jspectra0 = self.data_corr[:,:,indR,:] |
|
1007 | 1003 | jspectra = copy.copy(jspectra0) |
|
1008 | 1004 | |
|
1009 | 1005 | num_chan = jspectra.shape[0] |
|
1010 | 1006 | num_hei = jspectra.shape[2] |
|
1011 | 1007 | |
|
1012 | 1008 | freq_dc = jspectra.shape[1]/2 |
|
1013 | 1009 | ind_vel = numpy.array([-2,-1,1,2]) + freq_dc |
|
1014 | 1010 | |
|
1015 | 1011 | if ind_vel[0]<0: |
|
1016 | 1012 | ind_vel[range(0,1)] = ind_vel[range(0,1)] + self.num_prof |
|
1017 | 1013 | |
|
1018 | 1014 | if mode == 1: |
|
1019 | 1015 | jspectra[:,freq_dc,:] = (jspectra[:,ind_vel[1],:] + jspectra[:,ind_vel[2],:])/2 #CORRECCION |
|
1020 | 1016 | |
|
1021 | 1017 | if mode == 2: |
|
1022 | 1018 | |
|
1023 | 1019 | vel = numpy.array([-2,-1,1,2]) |
|
1024 | 1020 | xx = numpy.zeros([4,4]) |
|
1025 | 1021 | |
|
1026 | 1022 | for fil in range(4): |
|
1027 | 1023 | xx[fil,:] = vel[fil]**numpy.asarray(range(4)) |
|
1028 | 1024 | |
|
1029 | 1025 | xx_inv = numpy.linalg.inv(xx) |
|
1030 | 1026 | xx_aux = xx_inv[0,:] |
|
1031 | 1027 | |
|
1032 | 1028 | for ich in range(num_chan): |
|
1033 | 1029 | yy = jspectra[ich,ind_vel,:] |
|
1034 | 1030 | jspectra[ich,freq_dc,:] = numpy.dot(xx_aux,yy) |
|
1035 | 1031 | |
|
1036 | 1032 | junkid = jspectra[ich,freq_dc,:]<=0 |
|
1037 | 1033 | cjunkid = sum(junkid) |
|
1038 | 1034 | |
|
1039 | 1035 | if cjunkid.any(): |
|
1040 | 1036 | jspectra[ich,freq_dc,junkid.nonzero()] = (jspectra[ich,ind_vel[1],junkid] + jspectra[ich,ind_vel[2],junkid])/2 |
|
1041 | 1037 | |
|
1042 | 1038 | noise = jspectra0[:,freq_dc,:] - jspectra[:,freq_dc,:] |
|
1043 | 1039 | |
|
1044 | 1040 | return noise |
|
1045 | 1041 | |
|
1046 | 1042 | def getTimeInterval(self): |
|
1047 | 1043 | |
|
1048 | 1044 | timeInterval = self.ippSeconds * self.nCohInt * self.nPoints |
|
1049 | 1045 | |
|
1050 | 1046 | return timeInterval |
|
1051 | 1047 | |
|
1052 | 1048 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
1053 | 1049 | # pairsList = property(getPairsList, "I'm the 'pairsList' property.") |
|
1054 | 1050 | # nPoints = property(getNPoints, "I'm the 'nPoints' property.") |
|
1055 | 1051 | calculateVelocity = property(getCalculateVelocity, "I'm the 'calculateVelocity' property.") |
|
1056 | 1052 | nAvg = property(getNAvg, "I'm the 'nAvg' property.") |
|
1057 | 1053 | bufferSize = property(getBufferSize, "I'm the 'bufferSize' property.") |
|
1058 | 1054 | |
|
1059 | 1055 | |
|
1060 | 1056 | class Parameters(JROData): |
|
1061 | 1057 | |
|
1062 | 1058 | #Information from previous data |
|
1063 | 1059 | |
|
1064 | 1060 | inputUnit = None #Type of data to be processed |
|
1065 | 1061 | |
|
1066 | 1062 | operation = None #Type of operation to parametrize |
|
1067 | 1063 | |
|
1068 | 1064 | normFactor = None #Normalization Factor |
|
1069 | 1065 | |
|
1070 | 1066 | groupList = None #List of Pairs, Groups, etc |
|
1071 | 1067 | |
|
1072 | 1068 | #Parameters |
|
1073 | 1069 | |
|
1074 | 1070 | data_param = None #Parameters obtained |
|
1075 | 1071 | |
|
1076 | 1072 | data_pre = None #Data Pre Parametrization |
|
1077 | 1073 | |
|
1078 | 1074 | data_SNR = None #Signal to Noise Ratio |
|
1079 | 1075 | |
|
1080 | 1076 | # heightRange = None #Heights |
|
1081 | 1077 | |
|
1082 | 1078 | abscissaList = None #Abscissa, can be velocities, lags or time |
|
1083 | 1079 | |
|
1084 | 1080 | noise = None #Noise Potency |
|
1085 | 1081 | |
|
1086 | 1082 | utctimeInit = None #Initial UTC time |
|
1087 | 1083 | |
|
1088 | 1084 | paramInterval = None #Time interval to calculate Parameters in seconds |
|
1089 | 1085 | |
|
1090 | 1086 | #Fitting |
|
1091 | 1087 | |
|
1092 | 1088 | data_error = None #Error of the estimation |
|
1093 | 1089 | |
|
1094 | 1090 | constants = None |
|
1095 | 1091 | |
|
1096 | 1092 | library = None |
|
1097 | 1093 | |
|
1098 | 1094 | #Output signal |
|
1099 | 1095 | |
|
1100 | 1096 | outputInterval = None #Time interval to calculate output signal in seconds |
|
1101 | 1097 | |
|
1102 | 1098 | data_output = None #Out signal |
|
1103 | 1099 | |
|
1104 | 1100 | |
|
1105 | 1101 | |
|
1106 | 1102 | def __init__(self): |
|
1107 | 1103 | ''' |
|
1108 | 1104 | Constructor |
|
1109 | 1105 | ''' |
|
1110 | 1106 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
1111 | 1107 | |
|
1112 | 1108 | self.systemHeaderObj = SystemHeader() |
|
1113 | 1109 | |
|
1114 | 1110 | self.type = "Parameters" |
|
1115 | 1111 | |
|
1116 | 1112 | def getTimeRange1(self): |
|
1117 | 1113 | |
|
1118 | 1114 | datatime = [] |
|
1119 | 1115 | |
|
1120 | 1116 | if self.useLocalTime: |
|
1121 | 1117 | time1 = self.utctimeInit - self.timeZone*60 |
|
1122 | 1118 | else: |
|
1123 | 1119 | time1 = utctimeInit |
|
1124 | 1120 | |
|
1125 | 1121 | # datatime.append(self.utctimeInit) |
|
1126 | 1122 | # datatime.append(self.utctimeInit + self.outputInterval) |
|
1127 | 1123 | datatime.append(time1) |
|
1128 | 1124 | datatime.append(time1 + self.outputInterval) |
|
1129 | 1125 | |
|
1130 | 1126 | datatime = numpy.array(datatime) |
|
1131 | 1127 | |
|
1132 | 1128 | return datatime |
@@ -1,19 +1,14 | |||
|
1 | 1 | ''' |
|
2 | 2 | |
|
3 | 3 | $Author: murco $ |
|
4 | 4 | $Id: JRODataIO.py 169 2012-11-19 21:57:03Z murco $ |
|
5 | 5 | ''' |
|
6 | 6 | |
|
7 | 7 | from jroIO_voltage import * |
|
8 | 8 | from jroIO_spectra import * |
|
9 | 9 | from jroIO_heispectra import * |
|
10 | 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 | 12 | from jroIO_amisr import * |
|
18 | 13 | from jroIO_HDF5 import * |
|
19 | 14 | from jroIO_hf import * No newline at end of file |
@@ -1,849 +1,845 | |||
|
1 | 1 | ''' |
|
2 | 2 | Created on Jul 3, 2014 |
|
3 | 3 | |
|
4 | 4 | @author: roj-idl71 |
|
5 | 5 | ''' |
|
6 | 6 | |
|
7 | 7 | import os, sys |
|
8 | 8 | import time, datetime |
|
9 | 9 | import numpy |
|
10 | 10 | import fnmatch |
|
11 | 11 | import glob |
|
12 | ||
|
13 | try: | |
|
14 | from gevent import sleep | |
|
15 | except: | |
|
16 | from time import sleep | |
|
12 | from time import sleep | |
|
17 | 13 | |
|
18 | 14 | try: |
|
19 | 15 | import pyfits |
|
20 | except: | |
|
21 | """ | |
|
22 | """ | |
|
16 | except ImportError, e: | |
|
17 | print "Fits data cannot be used. Install pyfits module" | |
|
23 | 18 | |
|
24 | 19 | from xml.etree.ElementTree import ElementTree |
|
25 | 20 | |
|
26 | 21 | from jroIO_base import isRadarFolder, isNumber |
|
22 | from schainpy.model.data.jrodata import Fits | |
|
27 | 23 | from schainpy.model.proc.jroproc_base import Operation, ProcessingUnit |
|
28 | 24 | |
|
29 | class Fits: | |
|
25 | class PyFits(object): | |
|
30 | 26 | name=None |
|
31 | 27 | format=None |
|
32 | 28 | array =None |
|
33 | 29 | data =None |
|
34 | 30 | thdulist=None |
|
35 | 31 | prihdr=None |
|
36 | 32 | hdu=None |
|
37 | 33 | |
|
38 | 34 | def __init__(self): |
|
39 | 35 | |
|
40 | 36 | pass |
|
41 | 37 | |
|
42 | 38 | def setColF(self,name,format,array): |
|
43 | 39 | self.name=name |
|
44 | 40 | self.format=format |
|
45 | 41 | self.array=array |
|
46 | 42 | a1=numpy.array([self.array],dtype=numpy.float32) |
|
47 | 43 | self.col1 = pyfits.Column(name=self.name, format=self.format, array=a1) |
|
48 | 44 | return self.col1 |
|
49 | 45 | |
|
50 | 46 | # def setColP(self,name,format,data): |
|
51 | 47 | # self.name=name |
|
52 | 48 | # self.format=format |
|
53 | 49 | # self.data=data |
|
54 | 50 | # a2=numpy.array([self.data],dtype=numpy.float32) |
|
55 | 51 | # self.col2 = pyfits.Column(name=self.name, format=self.format, array=a2) |
|
56 | 52 | # return self.col2 |
|
57 | 53 | |
|
58 | 54 | |
|
59 | 55 | def writeData(self,name,format,data): |
|
60 | 56 | self.name=name |
|
61 | 57 | self.format=format |
|
62 | 58 | self.data=data |
|
63 | 59 | a2=numpy.array([self.data],dtype=numpy.float32) |
|
64 | 60 | self.col2 = pyfits.Column(name=self.name, format=self.format, array=a2) |
|
65 | 61 | return self.col2 |
|
66 | 62 | |
|
67 | 63 | def cFImage(self,idblock,year,month,day,hour,minute,second): |
|
68 | 64 | self.hdu= pyfits.PrimaryHDU(idblock) |
|
69 | 65 | self.hdu.header.set("Year",year) |
|
70 | 66 | self.hdu.header.set("Month",month) |
|
71 | 67 | self.hdu.header.set("Day",day) |
|
72 | 68 | self.hdu.header.set("Hour",hour) |
|
73 | 69 | self.hdu.header.set("Minute",minute) |
|
74 | 70 | self.hdu.header.set("Second",second) |
|
75 | 71 | return self.hdu |
|
76 | 72 | |
|
77 | 73 | |
|
78 | 74 | def Ctable(self,colList): |
|
79 | 75 | self.cols=pyfits.ColDefs(colList) |
|
80 | 76 | self.tbhdu = pyfits.new_table(self.cols) |
|
81 | 77 | return self.tbhdu |
|
82 | 78 | |
|
83 | 79 | |
|
84 | 80 | def CFile(self,hdu,tbhdu): |
|
85 | 81 | self.thdulist=pyfits.HDUList([hdu,tbhdu]) |
|
86 | 82 | |
|
87 | 83 | def wFile(self,filename): |
|
88 | 84 | if os.path.isfile(filename): |
|
89 | 85 | os.remove(filename) |
|
90 | 86 | self.thdulist.writeto(filename) |
|
91 | 87 | |
|
92 | 88 | |
|
93 | 89 | class ParameterConf: |
|
94 | 90 | ELEMENTNAME = 'Parameter' |
|
95 | 91 | def __init__(self): |
|
96 | 92 | self.name = '' |
|
97 | 93 | self.value = '' |
|
98 | 94 | |
|
99 | 95 | def readXml(self, parmElement): |
|
100 | 96 | self.name = parmElement.get('name') |
|
101 | 97 | self.value = parmElement.get('value') |
|
102 | 98 | |
|
103 | 99 | def getElementName(self): |
|
104 | 100 | return self.ELEMENTNAME |
|
105 | 101 | |
|
106 | class Metadata: | |
|
102 | class Metadata(object): | |
|
107 | 103 | |
|
108 | 104 | def __init__(self, filename): |
|
109 | 105 | self.parmConfObjList = [] |
|
110 | 106 | self.readXml(filename) |
|
111 | 107 | |
|
112 | 108 | def readXml(self, filename): |
|
113 | 109 | self.projectElement = None |
|
114 | 110 | self.procUnitConfObjDict = {} |
|
115 | 111 | self.projectElement = ElementTree().parse(filename) |
|
116 | 112 | self.project = self.projectElement.tag |
|
117 | 113 | |
|
118 | 114 | parmElementList = self.projectElement.getiterator(ParameterConf().getElementName()) |
|
119 | 115 | |
|
120 | 116 | for parmElement in parmElementList: |
|
121 | 117 | parmConfObj = ParameterConf() |
|
122 | 118 | parmConfObj.readXml(parmElement) |
|
123 | 119 | self.parmConfObjList.append(parmConfObj) |
|
124 | 120 | |
|
125 | 121 | class FitsWriter(Operation): |
|
126 | 122 | |
|
127 | 123 | def __init__(self): |
|
128 | 124 | self.isConfig = False |
|
129 | 125 | self.dataBlocksPerFile = None |
|
130 | 126 | self.blockIndex = 0 |
|
131 | 127 | self.flagIsNewFile = 1 |
|
132 | 128 | self.fitsObj = None |
|
133 | 129 | self.optchar = 'P' |
|
134 | 130 | self.ext = '.fits' |
|
135 | 131 | self.setFile = 0 |
|
136 | 132 | |
|
137 | def setFitsHeader(self, dataOut, metadatafile): | |
|
133 | def setFitsHeader(self, dataOut, metadatafile=None): | |
|
138 | 134 | |
|
139 | 135 | header_data = pyfits.PrimaryHDU() |
|
140 | 136 | |
|
141 | metadata4fits = Metadata(metadatafile) | |
|
142 | for parameter in metadata4fits.parmConfObjList: | |
|
143 | parm_name = parameter.name | |
|
144 | parm_value = parameter.value | |
|
137 | header_data.header['EXPNAME'] = "RADAR DATA" | |
|
138 | header_data.header['DATATYPE'] = "SPECTRA" | |
|
139 | header_data.header['COMMENT'] = "" | |
|
140 | ||
|
141 | if metadatafile: | |
|
145 | 142 | |
|
146 | # if parm_value == 'fromdatadatetime': | |
|
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 | |
|
143 | metadata4fits = Metadata(metadatafile) | |
|
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 | 151 | header_data.header['DATETIME'] = time.strftime("%b %d %Y %H:%M:%S", dataOut.datatime.timetuple()) |
|
161 | 152 | header_data.header['CHANNELLIST'] = str(dataOut.channelList) |
|
162 | 153 | header_data.header['NCHANNELS'] = dataOut.nChannels |
|
163 | 154 | #header_data.header['HEIGHTS'] = dataOut.heightList |
|
164 | 155 | header_data.header['NHEIGHTS'] = dataOut.nHeights |
|
165 | 156 | |
|
166 | 157 | header_data.header['IPPSECONDS'] = dataOut.ippSeconds |
|
167 | 158 | header_data.header['NCOHINT'] = dataOut.nCohInt |
|
168 | 159 | header_data.header['NINCOHINT'] = dataOut.nIncohInt |
|
169 | 160 | header_data.header['TIMEZONE'] = dataOut.timeZone |
|
170 | 161 | header_data.header['NBLOCK'] = self.blockIndex |
|
171 | 162 | |
|
172 | 163 | header_data.writeto(self.filename) |
|
173 | 164 | |
|
174 | 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 | 170 | self.path = path |
|
180 | 171 | self.dataOut = dataOut |
|
181 | 172 | self.metadatafile = metadatafile |
|
182 | 173 | self.dataBlocksPerFile = dataBlocksPerFile |
|
183 | 174 | |
|
184 | 175 | def open(self): |
|
185 | 176 | self.fitsObj = pyfits.open(self.filename, mode='update') |
|
186 | 177 | |
|
187 | 178 | |
|
188 | 179 | def addExtension(self, data, tagname): |
|
189 | 180 | self.open() |
|
190 | 181 | extension = pyfits.ImageHDU(data=data, name=tagname) |
|
191 | 182 | #extension.header['TAG'] = tagname |
|
192 | 183 | self.fitsObj.append(extension) |
|
193 | 184 | self.write() |
|
194 | 185 | |
|
195 | 186 | def addData(self, data): |
|
196 | 187 | self.open() |
|
197 | 188 | extension = pyfits.ImageHDU(data=data, name=self.fitsObj[0].header['DATATYPE']) |
|
198 | 189 | extension.header['UTCTIME'] = self.dataOut.utctime |
|
199 | 190 | self.fitsObj.append(extension) |
|
200 | 191 | self.blockIndex += 1 |
|
201 | 192 | self.fitsObj[0].header['NBLOCK'] = self.blockIndex |
|
202 | 193 | |
|
203 | 194 | self.write() |
|
204 | 195 | |
|
205 | 196 | def write(self): |
|
206 | 197 | |
|
207 | 198 | self.fitsObj.flush(verbose=True) |
|
208 | 199 | self.fitsObj.close() |
|
209 | 200 | |
|
210 | 201 | |
|
211 | 202 | def setNextFile(self): |
|
212 | 203 | |
|
213 | 204 | ext = self.ext |
|
214 | 205 | path = self.path |
|
215 | 206 | |
|
216 | 207 | timeTuple = time.localtime( self.dataOut.utctime) |
|
217 | 208 | subfolder = 'd%4.4d%3.3d' % (timeTuple.tm_year,timeTuple.tm_yday) |
|
218 | 209 | |
|
219 | 210 | fullpath = os.path.join( path, subfolder ) |
|
220 | 211 | if not( os.path.exists(fullpath) ): |
|
221 | 212 | os.mkdir(fullpath) |
|
222 | 213 | self.setFile = -1 #inicializo mi contador de seteo |
|
223 | 214 | else: |
|
224 | 215 | filesList = os.listdir( fullpath ) |
|
225 | 216 | if len( filesList ) > 0: |
|
226 | 217 | filesList = sorted( filesList, key=str.lower ) |
|
227 | 218 | filen = filesList[-1] |
|
228 | 219 | |
|
229 | 220 | if isNumber( filen[8:11] ): |
|
230 | 221 | self.setFile = int( filen[8:11] ) #inicializo mi contador de seteo al seteo del ultimo file |
|
231 | 222 | else: |
|
232 | 223 | self.setFile = -1 |
|
233 | 224 | else: |
|
234 | 225 | self.setFile = -1 #inicializo mi contador de seteo |
|
235 | 226 | |
|
236 | 227 | setFile = self.setFile |
|
237 | 228 | setFile += 1 |
|
238 | 229 | |
|
239 | 230 | thisFile = '%s%4.4d%3.3d%3.3d%s' % (self.optchar, |
|
240 | 231 | timeTuple.tm_year, |
|
241 | 232 | timeTuple.tm_yday, |
|
242 | 233 | setFile, |
|
243 | 234 | ext ) |
|
244 | 235 | |
|
245 | 236 | filename = os.path.join( path, subfolder, thisFile ) |
|
246 | 237 | |
|
247 | 238 | self.blockIndex = 0 |
|
248 | 239 | self.filename = filename |
|
249 | 240 | self.setFile = setFile |
|
250 | 241 | self.flagIsNewFile = 1 |
|
251 | 242 | |
|
252 | 243 | print 'Writing the file: %s'%self.filename |
|
253 | 244 | |
|
254 | 245 | self.setFitsHeader(self.dataOut, self.metadatafile) |
|
255 | 246 | |
|
256 | 247 | return 1 |
|
257 | 248 | |
|
258 | 249 | def writeBlock(self): |
|
259 | 250 | self.addData(self.dataOut.data_spc) |
|
260 | 251 | self.flagIsNewFile = 0 |
|
261 | 252 | |
|
262 | 253 | |
|
263 | 254 | def __setNewBlock(self): |
|
264 | 255 | |
|
265 | 256 | if self.flagIsNewFile: |
|
266 | 257 | return 1 |
|
267 | 258 | |
|
268 | 259 | if self.blockIndex < self.dataBlocksPerFile: |
|
269 | 260 | return 1 |
|
270 | 261 | |
|
271 | 262 | if not( self.setNextFile() ): |
|
272 | 263 | return 0 |
|
273 | 264 | |
|
274 | 265 | return 1 |
|
275 | 266 | |
|
276 | 267 | def writeNextBlock(self): |
|
277 | 268 | if not( self.__setNewBlock() ): |
|
278 | 269 | return 0 |
|
279 | 270 | self.writeBlock() |
|
280 | 271 | return 1 |
|
281 | 272 | |
|
282 | 273 | def putData(self): |
|
283 | 274 | if self.flagIsNewFile: |
|
284 | 275 | self.setNextFile() |
|
285 | 276 | self.writeNextBlock() |
|
286 | 277 | |
|
287 | 278 | def run(self, dataOut, **kwargs): |
|
288 | 279 | if not(self.isConfig): |
|
289 | 280 | self.setup(dataOut, **kwargs) |
|
290 | 281 | self.isConfig = True |
|
291 | 282 | self.putData() |
|
292 | 283 | |
|
293 | 284 | |
|
294 | 285 | class FitsReader(ProcessingUnit): |
|
295 | 286 | |
|
296 | 287 | # __TIMEZONE = time.timezone |
|
297 | 288 | |
|
298 | 289 | expName = None |
|
299 | 290 | datetimestr = None |
|
300 | 291 | utc = None |
|
301 | 292 | nChannels = None |
|
302 | 293 | nSamples = None |
|
303 | 294 | dataBlocksPerFile = None |
|
304 | 295 | comments = None |
|
305 | 296 | lastUTTime = None |
|
306 | 297 | header_dict = None |
|
307 | 298 | data = None |
|
308 | 299 | data_header_dict = None |
|
309 | 300 | |
|
310 | 301 | def __init__(self): |
|
311 | 302 | self.isConfig = False |
|
312 | 303 | self.ext = '.fits' |
|
313 | 304 | self.setFile = 0 |
|
314 | 305 | self.flagNoMoreFiles = 0 |
|
315 | 306 | self.flagIsNewFile = 1 |
|
316 | 307 | self.flagDiscontinuousBlock = None |
|
317 | 308 | self.fileIndex = None |
|
318 | 309 | self.filename = None |
|
319 | 310 | self.fileSize = None |
|
320 | 311 | self.fitsObj = None |
|
321 | 312 | self.timeZone = None |
|
322 | 313 | self.nReadBlocks = 0 |
|
323 | 314 | self.nTotalBlocks = 0 |
|
324 | 315 | self.dataOut = self.createObjByDefault() |
|
325 | 316 | self.maxTimeStep = 10# deberia ser definido por el usuario usando el metodo setup() |
|
326 | 317 | self.blockIndex = 1 |
|
327 | 318 | |
|
328 | 319 | def createObjByDefault(self): |
|
329 | 320 | |
|
330 | 321 | dataObj = Fits() |
|
331 | 322 | |
|
332 | 323 | return dataObj |
|
333 | 324 | |
|
334 | 325 | def isFileinThisTime(self, filename, startTime, endTime, useLocalTime=False): |
|
335 | 326 | try: |
|
336 | 327 | fitsObj = pyfits.open(filename,'readonly') |
|
337 | 328 | except: |
|
338 | 329 | raise IOError, "The file %s can't be opened" %(filename) |
|
339 | 330 | |
|
340 | 331 | header = fitsObj[0].header |
|
341 | 332 | struct_time = time.strptime(header['DATETIME'], "%b %d %Y %H:%M:%S") |
|
342 | 333 | utc = time.mktime(struct_time) - time.timezone #TIMEZONE debe ser un parametro del header FITS |
|
343 | 334 | |
|
344 | 335 | ltc = utc |
|
345 | 336 | if useLocalTime: |
|
346 | 337 | ltc -= time.timezone |
|
347 | 338 | thisDatetime = datetime.datetime.utcfromtimestamp(ltc) |
|
348 | 339 | thisTime = thisDatetime.time() |
|
349 | 340 | |
|
350 | 341 | if not ((startTime <= thisTime) and (endTime > thisTime)): |
|
351 | 342 | return None |
|
352 | 343 | |
|
353 | 344 | return thisDatetime |
|
354 | 345 | |
|
355 | 346 | def __setNextFileOnline(self): |
|
356 | 347 | raise ValueError, "No implemented" |
|
357 | 348 | |
|
358 | 349 | def __setNextFileOffline(self): |
|
359 | 350 | idFile = self.fileIndex |
|
360 | 351 | |
|
361 | 352 | while (True): |
|
362 | 353 | idFile += 1 |
|
363 | 354 | if not(idFile < len(self.filenameList)): |
|
364 | 355 | self.flagNoMoreFiles = 1 |
|
365 | 356 | print "No more Files" |
|
366 | 357 | return 0 |
|
367 | 358 | |
|
368 | 359 | filename = self.filenameList[idFile] |
|
369 | 360 | |
|
370 | 361 | # if not(self.__verifyFile(filename)): |
|
371 | 362 | # continue |
|
372 | 363 | |
|
373 | 364 | fileSize = os.path.getsize(filename) |
|
374 | 365 | fitsObj = pyfits.open(filename,'readonly') |
|
375 | 366 | break |
|
376 | 367 | |
|
377 | 368 | self.flagIsNewFile = 1 |
|
378 | 369 | self.fileIndex = idFile |
|
379 | 370 | self.filename = filename |
|
380 | 371 | self.fileSize = fileSize |
|
381 | 372 | self.fitsObj = fitsObj |
|
382 | 373 | self.blockIndex = 0 |
|
383 | 374 | print "Setting the file: %s"%self.filename |
|
384 | 375 | |
|
385 | 376 | return 1 |
|
386 | 377 | |
|
387 | 378 | def __setValuesFromHeader(self): |
|
388 | 379 | |
|
389 | 380 | self.dataOut.header = self.header_dict |
|
390 | 381 | self.dataOut.expName = self.expName |
|
391 | self.dataOut.nChannels = self.nChannels | |
|
382 | ||
|
392 | 383 | self.dataOut.timeZone = self.timeZone |
|
393 | 384 | self.dataOut.dataBlocksPerFile = self.dataBlocksPerFile |
|
394 | 385 | self.dataOut.comments = self.comments |
|
395 | 386 | # self.dataOut.timeInterval = self.timeInterval |
|
396 | 387 | self.dataOut.channelList = self.channelList |
|
397 | 388 | self.dataOut.heightList = self.heightList |
|
398 | 389 | |
|
399 | 390 | self.dataOut.nCohInt = self.nCohInt |
|
400 | 391 | self.dataOut.nIncohInt = self.nIncohInt |
|
401 | 392 | |
|
393 | self.dataOut.ippSeconds = self.ippSeconds | |
|
394 | ||
|
402 | 395 | def readHeader(self): |
|
403 | 396 | headerObj = self.fitsObj[0] |
|
404 | 397 | |
|
405 | 398 | self.header_dict = headerObj.header |
|
406 | 399 | if 'EXPNAME' in headerObj.header.keys(): |
|
407 | 400 | self.expName = headerObj.header['EXPNAME'] |
|
408 | 401 | |
|
409 | 402 | if 'DATATYPE' in headerObj.header.keys(): |
|
410 | 403 | self.dataType = headerObj.header['DATATYPE'] |
|
411 | 404 | |
|
412 | 405 | self.datetimestr = headerObj.header['DATETIME'] |
|
413 | 406 | channelList = headerObj.header['CHANNELLIST'] |
|
414 | 407 | channelList = channelList.split('[') |
|
415 | 408 | channelList = channelList[1].split(']') |
|
416 | 409 | channelList = channelList[0].split(',') |
|
417 | 410 | channelList = [int(ch) for ch in channelList] |
|
418 | 411 | self.channelList = channelList |
|
419 | 412 | self.nChannels = headerObj.header['NCHANNELS'] |
|
420 | 413 | self.nHeights = headerObj.header['NHEIGHTS'] |
|
421 | 414 | self.ippSeconds = headerObj.header['IPPSECONDS'] |
|
422 | 415 | self.nCohInt = headerObj.header['NCOHINT'] |
|
423 | 416 | self.nIncohInt = headerObj.header['NINCOHINT'] |
|
424 | 417 | self.dataBlocksPerFile = headerObj.header['NBLOCK'] |
|
425 | 418 | self.timeZone = headerObj.header['TIMEZONE'] |
|
426 | 419 | |
|
427 | 420 | # self.timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt |
|
428 | 421 | |
|
429 | 422 | if 'COMMENT' in headerObj.header.keys(): |
|
430 | 423 | self.comments = headerObj.header['COMMENT'] |
|
431 | 424 | |
|
432 | 425 | self.readHeightList() |
|
433 | 426 | |
|
434 | 427 | def readHeightList(self): |
|
435 | 428 | self.blockIndex = self.blockIndex + 1 |
|
436 | 429 | obj = self.fitsObj[self.blockIndex] |
|
437 | 430 | self.heightList = obj.data |
|
438 | 431 | self.blockIndex = self.blockIndex + 1 |
|
439 | 432 | |
|
440 | 433 | def readExtension(self): |
|
441 | 434 | obj = self.fitsObj[self.blockIndex] |
|
442 | 435 | self.heightList = obj.data |
|
443 | 436 | self.blockIndex = self.blockIndex + 1 |
|
444 | 437 | |
|
445 | 438 | def setNextFile(self): |
|
446 | 439 | |
|
447 | 440 | if self.online: |
|
448 | 441 | newFile = self.__setNextFileOnline() |
|
449 | 442 | else: |
|
450 | 443 | newFile = self.__setNextFileOffline() |
|
451 | 444 | |
|
452 | 445 | if not(newFile): |
|
453 | 446 | return 0 |
|
454 | 447 | |
|
455 | 448 | self.readHeader() |
|
456 | 449 | self.__setValuesFromHeader() |
|
457 | 450 | self.nReadBlocks = 0 |
|
458 | 451 | # self.blockIndex = 1 |
|
459 | 452 | return 1 |
|
460 | 453 | |
|
461 | 454 | def __searchFilesOffLine(self, |
|
462 | 455 | path, |
|
463 | 456 | startDate, |
|
464 | 457 | endDate, |
|
465 | 458 | startTime=datetime.time(0,0,0), |
|
466 | 459 | endTime=datetime.time(23,59,59), |
|
467 | 460 | set=None, |
|
468 | 461 | expLabel='', |
|
469 | 462 | ext='.fits', |
|
470 | 463 | walk=True): |
|
471 | 464 | |
|
472 | 465 | pathList = [] |
|
473 | 466 | |
|
474 | 467 | if not walk: |
|
475 | 468 | pathList.append(path) |
|
476 | 469 | |
|
477 | 470 | else: |
|
478 | 471 | dirList = [] |
|
479 | 472 | for thisPath in os.listdir(path): |
|
480 | 473 | if not os.path.isdir(os.path.join(path,thisPath)): |
|
481 | 474 | continue |
|
482 | 475 | if not isRadarFolder(thisPath): |
|
483 | 476 | continue |
|
484 | 477 | |
|
485 | 478 | dirList.append(thisPath) |
|
486 | 479 | |
|
487 | 480 | if not(dirList): |
|
488 | 481 | return None, None |
|
489 | 482 | |
|
490 | 483 | thisDate = startDate |
|
491 | 484 | |
|
492 | 485 | while(thisDate <= endDate): |
|
493 | 486 | year = thisDate.timetuple().tm_year |
|
494 | 487 | doy = thisDate.timetuple().tm_yday |
|
495 | 488 | |
|
496 | 489 | matchlist = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy) + '*') |
|
497 | 490 | if len(matchlist) == 0: |
|
498 | 491 | thisDate += datetime.timedelta(1) |
|
499 | 492 | continue |
|
500 | 493 | for match in matchlist: |
|
501 | 494 | pathList.append(os.path.join(path,match,expLabel)) |
|
502 | 495 | |
|
503 | 496 | thisDate += datetime.timedelta(1) |
|
504 | 497 | |
|
505 | 498 | if pathList == []: |
|
506 | 499 | print "Any folder was found for the date range: %s-%s" %(startDate, endDate) |
|
507 | 500 | return None, None |
|
508 | 501 | |
|
509 | 502 | print "%d folder(s) was(were) found for the date range: %s - %s" %(len(pathList), startDate, endDate) |
|
510 | 503 | |
|
511 | 504 | filenameList = [] |
|
512 | 505 | datetimeList = [] |
|
513 | 506 | |
|
514 | 507 | for i in range(len(pathList)): |
|
515 | 508 | |
|
516 | 509 | thisPath = pathList[i] |
|
517 | 510 | |
|
518 | 511 | fileList = glob.glob1(thisPath, "*%s" %ext) |
|
519 | 512 | fileList.sort() |
|
520 | 513 | |
|
521 | 514 | for thisFile in fileList: |
|
522 | 515 | |
|
523 | 516 | filename = os.path.join(thisPath,thisFile) |
|
524 | 517 | thisDatetime = self.isFileinThisTime(filename, startTime, endTime) |
|
525 | 518 | |
|
526 | 519 | if not(thisDatetime): |
|
527 | 520 | continue |
|
528 | 521 | |
|
529 | 522 | filenameList.append(filename) |
|
530 | 523 | datetimeList.append(thisDatetime) |
|
531 | 524 | |
|
532 | 525 | if not(filenameList): |
|
533 | 526 | print "Any file was found for the time range %s - %s" %(startTime, endTime) |
|
534 | 527 | return None, None |
|
535 | 528 | |
|
536 | 529 | print "%d file(s) was(were) found for the time range: %s - %s" %(len(filenameList), startTime, endTime) |
|
537 | 530 | |
|
538 | 531 | |
|
539 | 532 | for i in range(len(filenameList)): |
|
540 | 533 | print "%s -> [%s]" %(filenameList[i], datetimeList[i].ctime()) |
|
541 | 534 | |
|
542 | 535 | self.filenameList = filenameList |
|
543 | 536 | self.datetimeList = datetimeList |
|
544 | 537 | |
|
545 | 538 | return pathList, filenameList |
|
546 | 539 | |
|
547 | 540 | def setup(self, path=None, |
|
548 | 541 | startDate=None, |
|
549 | 542 | endDate=None, |
|
550 | 543 | startTime=datetime.time(0,0,0), |
|
551 | 544 | endTime=datetime.time(23,59,59), |
|
552 | 545 | set=0, |
|
553 | 546 | expLabel = "", |
|
554 | 547 | ext = None, |
|
555 | 548 | online = False, |
|
556 | 549 | delay = 60, |
|
557 | 550 | walk = True): |
|
558 | 551 | |
|
559 | 552 | if path == None: |
|
560 | 553 | raise ValueError, "The path is not valid" |
|
561 | 554 | |
|
562 | 555 | if ext == None: |
|
563 | 556 | ext = self.ext |
|
564 | 557 | |
|
565 | 558 | if not(online): |
|
566 | 559 | print "Searching files in offline mode ..." |
|
567 | 560 | pathList, filenameList = self.__searchFilesOffLine(path, startDate=startDate, endDate=endDate, |
|
568 | 561 | startTime=startTime, endTime=endTime, |
|
569 | 562 | set=set, expLabel=expLabel, ext=ext, |
|
570 | 563 | walk=walk) |
|
571 | 564 | |
|
572 | 565 | if not(pathList): |
|
573 | 566 | print "No *%s files into the folder %s \nfor the range: %s - %s"%(ext, path, |
|
574 | 567 | datetime.datetime.combine(startDate,startTime).ctime(), |
|
575 | 568 | datetime.datetime.combine(endDate,endTime).ctime()) |
|
576 | 569 | |
|
577 | 570 | sys.exit(-1) |
|
578 | 571 | |
|
579 | 572 | self.fileIndex = -1 |
|
580 | 573 | self.pathList = pathList |
|
581 | 574 | self.filenameList = filenameList |
|
582 | 575 | |
|
583 | 576 | self.online = online |
|
584 | 577 | self.delay = delay |
|
585 | 578 | ext = ext.lower() |
|
586 | 579 | self.ext = ext |
|
587 | 580 | |
|
588 | 581 | if not(self.setNextFile()): |
|
589 | 582 | if (startDate!=None) and (endDate!=None): |
|
590 | 583 | print "No files in range: %s - %s" %(datetime.datetime.combine(startDate,startTime).ctime(), datetime.datetime.combine(endDate,endTime).ctime()) |
|
591 | 584 | elif startDate != None: |
|
592 | 585 | print "No files in range: %s" %(datetime.datetime.combine(startDate,startTime).ctime()) |
|
593 | 586 | else: |
|
594 | 587 | print "No files" |
|
595 | 588 | |
|
596 | 589 | sys.exit(-1) |
|
597 | 590 | |
|
598 | 591 | |
|
599 | 592 | |
|
600 | 593 | def readBlock(self): |
|
601 | 594 | dataObj = self.fitsObj[self.blockIndex] |
|
602 | 595 | |
|
603 | 596 | self.data = dataObj.data |
|
604 | 597 | self.data_header_dict = dataObj.header |
|
605 | 598 | self.utc = self.data_header_dict['UTCTIME'] |
|
606 | 599 | |
|
607 | 600 | self.flagIsNewFile = 0 |
|
608 | 601 | self.blockIndex += 1 |
|
609 | 602 | self.nTotalBlocks += 1 |
|
610 | 603 | self.nReadBlocks += 1 |
|
611 | 604 | |
|
612 | 605 | return 1 |
|
613 | 606 | |
|
614 | 607 | def __jumpToLastBlock(self): |
|
615 | 608 | raise ValueError, "No implemented" |
|
616 | 609 | |
|
617 | 610 | def __waitNewBlock(self): |
|
618 | 611 | """ |
|
619 | 612 | Return 1 si se encontro un nuevo bloque de datos, 0 de otra forma. |
|
620 | 613 | |
|
621 | 614 | Si el modo de lectura es OffLine siempre retorn 0 |
|
622 | 615 | """ |
|
623 | 616 | if not self.online: |
|
624 | 617 | return 0 |
|
625 | 618 | |
|
626 | 619 | if (self.nReadBlocks >= self.dataBlocksPerFile): |
|
627 | 620 | return 0 |
|
628 | 621 | |
|
629 | 622 | currentPointer = self.fp.tell() |
|
630 | 623 | |
|
631 | 624 | neededSize = self.processingHeaderObj.blockSize + self.basicHeaderSize |
|
632 | 625 | |
|
633 | 626 | for nTries in range( self.nTries ): |
|
634 | 627 | |
|
635 | 628 | self.fp.close() |
|
636 | 629 | self.fp = open( self.filename, 'rb' ) |
|
637 | 630 | self.fp.seek( currentPointer ) |
|
638 | 631 | |
|
639 | 632 | self.fileSize = os.path.getsize( self.filename ) |
|
640 | 633 | currentSize = self.fileSize - currentPointer |
|
641 | 634 | |
|
642 | 635 | if ( currentSize >= neededSize ): |
|
643 | 636 | self.__rdBasicHeader() |
|
644 | 637 | return 1 |
|
645 | 638 | |
|
646 | 639 | print "\tWaiting %0.2f seconds for the next block, try %03d ..." % (self.delay, nTries+1) |
|
647 | 640 | sleep( self.delay ) |
|
648 | 641 | |
|
649 | 642 | |
|
650 | 643 | return 0 |
|
651 | 644 | |
|
652 | 645 | def __setNewBlock(self): |
|
653 | 646 | |
|
654 | 647 | if self.online: |
|
655 | 648 | self.__jumpToLastBlock() |
|
656 | 649 | |
|
657 | 650 | if self.flagIsNewFile: |
|
658 | 651 | return 1 |
|
659 | 652 | |
|
660 | 653 | self.lastUTTime = self.utc |
|
661 | 654 | |
|
662 | 655 | if self.online: |
|
663 | 656 | if self.__waitNewBlock(): |
|
664 | 657 | return 1 |
|
665 | 658 | |
|
666 | 659 | if self.nReadBlocks < self.dataBlocksPerFile: |
|
667 | 660 | return 1 |
|
668 | 661 | |
|
669 | 662 | if not(self.setNextFile()): |
|
670 | 663 | return 0 |
|
671 | 664 | |
|
672 | 665 | deltaTime = self.utc - self.lastUTTime |
|
673 | 666 | |
|
674 | 667 | self.flagDiscontinuousBlock = 0 |
|
675 | 668 | |
|
676 | 669 | if deltaTime > self.maxTimeStep: |
|
677 | 670 | self.flagDiscontinuousBlock = 1 |
|
678 | 671 | |
|
679 | 672 | return 1 |
|
680 | 673 | |
|
681 | 674 | |
|
682 | 675 | def readNextBlock(self): |
|
683 | 676 | if not(self.__setNewBlock()): |
|
684 | 677 | return 0 |
|
685 | 678 | |
|
686 | 679 | if not(self.readBlock()): |
|
687 | 680 | return 0 |
|
688 | 681 | |
|
689 | 682 | return 1 |
|
690 | 683 | |
|
684 | def printInfo(self): | |
|
685 | ||
|
686 | pass | |
|
691 | 687 | |
|
692 | 688 | def getData(self): |
|
693 | 689 | |
|
694 | 690 | if self.flagNoMoreFiles: |
|
695 | 691 | self.dataOut.flagNoData = True |
|
696 | 692 | print 'Process finished' |
|
697 | 693 | return 0 |
|
698 | 694 | |
|
699 | 695 | self.flagDiscontinuousBlock = 0 |
|
700 | 696 | self.flagIsNewBlock = 0 |
|
701 | 697 | |
|
702 | 698 | if not(self.readNextBlock()): |
|
703 | 699 | return 0 |
|
704 | 700 | |
|
705 |
if self.data |
|
|
701 | if self.data is None: | |
|
706 | 702 | self.dataOut.flagNoData = True |
|
707 | 703 | return 0 |
|
708 | 704 | |
|
709 | 705 | self.dataOut.data = self.data |
|
710 | 706 | self.dataOut.data_header = self.data_header_dict |
|
711 | 707 | self.dataOut.utctime = self.utc |
|
712 | 708 | |
|
713 | 709 | # self.dataOut.header = self.header_dict |
|
714 | 710 | # self.dataOut.expName = self.expName |
|
715 | 711 | # self.dataOut.nChannels = self.nChannels |
|
716 | 712 | # self.dataOut.timeZone = self.timeZone |
|
717 | 713 | # self.dataOut.dataBlocksPerFile = self.dataBlocksPerFile |
|
718 | 714 | # self.dataOut.comments = self.comments |
|
719 | 715 | # # self.dataOut.timeInterval = self.timeInterval |
|
720 | 716 | # self.dataOut.channelList = self.channelList |
|
721 | 717 | # self.dataOut.heightList = self.heightList |
|
722 | 718 | self.dataOut.flagNoData = False |
|
723 | 719 | |
|
724 | 720 | return self.dataOut.data |
|
725 | 721 | |
|
726 | 722 | def run(self, **kwargs): |
|
727 | 723 | |
|
728 | 724 | if not(self.isConfig): |
|
729 | 725 | self.setup(**kwargs) |
|
730 | 726 | self.isConfig = True |
|
731 | 727 | |
|
732 | 728 | self.getData() |
|
733 | 729 | |
|
734 | 730 | class SpectraHeisWriter(Operation): |
|
735 | 731 | # set = None |
|
736 | 732 | setFile = None |
|
737 | 733 | idblock = None |
|
738 | 734 | doypath = None |
|
739 | 735 | subfolder = None |
|
740 | 736 | |
|
741 | 737 | def __init__(self): |
|
742 | self.wrObj = Fits() | |
|
738 | self.wrObj = PyFits() | |
|
743 | 739 | # self.dataOut = dataOut |
|
744 | 740 | self.nTotalBlocks=0 |
|
745 | 741 | # self.set = None |
|
746 | 742 | self.setFile = None |
|
747 | 743 | self.idblock = 0 |
|
748 | 744 | self.wrpath = None |
|
749 | 745 | self.doypath = None |
|
750 | 746 | self.subfolder = None |
|
751 | 747 | self.isConfig = False |
|
752 | 748 | |
|
753 | 749 | def isNumber(str): |
|
754 | 750 | """ |
|
755 | 751 | Chequea si el conjunto de caracteres que componen un string puede ser convertidos a un numero. |
|
756 | 752 | |
|
757 | 753 | Excepciones: |
|
758 | 754 | Si un determinado string no puede ser convertido a numero |
|
759 | 755 | Input: |
|
760 | 756 | str, string al cual se le analiza para determinar si convertible a un numero o no |
|
761 | 757 | |
|
762 | 758 | Return: |
|
763 | 759 | True : si el string es uno numerico |
|
764 | 760 | False : no es un string numerico |
|
765 | 761 | """ |
|
766 | 762 | try: |
|
767 | 763 | float( str ) |
|
768 | 764 | return True |
|
769 | 765 | except: |
|
770 | 766 | return False |
|
771 | 767 | |
|
772 | 768 | def setup(self, dataOut, wrpath): |
|
773 | 769 | |
|
774 | 770 | if not(os.path.exists(wrpath)): |
|
775 | 771 | os.mkdir(wrpath) |
|
776 | 772 | |
|
777 | 773 | self.wrpath = wrpath |
|
778 | 774 | # self.setFile = 0 |
|
779 | 775 | self.dataOut = dataOut |
|
780 | 776 | |
|
781 | 777 | def putData(self): |
|
782 | 778 | name= time.localtime( self.dataOut.utctime) |
|
783 | 779 | ext=".fits" |
|
784 | 780 | |
|
785 | 781 | if self.doypath == None: |
|
786 | 782 | self.subfolder = 'F%4.4d%3.3d_%d' % (name.tm_year,name.tm_yday,time.mktime(datetime.datetime.now().timetuple())) |
|
787 | 783 | self.doypath = os.path.join( self.wrpath, self.subfolder ) |
|
788 | 784 | os.mkdir(self.doypath) |
|
789 | 785 | |
|
790 | 786 | if self.setFile == None: |
|
791 | 787 | # self.set = self.dataOut.set |
|
792 | 788 | self.setFile = 0 |
|
793 | 789 | # if self.set != self.dataOut.set: |
|
794 | 790 | ## self.set = self.dataOut.set |
|
795 | 791 | # self.setFile = 0 |
|
796 | 792 | |
|
797 | 793 | #make the filename |
|
798 | 794 | thisFile = 'D%4.4d%3.3d_%3.3d%s' % (name.tm_year,name.tm_yday,self.setFile,ext) |
|
799 | 795 | |
|
800 | 796 | filename = os.path.join(self.wrpath,self.subfolder, thisFile) |
|
801 | 797 | |
|
802 | 798 | idblock = numpy.array([self.idblock],dtype="int64") |
|
803 | 799 | header=self.wrObj.cFImage(idblock=idblock, |
|
804 | 800 | year=time.gmtime(self.dataOut.utctime).tm_year, |
|
805 | 801 | month=time.gmtime(self.dataOut.utctime).tm_mon, |
|
806 | 802 | day=time.gmtime(self.dataOut.utctime).tm_mday, |
|
807 | 803 | hour=time.gmtime(self.dataOut.utctime).tm_hour, |
|
808 | 804 | minute=time.gmtime(self.dataOut.utctime).tm_min, |
|
809 | 805 | second=time.gmtime(self.dataOut.utctime).tm_sec) |
|
810 | 806 | |
|
811 | 807 | c=3E8 |
|
812 | 808 | deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0] |
|
813 | 809 | freq=numpy.arange(-1*self.dataOut.nHeights/2.,self.dataOut.nHeights/2.)*(c/(2*deltaHeight*1000)) |
|
814 | 810 | |
|
815 | 811 | colList = [] |
|
816 | 812 | |
|
817 | 813 | colFreq=self.wrObj.setColF(name="freq", format=str(self.dataOut.nFFTPoints)+'E', array=freq) |
|
818 | 814 | |
|
819 | 815 | colList.append(colFreq) |
|
820 | 816 | |
|
821 | 817 | nchannel=self.dataOut.nChannels |
|
822 | 818 | |
|
823 | 819 | for i in range(nchannel): |
|
824 | 820 | col = self.wrObj.writeData(name="PCh"+str(i+1), |
|
825 | 821 | format=str(self.dataOut.nFFTPoints)+'E', |
|
826 | 822 | data=10*numpy.log10(self.dataOut.data_spc[i,:])) |
|
827 | 823 | |
|
828 | 824 | colList.append(col) |
|
829 | 825 | |
|
830 | 826 | data=self.wrObj.Ctable(colList=colList) |
|
831 | 827 | |
|
832 | 828 | self.wrObj.CFile(header,data) |
|
833 | 829 | |
|
834 | 830 | self.wrObj.wFile(filename) |
|
835 | 831 | |
|
836 | 832 | #update the setFile |
|
837 | 833 | self.setFile += 1 |
|
838 | 834 | self.idblock += 1 |
|
839 | 835 | |
|
840 | 836 | return 1 |
|
841 | 837 | |
|
842 | 838 | def run(self, dataOut, **kwargs): |
|
843 | 839 | |
|
844 | 840 | if not(self.isConfig): |
|
845 | 841 | |
|
846 | 842 | self.setup(dataOut, **kwargs) |
|
847 | 843 | self.isConfig = True |
|
848 | 844 | |
|
849 | 845 | self.putData() No newline at end of file |
@@ -1,343 +1,343 | |||
|
1 | 1 | import numpy |
|
2 | 2 | |
|
3 | 3 | from jroproc_base import ProcessingUnit, Operation |
|
4 | 4 | from schainpy.model.data.jrodata import SpectraHeis |
|
5 | 5 | |
|
6 | 6 | class SpectraHeisProc(ProcessingUnit): |
|
7 | 7 | |
|
8 | 8 | def __init__(self): |
|
9 | 9 | |
|
10 | 10 | ProcessingUnit.__init__(self) |
|
11 | 11 | |
|
12 | 12 | # self.buffer = None |
|
13 | 13 | # self.firstdatatime = None |
|
14 | 14 | # self.profIndex = 0 |
|
15 | 15 | self.dataOut = SpectraHeis() |
|
16 | 16 | |
|
17 | 17 | def __updateObjFromVoltage(self): |
|
18 | 18 | |
|
19 | 19 | self.dataOut.timeZone = self.dataIn.timeZone |
|
20 | 20 | self.dataOut.dstFlag = self.dataIn.dstFlag |
|
21 | 21 | self.dataOut.errorCount = self.dataIn.errorCount |
|
22 | 22 | self.dataOut.useLocalTime = self.dataIn.useLocalTime |
|
23 | 23 | |
|
24 | 24 | self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()# |
|
25 | 25 | self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy()# |
|
26 | 26 | self.dataOut.channelList = self.dataIn.channelList |
|
27 | 27 | self.dataOut.heightList = self.dataIn.heightList |
|
28 | 28 | # self.dataOut.dtype = self.dataIn.dtype |
|
29 | 29 | self.dataOut.dtype = numpy.dtype([('real','<f4'),('imag','<f4')]) |
|
30 | 30 | # self.dataOut.nHeights = self.dataIn.nHeights |
|
31 | 31 | # self.dataOut.nChannels = self.dataIn.nChannels |
|
32 | 32 | self.dataOut.nBaud = self.dataIn.nBaud |
|
33 | 33 | self.dataOut.nCode = self.dataIn.nCode |
|
34 | 34 | self.dataOut.code = self.dataIn.code |
|
35 | 35 | # self.dataOut.nProfiles = 1 |
|
36 | 36 | # self.dataOut.nProfiles = self.dataOut.nFFTPoints |
|
37 | 37 | self.dataOut.nFFTPoints = self.dataIn.nHeights |
|
38 | 38 | # self.dataOut.channelIndexList = self.dataIn.channelIndexList |
|
39 | 39 | # self.dataOut.flagNoData = self.dataIn.flagNoData |
|
40 | 40 | self.dataOut.flagDiscontinuousBlock = self.dataIn.flagDiscontinuousBlock |
|
41 | 41 | self.dataOut.utctime = self.dataIn.utctime |
|
42 | 42 | # self.dataOut.utctime = self.firstdatatime |
|
43 | 43 | self.dataOut.flagDecodeData = self.dataIn.flagDecodeData #asumo q la data esta decodificada |
|
44 | 44 | self.dataOut.flagDeflipData = self.dataIn.flagDeflipData #asumo q la data esta sin flip |
|
45 | 45 | # self.dataOut.flagShiftFFT = self.dataIn.flagShiftFFT |
|
46 | 46 | self.dataOut.nCohInt = self.dataIn.nCohInt |
|
47 | 47 | self.dataOut.nIncohInt = 1 |
|
48 | 48 | # self.dataOut.ippSeconds= self.dataIn.ippSeconds |
|
49 | 49 | self.dataOut.windowOfFilter = self.dataIn.windowOfFilter |
|
50 | 50 | |
|
51 | 51 | # self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nIncohInt |
|
52 | 52 | # self.dataOut.set=self.dataIn.set |
|
53 | 53 | # self.dataOut.deltaHeight=self.dataIn.deltaHeight |
|
54 | 54 | |
|
55 | 55 | |
|
56 | 56 | def __updateObjFromFits(self): |
|
57 | 57 | |
|
58 | 58 | self.dataOut.utctime = self.dataIn.utctime |
|
59 | self.dataOut.channelIndexList = self.dataIn.channelIndexList | |
|
59 | # self.dataOut.channelIndexList = self.dataIn.channelIndexList | |
|
60 | 60 | |
|
61 | 61 | self.dataOut.channelList = self.dataIn.channelList |
|
62 | 62 | self.dataOut.heightList = self.dataIn.heightList |
|
63 | 63 | self.dataOut.data_spc = self.dataIn.data |
|
64 | 64 | self.dataOut.ippSeconds = self.dataIn.ippSeconds |
|
65 | 65 | self.dataOut.nCohInt = self.dataIn.nCohInt |
|
66 | 66 | self.dataOut.nIncohInt = self.dataIn.nIncohInt |
|
67 | 67 | # self.dataOut.timeInterval = self.dataIn.timeInterval |
|
68 | 68 | self.dataOut.timeZone = self.dataIn.timeZone |
|
69 | 69 | self.dataOut.useLocalTime = True |
|
70 | 70 | # self.dataOut. |
|
71 | 71 | # self.dataOut. |
|
72 | 72 | |
|
73 | 73 | def __getFft(self): |
|
74 | 74 | |
|
75 | 75 | fft_volt = numpy.fft.fft(self.dataIn.data, axis=1) |
|
76 | 76 | fft_volt = numpy.fft.fftshift(fft_volt,axes=(1,)) |
|
77 | 77 | spc = numpy.abs(fft_volt * numpy.conjugate(fft_volt))/(self.dataOut.nFFTPoints) |
|
78 | 78 | self.dataOut.data_spc = spc |
|
79 | 79 | |
|
80 | 80 | def run(self): |
|
81 | 81 | |
|
82 | 82 | self.dataOut.flagNoData = True |
|
83 | 83 | |
|
84 | 84 | if self.dataIn.type == "Fits": |
|
85 | 85 | self.__updateObjFromFits() |
|
86 | 86 | self.dataOut.flagNoData = False |
|
87 | 87 | return |
|
88 | 88 | |
|
89 | 89 | if self.dataIn.type == "SpectraHeis": |
|
90 | 90 | self.dataOut.copy(self.dataIn) |
|
91 | 91 | return |
|
92 | 92 | |
|
93 | 93 | if self.dataIn.type == "Voltage": |
|
94 | 94 | self.__updateObjFromVoltage() |
|
95 | 95 | self.__getFft() |
|
96 | 96 | self.dataOut.flagNoData = False |
|
97 | 97 | |
|
98 | 98 | return |
|
99 | 99 | |
|
100 | 100 | raise ValueError, "The type object %s is not valid"%(self.dataIn.type) |
|
101 | 101 | |
|
102 | 102 | |
|
103 | 103 | def selectChannels(self, channelList): |
|
104 | 104 | |
|
105 | 105 | channelIndexList = [] |
|
106 | 106 | |
|
107 | 107 | for channel in channelList: |
|
108 | 108 | index = self.dataOut.channelList.index(channel) |
|
109 | 109 | channelIndexList.append(index) |
|
110 | 110 | |
|
111 | 111 | self.selectChannelsByIndex(channelIndexList) |
|
112 | 112 | |
|
113 | 113 | def selectChannelsByIndex(self, channelIndexList): |
|
114 | 114 | """ |
|
115 | 115 | Selecciona un bloque de datos en base a canales segun el channelIndexList |
|
116 | 116 | |
|
117 | 117 | Input: |
|
118 | 118 | channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7] |
|
119 | 119 | |
|
120 | 120 | Affected: |
|
121 | 121 | self.dataOut.data |
|
122 | 122 | self.dataOut.channelIndexList |
|
123 | 123 | self.dataOut.nChannels |
|
124 | 124 | self.dataOut.m_ProcessingHeader.totalSpectra |
|
125 | 125 | self.dataOut.systemHeaderObj.numChannels |
|
126 | 126 | self.dataOut.m_ProcessingHeader.blockSize |
|
127 | 127 | |
|
128 | 128 | Return: |
|
129 | 129 | None |
|
130 | 130 | """ |
|
131 | 131 | |
|
132 | 132 | for channelIndex in channelIndexList: |
|
133 | 133 | if channelIndex not in self.dataOut.channelIndexList: |
|
134 | 134 | print channelIndexList |
|
135 | 135 | raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex |
|
136 | 136 | |
|
137 | 137 | # nChannels = len(channelIndexList) |
|
138 | 138 | |
|
139 | 139 | data_spc = self.dataOut.data_spc[channelIndexList,:] |
|
140 | 140 | |
|
141 | 141 | self.dataOut.data_spc = data_spc |
|
142 | 142 | self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] |
|
143 | 143 | |
|
144 | 144 | return 1 |
|
145 | 145 | |
|
146 | 146 | class IncohInt4SpectraHeis(Operation): |
|
147 | 147 | |
|
148 | 148 | isConfig = False |
|
149 | 149 | |
|
150 | 150 | __profIndex = 0 |
|
151 | 151 | __withOverapping = False |
|
152 | 152 | |
|
153 | 153 | __byTime = False |
|
154 | 154 | __initime = None |
|
155 | 155 | __lastdatatime = None |
|
156 | 156 | __integrationtime = None |
|
157 | 157 | |
|
158 | 158 | __buffer = None |
|
159 | 159 | |
|
160 | 160 | __dataReady = False |
|
161 | 161 | |
|
162 | 162 | n = None |
|
163 | 163 | |
|
164 | 164 | |
|
165 | 165 | def __init__(self): |
|
166 | 166 | |
|
167 | 167 | Operation.__init__(self) |
|
168 | 168 | # self.isConfig = False |
|
169 | 169 | |
|
170 | 170 | def setup(self, n=None, timeInterval=None, overlapping=False): |
|
171 | 171 | """ |
|
172 | 172 | Set the parameters of the integration class. |
|
173 | 173 | |
|
174 | 174 | Inputs: |
|
175 | 175 | |
|
176 | 176 | n : Number of coherent integrations |
|
177 | 177 | timeInterval : Time of integration. If the parameter "n" is selected this one does not work |
|
178 | 178 | overlapping : |
|
179 | 179 | |
|
180 | 180 | """ |
|
181 | 181 | |
|
182 | 182 | self.__initime = None |
|
183 | 183 | self.__lastdatatime = 0 |
|
184 | 184 | self.__buffer = None |
|
185 | 185 | self.__dataReady = False |
|
186 | 186 | |
|
187 | 187 | |
|
188 | 188 | if n == None and timeInterval == None: |
|
189 | 189 | raise ValueError, "n or timeInterval should be specified ..." |
|
190 | 190 | |
|
191 | 191 | if n != None: |
|
192 | 192 | self.n = n |
|
193 | 193 | self.__byTime = False |
|
194 | 194 | else: |
|
195 | 195 | self.__integrationtime = timeInterval #* 60. #if (type(timeInterval)!=integer) -> change this line |
|
196 | 196 | self.n = 9999 |
|
197 | 197 | self.__byTime = True |
|
198 | 198 | |
|
199 | 199 | if overlapping: |
|
200 | 200 | self.__withOverapping = True |
|
201 | 201 | self.__buffer = None |
|
202 | 202 | else: |
|
203 | 203 | self.__withOverapping = False |
|
204 | 204 | self.__buffer = 0 |
|
205 | 205 | |
|
206 | 206 | self.__profIndex = 0 |
|
207 | 207 | |
|
208 | 208 | def putData(self, data): |
|
209 | 209 | |
|
210 | 210 | """ |
|
211 | 211 | Add a profile to the __buffer and increase in one the __profileIndex |
|
212 | 212 | |
|
213 | 213 | """ |
|
214 | 214 | |
|
215 | 215 | if not self.__withOverapping: |
|
216 | 216 | self.__buffer += data.copy() |
|
217 | 217 | self.__profIndex += 1 |
|
218 | 218 | return |
|
219 | 219 | |
|
220 | 220 | #Overlapping data |
|
221 | 221 | nChannels, nHeis = data.shape |
|
222 | 222 | data = numpy.reshape(data, (1, nChannels, nHeis)) |
|
223 | 223 | |
|
224 | 224 | #If the buffer is empty then it takes the data value |
|
225 | 225 | if self.__buffer is None: |
|
226 | 226 | self.__buffer = data |
|
227 | 227 | self.__profIndex += 1 |
|
228 | 228 | return |
|
229 | 229 | |
|
230 | 230 | #If the buffer length is lower than n then stakcing the data value |
|
231 | 231 | if self.__profIndex < self.n: |
|
232 | 232 | self.__buffer = numpy.vstack((self.__buffer, data)) |
|
233 | 233 | self.__profIndex += 1 |
|
234 | 234 | return |
|
235 | 235 | |
|
236 | 236 | #If the buffer length is equal to n then replacing the last buffer value with the data value |
|
237 | 237 | self.__buffer = numpy.roll(self.__buffer, -1, axis=0) |
|
238 | 238 | self.__buffer[self.n-1] = data |
|
239 | 239 | self.__profIndex = self.n |
|
240 | 240 | return |
|
241 | 241 | |
|
242 | 242 | |
|
243 | 243 | def pushData(self): |
|
244 | 244 | """ |
|
245 | 245 | Return the sum of the last profiles and the profiles used in the sum. |
|
246 | 246 | |
|
247 | 247 | Affected: |
|
248 | 248 | |
|
249 | 249 | self.__profileIndex |
|
250 | 250 | |
|
251 | 251 | """ |
|
252 | 252 | |
|
253 | 253 | if not self.__withOverapping: |
|
254 | 254 | data = self.__buffer |
|
255 | 255 | n = self.__profIndex |
|
256 | 256 | |
|
257 | 257 | self.__buffer = 0 |
|
258 | 258 | self.__profIndex = 0 |
|
259 | 259 | |
|
260 | 260 | return data, n |
|
261 | 261 | |
|
262 | 262 | #Integration with Overlapping |
|
263 | 263 | data = numpy.sum(self.__buffer, axis=0) |
|
264 | 264 | n = self.__profIndex |
|
265 | 265 | |
|
266 | 266 | return data, n |
|
267 | 267 | |
|
268 | 268 | def byProfiles(self, data): |
|
269 | 269 | |
|
270 | 270 | self.__dataReady = False |
|
271 | 271 | avgdata = None |
|
272 | 272 | # n = None |
|
273 | 273 | |
|
274 | 274 | self.putData(data) |
|
275 | 275 | |
|
276 | 276 | if self.__profIndex == self.n: |
|
277 | 277 | |
|
278 | 278 | avgdata, n = self.pushData() |
|
279 | 279 | self.__dataReady = True |
|
280 | 280 | |
|
281 | 281 | return avgdata |
|
282 | 282 | |
|
283 | 283 | def byTime(self, data, datatime): |
|
284 | 284 | |
|
285 | 285 | self.__dataReady = False |
|
286 | 286 | avgdata = None |
|
287 | 287 | n = None |
|
288 | 288 | |
|
289 | 289 | self.putData(data) |
|
290 | 290 | |
|
291 | 291 | if (datatime - self.__initime) >= self.__integrationtime: |
|
292 | 292 | avgdata, n = self.pushData() |
|
293 | 293 | self.n = n |
|
294 | 294 | self.__dataReady = True |
|
295 | 295 | |
|
296 | 296 | return avgdata |
|
297 | 297 | |
|
298 | 298 | def integrate(self, data, datatime=None): |
|
299 | 299 | |
|
300 | 300 | if self.__initime == None: |
|
301 | 301 | self.__initime = datatime |
|
302 | 302 | |
|
303 | 303 | if self.__byTime: |
|
304 | 304 | avgdata = self.byTime(data, datatime) |
|
305 | 305 | else: |
|
306 | 306 | avgdata = self.byProfiles(data) |
|
307 | 307 | |
|
308 | 308 | |
|
309 | 309 | self.__lastdatatime = datatime |
|
310 | 310 | |
|
311 | 311 | if avgdata is None: |
|
312 | 312 | return None, None |
|
313 | 313 | |
|
314 | 314 | avgdatatime = self.__initime |
|
315 | 315 | |
|
316 | 316 | deltatime = datatime -self.__lastdatatime |
|
317 | 317 | |
|
318 | 318 | if not self.__withOverapping: |
|
319 | 319 | self.__initime = datatime |
|
320 | 320 | else: |
|
321 | 321 | self.__initime += deltatime |
|
322 | 322 | |
|
323 | 323 | return avgdata, avgdatatime |
|
324 | 324 | |
|
325 | 325 | def run(self, dataOut, **kwargs): |
|
326 | 326 | |
|
327 | 327 | if not self.isConfig: |
|
328 | 328 | self.setup(**kwargs) |
|
329 | 329 | self.isConfig = True |
|
330 | 330 | |
|
331 | 331 | avgdata, avgdatatime = self.integrate(dataOut.data_spc, dataOut.utctime) |
|
332 | 332 | |
|
333 | 333 | # dataOut.timeInterval *= n |
|
334 | 334 | dataOut.flagNoData = True |
|
335 | 335 | |
|
336 | 336 | if self.__dataReady: |
|
337 | 337 | dataOut.data_spc = avgdata |
|
338 | 338 | dataOut.nIncohInt *= self.n |
|
339 | 339 | # dataOut.nCohInt *= self.n |
|
340 | 340 | dataOut.utctime = avgdatatime |
|
341 | 341 | # dataOut.timeInterval = dataOut.ippSeconds * dataOut.nIncohInt |
|
342 | 342 | # dataOut.timeInterval = self.__timeInterval*self.n |
|
343 | 343 | dataOut.flagNoData = False No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now